Commit Graph

146 Commits

Author SHA1 Message Date
auouymous b53ba83d22 Fix issue retrieving channel ID for Youtube pages.
The channelId meta tag was removed from the HTML. Changing to the
channel_id in RSS feed URL tag should be stable.
2023-05-23 14:13:24 -06:00
auouymous 92c741b02f Log URL when youtube.py can't get channel ID. 2023-01-22 17:21:23 -07:00
auouymous 25991ef8bb Throw exception if youtube channelId is empty.
And try to find it in entries. This prevents description and cover art
from being removed when youtube feed is broken.
2022-11-18 03:09:53 -07:00
auouymous f6a919759f Remove erroneous logger parameter when failing to get Youtube GDPR URL.
Reported-by: Teemu Ikonen <tpikonen@gmail.com>
2022-05-08 16:09:21 -06:00
auouymous a83b750459 Catch youtube 404 errors.
Avoids parsing the 404 error page as XML and then throwing malformed XML
errors.
2022-02-27 20:46:50 -07:00
auouymous 20dd397e9e Memoize youtube channel ID and feed data.
Internal youtube support and the youtube-dl extension both cause the
youtube feed URL to be fetched three times per update. Caching the feed
data from feedcore allows internal support to only load the feed once.
The lru_cache removes one of the youtube-dl fetches, not perfect, but
two is better than three. I saw a 40% decrease in update times when
using the internal youtube code.

Throwing an exception from get_channel_id_url() prevents get_cover() and
get_channel_desc() from attempting to fetch a None URL, and provides
more accurate errors.

The lru_cache on get_youtube_id() saves 1ms per youtube channel when
updating. Which adds up with a lot of channels, and might be more on
slower devices.
2022-02-27 02:52:06 -07:00
auouymous 10e48a3ea5
Merge pull request #1174 from auouymous/fix-youtube-json
Improve Youtube initial player response regular expression.
2021-10-28 03:31:24 -07:00
auouymous cae617701f Support youtube 'user' feed URLs in for_each_feed_pattern(). 2021-10-14 19:28:05 -06:00
auouymous 8a403d2783 Optimize get_youtube_id().
The watch URL is the most common and should be checked first. The swf
URL probably no longer works but can be kept for compatibility.
2021-10-14 19:19:12 -06:00
auouymous 6ced881d74 Improve Youtube initial player response regular expression.
The text may contain "};" patterns inside the initial player response.
And the non-greedy regex would fail to match the entire IPR, causing it
to fail during JSON decoding.
2021-10-13 21:58:24 -06:00
auouymous bba167b811 Query duration for youtube episodes when not using youtube-dl.
The duration is not available in the youtube feed and requires a request
for each episode. It was set when downloading but the user had no way of
knowing how long an episode was before downloading it. Live streams do
not have a duration until they end, and remain blank until downloaded or
the next update.

This will increase the time it takes to update feeds, with new
subscriptions possibly taking 16x longer to update due to the 16
requests vs the previous single request. Updating existing feeds
will only have an additional request for each new episode.
2021-08-14 23:09:07 -06:00
auouymous db651427ee Use util.urlopen instead of requests.get for youtube. 2021-07-18 04:52:01 -06:00
auouymous 7429bc1904
Merge pull request #1084 from auouymous/change-youtube-endpoint-order
Try new youtube endpoint first and fallback to the old endpoint.
2021-07-08 21:45:06 -07:00
auouymous 6e48992b31 Skip non-integer youtube formats. 2021-07-07 01:59:41 -06:00
auouymous d6dd5b62bf Try new youtube endpoint first and fallback to the old endpoint. 2021-07-06 21:07:47 -06:00
auouymous 14bf8b44b7 Fix issues with #1073 pull request. 2021-07-06 19:05:23 -06:00
auouymous 82d926bcdd
Merge pull request #1073 from 18928172992817182/youtube-gdpr
Fix support for automatically accepting GDPR youtube consents
2021-07-06 17:56:13 -07:00
auouymous 8c56e71b0b Don't parse youtube feed URLs.
This fixes a bug where the feed URL is parsed to the channel URL,
potentially causing issues subscribing to feed URLs, but causing gpo
failures when enabling or disabling youtube channels.
2021-06-30 22:30:40 -06:00
gustaf 3003c8a4c0 Fix support for automatically accepting GDPR youtube consents 2021-06-18 15:40:26 +02:00
auouymous 140a351bce Fix DRM content detection for youtube episodes. 2021-06-11 04:52:36 -06:00
auouymous c0d21d1967
Merge pull request #1055 from auouymous/subscribe-to-youtube-via-video-pages
Subscribe to Youtube channels via video pages
2021-06-02 20:06:13 -07:00
auouymous 6f620c87f5 Skip 'best' Youtube formats when using built-in support.
The best, bestvideo and bestaudio formats can be added to
`preferred_fmt_ids` for use by the Youtube-DL extension with
manage_downloads. Hoever, the built-in support would fail if it
encountered one of these formats. Skipping allows "Download with
Youtube-DL" to use them in the same way it allows adaptive formats to be
used.
2021-05-31 22:50:26 -06:00
auouymous ae2534f9ee Subscribe to Youtube channels via video pages
This finishes what began in #869.
2021-05-31 22:27:44 -06:00
auouymous a2fc81ee82
Merge pull request #1043 from auouymous/improve-youtube
Fix youtube support and use requests for downloads.
2021-05-23 18:05:32 -07:00
auouymous 90682b7413 Use 'stream' instead of 'download' in error message when streaming. 2021-05-21 21:22:57 -06:00
auouymous 7177834d24 Fix youtube support and use requests for downloads.
The `get_video_info` URL no longer exists (without html5=1) and instead
of throwing a 404 not found error, http_request() was returning an empty
page which threw a no formats found error. The new requests code will
throw the correct error if this happens in the future.

