From ccf0a6b86b7f68a75463804fe485ec240b8635f0 Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:51:51 +0000 Subject: [PATCH 001/126] [cleanup] Misc (#11574) Authored by: bashonly, pzhlkj6612 Co-authored-by: Mozi <29089388+pzhlkj6612@users.noreply.github.com> --- Changelog.md | 2 +- devscripts/changelog_override.json | 2 +- yt_dlp/extractor/dailymotion.py | 22 +++++++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 41a2da744..4dc032368 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,7 +8,7 @@ ### 2024.11.18 #### Important changes - **Login with OAuth is no longer supported for YouTube** -Due to a change made by the site, yt-dlp is longer able to support OAuth login for YouTube. [Read more](https://github.com/yt-dlp/yt-dlp/issues/11462#issuecomment-2471703090) +Due to a change made by the site, yt-dlp is no longer able to support OAuth login for YouTube. [Read more](https://github.com/yt-dlp/yt-dlp/issues/11462#issuecomment-2471703090) #### Core changes - [Catch broken Cryptodome installations](https://github.com/yt-dlp/yt-dlp/commit/b83ca24eb72e1e558b0185bd73975586c0bc0546) ([#11486](https://github.com/yt-dlp/yt-dlp/issues/11486)) by [seproDev](https://github.com/seproDev) diff --git a/devscripts/changelog_override.json b/devscripts/changelog_override.json index 906e5cf72..079e2f729 100644 --- a/devscripts/changelog_override.json +++ b/devscripts/changelog_override.json @@ -238,6 +238,6 @@ { "action": "add", "when": "52c0ffe40ad6e8404d93296f575007b05b04c686", - "short": "[priority] **Login with OAuth is no longer supported for YouTube**\nDue to a change made by the site, yt-dlp is longer able to support OAuth login for YouTube. [Read more](https://github.com/yt-dlp/yt-dlp/issues/11462#issuecomment-2471703090)" + "short": "[priority] **Login with OAuth is no longer supported for YouTube**\nDue to a change made by the site, yt-dlp is no longer able to support OAuth login for YouTube. [Read more](https://github.com/yt-dlp/yt-dlp/issues/11462#issuecomment-2471703090)" } ] diff --git a/yt_dlp/extractor/dailymotion.py b/yt_dlp/extractor/dailymotion.py index cb1453d3f..423c11c57 100644 --- a/yt_dlp/extractor/dailymotion.py +++ b/yt_dlp/extractor/dailymotion.py @@ -261,6 +261,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor): 'tags': [], 'view_count': int, 'like_count': int, + 'thumbnail': r're:https://\w+.dmcdn.net/v/WnEY61cmvMxt2Fi6d/x1080', }, }, { # https://geo.dailymotion.com/player/xf7zn.html?playlist=x7wdsj @@ -288,6 +289,25 @@ class DailymotionIE(DailymotionBaseInfoExtractor): 'description': 'À bord du « véloto », l’alternative à la voiture pour la campagne', 'tags': ['biclou', 'vélo', 'véloto', 'campagne', 'voiture', 'environnement', 'véhicules intermédiaires'], }, + }, { + # https://geo.dailymotion.com/player/xry80.html?video=x8vu47w + 'url': 'https://www.metatube.com/en/videos/546765/This-frogs-decorates-Christmas-tree/', + 'info_dict': { + 'id': 'x8vu47w', + 'ext': 'mp4', + 'like_count': int, + 'uploader': 'Metatube', + 'thumbnail': r're:https://\w+.dmcdn.net/v/W1G_S1coGSFTfkTeR/x1080', + 'upload_date': '20240326', + 'view_count': int, + 'timestamp': 1711496732, + 'age_limit': 0, + 'uploader_id': 'x2xpy74', + 'title': 'Está lindas ranitas ponen su arbolito', + 'duration': 28, + 'description': 'Que lindura', + 'tags': [], + }, }] _GEO_BYPASS = False _COMMON_MEDIA_FIELDS = '''description @@ -302,7 +322,7 @@ def _extract_embed_urls(cls, url, webpage): yield from super()._extract_embed_urls(url, webpage) for mobj in re.finditer( r'(?s)DM\.player\([^,]+,\s*{.*?video[\'"]?\s*:\s*["\']?(?P[0-9a-zA-Z]+).+?}\s*\);', webpage): - yield from 'https://www.dailymotion.com/embed/video/' + mobj.group('id') + yield 'https://www.dailymotion.com/embed/video/' + mobj.group('id') for mobj in re.finditer( r'(?s)', webpage), + (..., {json.loads}, ..., {self._find_json}, ..., 'children', ..., ..., 'children', ..., ..., 'children')) + + if traverse_obj(nextjs_data, (..., ..., 'children', ..., 'isLive', {bool}, any)): + # For livestreams we need the id of the stream instead of the currently airing episode id + video_id = traverse_obj(nextjs_data, ( + ..., ..., 'children', ..., 'children', ..., 'children', ..., 'children', ..., ..., + 'children', ..., ..., 'children', ..., ..., 'children', ..., 'options', 'id', {str}, any)) + else: + video_id = traverse_obj(nextjs_data, ( + ..., ..., ..., 'children', + lambda _, v: v['video']['url'] == urllib.parse.urlparse(url).path, + 'video', ('playerReplayId', 'siId'), {str}, any)) if not video_id: - video_id = self._html_search_regex( - r'(?:href=|player\.setVideo\(\s*)"http://videos?\.francetv\.fr/video/([^@"]+@[^"]+)"', - webpage, 'video ID') + raise ExtractorError('Unable to extract video ID') return self._make_url_result(video_id, url=url) From d59f14a0a7a8b55e6bf468237def62b73ab4a517 Mon Sep 17 00:00:00 2001 From: alard Date: Thu, 30 Jan 2025 00:38:36 +0100 Subject: [PATCH 111/126] [ie/goplay] Fix extractor (#12237) Authored by: alard --- yt_dlp/extractor/goplay.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/goplay.py b/yt_dlp/extractor/goplay.py index 32300f75c..c654c757c 100644 --- a/yt_dlp/extractor/goplay.py +++ b/yt_dlp/extractor/goplay.py @@ -12,7 +12,6 @@ from ..utils import ( ExtractorError, int_or_none, - js_to_json, remove_end, traverse_obj, ) @@ -76,6 +75,7 @@ def _real_initialize(self): if not self._id_token: raise self.raise_login_required(method='password') + # XXX: For parsing next.js v15+ data; see also yt_dlp.extractor.francetv def _find_json(self, s): return self._search_json( r'\w+\s*:\s*', s, 'next js data', None, contains_pattern=r'\[(?s:.+)\]', default=None) @@ -86,9 +86,10 @@ def _real_extract(self, url): nextjs_data = traverse_obj( re.findall(r']*>\s*self\.__next_f\.push\(\s*(\[.+?\])\s*\);?\s*', webpage), - (..., {js_to_json}, {json.loads}, ..., {self._find_json}, ...)) + (..., {json.loads}, ..., {self._find_json}, ...)) meta = traverse_obj(nextjs_data, ( - ..., lambda _, v: v['meta']['path'] == urllib.parse.urlparse(url).path, 'meta', any)) + ..., ..., 'children', ..., ..., 'children', + lambda _, v: v['video']['path'] == urllib.parse.urlparse(url).path, 'video', any)) video_id = meta['uuid'] info_dict = traverse_obj(meta, { From f8d0161455f00add65585ca1a476a7b5d56f5f96 Mon Sep 17 00:00:00 2001 From: dove <147140405+slipinthedove@users.noreply.github.com> Date: Wed, 29 Jan 2025 20:55:40 -0300 Subject: [PATCH 112/126] [ie/globo] Fix extractor (#11795) Closes #9512, Closes #11541, Closes #11772 Authored by: slipinthedove, YoshiTabletopGamer Co-authored-by: YoshiTabletopGamer <88633614+YoshiTabletopGamer@users.noreply.github.com> --- yt_dlp/extractor/globo.py | 201 ++++++++++++++++++-------------------- 1 file changed, 93 insertions(+), 108 deletions(-) diff --git a/yt_dlp/extractor/globo.py b/yt_dlp/extractor/globo.py index d72296be6..7acbd2820 100644 --- a/yt_dlp/extractor/globo.py +++ b/yt_dlp/extractor/globo.py @@ -1,32 +1,48 @@ -import base64 -import hashlib import json -import random import re +import uuid from .common import InfoExtractor -from ..networking import HEADRequest from ..utils import ( - ExtractorError, + determine_ext, + filter_dict, float_or_none, + int_or_none, orderedSet, str_or_none, try_get, + url_or_none, ) +from ..utils.traversal import subs_list_to_dict, traverse_obj class GloboIE(InfoExtractor): - _VALID_URL = r'(?:globo:|https?://.+?\.globo\.com/(?:[^/]+/)*(?:v/(?:[^/]+/)?|videos/))(?P\d{7,})' + _VALID_URL = r'(?:globo:|https?://[^/?#]+?\.globo\.com/(?:[^/?#]+/))(?P\d{7,})' _NETRC_MACHINE = 'globo' + _VIDEO_VIEW = ''' + query getVideoView($videoId: ID!) { + video(id: $videoId) { + duration + description + relatedEpisodeNumber + relatedSeasonNumber + headline + title { + originProgramId + headline + } + } + } + ''' _TESTS = [{ - 'url': 'http://g1.globo.com/carros/autoesporte/videos/t/exclusivos-do-g1/v/mercedes-benz-gla-passa-por-teste-de-colisao-na-europa/3607726/', + 'url': 'https://globoplay.globo.com/v/3607726/', 'info_dict': { 'id': '3607726', 'ext': 'mp4', 'title': 'Mercedes-Benz GLA passa por teste de colisão na Europa', 'duration': 103.204, - 'uploader': 'G1', - 'uploader_id': '2015', + 'uploader': 'G1 ao vivo', + 'uploader_id': '4209', }, 'params': { 'skip_download': True, @@ -38,39 +54,36 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom Dia Brasil', + 'uploader_id': '810', }, 'params': { 'skip_download': True, }, - }, { - 'url': 'http://canalbrasil.globo.com/programas/sangue-latino/videos/3928201.html', - 'only_matching': True, - }, { - 'url': 'http://globosatplay.globo.com/globonews/v/4472924/', - 'only_matching': True, - }, { - 'url': 'http://globotv.globo.com/t/programa/v/clipe-sexo-e-as-negas-adeus/3836166/', - 'only_matching': True, - }, { - 'url': 'http://globotv.globo.com/canal-brasil/sangue-latino/t/todos-os-videos/v/ator-e-diretor-argentino-ricado-darin-fala-sobre-utopias-e-suas-perdas/3928201/', - 'only_matching': True, - }, { - 'url': 'http://canaloff.globo.com/programas/desejar-profundo/videos/4518560.html', - 'only_matching': True, }, { 'url': 'globo:3607726', 'only_matching': True, - }, { - 'url': 'https://globoplay.globo.com/v/10248083/', + }, + { + 'url': 'globo:8013907', # needs subscription to globoplay 'info_dict': { - 'id': '10248083', + 'id': '8013907', 'ext': 'mp4', - 'title': 'Melhores momentos: Equador 1 x 1 Brasil pelas Eliminatórias da Copa do Mundo 2022', - 'duration': 530.964, - 'uploader': 'SporTV', - 'uploader_id': '698', + 'title': 'Capítulo de 14⧸08⧸1989', + 'episode_number': 1, + }, + 'params': { + 'skip_download': True, + }, + }, + { + 'url': 'globo:12824146', + 'info_dict': { + 'id': '12824146', + 'ext': 'mp4', + 'title': 'Acordo de damas', + 'episode_number': 1, + 'season_number': 2, }, 'params': { 'skip_download': True, @@ -80,98 +93,70 @@ class GloboIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - self._request_webpage( - HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'), - video_id, 'Getting cookies') - - video = self._download_json( - f'http://api.globovideos.com/videos/{video_id}/playlist', - video_id)['videos'][0] - if not self.get_param('allow_unplayable_formats') and video.get('encrypted') is True: - self.report_drm(video_id) - - title = video['title'] + info = self._download_json( + 'https://cloud-jarvis.globo.com/graphql', video_id, + query={ + 'operationName': 'getVideoView', + 'variables': json.dumps({'videoId': video_id}), + 'query': self._VIDEO_VIEW, + }, headers={ + 'content-type': 'application/json', + 'x-platform-id': 'web', + 'x-device-id': 'desktop', + 'x-client-version': '2024.12-5', + })['data']['video'] formats = [] - security = self._download_json( - 'https://playback.video.globo.com/v2/video-session', video_id, f'Downloading security hash for {video_id}', - headers={'content-type': 'application/json'}, data=json.dumps({ - 'player_type': 'desktop', + video = self._download_json( + 'https://playback.video.globo.com/v4/video-session', video_id, + f'Downloading resource info for {video_id}', + headers={'Content-Type': 'application/json'}, + data=json.dumps(filter_dict({ + 'player_type': 'mirakulo_8k_hdr', 'video_id': video_id, 'quality': 'max', 'content_protection': 'widevine', - 'vsid': '581b986b-4c40-71f0-5a58-803e579d5fa2', - 'tz': '-3.0:00', - }).encode()) + 'vsid': f'{uuid.uuid4()}', + 'consumption': 'streaming', + 'capabilities': {'low_latency': True}, + 'tz': '-03:00', + 'Authorization': try_get(self._get_cookies('https://globo.com'), + lambda x: f'Bearer {x["GLBID"].value}'), + 'version': 1, + })).encode()) - self._request_webpage(HEADRequest(security['sources'][0]['url_template']), video_id, 'Getting locksession cookie') + if traverse_obj(video, ('resource', 'drm_protection_enabled', {bool})): + self.report_drm(video_id) - security_hash = security['sources'][0]['token'] - if not security_hash: - message = security.get('message') - if message: - raise ExtractorError( - f'{self.IE_NAME} returned error: {message}', expected=True) + main_source = video['sources'][0] - hash_code = security_hash[:2] - padding = '%010d' % random.randint(1, 10000000000) - if hash_code in ('04', '14'): - received_time = security_hash[3:13] - received_md5 = security_hash[24:] - hash_prefix = security_hash[:23] - elif hash_code in ('02', '12', '03', '13'): - received_time = security_hash[2:12] - received_md5 = security_hash[22:] - padding += '1' - hash_prefix = '05' + security_hash[:22] - - padded_sign_time = str(int(received_time) + 86400) + padding - md5_data = (received_md5 + padded_sign_time + '0xAC10FD').encode() - signed_md5 = base64.urlsafe_b64encode(hashlib.md5(md5_data).digest()).decode().strip('=') - signed_hash = hash_prefix + padded_sign_time + signed_md5 - source = security['sources'][0]['url_parts'] - resource_url = source['scheme'] + '://' + source['domain'] + source['path'] - signed_url = '{}?h={}&k=html5&a={}'.format(resource_url, signed_hash, 'F' if video.get('subscriber_only') else 'A') - - fmts, subtitles = self._extract_m3u8_formats_and_subtitles( - signed_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) - formats.extend(fmts) - - for resource in video['resources']: - if resource.get('type') == 'subtitle': - subtitles.setdefault(resource.get('language') or 'por', []).append({ - 'url': resource.get('url'), - }) - subs = try_get(security, lambda x: x['source']['subtitles'], expected_type=dict) or {} - for sub_lang, sub_url in subs.items(): - if sub_url: - subtitles.setdefault(sub_lang or 'por', []).append({ - 'url': sub_url, - }) - subs = try_get(security, lambda x: x['source']['subtitles_webvtt'], expected_type=dict) or {} - for sub_lang, sub_url in subs.items(): - if sub_url: - subtitles.setdefault(sub_lang or 'por', []).append({ - 'url': sub_url, - }) - - duration = float_or_none(video.get('duration'), 1000) - uploader = video.get('channel') - uploader_id = str_or_none(video.get('channel_id')) + # 4k streams are exclusively outputted in dash, so we need to filter these out + if determine_ext(main_source['url']) == 'mpd': + formats, subtitles = self._extract_mpd_formats_and_subtitles(main_source['url'], video_id, mpd_id='dash') + else: + formats, subtitles = self._extract_m3u8_formats_and_subtitles( + main_source['url'], video_id, 'mp4', m3u8_id='hls') + self._merge_subtitles(traverse_obj(main_source, ('text', ..., { + 'url': ('subtitle', 'srt', 'url', {url_or_none}), + }, all, {subs_list_to_dict(lang='en')})), target=subtitles) return { 'id': video_id, - 'title': title, - 'duration': duration, - 'uploader': uploader, - 'uploader_id': uploader_id, + **traverse_obj(info, { + 'title': ('headline', {str}), + 'duration': ('duration', {float_or_none(scale=1000)}), + 'uploader': ('title', 'headline', {str}), + 'uploader_id': ('title', 'originProgramId', {str_or_none}), + 'episode_number': ('relatedEpisodeNumber', {int_or_none}), + 'season_number': ('relatedSeasonNumber', {int_or_none}), + }), 'formats': formats, 'subtitles': subtitles, } class GloboArticleIE(InfoExtractor): - _VALID_URL = r'https?://.+?\.globo\.com/(?:[^/]+/)*(?P[^/.]+)(?:\.html)?' + _VALID_URL = r'https?://(?!globoplay).+?\.globo\.com/(?:[^/?#]+/)*(?P[^/?#.]+)(?:\.html)?' _VIDEOID_REGEXES = [ r'\bdata-video-id=["\'](\d{7,})["\']', From 03c3d705778c07739e0034b51490877cffdc0983 Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:58:10 -0600 Subject: [PATCH 113/126] [ie/cwtv:movie] Add extractor (#12227) Closes #12113 Authored by: bashonly --- yt_dlp/extractor/_extractors.py | 5 ++- yt_dlp/extractor/cwtv.py | 56 ++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index 2566a791c..c331bab78 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -454,7 +454,10 @@ CuriosityStreamIE, CuriosityStreamSeriesIE, ) -from .cwtv import CWTVIE +from .cwtv import ( + CWTVIE, + CWTVMovieIE, +) from .cybrary import ( CybraryCourseIE, CybraryIE, diff --git a/yt_dlp/extractor/cwtv.py b/yt_dlp/extractor/cwtv.py index 24a8d676a..cdb29fcee 100644 --- a/yt_dlp/extractor/cwtv.py +++ b/yt_dlp/extractor/cwtv.py @@ -1,9 +1,12 @@ +import re + from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, parse_age_limit, parse_iso8601, + parse_qs, smuggle_url, str_or_none, update_url_query, @@ -12,7 +15,8 @@ class CWTVIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?cw(?:tv(?:pr)?|seed)\.com/(?:shows/)?(?:[^/]+/)+[^?]*\?.*\b(?:play|watch)=(?P[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})' + IE_NAME = 'cwtv' + _VALID_URL = r'https?://(?:www\.)?cw(?:tv(?:pr)?|seed)\.com/(?:shows/)?(?:[^/]+/)+[^?]*\?.*\b(?:play|watch|guid)=(?P[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})' _TESTS = [{ 'url': 'https://www.cwtv.com/shows/continuum/a-stitch-in-time/?play=9149a1e1-4cb2-46d7-81b2-47d35bbd332b', 'info_dict': { @@ -90,6 +94,9 @@ class CWTVIE(InfoExtractor): }, { 'url': 'http://cwtv.com/shows/arrow/legends-of-yesterday/?watch=6b15e985-9345-4f60-baf8-56e96be57c63', 'only_matching': True, + }, { + 'url': 'http://www.cwtv.com/movies/play/?guid=0a8e8b5b-1356-41d5-9a6a-4eda1a6feb6c', + 'only_matching': True, }] def _real_extract(self, url): @@ -124,3 +131,50 @@ def _real_extract(self, url): 'ie_key': 'ThePlatform', 'thumbnail': video_data.get('large_thumbnail'), } + + +class CWTVMovieIE(InfoExtractor): + IE_NAME = 'cwtv:movie' + _VALID_URL = r'https?://(?:www\.)?cwtv\.com/shows/(?P[\w-]+)/?\?(?:[^#]+&)?viewContext=Movies' + _TESTS = [{ + 'url': 'https://www.cwtv.com/shows/the-crush/?viewContext=Movies+Swimlane', + 'info_dict': { + 'id': '0a8e8b5b-1356-41d5-9a6a-4eda1a6feb6c', + 'ext': 'mp4', + 'title': 'The Crush', + 'upload_date': '20241112', + 'description': 'md5:1549acd90dff4a8273acd7284458363e', + 'chapters': 'count:9', + 'timestamp': 1731398400, + 'age_limit': 16, + 'duration': 5337, + 'series': 'The Crush', + 'season': 'Season 1', + 'uploader': 'CWTV', + 'season_number': 1, + 'episode': 'Episode 1', + 'episode_number': 1, + 'thumbnail': r're:https?://.+\.jpe?g', + }, + 'params': { + # m3u8 download + 'skip_download': True, + }, + }] + _UUID_RE = r'[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12}' + + def _real_extract(self, url): + display_id = self._match_id(url) + webpage = self._download_webpage(url, display_id) + app_url = ( + self._html_search_meta('al:ios:url', webpage, default=None) + or self._html_search_meta('al:android:url', webpage, default=None)) + video_id = ( + traverse_obj(parse_qs(app_url), ('video_id', 0, {lambda x: re.fullmatch(self._UUID_RE, x)}, 0)) + or self._search_regex([ + rf'CWTV\.Site\.curPlayingGUID\s*=\s*["\']({self._UUID_RE})', + rf'CWTV\.Site\.viewInAppURL\s*=\s*["\']/shows/[\w-]+/watch-in-app/\?play=({self._UUID_RE})', + ], webpage, 'video ID')) + + return self.url_result( + f'https://www.cwtv.com/shows/{display_id}/{display_id}/?play={video_id}', CWTVIE, video_id) From 517ddf3c3f12560ab93e3d36244dc82db9f97818 Mon Sep 17 00:00:00 2001 From: sepro Date: Sat, 8 Feb 2025 17:00:38 +0100 Subject: [PATCH 114/126] [misc] Improve Issue/PR templates (#11499) Authored by: seproDev --- .github/ISSUE_TEMPLATE/1_broken_site.yml | 24 ++++-------- .../ISSUE_TEMPLATE/2_site_support_request.yml | 24 ++++-------- .../ISSUE_TEMPLATE/3_site_feature_request.yml | 26 ++++--------- .github/ISSUE_TEMPLATE/4_bug_report.yml | 28 ++++---------- .github/ISSUE_TEMPLATE/5_feature_request.yml | 26 ++++--------- .github/ISSUE_TEMPLATE/6_question.yml | 26 ++++--------- .github/ISSUE_TEMPLATE/config.yml | 7 +--- .github/ISSUE_TEMPLATE_tmpl/1_broken_site.yml | 4 +- .../2_site_support_request.yml | 4 +- .../3_site_feature_request.yml | 6 +-- .github/ISSUE_TEMPLATE_tmpl/4_bug_report.yml | 8 +--- .../ISSUE_TEMPLATE_tmpl/5_feature_request.yml | 6 +-- .github/ISSUE_TEMPLATE_tmpl/6_question.yml | 6 +-- .github/PULL_REQUEST_TEMPLATE.md | 37 ++++++++++--------- README.md | 1 - devscripts/make_issue_template.py | 30 ++++++--------- 16 files changed, 87 insertions(+), 176 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/1_broken_site.yml b/.github/ISSUE_TEMPLATE/1_broken_site.yml index 20e5e944f..fd7591ba2 100644 --- a/.github/ISSUE_TEMPLATE/1_broken_site.yml +++ b/.github/ISSUE_TEMPLATE/1_broken_site.yml @@ -2,13 +2,11 @@ name: Broken site support description: Report issue with yt-dlp on a supported site labels: [triage, site-bug] body: - - type: checkboxes + - type: markdown attributes: - label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE - description: Fill all fields even if you think it is irrelevant for the issue - options: - - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field - required: true + value: | + > [!IMPORTANT] + > Not providing the required (*) information will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: @@ -24,9 +22,7 @@ body: required: true - label: I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command) required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766), [the FAQ](https://github.com/yt-dlp/yt-dlp/wiki/FAQ), and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%3Aissue%20-label%3Aspam%20%20) for similar issues **including closed ones**. DO NOT post duplicates required: true - label: I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required - type: input @@ -47,6 +43,8 @@ body: id: verbose attributes: label: Provide verbose output that clearly demonstrates the problem + description: | + This is mandatory unless absolutely impossible to provide. If you are unable to provide the output, please explain why. options: - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU `) required: true @@ -78,11 +76,3 @@ body: render: shell validations: required: true - - type: markdown - attributes: - value: | - > [!CAUTION] - > ### GitHub is experiencing a high volume of malicious spam comments. - > ### If you receive any replies asking you download a file, do NOT follow the download links! - > - > Note that this issue may be temporarily locked as an anti-spam measure after it is opened. diff --git a/.github/ISSUE_TEMPLATE/2_site_support_request.yml b/.github/ISSUE_TEMPLATE/2_site_support_request.yml index 4aeff7dc6..111f423d0 100644 --- a/.github/ISSUE_TEMPLATE/2_site_support_request.yml +++ b/.github/ISSUE_TEMPLATE/2_site_support_request.yml @@ -2,13 +2,11 @@ name: Site support request description: Request support for a new site labels: [triage, site-request] body: - - type: checkboxes + - type: markdown attributes: - label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE - description: Fill all fields even if you think it is irrelevant for the issue - options: - - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field - required: true + value: | + > [!IMPORTANT] + > Not providing the required (*) information will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: @@ -24,9 +22,7 @@ body: required: true - label: I've checked that none of provided URLs [violate any copyrights](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#is-the-website-primarily-used-for-piracy) or contain any [DRM](https://en.wikipedia.org/wiki/Digital_rights_management) to the best of my knowledge required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%3Aissue%20-label%3Aspam%20%20) for similar requests **including closed ones**. DO NOT post duplicates required: true - label: I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and am willing to share it if required - type: input @@ -59,6 +55,8 @@ body: id: verbose attributes: label: Provide verbose output that clearly demonstrates the problem + description: | + This is mandatory unless absolutely impossible to provide. If you are unable to provide the output, please explain why. options: - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU `) required: true @@ -90,11 +88,3 @@ body: render: shell validations: required: true - - type: markdown - attributes: - value: | - > [!CAUTION] - > ### GitHub is experiencing a high volume of malicious spam comments. - > ### If you receive any replies asking you download a file, do NOT follow the download links! - > - > Note that this issue may be temporarily locked as an anti-spam measure after it is opened. diff --git a/.github/ISSUE_TEMPLATE/3_site_feature_request.yml b/.github/ISSUE_TEMPLATE/3_site_feature_request.yml index 2f516ebb7..fd74be331 100644 --- a/.github/ISSUE_TEMPLATE/3_site_feature_request.yml +++ b/.github/ISSUE_TEMPLATE/3_site_feature_request.yml @@ -1,14 +1,12 @@ name: Site feature request -description: Request a new functionality for a supported site +description: Request new functionality for a site supported by yt-dlp labels: [triage, site-enhancement] body: - - type: checkboxes + - type: markdown attributes: - label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE - description: Fill all fields even if you think it is irrelevant for the issue - options: - - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field - required: true + value: | + > [!IMPORTANT] + > Not providing the required (*) information will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: @@ -22,9 +20,7 @@ body: required: true - label: I've checked that all provided URLs are playable in a browser with the same IP and same login details required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%3Aissue%20-label%3Aspam%20%20) for similar requests **including closed ones**. DO NOT post duplicates required: true - label: I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required - type: input @@ -55,6 +51,8 @@ body: id: verbose attributes: label: Provide verbose output that clearly demonstrates the problem + description: | + This is mandatory unless absolutely impossible to provide. If you are unable to provide the output, please explain why. options: - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU `) required: true @@ -86,11 +84,3 @@ body: render: shell validations: required: true - - type: markdown - attributes: - value: | - > [!CAUTION] - > ### GitHub is experiencing a high volume of malicious spam comments. - > ### If you receive any replies asking you download a file, do NOT follow the download links! - > - > Note that this issue may be temporarily locked as an anti-spam measure after it is opened. diff --git a/.github/ISSUE_TEMPLATE/4_bug_report.yml b/.github/ISSUE_TEMPLATE/4_bug_report.yml index 201586e9d..e9ec45e14 100644 --- a/.github/ISSUE_TEMPLATE/4_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/4_bug_report.yml @@ -2,13 +2,11 @@ name: Core bug report description: Report a bug unrelated to any particular site or extractor labels: [triage, bug] body: - - type: checkboxes + - type: markdown attributes: - label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE - description: Fill all fields even if you think it is irrelevant for the issue - options: - - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field - required: true + value: | + > [!IMPORTANT] + > Not providing the required (*) information will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: @@ -20,13 +18,7 @@ body: required: true - label: I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels)) required: true - - label: I've checked that all provided URLs are playable in a browser with the same IP and same login details - required: true - - label: I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command) - required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766), [the FAQ](https://github.com/yt-dlp/yt-dlp/wiki/FAQ), and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%3Aissue%20-label%3Aspam%20%20) for similar issues **including closed ones**. DO NOT post duplicates required: true - type: textarea id: description @@ -40,6 +32,8 @@ body: id: verbose attributes: label: Provide verbose output that clearly demonstrates the problem + description: | + This is mandatory unless absolutely impossible to provide. If you are unable to provide the output, please explain why. options: - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU `) required: true @@ -71,11 +65,3 @@ body: render: shell validations: required: true - - type: markdown - attributes: - value: | - > [!CAUTION] - > ### GitHub is experiencing a high volume of malicious spam comments. - > ### If you receive any replies asking you download a file, do NOT follow the download links! - > - > Note that this issue may be temporarily locked as an anti-spam measure after it is opened. diff --git a/.github/ISSUE_TEMPLATE/5_feature_request.yml b/.github/ISSUE_TEMPLATE/5_feature_request.yml index 765de86a2..9c7d66d81 100644 --- a/.github/ISSUE_TEMPLATE/5_feature_request.yml +++ b/.github/ISSUE_TEMPLATE/5_feature_request.yml @@ -1,14 +1,12 @@ name: Feature request -description: Request a new functionality unrelated to any particular site or extractor +description: Request a new feature unrelated to any particular site or extractor labels: [triage, enhancement] body: - - type: checkboxes + - type: markdown attributes: - label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE - description: Fill all fields even if you think it is irrelevant for the issue - options: - - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field - required: true + value: | + > [!IMPORTANT] + > Not providing the required (*) information will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: @@ -22,9 +20,7 @@ body: required: true - label: I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels)) required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%3Aissue%20-label%3Aspam%20%20) for similar requests **including closed ones**. DO NOT post duplicates required: true - type: textarea id: description @@ -38,6 +34,8 @@ body: id: verbose attributes: label: Provide verbose output that clearly demonstrates the problem + description: | + This is mandatory unless absolutely impossible to provide. If you are unable to provide the output, please explain why. options: - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU `) - label: "If using API, add `'verbose': True` to `YoutubeDL` params instead" @@ -65,11 +63,3 @@ body: [youtube] Extracting URL: https://www.youtube.com/watch?v=BaW_jenozKc render: shell - - type: markdown - attributes: - value: | - > [!CAUTION] - > ### GitHub is experiencing a high volume of malicious spam comments. - > ### If you receive any replies asking you download a file, do NOT follow the download links! - > - > Note that this issue may be temporarily locked as an anti-spam measure after it is opened. diff --git a/.github/ISSUE_TEMPLATE/6_question.yml b/.github/ISSUE_TEMPLATE/6_question.yml index 198e21bec..186f73a4a 100644 --- a/.github/ISSUE_TEMPLATE/6_question.yml +++ b/.github/ISSUE_TEMPLATE/6_question.yml @@ -1,14 +1,12 @@ name: Ask question -description: Ask yt-dlp related question +description: Ask a question about using yt-dlp labels: [question] body: - - type: checkboxes + - type: markdown attributes: - label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE - description: Fill all fields even if you think it is irrelevant for the issue - options: - - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field - required: true + value: | + > [!IMPORTANT] + > Not providing the required (*) information will result in your issue being closed and ignored. - type: markdown attributes: value: | @@ -28,9 +26,7 @@ body: required: true - label: I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels)) required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar questions **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766), [the FAQ](https://github.com/yt-dlp/yt-dlp/wiki/FAQ), and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%3Aissue%20-label%3Aspam%20%20) for similar questions **including closed ones**. DO NOT post duplicates required: true - type: textarea id: question @@ -44,6 +40,8 @@ body: id: verbose attributes: label: Provide verbose output that clearly demonstrates the problem + description: | + This is mandatory unless absolutely impossible to provide. If you are unable to provide the output, please explain why. options: - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU `) - label: "If using API, add `'verbose': True` to `YoutubeDL` params instead" @@ -71,11 +69,3 @@ body: [youtube] Extracting URL: https://www.youtube.com/watch?v=BaW_jenozKc render: shell - - type: markdown - attributes: - value: | - > [!CAUTION] - > ### GitHub is experiencing a high volume of malicious spam comments. - > ### If you receive any replies asking you download a file, do NOT follow the download links! - > - > Note that this issue may be temporarily locked as an anti-spam measure after it is opened. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 9cdffa4b1..0131631bb 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,5 @@ blank_issues_enabled: false contact_links: - - name: Get help from the community on Discord + - name: Get help on Discord url: https://discord.gg/H5MNcFW63r - about: Join the yt-dlp Discord for community-powered support! - - name: Matrix Bridge to the Discord server - url: https://matrix.to/#/#yt-dlp:matrix.org - about: For those who do not want to use Discord + about: Join the yt-dlp Discord server for support and discussion diff --git a/.github/ISSUE_TEMPLATE_tmpl/1_broken_site.yml b/.github/ISSUE_TEMPLATE_tmpl/1_broken_site.yml index bff28ae4e..f1a2d3090 100644 --- a/.github/ISSUE_TEMPLATE_tmpl/1_broken_site.yml +++ b/.github/ISSUE_TEMPLATE_tmpl/1_broken_site.yml @@ -18,9 +18,7 @@ body: required: true - label: I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command) required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766), [the FAQ](https://github.com/yt-dlp/yt-dlp/wiki/FAQ), and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%%3Aissue%%20-label%%3Aspam%%20%%20) for similar issues **including closed ones**. DO NOT post duplicates required: true - label: I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required - type: input diff --git a/.github/ISSUE_TEMPLATE_tmpl/2_site_support_request.yml b/.github/ISSUE_TEMPLATE_tmpl/2_site_support_request.yml index 2bffe738d..31b89b683 100644 --- a/.github/ISSUE_TEMPLATE_tmpl/2_site_support_request.yml +++ b/.github/ISSUE_TEMPLATE_tmpl/2_site_support_request.yml @@ -18,9 +18,7 @@ body: required: true - label: I've checked that none of provided URLs [violate any copyrights](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#is-the-website-primarily-used-for-piracy) or contain any [DRM](https://en.wikipedia.org/wiki/Digital_rights_management) to the best of my knowledge required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%%3Aissue%%20-label%%3Aspam%%20%%20) for similar requests **including closed ones**. DO NOT post duplicates required: true - label: I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and am willing to share it if required - type: input diff --git a/.github/ISSUE_TEMPLATE_tmpl/3_site_feature_request.yml b/.github/ISSUE_TEMPLATE_tmpl/3_site_feature_request.yml index 6c3127983..421766a75 100644 --- a/.github/ISSUE_TEMPLATE_tmpl/3_site_feature_request.yml +++ b/.github/ISSUE_TEMPLATE_tmpl/3_site_feature_request.yml @@ -1,5 +1,5 @@ name: Site feature request -description: Request a new functionality for a supported site +description: Request new functionality for a site supported by yt-dlp labels: [triage, site-enhancement] body: %(no_skip)s @@ -16,9 +16,7 @@ body: required: true - label: I've checked that all provided URLs are playable in a browser with the same IP and same login details required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%%3Aissue%%20-label%%3Aspam%%20%%20) for similar requests **including closed ones**. DO NOT post duplicates required: true - label: I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required - type: input diff --git a/.github/ISSUE_TEMPLATE_tmpl/4_bug_report.yml b/.github/ISSUE_TEMPLATE_tmpl/4_bug_report.yml index 5f357d96e..31a19b292 100644 --- a/.github/ISSUE_TEMPLATE_tmpl/4_bug_report.yml +++ b/.github/ISSUE_TEMPLATE_tmpl/4_bug_report.yml @@ -14,13 +14,7 @@ body: required: true - label: I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels)) required: true - - label: I've checked that all provided URLs are playable in a browser with the same IP and same login details - required: true - - label: I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command) - required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766), [the FAQ](https://github.com/yt-dlp/yt-dlp/wiki/FAQ), and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%%3Aissue%%20-label%%3Aspam%%20%%20) for similar issues **including closed ones**. DO NOT post duplicates required: true - type: textarea id: description diff --git a/.github/ISSUE_TEMPLATE_tmpl/5_feature_request.yml b/.github/ISSUE_TEMPLATE_tmpl/5_feature_request.yml index 99107ff58..b8ab6610b 100644 --- a/.github/ISSUE_TEMPLATE_tmpl/5_feature_request.yml +++ b/.github/ISSUE_TEMPLATE_tmpl/5_feature_request.yml @@ -1,5 +1,5 @@ name: Feature request -description: Request a new functionality unrelated to any particular site or extractor +description: Request a new feature unrelated to any particular site or extractor labels: [triage, enhancement] body: %(no_skip)s @@ -16,9 +16,7 @@ body: required: true - label: I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels)) required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%%3Aissue%%20-label%%3Aspam%%20%%20) for similar requests **including closed ones**. DO NOT post duplicates required: true - type: textarea id: description diff --git a/.github/ISSUE_TEMPLATE_tmpl/6_question.yml b/.github/ISSUE_TEMPLATE_tmpl/6_question.yml index bd742109a..062e96321 100644 --- a/.github/ISSUE_TEMPLATE_tmpl/6_question.yml +++ b/.github/ISSUE_TEMPLATE_tmpl/6_question.yml @@ -1,5 +1,5 @@ name: Ask question -description: Ask yt-dlp related question +description: Ask a question about using yt-dlp labels: [question] body: %(no_skip)s @@ -22,9 +22,7 @@ body: required: true - label: I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels)) required: true - - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar questions **including closed ones**. DO NOT post duplicates - required: true - - label: I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue) + - label: I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766), [the FAQ](https://github.com/yt-dlp/yt-dlp/wiki/FAQ), and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=is%%3Aissue%%20-label%%3Aspam%%20%%20) for similar questions **including closed ones**. DO NOT post duplicates required: true - type: textarea id: question diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4deee572f..4dcfcc48c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,14 +1,17 @@ -**IMPORTANT**: PRs without the template will be CLOSED + ### Description of your *pull request* and other information - - -ADD DESCRIPTION HERE +ADD DETAILED DESCRIPTION HERE Fixes # @@ -16,24 +19,22 @@ ### Description of your *pull request* and other information
Template ### Before submitting a *pull request* make sure you have: - [ ] At least skimmed through [contributing guidelines](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#developer-instructions) including [yt-dlp coding conventions](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#yt-dlp-coding-conventions) - [ ] [Searched](https://github.com/yt-dlp/yt-dlp/search?q=is%3Apr&type=Issues) the bugtracker for similar pull requests -### In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under [Unlicense](http://unlicense.org/). Check all of the following options that apply: -- [ ] I am the original author of this code and I am willing to release it under [Unlicense](http://unlicense.org/) -- [ ] I am not the original author of this code but it is in public domain or released under [Unlicense](http://unlicense.org/) (provide reliable evidence) +### In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under [Unlicense](http://unlicense.org/). Check those that apply and remove the others: +- [ ] I am the original author of the code in this PR, and I am willing to release it under [Unlicense](http://unlicense.org/) +- [ ] I am not the original author of the code in this PR, but it is in the public domain or released under [Unlicense](http://unlicense.org/) (provide reliable evidence) -### What is the purpose of your *pull request*? +### What is the purpose of your *pull request*? Check those that apply and remove the others: - [ ] Fix or improvement to an extractor (Make sure to add/update tests) - [ ] New extractor ([Piracy websites will not be accepted](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#is-the-website-primarily-used-for-piracy)) - [ ] Core bug fix/improvement diff --git a/README.md b/README.md index 45c56434a..0ac27c462 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ [![Release version](https://img.shields.io/github/v/release/yt-dlp/yt-dlp?color=brightgreen&label=Download&style=for-the-badge)](#installation "Installation") [![PyPI](https://img.shields.io/badge/-PyPI-blue.svg?logo=pypi&labelColor=555555&style=for-the-badge)](https://pypi.org/project/yt-dlp "PyPI") [![Donate](https://img.shields.io/badge/_-Donate-red.svg?logo=githubsponsors&labelColor=555555&style=for-the-badge)](Collaborators.md#collaborators "Donate") -[![Matrix](https://img.shields.io/matrix/yt-dlp:matrix.org?color=brightgreen&labelColor=555555&label=&logo=element&style=for-the-badge)](https://matrix.to/#/#yt-dlp:matrix.org "Matrix") [![Discord](https://img.shields.io/discord/807245652072857610?color=blue&labelColor=555555&label=&logo=discord&style=for-the-badge)](https://discord.gg/H5MNcFW63r "Discord") [![Supported Sites](https://img.shields.io/badge/-Supported_Sites-brightgreen.svg?style=for-the-badge)](supportedsites.md "Supported Sites") [![License: Unlicense](https://img.shields.io/badge/-Unlicense-blue.svg?style=for-the-badge)](LICENSE "License") diff --git a/devscripts/make_issue_template.py b/devscripts/make_issue_template.py index 2a418ddbf..681ebc51c 100644 --- a/devscripts/make_issue_template.py +++ b/devscripts/make_issue_template.py @@ -11,11 +11,13 @@ from devscripts.utils import get_filename_args, read_file, write_file -VERBOSE_TMPL = ''' +VERBOSE = ''' - type: checkboxes id: verbose attributes: label: Provide verbose output that clearly demonstrates the problem + description: | + This is mandatory unless absolutely impossible to provide. If you are unable to provide the output, please explain why. options: - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU `) required: true @@ -47,31 +49,23 @@ render: shell validations: required: true - - type: markdown - attributes: - value: | - > [!CAUTION] - > ### GitHub is experiencing a high volume of malicious spam comments. - > ### If you receive any replies asking you download a file, do NOT follow the download links! - > - > Note that this issue may be temporarily locked as an anti-spam measure after it is opened. '''.strip() NO_SKIP = ''' - - type: checkboxes + - type: markdown attributes: - label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE - description: Fill all fields even if you think it is irrelevant for the issue - options: - - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\\* field - required: true + value: | + > [!IMPORTANT] + > Not providing the required (*) information will result in your issue being closed and ignored. '''.strip() def main(): - fields = {'no_skip': NO_SKIP} - fields['verbose'] = VERBOSE_TMPL % fields - fields['verbose_optional'] = re.sub(r'(\n\s+validations:)?\n\s+required: true', '', fields['verbose']) + fields = { + 'no_skip': NO_SKIP, + 'verbose': VERBOSE, + 'verbose_optional': re.sub(r'(\n\s+validations:)?\n\s+required: true', '', VERBOSE), + } infile, outfile = get_filename_args(has_infile=True) write_file(outfile, read_file(infile) % fields) From 0d9f061d38c3a4da61972e2adad317079f2f1c84 Mon Sep 17 00:00:00 2001 From: Simon Sawicki Date: Sat, 8 Feb 2025 18:48:36 +0100 Subject: [PATCH 115/126] [jsinterp] Add `js_number_to_string` (#12110) Authored by: Grub4K --- test/test_jsinterp.py | 23 +++++++++++++++++- yt_dlp/jsinterp.py | 55 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py index 06840ed85..c1464f2cd 100644 --- a/test/test_jsinterp.py +++ b/test/test_jsinterp.py @@ -9,7 +9,7 @@ import math -from yt_dlp.jsinterp import JS_Undefined, JSInterpreter +from yt_dlp.jsinterp import JS_Undefined, JSInterpreter, js_number_to_string class NaN: @@ -431,6 +431,27 @@ def test_slice(self): self._test('function f(){return "012345678".slice(-1, 1)}', '') self._test('function f(){return "012345678".slice(-3, -1)}', '67') + def test_js_number_to_string(self): + for test, radix, expected in [ + (0, None, '0'), + (-0, None, '0'), + (0.0, None, '0'), + (-0.0, None, '0'), + (math.nan, None, 'NaN'), + (-math.nan, None, 'NaN'), + (math.inf, None, 'Infinity'), + (-math.inf, None, '-Infinity'), + (10 ** 21.5, 8, '526665530627250154000000'), + (6, 2, '110'), + (254, 16, 'fe'), + (-10, 2, '-1010'), + (-0xff, 2, '-11111111'), + (0.1 + 0.2, 16, '0.4cccccccccccd'), + (1234.1234, 10, '1234.1234'), + # (1000000000000000128, 10, '1000000000000000100') + ]: + assert js_number_to_string(test, radix) == expected + if __name__ == '__main__': unittest.main() diff --git a/yt_dlp/jsinterp.py b/yt_dlp/jsinterp.py index ba059babb..bd6a47004 100644 --- a/yt_dlp/jsinterp.py +++ b/yt_dlp/jsinterp.py @@ -95,6 +95,61 @@ def _js_ternary(cndn, if_true=True, if_false=False): return if_true +# Ref: https://es5.github.io/#x9.8.1 +def js_number_to_string(val: float, radix: int = 10): + if radix in (JS_Undefined, None): + radix = 10 + assert radix in range(2, 37), 'radix must be an integer at least 2 and no greater than 36' + + if math.isnan(val): + return 'NaN' + if val == 0: + return '0' + if math.isinf(val): + return '-Infinity' if val < 0 else 'Infinity' + if radix == 10: + # TODO: implement special cases + ... + + ALPHABET = b'0123456789abcdefghijklmnopqrstuvwxyz.-' + + result = collections.deque() + sign = val < 0 + val = abs(val) + fraction, integer = math.modf(val) + delta = max(math.nextafter(.0, math.inf), math.ulp(val) / 2) + + if fraction >= delta: + result.append(-2) # `.` + while fraction >= delta: + delta *= radix + fraction, digit = math.modf(fraction * radix) + result.append(int(digit)) + # if we need to round, propagate potential carry through fractional part + needs_rounding = fraction > 0.5 or (fraction == 0.5 and int(digit) & 1) + if needs_rounding and fraction + delta > 1: + for index in reversed(range(1, len(result))): + if result[index] + 1 < radix: + result[index] += 1 + break + result.pop() + + else: + integer += 1 + break + + integer, digit = divmod(int(integer), radix) + result.appendleft(digit) + while integer > 0: + integer, digit = divmod(integer, radix) + result.appendleft(digit) + + if sign: + result.appendleft(-1) # `-` + + return bytes(ALPHABET[digit] for digit in result).decode('ascii') + + # Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence _OPERATORS = { # None => Defined in JSInterpreter._operator '?': None, From 10b7ff68e98f17655e31952f6e17120b2d7dda96 Mon Sep 17 00:00:00 2001 From: entourage8 <193440922+entourage8@users.noreply.github.com> Date: Sat, 8 Feb 2025 22:43:12 +0100 Subject: [PATCH 116/126] [fd/hls] Fix `BYTERANGE` logic (#11972) Closes #3578, Closes #3810, Closes #9400 Authored by: entourage8 --- yt_dlp/downloader/hls.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/yt_dlp/downloader/hls.py b/yt_dlp/downloader/hls.py index da2574da7..7bd116d96 100644 --- a/yt_dlp/downloader/hls.py +++ b/yt_dlp/downloader/hls.py @@ -177,6 +177,7 @@ def is_ad_fragment_end(s): if external_aes_iv: external_aes_iv = binascii.unhexlify(remove_start(external_aes_iv, '0x').zfill(32)) byte_range = {} + byte_range_offset = 0 discontinuity_count = 0 frag_index = 0 ad_frag_next = False @@ -204,6 +205,11 @@ def is_ad_fragment_end(s): }) media_sequence += 1 + # If the byte_range is truthy, reset it after appending a fragment that uses it + if byte_range: + byte_range_offset = byte_range['end'] + byte_range = {} + elif line.startswith('#EXT-X-MAP'): if format_index and discontinuity_count != format_index: continue @@ -217,10 +223,12 @@ def is_ad_fragment_end(s): if extra_segment_query: frag_url = update_url_query(frag_url, extra_segment_query) + map_byte_range = {} + if map_info.get('BYTERANGE'): splitted_byte_range = map_info.get('BYTERANGE').split('@') - sub_range_start = int(splitted_byte_range[1]) if len(splitted_byte_range) == 2 else byte_range['end'] - byte_range = { + sub_range_start = int(splitted_byte_range[1]) if len(splitted_byte_range) == 2 else 0 + map_byte_range = { 'start': sub_range_start, 'end': sub_range_start + int(splitted_byte_range[0]), } @@ -229,7 +237,7 @@ def is_ad_fragment_end(s): 'frag_index': frag_index, 'url': frag_url, 'decrypt_info': decrypt_info, - 'byte_range': byte_range, + 'byte_range': map_byte_range, 'media_sequence': media_sequence, }) media_sequence += 1 @@ -257,7 +265,7 @@ def is_ad_fragment_end(s): media_sequence = int(line[22:]) elif line.startswith('#EXT-X-BYTERANGE'): splitted_byte_range = line[17:].split('@') - sub_range_start = int(splitted_byte_range[1]) if len(splitted_byte_range) == 2 else byte_range['end'] + sub_range_start = int(splitted_byte_range[1]) if len(splitted_byte_range) == 2 else byte_range_offset byte_range = { 'start': sub_range_start, 'end': sub_range_start + int(splitted_byte_range[0]), From 19edaa44fcd375f54e63d6227b092f5252d3e889 Mon Sep 17 00:00:00 2001 From: Julien Valentin Date: Sun, 9 Feb 2025 00:28:54 +0100 Subject: [PATCH 117/126] [ie/generic] Extract `live_status` for DASH manifest URLs (#12256) * Also removes the content-type check for dash+xml/mpd. This was added in cf1f13b817d88eb7d4b449f20cbad3215030e35f, but is a no-op since the regex pattern was never changed accordingly. And it looks like it was unwanted anyways per 28ad7df65ddb78c16ac008886d14ae2914aea6be Closes #12255 Authored by: mp3butcher --- yt_dlp/extractor/generic.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py index 320a47772..67c224e50 100644 --- a/yt_dlp/extractor/generic.py +++ b/yt_dlp/extractor/generic.py @@ -293,6 +293,19 @@ class GenericIE(InfoExtractor): 'timestamp': 1378272859.0, }, }, + # Live DASH MPD + { + 'url': 'https://livesim2.dashif.org/livesim2/ato_10/testpic_2s/Manifest.mpd', + 'info_dict': { + 'id': 'Manifest', + 'ext': 'mp4', + 'title': r're:Manifest \d{4}-\d{2}-\d{2} \d{2}:\d{2}$', + 'live_status': 'is_live', + }, + 'params': { + 'skip_download': 'livestream', + }, + }, # m3u8 served with Content-Type: audio/x-mpegURL; charset=utf-8 { 'url': 'http://once.unicornmedia.com/now/master/playlist/bb0b18ba-64f5-4b1b-a29f-0ac252f06b68/77a785f3-5188-4806-b788-0893a61634ed/93677179-2d99-4ef4-9e17-fe70d49abfbf/content.m3u8', @@ -2436,10 +2449,9 @@ def _real_extract(self, url): subtitles = {} if format_id.endswith('mpegurl') or ext == 'm3u8': formats, subtitles = self._extract_m3u8_formats_and_subtitles(url, video_id, 'mp4', headers=headers) - elif format_id.endswith(('mpd', 'dash+xml')) or ext == 'mpd': - formats, subtitles = self._extract_mpd_formats_and_subtitles(url, video_id, headers=headers) elif format_id == 'f4m' or ext == 'f4m': formats = self._extract_f4m_formats(url, video_id, headers=headers) + # Don't check for DASH/mpd here, do it later w/ first_bytes. Same number of requests either way else: formats = [{ 'format_id': format_id, @@ -2521,6 +2533,7 @@ def _real_extract(self, url): doc, mpd_base_url=full_response.url.rpartition('/')[0], mpd_url=url) + info_dict['live_status'] = 'is_live' if doc.get('type') == 'dynamic' else None self._extra_manifest_info(info_dict, url) self.report_detected('DASH manifest') return info_dict From 1295bbedd45fa8d9bc3f7a194864ae280297848e Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Sat, 8 Feb 2025 20:21:48 -0600 Subject: [PATCH 118/126] [ie/francetv:site] Fix livestream extraction (#12316) Closes #12310 Authored by: bashonly --- yt_dlp/extractor/francetv.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/francetv.py b/yt_dlp/extractor/francetv.py index 01b18d8da..c6036b306 100644 --- a/yt_dlp/extractor/francetv.py +++ b/yt_dlp/extractor/francetv.py @@ -358,7 +358,8 @@ def _real_extract(self, url): # For livestreams we need the id of the stream instead of the currently airing episode id video_id = traverse_obj(nextjs_data, ( ..., ..., 'children', ..., 'children', ..., 'children', ..., 'children', ..., ..., - 'children', ..., ..., 'children', ..., ..., 'children', ..., 'options', 'id', {str}, any)) + 'children', ..., ..., 'children', ..., ..., 'children', (..., (..., ...)), + 'options', 'id', {str}, any)) else: video_id = traverse_obj(nextjs_data, ( ..., ..., ..., 'children', From 241ace4f104d50fdf7638f9203927aefcf57a1f7 Mon Sep 17 00:00:00 2001 From: Stefan Lobbenmeier Date: Sun, 9 Feb 2025 20:19:28 +0100 Subject: [PATCH 119/126] [ie/zdf] Extract more metadata (#9565) Closes #9564 Authored by: StefanLobbenmeier --- yt_dlp/extractor/zdf.py | 94 +++++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 18 deletions(-) diff --git a/yt_dlp/extractor/zdf.py b/yt_dlp/extractor/zdf.py index 703766cd7..b64a88f6c 100644 --- a/yt_dlp/extractor/zdf.py +++ b/yt_dlp/extractor/zdf.py @@ -187,12 +187,20 @@ class ZDFIE(ZDFBaseIE): 'info_dict': { 'id': '151025_magie_farben2_tex', 'ext': 'mp4', + 'duration': 2615.0, 'title': 'Die Magie der Farben (2/2)', 'description': 'md5:a89da10c928c6235401066b60a6d5c1a', - 'duration': 2615, 'timestamp': 1465021200, - 'upload_date': '20160604', 'thumbnail': 'https://www.zdf.de/assets/mauve-im-labor-100~768x432?cb=1464909117806', + 'upload_date': '20160604', + 'episode': 'Die Magie der Farben (2/2)', + 'episode_id': 'POS_954f4170-36a5-4a41-a6cf-78f1f3b1f127', + 'season': 'Staffel 1', + 'series': 'Die Magie der Farben', + 'season_number': 1, + 'series_id': 'a39900dd-cdbd-4a6a-a413-44e8c6ae18bc', + 'season_id': '5a92e619-8a0f-4410-a3d5-19c76fbebb37', + 'episode_number': 2, }, }, { 'url': 'https://www.zdf.de/funk/druck-11790/funk-alles-ist-verzaubert-102.html', @@ -200,12 +208,13 @@ class ZDFIE(ZDFBaseIE): 'info_dict': { 'ext': 'mp4', 'id': 'video_funk_1770473', - 'duration': 1278, - 'description': 'Die Neue an der Schule verdreht Ismail den Kopf.', + 'duration': 1278.0, 'title': 'Alles ist verzaubert', + 'description': 'Die Neue an der Schule verdreht Ismail den Kopf.', 'timestamp': 1635520560, - 'upload_date': '20211029', 'thumbnail': 'https://www.zdf.de/assets/teaser-funk-alles-ist-verzaubert-102~1920x1080?cb=1663848412907', + 'upload_date': '20211029', + 'episode': 'Alles ist verzaubert', }, }, { # Same as https://www.phoenix.de/sendungen/dokumentationen/gesten-der-maechtigen-i-a-89468.html?ref=suche @@ -248,22 +257,52 @@ class ZDFIE(ZDFBaseIE): 'title': 'Das Geld anderer Leute', 'description': 'md5:cb6f660850dc5eb7d1ab776ea094959d', 'duration': 2581.0, - 'timestamp': 1675160100, - 'upload_date': '20230131', + 'timestamp': 1728983700, + 'upload_date': '20241015', 'thumbnail': 'https://epg-image.zdf.de/fotobase-webdelivery/images/e2d7e55a-09f0-424e-ac73-6cac4dd65f35?layout=2400x1350', + 'series': 'SOKO Stuttgart', + 'series_id': 'f862ce9a-6dd1-4388-a698-22b36ac4c9e9', + 'season': 'Staffel 11', + 'season_number': 11, + 'season_id': 'ae1b4990-6d87-4970-a571-caccf1ba2879', + 'episode': 'Das Geld anderer Leute', + 'episode_number': 10, + 'episode_id': 'POS_7f367934-f2f0-45cb-9081-736781ff2d23', }, }, { 'url': 'https://www.zdf.de/dokumentation/terra-x/unser-gruener-planet-wuesten-doku-100.html', 'info_dict': { - 'id': '220605_dk_gruener_planet_wuesten_tex', + 'id': '220525_green_planet_makingof_1_tropen_tex', 'ext': 'mp4', - 'title': 'Unser grüner Planet - Wüsten', - 'description': 'md5:4fc647b6f9c3796eea66f4a0baea2862', - 'duration': 2613.0, - 'timestamp': 1654450200, - 'upload_date': '20220605', - 'format_note': 'uhd, main', - 'thumbnail': 'https://www.zdf.de/assets/saguaro-kakteen-102~3840x2160?cb=1655910690796', + 'title': 'Making-of Unser grüner Planet - Tropen', + 'description': 'md5:d7c6949dc7c75c73c4ad51c785fb0b79', + 'duration': 435.0, + 'timestamp': 1653811200, + 'upload_date': '20220529', + 'format_note': 'hd, main', + 'thumbnail': 'https://www.zdf.de/assets/unser-gruener-planet-making-of-1-tropen-100~3840x2160?cb=1653493335577', + 'episode': 'Making-of Unser grüner Planet - Tropen', + }, + 'skip': 'No longer available: "Leider kein Video verfügbar"', + }, { + 'url': 'https://www.zdf.de/serien/northern-lights/begegnung-auf-der-bruecke-100.html', + 'info_dict': { + 'id': '240319_2310_sendung_not', + 'ext': 'mp4', + 'title': 'Begegnung auf der Brücke', + 'description': 'md5:e53a555da87447f7f1207f10353f8e45', + 'thumbnail': 'https://epg-image.zdf.de/fotobase-webdelivery/images/c5ff1d1f-f5c8-4468-86ac-1b2f1dbecc76?layout=2400x1350', + 'upload_date': '20250203', + 'duration': 3083.0, + 'timestamp': 1738546500, + 'series_id': '1d7a1879-01ee-4468-8237-c6b4ecd633c7', + 'series': 'Northern Lights', + 'season': 'Staffel 1', + 'season_number': 1, + 'season_id': '22ac26a2-4ea2-4055-ac0b-98b755cdf718', + 'episode': 'Begegnung auf der Brücke', + 'episode_number': 1, + 'episode_id': 'POS_71049438-024b-471f-b472-4fe2e490d1fb', }, }] @@ -316,12 +355,31 @@ def _extract_entry(self, url, player, content, video_id): 'timestamp': unified_timestamp(content.get('editorialDate')), 'thumbnails': thumbnails, 'chapters': chapters or None, + 'episode': title, + **traverse_obj(content, ('programmeItem', 0, 'http://zdf.de/rels/target', { + 'series_id': ('http://zdf.de/rels/cmdm/series', 'seriesUuid', {str}), + 'series': ('http://zdf.de/rels/cmdm/series', 'seriesTitle', {str}), + 'season': ('http://zdf.de/rels/cmdm/season', 'seasonTitle', {str}), + 'season_number': ('http://zdf.de/rels/cmdm/season', 'seasonNumber', {int_or_none}), + 'season_id': ('http://zdf.de/rels/cmdm/season', 'seasonUuid', {str}), + 'episode_number': ('episodeNumber', {int_or_none}), + 'episode_id': ('contentId', {str}), + })), }) def _extract_regular(self, url, player, video_id): - content = self._call_api( - player['content'], video_id, 'content', player['apiToken'], url) - return self._extract_entry(player['content'], player, content, video_id) + player_url = player['content'] + + try: + content = self._call_api( + update_url_query(player_url, {'profile': 'player-3'}), + video_id, 'content', player['apiToken'], url) + except ExtractorError as e: + self.report_warning(f'{video_id}: {e.orig_msg}; retrying with v2 profile') + content = self._call_api( + player_url, video_id, 'content', player['apiToken'], url) + + return self._extract_entry(player_url, player, content, video_id) def _extract_mobile(self, video_id): video = self._download_v2_doc(video_id) From 4ca8c44a073d5aa3a3e3112c35b2b23d6ce25ac6 Mon Sep 17 00:00:00 2001 From: sepro Date: Sun, 9 Feb 2025 22:37:23 +0100 Subject: [PATCH 120/126] [jsinterp] Improve zeroise (#12313) Authored by: seproDev --- test/test_jsinterp.py | 10 ++++++++++ test/test_youtube_signature.py | 4 ++++ yt_dlp/jsinterp.py | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py index c1464f2cd..ed3ca61c4 100644 --- a/test/test_jsinterp.py +++ b/test/test_jsinterp.py @@ -93,6 +93,16 @@ def test_operators(self): self._test('function f(){return 0 ?? 42;}', 0) self._test('function f(){return "life, the universe and everything" < 42;}', False) self._test('function f(){return 0 - 7 * - 6;}', 42) + self._test('function f(){return true << "5";}', 32) + self._test('function f(){return true << true;}', 2) + self._test('function f(){return "19" & "21.9";}', 17) + self._test('function f(){return "19" & false;}', 0) + self._test('function f(){return "11.0" >> "2.1";}', 2) + self._test('function f(){return 5 ^ 9;}', 12) + self._test('function f(){return 0.0 << NaN}', 0) + self._test('function f(){return null << undefined}', 0) + # TODO: Does not work due to number too large + # self._test('function f(){return 21 << 4294967297}', 42) def test_array_access(self): self._test('function f(){var x = [1,2,3]; x[0] = 4; x[0] = 5; x[2.0] = 7; return x;}', [5, 2, 7]) diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index 13436f088..7ae627f2c 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -201,6 +201,10 @@ 'https://www.youtube.com/s/player/2f1832d2/player_ias.vflset/en_US/base.js', 'YWt1qdbe8SAfkoPHW5d', 'RrRjWQOJmBiP', ), + ( + 'https://www.youtube.com/s/player/9c6dfc4a/player_ias.vflset/en_US/base.js', + 'jbu7ylIosQHyJyJV', 'uwI0ESiynAmhNg', + ), ] diff --git a/yt_dlp/jsinterp.py b/yt_dlp/jsinterp.py index bd6a47004..ac0629715 100644 --- a/yt_dlp/jsinterp.py +++ b/yt_dlp/jsinterp.py @@ -25,7 +25,7 @@ def zeroise(x): with contextlib.suppress(TypeError): if math.isnan(x): # NB: NaN cannot be checked by membership return 0 - return x + return int(float(x)) def wrapped(a, b): return op(zeroise(a), zeroise(b)) & 0xffffffff From 14cd7f3443c6da4d49edaefcc12da9dee86e243e Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Mon, 10 Feb 2025 20:00:00 +0100 Subject: [PATCH 121/126] [ie/twitter] Fix syndication token generation (#12107) Authored by: pjrobertson, Grub4K Co-authored-by: Simon Sawicki --- yt_dlp/extractor/twitter.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/twitter.py b/yt_dlp/extractor/twitter.py index c05b5bf9c..d32ae3f18 100644 --- a/yt_dlp/extractor/twitter.py +++ b/yt_dlp/extractor/twitter.py @@ -1,11 +1,12 @@ import functools import json -import random +import math import re import urllib.parse from .common import InfoExtractor from .periscope import PeriscopeBaseIE, PeriscopeIE +from ..jsinterp import js_number_to_string from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, @@ -1330,6 +1331,11 @@ def _build_graphql_query(self, media_id): }, } + def _generate_syndication_token(self, twid): + # ((Number(twid) / 1e15) * Math.PI).toString(36).replace(/(0+|\.)/g, '') + translation = str.maketrans(dict.fromkeys('0.')) + return js_number_to_string((int(twid) / 1e15) * math.PI, 36).translate(translation) + def _call_syndication_api(self, twid): self.report_warning( 'Not all metadata or media is available via syndication endpoint', twid, only_once=True) @@ -1337,8 +1343,7 @@ def _call_syndication_api(self, twid): 'https://cdn.syndication.twimg.com/tweet-result', twid, 'Downloading syndication JSON', headers={'User-Agent': 'Googlebot'}, query={ 'id': twid, - # TODO: token = ((Number(twid) / 1e15) * Math.PI).toString(36).replace(/(0+|\.)/g, '') - 'token': ''.join(random.choices('123456789abcdefghijklmnopqrstuvwxyz', k=10)), + 'token': self._generate_syndication_token(twid), }) if not status: raise ExtractorError('Syndication endpoint returned empty JSON response') From c987be0acb6872c6561f28aa28171e803393d851 Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:08:10 -0600 Subject: [PATCH 122/126] [fd/hls] Support `hls_media_playlist_data` format field (#12322) Authored by: bashonly --- yt_dlp/YoutubeDL.py | 2 +- yt_dlp/downloader/hls.py | 12 ++++++++---- yt_dlp/extractor/common.py | 5 +++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index b7b19cf6e..3293a9076 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -598,7 +598,7 @@ class YoutubeDL: # NB: Keep in sync with the docstring of extractor/common.py 'url', 'manifest_url', 'manifest_stream_number', 'ext', 'format', 'format_id', 'format_note', 'width', 'height', 'aspect_ratio', 'resolution', 'dynamic_range', 'tbr', 'abr', 'acodec', 'asr', 'audio_channels', - 'vbr', 'fps', 'vcodec', 'container', 'filesize', 'filesize_approx', 'rows', 'columns', + 'vbr', 'fps', 'vcodec', 'container', 'filesize', 'filesize_approx', 'rows', 'columns', 'hls_media_playlist_data', 'player_url', 'protocol', 'fragment_base_url', 'fragments', 'is_from_start', 'is_dash_periods', 'request_data', 'preference', 'language', 'language_preference', 'quality', 'source_preference', 'cookies', 'http_headers', 'stretched_ratio', 'no_resume', 'has_drm', 'extra_param_to_segment_url', 'extra_param_to_key_url', diff --git a/yt_dlp/downloader/hls.py b/yt_dlp/downloader/hls.py index 7bd116d96..7a47f8f83 100644 --- a/yt_dlp/downloader/hls.py +++ b/yt_dlp/downloader/hls.py @@ -72,11 +72,15 @@ def check_results(): def real_download(self, filename, info_dict): man_url = info_dict['url'] - self.to_screen(f'[{self.FD_NAME}] Downloading m3u8 manifest') - urlh = self.ydl.urlopen(self._prepare_url(info_dict, man_url)) - man_url = urlh.url - s = urlh.read().decode('utf-8', 'ignore') + s = info_dict.get('hls_media_playlist_data') + if s: + self.to_screen(f'[{self.FD_NAME}] Using m3u8 manifest from extracted info') + else: + self.to_screen(f'[{self.FD_NAME}] Downloading m3u8 manifest') + urlh = self.ydl.urlopen(self._prepare_url(info_dict, man_url)) + man_url = urlh.url + s = urlh.read().decode('utf-8', 'ignore') can_download, message = self.can_download(s, info_dict, self.params.get('allow_unplayable_formats')), None if can_download: diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 92ddad2b7..3e7734ce1 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -201,6 +201,11 @@ class InfoExtractor: fragment_base_url * "duration" (optional, int or float) * "filesize" (optional, int) + * hls_media_playlist_data + The M3U8 media playlist data as a string. + Only use if the data must be modified during extraction and + the native HLS downloader should bypass requesting the URL. + Does not apply if ffmpeg is used as external downloader * is_from_start Is a live format that can be downloaded from the start. Boolean * preference Order number of this format. If this field is From 208163447408c78673b08c172beafe5c310fb167 Mon Sep 17 00:00:00 2001 From: Mozi <29089388+pzhlkj6612@users.noreply.github.com> Date: Mon, 10 Feb 2025 23:22:21 +0000 Subject: [PATCH 123/126] [test:download] Validate and sort info dict fields (#12299) Authored by: pzhlkj6612, bashonly Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com> --- test/helper.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/helper.py b/test/helper.py index c776e70b7..193019019 100644 --- a/test/helper.py +++ b/test/helper.py @@ -237,6 +237,20 @@ def sanitize(key, value): def expect_info_dict(self, got_dict, expected_dict): + ALLOWED_KEYS_SORT_ORDER = ( + # NB: Keep in sync with the docstring of extractor/common.py + 'id', 'ext', 'direct', 'display_id', 'title', 'alt_title', 'description', 'media_type', + 'uploader', 'uploader_id', 'uploader_url', 'channel', 'channel_id', 'channel_url', 'channel_is_verified', + 'channel_follower_count', 'comment_count', 'view_count', 'concurrent_view_count', + 'like_count', 'dislike_count', 'repost_count', 'average_rating', 'age_limit', 'duration', 'thumbnail', 'heatmap', + 'chapters', 'chapter', 'chapter_number', 'chapter_id', 'start_time', 'end_time', 'section_start', 'section_end', + 'categories', 'tags', 'cast', 'composers', 'artists', 'album_artists', 'creators', 'genres', + 'track', 'track_number', 'track_id', 'album', 'album_type', 'disc_number', + 'series', 'series_id', 'season', 'season_number', 'season_id', 'episode', 'episode_number', 'episode_id', + 'timestamp', 'upload_date', 'release_timestamp', 'release_date', 'release_year', 'modified_timestamp', 'modified_date', + 'playable_in_embed', 'availability', 'live_status', 'location', 'license', '_old_archive_ids', + ) + expect_dict(self, got_dict, expected_dict) # Check for the presence of mandatory fields if got_dict.get('_type') not in ('playlist', 'multi_video'): @@ -252,7 +266,13 @@ def expect_info_dict(self, got_dict, expected_dict): test_info_dict = sanitize_got_info_dict(got_dict) - missing_keys = set(test_info_dict.keys()) - set(expected_dict.keys()) + # Check for invalid/misspelled field names being returned by the extractor + invalid_keys = sorted(test_info_dict.keys() - ALLOWED_KEYS_SORT_ORDER) + self.assertFalse(invalid_keys, f'Invalid fields returned by the extractor: {", ".join(invalid_keys)}') + + missing_keys = sorted( + test_info_dict.keys() - expected_dict.keys(), + key=lambda x: ALLOWED_KEYS_SORT_ORDER.index(x)) if missing_keys: def _repr(v): if isinstance(v, str): From 4ecb833472c90e078567b561fb7c089f1aa9587b Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:40:21 -0600 Subject: [PATCH 124/126] [misc] Clarify that the issue template cannot be removed (#12332) Fix 517ddf3c3f12560ab93e3d36244dc82db9f97818 Authored by: bashonly --- .github/ISSUE_TEMPLATE/1_broken_site.yml | 2 +- .github/ISSUE_TEMPLATE/2_site_support_request.yml | 2 +- .github/ISSUE_TEMPLATE/3_site_feature_request.yml | 2 +- .github/ISSUE_TEMPLATE/4_bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/5_feature_request.yml | 2 +- .github/ISSUE_TEMPLATE/6_question.yml | 2 +- devscripts/make_issue_template.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/1_broken_site.yml b/.github/ISSUE_TEMPLATE/1_broken_site.yml index fd7591ba2..c8d3de06b 100644 --- a/.github/ISSUE_TEMPLATE/1_broken_site.yml +++ b/.github/ISSUE_TEMPLATE/1_broken_site.yml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Not providing the required (*) information will result in your issue being closed and ignored. + > Not providing the required (*) information or removing the template will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: diff --git a/.github/ISSUE_TEMPLATE/2_site_support_request.yml b/.github/ISSUE_TEMPLATE/2_site_support_request.yml index 111f423d0..a9564c0c2 100644 --- a/.github/ISSUE_TEMPLATE/2_site_support_request.yml +++ b/.github/ISSUE_TEMPLATE/2_site_support_request.yml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Not providing the required (*) information will result in your issue being closed and ignored. + > Not providing the required (*) information or removing the template will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: diff --git a/.github/ISSUE_TEMPLATE/3_site_feature_request.yml b/.github/ISSUE_TEMPLATE/3_site_feature_request.yml index fd74be331..6e2380fae 100644 --- a/.github/ISSUE_TEMPLATE/3_site_feature_request.yml +++ b/.github/ISSUE_TEMPLATE/3_site_feature_request.yml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Not providing the required (*) information will result in your issue being closed and ignored. + > Not providing the required (*) information or removing the template will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: diff --git a/.github/ISSUE_TEMPLATE/4_bug_report.yml b/.github/ISSUE_TEMPLATE/4_bug_report.yml index e9ec45e14..6fc523be0 100644 --- a/.github/ISSUE_TEMPLATE/4_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/4_bug_report.yml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Not providing the required (*) information will result in your issue being closed and ignored. + > Not providing the required (*) information or removing the template will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: diff --git a/.github/ISSUE_TEMPLATE/5_feature_request.yml b/.github/ISSUE_TEMPLATE/5_feature_request.yml index 9c7d66d81..57a33bb71 100644 --- a/.github/ISSUE_TEMPLATE/5_feature_request.yml +++ b/.github/ISSUE_TEMPLATE/5_feature_request.yml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Not providing the required (*) information will result in your issue being closed and ignored. + > Not providing the required (*) information or removing the template will result in your issue being closed and ignored. - type: checkboxes id: checklist attributes: diff --git a/.github/ISSUE_TEMPLATE/6_question.yml b/.github/ISSUE_TEMPLATE/6_question.yml index 186f73a4a..28ec7cbe0 100644 --- a/.github/ISSUE_TEMPLATE/6_question.yml +++ b/.github/ISSUE_TEMPLATE/6_question.yml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Not providing the required (*) information will result in your issue being closed and ignored. + > Not providing the required (*) information or removing the template will result in your issue being closed and ignored. - type: markdown attributes: value: | diff --git a/devscripts/make_issue_template.py b/devscripts/make_issue_template.py index 681ebc51c..110fcc245 100644 --- a/devscripts/make_issue_template.py +++ b/devscripts/make_issue_template.py @@ -56,7 +56,7 @@ attributes: value: | > [!IMPORTANT] - > Not providing the required (*) information will result in your issue being closed and ignored. + > Not providing the required (*) information or removing the template will result in your issue being closed and ignored. '''.strip() From f53553087d3fde9dcd61d6e9f98caf09db1d8ef2 Mon Sep 17 00:00:00 2001 From: Laurent FAVOLE Date: Tue, 11 Feb 2025 21:04:20 +0100 Subject: [PATCH 125/126] [ie/Digiview] Add extractor (#9902) Authored by: lfavole --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/digiview.py | 130 ++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 yt_dlp/extractor/digiview.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index c331bab78..c937dfe13 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -508,6 +508,7 @@ from .dhm import DHMIE from .digitalconcerthall import DigitalConcertHallIE from .digiteka import DigitekaIE +from .digiview import DigiviewIE from .discogs import DiscogsReleasePlaylistIE from .disney import DisneyIE from .dispeak import DigitallySpeakingIE diff --git a/yt_dlp/extractor/digiview.py b/yt_dlp/extractor/digiview.py new file mode 100644 index 000000000..f7f23864d --- /dev/null +++ b/yt_dlp/extractor/digiview.py @@ -0,0 +1,130 @@ +from .common import InfoExtractor +from .youtube import YoutubeIE +from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata + + +class DigiviewIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P[0-9a-f]+)' + _TESTS = [{ + # normal video + 'url': 'https://ladigitale.dev/digiview/#/v/67a8e50aee2ec', + 'info_dict': { + 'id': '67a8e50aee2ec', + 'ext': 'mp4', + 'title': 'Big Buck Bunny 60fps 4K - Official Blender Foundation Short Film', + 'thumbnail': 'https://i.ytimg.com/vi/aqz-KE-bpKQ/hqdefault.jpg', + 'upload_date': '20141110', + 'playable_in_embed': True, + 'duration': 635, + 'view_count': int, + 'comment_count': int, + 'channel': 'Blender', + 'license': 'Creative Commons Attribution license (reuse allowed)', + 'like_count': int, + 'tags': 'count:8', + 'live_status': 'not_live', + 'channel_id': 'UCSMOQeBJ2RAnuFungnQOxLg', + 'channel_follower_count': int, + 'channel_url': 'https://www.youtube.com/channel/UCSMOQeBJ2RAnuFungnQOxLg', + 'uploader_id': '@BlenderOfficial', + 'description': 'md5:8f3ed18a53a1bb36cbb3b70a15782fd0', + 'categories': ['Film & Animation'], + 'channel_is_verified': True, + 'heatmap': 'count:100', + 'section_end': 635, + 'uploader': 'Blender', + 'timestamp': 1415628355, + 'uploader_url': 'https://www.youtube.com/@BlenderOfficial', + 'age_limit': 0, + 'section_start': 0, + 'availability': 'public', + }, + }, { + # cut video + 'url': 'https://ladigitale.dev/digiview/#/v/67a8e51d0dd58', + 'info_dict': { + 'id': '67a8e51d0dd58', + 'ext': 'mp4', + 'title': 'Big Buck Bunny 60fps 4K - Official Blender Foundation Short Film', + 'thumbnail': 'https://i.ytimg.com/vi/aqz-KE-bpKQ/hqdefault.jpg', + 'upload_date': '20141110', + 'playable_in_embed': True, + 'duration': 5, + 'view_count': int, + 'comment_count': int, + 'channel': 'Blender', + 'license': 'Creative Commons Attribution license (reuse allowed)', + 'like_count': int, + 'tags': 'count:8', + 'live_status': 'not_live', + 'channel_id': 'UCSMOQeBJ2RAnuFungnQOxLg', + 'channel_follower_count': int, + 'channel_url': 'https://www.youtube.com/channel/UCSMOQeBJ2RAnuFungnQOxLg', + 'uploader_id': '@BlenderOfficial', + 'description': 'md5:8f3ed18a53a1bb36cbb3b70a15782fd0', + 'categories': ['Film & Animation'], + 'channel_is_verified': True, + 'heatmap': 'count:100', + 'section_end': 10, + 'uploader': 'Blender', + 'timestamp': 1415628355, + 'uploader_url': 'https://www.youtube.com/@BlenderOfficial', + 'age_limit': 0, + 'section_start': 5, + 'availability': 'public', + }, + }, { + # changed title + 'url': 'https://ladigitale.dev/digiview/#/v/67a8ea5644d7a', + 'info_dict': { + 'id': '67a8ea5644d7a', + 'ext': 'mp4', + 'title': 'Big Buck Bunny (with title changed)', + 'thumbnail': 'https://i.ytimg.com/vi/aqz-KE-bpKQ/hqdefault.jpg', + 'upload_date': '20141110', + 'playable_in_embed': True, + 'duration': 5, + 'view_count': int, + 'comment_count': int, + 'channel': 'Blender', + 'license': 'Creative Commons Attribution license (reuse allowed)', + 'like_count': int, + 'tags': 'count:8', + 'live_status': 'not_live', + 'channel_id': 'UCSMOQeBJ2RAnuFungnQOxLg', + 'channel_follower_count': int, + 'channel_url': 'https://www.youtube.com/channel/UCSMOQeBJ2RAnuFungnQOxLg', + 'uploader_id': '@BlenderOfficial', + 'description': 'md5:8f3ed18a53a1bb36cbb3b70a15782fd0', + 'categories': ['Film & Animation'], + 'channel_is_verified': True, + 'heatmap': 'count:100', + 'section_end': 15, + 'uploader': 'Blender', + 'timestamp': 1415628355, + 'uploader_url': 'https://www.youtube.com/@BlenderOfficial', + 'age_limit': 0, + 'section_start': 10, + 'availability': 'public', + }, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + video_data = self._download_json( + 'https://ladigitale.dev/digiview/inc/recuperer_video.php', video_id, + data=urlencode_postdata({'id': video_id})) + + clip_id = video_data['videoId'] + return self.url_result( + f'https://www.youtube.com/watch?v={clip_id}', + YoutubeIE, video_id, url_transparent=True, + **traverse_obj(video_data, { + 'section_start': ('debut', {int_or_none}), + 'section_end': ('fin', {int_or_none}), + 'description': ('description', {clean_html}, filter), + 'title': ('titre', {str}), + 'thumbnail': ('vignette', {url_or_none}), + 'view_count': ('vues', {int_or_none}), + }), + ) From 6ca23ffaa4663cb552f937f0b1e9769b66db11bd Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Tue, 11 Feb 2025 15:32:25 -0600 Subject: [PATCH 126/126] [ie/reddit] Bypass gated subreddit warning (#12335) Closes #12331 Authored by: bashonly --- yt_dlp/extractor/reddit.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/yt_dlp/extractor/reddit.py b/yt_dlp/extractor/reddit.py index 7325e547b..d5150fd8f 100644 --- a/yt_dlp/extractor/reddit.py +++ b/yt_dlp/extractor/reddit.py @@ -198,6 +198,25 @@ class RedditIE(InfoExtractor): 'skip_download': True, 'writesubtitles': True, }, + }, { + # "gated" subreddit post + 'url': 'https://old.reddit.com/r/ketamine/comments/degtjo/when_the_k_hits/', + 'info_dict': { + 'id': 'gqsbxts133r31', + 'ext': 'mp4', + 'display_id': 'degtjo', + 'title': 'When the K hits', + 'uploader': '[deleted]', + 'channel_id': 'ketamine', + 'comment_count': int, + 'like_count': int, + 'dislike_count': int, + 'age_limit': 18, + 'duration': 34, + 'thumbnail': r're:https?://.+/.+\.(?:jpg|png)', + 'timestamp': 1570438713.0, + 'upload_date': '20191007', + }, }, { 'url': 'https://www.reddit.com/r/videos/comments/6rrwyj', 'only_matching': True, @@ -245,6 +264,15 @@ def _perform_login(self, username, password): elif not traverse_obj(login, ('json', 'data', 'cookie', {str})): raise ExtractorError('Unable to login, no cookie was returned') + def _real_initialize(self): + # Set cookie to opt-in to age-restricted subreddits + self._set_cookie('reddit.com', 'over18', '1') + # Set cookie to opt-in to "gated" subreddits + options = traverse_obj(self._get_cookies('https://www.reddit.com/'), ( + '_options', 'value', {urllib.parse.unquote}, {json.loads}, {dict})) or {} + options['pref_gated_sr_optin'] = True + self._set_cookie('reddit.com', '_options', urllib.parse.quote(json.dumps(options))) + def _get_subtitles(self, video_id): # Fallback if there were no subtitles provided by DASH or HLS manifests caption_url = f'https://v.redd.it/{video_id}/wh_ben_en.vtt'