The player response data is still fetched from `get_video_info` but will
fallback to the `watch` URL if `get_video_info` is eventually removed.
The `watch` URL will fail for anyone in Europe due to it redirecting to
a GDPR cookie consent page.

Error messages have been shortened by removing video ID, which could be
removed from the code in the future.
2021-05-21 06:06:02 -06:00
Teemu Ikonen 0e94386bd3 Use raw strings in regexp patterns, fix DeprecationWarnings 2021-01-15 13:48:21 +02:00
Eric Le Lay e632bfdbde Merge remote-tracking branch 'origin/master' into requests 2020-11-24 09:23:28 +01:00
Teemu Ikonen 03436bab2d Fix translation of Youtube playlist URL to a feed 2020-11-12 22:35:13 +02:00
Eric Le Lay 3f9d6ec21f
Merge pull request #873 from auouymous/youtube-drm
Detect new key name for youtube DRM content.
2020-09-14 08:23:53 +02:00
auouymous 7e78b33385 Detect new key name for youtube DRM content. 2020-09-13 21:26:37 -06:00
auouymous e05db16e40 Add youtube streaming format for 1080p. 2020-09-13 18:55:47 -06:00
auouymous bc62e3bb4c Youtube live streaming support 2020-09-12 02:34:39 -06:00
Eric Le Lay 463e460170 Merge remote-tracking branch 'origin/master' into requests 2020-09-11 17:07:03 +02:00
Eric Le Lay 12912bed3e fix naive access to response.text
bytes for xml, utf-8 fallback for html, known encoding if available
2020-07-18 15:04:04 +02:00
auouymous 5e8b62d248 [A-Z] is not needed in URL patterns with re.IGNORECASE.
Organize feed URLs.
2020-07-13 02:25:19 -06:00
Eric Le Lay 3babb86c70 use requests package for util.urlopen
now a requests.Response is returned instead of the file-like object from urllib.
Fixed all usages of util.urlopen: it simplifies getting json, text encoding detection.
In particular feedcore (responsible for fetching feeds) is simplified.

This is a first pass and could benefit from better usage of the requests api
(Sessions for instance, to keep connection pools)

TODO: download.py
2020-07-11 17:42:28 +02:00
Eric Le Lay e0cde8a277
Merge pull request #798 from auouymous/dont-clear-custom-youtube-formats
don't clear custom youtube formats
2020-05-08 10:55:02 +02:00
auouymous 3da287791d don't clear custom youtube formats 2020-05-04 23:55:36 -06:00
auouymous d45ee08b31 simplify youtube formats with += operator 2020-05-04 20:47:43 -06:00
auouymous af93037dc1 refactor youtube formats and add settings for more resolutions 2020-04-24 06:26:00 -06:00
auouymous e4623c8e4e show url when get_channel_desc() fails 2020-03-12 21:18:29 -06:00
Eric Le Lay bffa6b9304 Remove youtube api key usage
fixes #616
2020-01-25 17:31:16 +01:00
auouymous 9031ed916a fix #722 youtube error_message referenced before assignment 2020-01-10 18:48:43 -07:00
auouymous 2ef45b860a Fix youtube live stream detection 2020-01-09 03:02:33 -07:00
auouymous 2fd6eb84b1 #723 get duration for youtube episodes 2020-01-07 18:57:47 +01:00
Eric Le Lay 88d7dabb4b id might be an int in preferences in preferred_fmt_ids 2020-01-05 17:56:09 +01:00
Eric Le Lay 93b64230c9 fix #714 Youtube download fail when preferred formats aren't available
thanks to @auouymous for the fix
2020-01-04 12:30:55 +01:00
auouymous 97a0c2d5d1 #719 support adaptive formats for youtube-dl extension 2020-01-04 12:28:00 +01:00
auouymous cce3ba90d8 #711 [youtube] unsupported DRM content error message 2020-01-04 12:27:02 +01:00