before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
lang = mobj.group('lang') or mobj.group('lang_2')
info = self._download_json(
'%s/config/%s/%s' % (self._API_BASE, lang, video_id), video_id)
player_info = info['videoJsonPlayer']
vsr = try_get(pl... | Note to self:
```suggestion
(?P<vaud>AUD|) # audio description
(?:
```
Should also add dispreference below. | 'only_matching': True,
}, {
'url': 'https://api.arte.tv/api/player/v2/config/de/LIVE',
'only_matching': True,
}]
_GEO_BYPASS = True
_LANG_MAP = { # ISO639 -> French abbreviations
'fr': 'F',
'de': 'A',
'en': 'E[ANG]',
'es': 'E[ESP]',
'it'... | @@ -45,6 +45,29 @@ class ArteTVIE(ArteTVBaseIE):
_GEO_BYPASS = True
+ # Reference formerly available at: section 6.8 of
+ # <https://www.arte.tv/sites/en/corporate/files/complete-technical-guidelines-arte-geie-v1-07-1.pdf>
+
+ __LANG_MAP = { # the RHS are not ISO codes, but French abbreviations
... | yt_dlp/extractor/arte.py | 26 | Python | 0.786 | suggestion | 135 | 51 | 51 | false | [arte] Move to v2 API | 3,302 | yt-dlp/yt-dlp | 132,642 | Python | fstirlitz | fstirlitz |
format_url = url_or_none(f.get('url'))
streamer = f.get('streamer')
if not format_url and not streamer:
continue
versionCode = f.get('versionCode')
l = re.escape(langcode)
# Language preference from most to least priority
... | This should probably check `rights` instead, or in addition. <https://www.arte.tv/de/videos/097407-215-A/28-minuten/> returns `rights: null` and `streams: []`. | },
'SAT': {
'AD', 'AT', 'AX', 'BG', 'BL', 'CH', 'CY', 'CZ',
'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GF',
'GR', 'HR', 'HU', 'IE', 'IS', 'IT', 'KN', 'LI',
'LT', 'LU', 'LV', 'MC', 'MF', 'MQ', 'MT', 'NC',
'NL', 'NO', 'PF', 'PL', 'PM', 'PT', 'RE'... | @@ -110,6 +111,13 @@ def _real_extract(self, url):
countries = tuple(code for code in geoblocking['code'].split('_') if code != 'EUR')
raise GeoRestrictedError('Video is geoblocked', countries=countries)
+ # e.g. <https://www.arte.tv/es/videos/104351-002-A/serviteur-du-peuple-1-23/>
+... | yt_dlp/extractor/arte.py | 26 | Python | 0.714 | suggestion | 159 | 51 | 51 | false | [arte] Move to v2 API | 3,302 | yt-dlp/yt-dlp | 132,642 | Python | fstirlitz | fstirlitz |
class ArteTVEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?arte\.tv/player/v\d+/index\.php\?.*?\bjson_url=.+'
_TESTS = [{
'url': 'https://www.arte.tv/player/v5/index.php?json_url=https%3A%2F%2Fapi.arte.tv%2Fapi%2Fplayer%2Fv2%2Fconfig%2Fde%2F100605-013-A&lang=de&autoplay=true&mute=0100605-01... | ```suggestion
# TODO: chapters from stream['segments']?
# The JS also apparently looks for chapters in config['data']['attributes']['chapters'],
# but I am yet to find a video having those
```
why do u split lines so much, and at odd places? Makes it really hard to read for me... | 'thumbnails': [
{'url': image['url'], 'id': image.get('caption')}
for image in metadata.get('images') or [] if url_or_none(image.get('url'))
],
}
class ArteTVEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?arte\.tv/player/v\d+/index\.php\?.... | @@ -5,195 +5,220 @@
compat_str,
)
from ..utils import (
+ GeoRestrictedError,
ExtractorError,
int_or_none,
+ parse_iso8601,
parse_qs,
- qualities,
strip_or_none,
try_get,
- unified_strdate,
url_or_none,
)
class ArteTVBaseIE(InfoExtractor):
_ARTE_LANGUAGES = 'f... | yt_dlp/extractor/arte.py | 26 | Python | 0.786 | question | 338 | 51 | 51 | false | [arte] Move to v2 API | 3,302 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | fstirlitz |
if re.match(p, versionCode):
lang_pref = len(PREFERENCES) - pref
break
else:
lang_pref = -1
format_note = '%s, %s' % (f.get('versionCode'), f.get('versionLibelle'))
media_type = f.get('mediaType')
if... | if u know this for sure, why not? Otherwise yt-dlp will try to determine it from the URL | m.group('vlang') == langauge_code, # we prefer voice in the requested language
not m.group('audio_desc'), # and not the audio description version
bool(m.group('original_voice')), # but if voice is not in the requested language, at leas... | @@ -5,195 +5,220 @@
compat_str,
)
from ..utils import (
+ GeoRestrictedError,
ExtractorError,
int_or_none,
+ parse_iso8601,
parse_qs,
- qualities,
strip_or_none,
try_get,
- unified_strdate,
url_or_none,
)
class ArteTVBaseIE(InfoExtractor):
_ARTE_LANGUAGES = 'f... | yt_dlp/extractor/arte.py | 26 | Python | 0.214 | suggestion | 88 | 51 | 51 | false | [arte] Move to v2 API | 3,302 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | fstirlitz |
f = dict(format_dict)
format_url = url_or_none(f.get('url'))
streamer = f.get('streamer')
if not format_url and not streamer:
continue
versionCode = f.get('versionCode')
l = re.escape(langcode)
# Language preference fro... | Speaking of which, what is this?
https://github.com/yt-dlp/yt-dlp/blob/926ccc84ef91498f3147b07d15eb5f40cd070471/yt_dlp/utils.py#L4188
It’s not an ISO 3166 code, and my GeoIP database (the last freely downloadable public version of GeoLite2) locates the IP block in Norway. (And so does Arte’s, apparently, because... | 'YT',
},
'SAT': {
'AD', 'AT', 'AX', 'BG', 'BL', 'CH', 'CY', 'CZ',
'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GF',
'GR', 'HR', 'HU', 'IE', 'IS', 'IT', 'KN', 'LI',
'LT', 'LU', 'LV', 'MC', 'MF', 'MQ', 'MT', 'NC',
'NL', 'NO', 'PF', 'PL'... | @@ -95,6 +95,24 @@ class ArteTVIE(ArteTVBaseIE):
)?
''')
+ __GEO_COUNTRIES = {
+ # obtained by exhaustive testing
+ # with both 'BE' sometimes works, sometimes doesn't
+ 'EUR_DE_FR': frozenset((
+ 'AT', 'BL', 'CH', 'DE', 'FR', 'GF', 'GP', 'LI',
+ 'MC', 'MF',... | yt_dlp/extractor/arte.py | 26 | Python | 0.5 | refactor | 358 | 51 | 51 | false | [arte] Move to v2 API | 3,302 | yt-dlp/yt-dlp | 132,642 | Python | fstirlitz | fstirlitz |
clean_html,
determine_ext,
get_element_by_attribute,
get_element_by_class,
int_or_none,
parse_bitrate,
parse_resolution,
unified_timestamp,
urlencode_postdata,
url_or_none,
)
class IcareusIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://(?:www\.)?
... | (untested)
```suggestion
_DOMAINS = '|'.join(map(re.escape, (
'asahitv.fi',
'helsinkikanava.fi',
'hyvinvointitv.fi',
'inez.fi',
'permanto.fi',
'suite.icareus.com',
'videos.minifiddlers.org',
))
_VALID_URL = rf'https?://(?:www\.)?{_DOMAINS}/[^?#]+/p... | int_or_none,
merge_dicts,
parse_bitrate,
parse_resolution,
remove_end,
str_or_none,
url_or_none,
urlencode_postdata,
)
class IcareusIE(InfoExtractor):
_DOMAINS = '|'.join(map(re.escape, (
'asahitv.fi',
'helsinkikanava.fi',
'hyvinvointitv.fi',
'inez.f... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.786 | security | 382 | 51 | 51 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
'title': 'Helsingin kaupungin ja HUSin tiedotustilaisuus koronaepidemiatilanteesta 24.11.2020',
'description': 'md5:3129d041c6fbbcdc7fe68d9a938fef1c',
'thumbnail': 'https://icareus-suite.secure2.footprint.net/image/image_gallery?img_id=76288630',
'upload_date': '20201124'... | only used once, don't need to be a variable | 'timestamp': 1606206600,
},
}, { # Non-m3u8 stream
'url': 'https://suite.icareus.com/fi/web/westend-indians/player/vod?assetId=47567389',
'md5': '72fc04ee971bbedc44405cdf16c990b6',
'info_dict': {
'id': '47567389',
'ext': 'mp4',
'title'... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.143 | suggestion | 43 | 51 | 51 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
'url': 'https://www.permanto.fi/web/alfatv/player/vod?assetId=165743121',
'only_matching': True
}, {
'url': 'https://suite.icareus.com/fi/web/westend-indians/player/vod?assetId=47567389',
'only_matching': True
}, {
'url': 'https://videos.minifiddlers.org/web/international... | * avoid use of `.*?`/`.+?`. You can use `[^"]+` instead
* Use `\s*` instead of space
* Use double quotes | 'only_matching': True
}, {
'url': 'https://hyvinvointitv.fi/fi/web/hyvinvointitv/player/vod?assetId=89149730',
'only_matching': True
}, {
'url': 'https://inez.fi/fi/web/inez-media/player/vod?assetId=71328822',
'only_matching': True
}, {
'url': 'https://www.per... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.571 | suggestion | 106 | 51 | 51 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
metad = None
if metajson:
# The description can contain newlines, HTML tags, quote chars etc.
# so we'll extract it manually
mo = re.match(
r'(.*",)\s*"description": "(.*?)",(\s*"thumbnailUrl":.*)',
metajson, flags=re.DOTALL)
... | capture this as a group from _VALID__URL | 'assetId': video_id,
'token': self._search_regex(r"_icareus\['token'\]\s*=\s*'([a-f0-9]+)'", webpage, 'icareus_token'),
}))
subtitles = {
remove_end(sdesc.split(' ')[0], ':'): [{'url': url_or_none(surl)}]
for _, sdesc, surl in assets.get('subt... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.071 | suggestion | 40 | 51 | 51 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
if mo:
fd['vbr'] = int_or_none(mo.group(1))
fd['abr'] = int_or_none(mo.group(2))
else:
fd['tbr'] = parse_bitrate(fmt)
fmt_id = item.get('id')
if fmt_id:
fd[... | ```suggestion
for scode, sdesc, surl in jsond.get('subtitles') or []:
```
same everywhere | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
int_or_none,
merge_dicts,
parse_bitrate,
parse_resolution,
remove_end,
str_or_none,
url_or_none,
urlencode_postdata,
)
class IcareusIE(InfoExtractor):
_DO... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.714 | suggestion | 100 | 46 | 181 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
fd['tbr'] = parse_bitrate(fmt)
fmt_id = item.get('id')
if fmt_id:
fd['format_id'] = str(fmt_id)
formats.append(fd)
for item in jsond.get('audio_urls', []):
fmt = item.get('name')
mo = re.match(r'... | this can just be a dict comprehension | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
int_or_none,
merge_dicts,
parse_bitrate,
parse_resolution,
remove_end,
str_or_none,
url_or_none,
urlencode_postdata,
)
class IcareusIE(InfoExtractor):
_DO... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.071 | suggestion | 37 | 42 | 181 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
}
if abr:
fd['abr'] = abr
formats.append(fd)
subtitles = {}
for sub in jsond.get('subtitles', []):
scode, sdesc, surl = sub
lang = sdesc.split(' ')[0]
lang = lang[:-1] if lang.endswith(':') else lang
sub... | ```suggestion
return {
'id': video_id,
'title': title,
'description': description,
'thumbnail': thumbnail,
'timestamp': timestamp,
'formats': formats,
'duration': duration,
'subtitles': subtitles,
}... | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
int_or_none,
merge_dicts,
parse_bitrate,
parse_resolution,
remove_end,
str_or_none,
url_or_none,
urlencode_postdata,
)
class IcareusIE(InfoExtractor):
_DO... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.786 | suggestion | 325 | 27 | 181 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
fatal=False))
else:
fd = {'url': video_url}
fmt = item.get('name')
if fmt:
fd['format'] = fmt
fd.update(parse_resolution(fmt))
mo = re.search(r'\((\d+)\s*kbps\)\s*\+\s*(\d+)\s*kbps... | if this gives None, the format should not be added to dict | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
int_or_none,
merge_dicts,
parse_bitrate,
parse_resolution,
remove_end,
str_or_none,
url_or_none,
urlencode_postdata,
)
class IcareusIE(InfoExtractor):
_DO... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.286 | style | 58 | 51 | 181 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
fd['format'] = fmt
fd.update(parse_resolution(fmt))
mo = re.search(r'\((\d+)\s*kbps\)\s*\+\s*(\d+)\s*kbps', fmt)
if mo:
fd['vbr'] = int_or_none(mo.group(1))
fd['abr'] = int_or_none(mo.group(2)... | looks like it can be a list comprehension | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
int_or_none,
merge_dicts,
parse_bitrate,
parse_resolution,
remove_end,
str_or_none,
url_or_none,
urlencode_postdata,
)
class IcareusIE(InfoExtractor):
_DO... | @@ -0,0 +1,226 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_attribute,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ unified_ti... | yt_dlp/extractor/icareus.py | 26 | Python | 0.071 | suggestion | 41 | 49 | 181 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
def _real_extract(self, url):
base_url, maybe_id = self._match_valid_url(url).groups()
page = self._download_webpage(url, maybe_id)
video_id = self._search_regex(
r"_icareus\['itemId'\]\s*=\s*'(\d+)'", page, "video_id")
api_base = self._search_regex(
r'var\s+... | metad can be directly put into the info_dict | base_url, temp_id = self._match_valid_url(url).groups()
webpage = self._download_webpage(url, temp_id)
video_id = self._search_regex(r"_icareus\['itemId'\]\s*=\s*'(\d+)'", webpage, 'video_id')
organization_id = self._search_regex(r"_icareus\['organizationId'\]\s*=\s*'(\d+)'", webpage, '... | @@ -0,0 +1,205 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ remove_end,
+ traverse_obj,
+ urlen... | yt_dlp/extractor/icareus.py | 26 | Python | 0.071 | suggestion | 44 | 51 | 51 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
token2 = self._search_regex(
r"""data\s*:\s*{action:"getAsset".*?token:'([a-f0-9]+)'}""", page,
"token2", default=None, fatal=False)
livestream_title = get_element_by_class(
'unpublished-info-item future-event-title', page)
metad = self._search_json_ld(page, v... | ```suggestion
f'{base_url}/icareus-suite-api-portlet/publishing',
``` | 'assetId': video_id,
'token': self._search_regex(r"_icareus\['token'\]\s*=\s*'([a-f0-9]+)'", webpage, 'icareus_token'),
}))
subtitles = {
remove_end(sdesc.split(' ')[0], ':'): [{'url': url_or_none(surl)}]
for _, sdesc, surl in assets.get('subt... | @@ -0,0 +1,205 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ remove_end,
+ traverse_obj,
+ urlen... | yt_dlp/extractor/icareus.py | 26 | Python | 0.571 | suggestion | 87 | 51 | 51 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
"languageId": "en_US",
"userId": "0",
"token": token2,
}
metad = self._download_json(
base_url + '/icareus-suite-api-portlet/publishing',
video_id, data=urlencode_postdata(data))
title = metad.get('name')... | the one from json/ld would already be "clean", no? | if video_url is None:
continue
ext = determine_ext(video_url)
if ext == 'm3u8':
fmts, subs = self._extract_m3u8_formats_and_subtitles(
video_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
formats.extend(fmts)
... | @@ -0,0 +1,205 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ remove_end,
+ traverse_obj,
+ urlen... | yt_dlp/extractor/icareus.py | 26 | Python | 0.214 | question | 50 | 51 | 51 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
token = self._search_regex(
r"_icareus\['token'\]\s*=\s*'([a-f0-9]+)'", page, "token")
token2 = self._search_regex(
r"""data\s*:\s*{action:"getAsset".*?token:'([a-f0-9]+)'}""", page,
"token2", default=None, fatal=False)
livestream_title = get_element_by_class(... | doesn't need to be a var. Same below | 'action': 'getAssetPlaybackUrls',
'organizationId': organization_id,
'assetId': video_id,
'token': self._search_regex(r"_icareus\['token'\]\s*=\s*'([a-f0-9]+)'", webpage, 'icareus_token'),
}))
subtitles = {
remove_end(sdesc... | @@ -0,0 +1,205 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ int_or_none,
+ parse_bitrate,
+ parse_resolution,
+ remove_end,
+ traverse_obj,
+ urlen... | yt_dlp/extractor/icareus.py | 26 | Python | 0.071 | suggestion | 36 | 51 | 51 | false | [icareus] Add new extractor | 3,320 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
class GronkhVodsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/vods/streams/?$'
IE_NAME = 'gronkh:vods'
_TESTS = [{
'url': 'https://gronkh.tv/vods/streams',
'info_dict': {
'_type': 'playlist',
'id': 'vods',
'title': 'vods',
'... | ```suggestion
items = traverse_obj(self._download_json(
f'https://api.gronkh.tv/v1/search?offset={self._PER_PAGE * page}&first={self._PER_PAGE}', 'vods',
note=f'Downloading stream video page {page + 1}'), ('results', 'videos', ...))
for item in items or []:
yield... | import functools
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
traverse_obj,
unified_strdate,
)
class GronkhIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/(?:watch/)?stream/(?P<id>\d+)'
_TESTS = [{
'url': 'https://gronkh.tv/stream/536',
... | @@ -44,3 +50,73 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv/?(feed/?)?$'
+ IE_NAME = 'gronkh:feed'
+
+ _TESTS = [{
+ 'url': 'https://gronkh.tv/feed... | yt_dlp/extractor/gronkh.py | 26 | Python | 0.786 | suggestion | 445 | 31 | 101 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
},
'playlist_count': 16,
}, {
'url': 'https://gronkh.tv',
'info_dict': {
'_type': 'playlist',
'id': 'feed',
'title': 'feed',
'description': 'feed',
},
'playlist_count': 16,
}]
def _real_extract(self, url):
... | ```suggestion
def _entries(self):
for type_ in ('recent', 'views'):
info = self._download_json(
f'https://api.gronkh.tv/v1/video/discovery/{type_}', 'feed', note=f'Downloading {type_} API JSON')
for item in traverse_obj(info, ('discovery', ...... |
def _entries(self):
for type_ in ('recent', 'views'):
info = self._download_json(
f'https://api.gronkh.tv/v1/video/discovery/{type_}', 'feed', note=f'Downloading {type_} API JSON')
for item in traverse_obj(info, ('discovery', ...)) or []:
yield self.u... | @@ -44,3 +50,73 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv/?(feed/?)?$'
+ IE_NAME = 'gronkh:feed'
+
+ _TESTS = [{
+ 'url': 'https://gronkh.tv/feed... | yt_dlp/extractor/gronkh.py | 26 | Python | 1 | refactor | 608 | 51 | 36 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'title': 'feed',
'description': 'feed',
},
'playlist_count': 16,
}, {
'url': 'https://gronkh.tv',
'info_dict': {
'_type': 'playlist',
'id': 'feed',
'title': 'feed',
'description': 'feed',
},
'play... | You are returning title as id? | 'only_matching': True,
}]
def _entries(self):
for type_ in ('recent', 'views'):
info = self._download_json(
f'https://api.gronkh.tv/v1/video/discovery/{type_}', 'feed', note=f'Downloading {type_} API JSON')
for item in traverse_obj(info, ('discovery', ...... | @@ -44,3 +50,73 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv/?(feed/?)?$'
+ IE_NAME = 'gronkh:feed'
+
+ _TESTS = [{
+ 'url': 'https://gronkh.tv/feed... | yt_dlp/extractor/gronkh.py | 26 | Python | 0.071 | question | 30 | 51 | 38 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, id)
if data_json.get('vtt_url'):
subtitles.setdefault('en', []).append({
'url': data_json['vtt_url'],
'ext': 'vtt',
})
self._sort_formats(formats)
return {
... | ```suggestion
```
same below | 'url': data_json['vtt_url'],
'ext': 'vtt',
})
self._sort_formats(formats)
return {
'id': id,
'title': data_json.get('title'),
'view_count': data_json.get('views'),
'thumbnail': data_json.get('preview_url'),
... | @@ -44,3 +50,73 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv/?(feed/?)?$'
+ IE_NAME = 'gronkh:feed'
+
+ _TESTS = [{
+ 'url': 'https://gronkh.tv/feed... | yt_dlp/extractor/gronkh.py | 26 | Python | 0.429 | suggestion | 30 | 51 | 51 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
# coding: utf-8
from __future__ import unicode_literals
import functools
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
traverse_obj,
unified_strdate,
)
class GronkhIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/(?:watch/)?stream/(?P<id>\d+)'
_TESTS ... | ```suggestion
import functools
``` | import functools
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
traverse_obj,
unified_strdate,
)
class GronkhIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/(?:watch/)?stream/(?P<id>\d+)'
_TESTS = [{
'url': 'https://gronkh.tv/stream/536',
... | @@ -1,8 +1,14 @@
# coding: utf-8
from __future__ import unicode_literals
+import functools | yt_dlp/extractor/gronkh.py | 4 | Python | 0.429 | suggestion | 36 | 29 | 29 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
}]
def _real_extract(self, url):
id = self._match_id(url)
data_json = self._download_json(f'https://api.gronkh.tv/v1/video/info?episode={id}', id)
m3u8_url = self._download_json(f'https://api.gronkh.tv/v1/video/playlist?episode={id}', id)['playlist_url']
formats, subtitles = sel... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv(?:/feed)?/?(?:#|$)'
```
similar below | id = self._match_id(url)
data_json = self._download_json(f'https://api.gronkh.tv/v1/video/info?episode={id}', id)
m3u8_url = self._download_json(f'https://api.gronkh.tv/v1/video/playlist?episode={id}', id)['playlist_url']
formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8... | @@ -44,3 +50,73 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv/?(feed/?)?$' | yt_dlp/extractor/gronkh.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'url': data_json['vtt_url'],
'ext': 'vtt',
})
self._sort_formats(formats)
return {
'id': id,
'title': data_json.get('title'),
'view_count': data_json.get('views'),
'thumbnail': data_json.get('preview_url'),
... | Why is title and description `feed`? Just dont return them if they are not meaningfull | self._sort_formats(formats)
return {
'id': id,
'title': data_json.get('title'),
'view_count': data_json.get('views'),
'thumbnail': data_json.get('preview_url'),
'upload_date': unified_strdate(data_json.get('created_at')),
'formats':... | @@ -44,3 +50,73 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv/?(feed/?)?$'
+ IE_NAME = 'gronkh:feed'
+
+ _TESTS = [{
+ 'url': 'https://gronkh.tv/feed... | yt_dlp/extractor/gronkh.py | 26 | Python | 0.357 | question | 86 | 51 | 51 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'subtitles': subtitles,
}
class GronkhFeedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/?(feed/?)?$'
IE_NAME = 'gronkh:feed'
_TESTS = [{
'url': 'https://gronkh.tv/feed',
'info_dict': {
'_type': 'playlist',
'id': 'feed',
... | needs to be only `only_matching` |
class GronkhFeedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv(?:/feed)?/?(?:#|$)'
IE_NAME = 'gronkh:feed'
_TESTS = [{
'url': 'https://gronkh.tv/feed',
'info_dict': {
'id': 'feed',
},
'playlist_count': 16,
}, {
'url': 'https://gronkh... | @@ -44,3 +50,73 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv/?(feed/?)?$'
+ IE_NAME = 'gronkh:feed'
+
+ _TESTS = [{
+ 'url': 'https://gronkh.tv/feed... | yt_dlp/extractor/gronkh.py | 26 | Python | 0.214 | suggestion | 32 | 51 | 51 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
_TESTS = [{
'url': 'https://gronkh.tv/feed',
'info_dict': {
'id': 'feed',
'title': 'feed',
'description': 'feed',
},
'playlist_count': 16,
}, {
'url': 'https://gronkh.tv',
'info_dict': {
'_type': 'playlist',
... | ```suggestion
def _entries(self):
for type_ in ('recent', 'views'):
info = self._download_json(
f'https://api.gronkh.tv/v1/video/discovery/{type_}', 'feed', note=f'Downloading {type_} API JSON')
for item in traverse_obj(info, ('discovery', ...)) or []:
... | _TESTS = [{
'url': 'https://gronkh.tv/feed',
'info_dict': {
'id': 'feed',
},
'playlist_count': 16,
}, {
'url': 'https://gronkh.tv',
'only_matching': True,
}]
def _entries(self):
for type_ in ('recent', 'views'):
info = self... | @@ -41,3 +47,67 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv(?:/feed)?/?(?:#|$)'
+ IE_NAME = 'gronkh:feed'
+
+ _TESTS = [{
+ 'url': 'https://gronkh.... | yt_dlp/extractor/gronkh.py | 26 | Python | 0.929 | suggestion | 465 | 51 | 46 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
for item in traverse_obj(info, ('discovery', ...)) or []:
yield self.url_result(f'https://gronkh.tv/watch/stream/{item.get("episode")}', GronkhIE, item.get('title'))
def _real_extract(self, url):
return self.playlist_result(self._entries(), 'feed', 'feed', 'feed')
class Gronkh... | ```suggestion
yield self.url_result(f'https://gronkh.tv/watch/stream/{item["episode"]}', GronkhIE, item['episode'], item.get('title'))
```
same issue above | for item in traverse_obj(info, ('discovery', ...)) or []:
yield self.url_result(f'https://gronkh.tv/watch/stream/{item["episode"]}', GronkhIE, item.get('title'))
def _real_extract(self, url):
return self.playlist_result(self._entries(), 'feed')
class GronkhVodsIE(InfoExtractor... | @@ -41,3 +47,54 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class GronkhFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gronkh\.tv(?:/feed)?/?(?:#|$)'
+ IE_NAME = 'gronkh:feed'
+
+ _TESTS = [{
+ 'url': 'https://gronkh.... | yt_dlp/extractor/gronkh.py | 26 | Python | 0.714 | suggestion | 170 | 31 | 31 | false | [gronkh] Improve extractor | 3,337 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'md5': '71f9239d69ced58ab74a816908847cc1',
'info_dict': {
'id': 'apak-220',
'ext': 'mp4',
'title': 'md5:5c3861b7cf80112a6e2b70bccf170824',
'description': None,
'thumbnail': r're:^https?://.*\.jpg$',
'age_limit': 18,
'lik... | `default=None` means you expect it to fail and it shouldn't show warning. That does make sense for thumbnail. But an empty description can be denoted by `''` as opposed to `None` (no description/can't extract description). For title, default=None makes no sense at all | 'info_dict': {
'id': 'apak-220',
'ext': 'mp4',
'title': 'md5:5c3861b7cf80112a6e2b70bccf170824',
'description': '',
'thumbnail': r're:^https?://.*\.jpg$',
'age_limit': 18,
'like_count': int,
'view_count': int,
... | @@ -0,0 +1,125 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ orderedSet,
+ unified_strdate,
+)
+
+
+class JableIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?jable.tv/vid... | yt_dlp/extractor/jable.py | 26 | Python | 0.643 | bug | 268 | 51 | 51 | false | [Jable] Add extractor | 3,341 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mezbaul-h |
import re
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
orderedSet,
unified_strdate,
)
class JableIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?jable.tv/videos/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://jable.tv/videos/pppd-812/',
... | ```suggestion
```
None doesn't have to be tested | import re
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
orderedSet,
unified_strdate,
)
class JableIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?jable.tv/videos/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://jable.tv/videos/pppd-812/',
... | @@ -0,0 +1,125 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ orderedSet,
+ unified_strdate,
+)
+
+
+class JableIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?jable.tv/vid... | yt_dlp/extractor/jable.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | [Jable] Add extractor | 3,341 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mezbaul-h |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
formats = self._extract_m3u8_formats(
self._search_regex(r'var\s+hlsUrl\s*=\s*\'([^\']+)', webpage, 'hls_url'), video_id, 'mp4', m3u8_id='hls')
self._sort_formats(... | ```suggestion
'upload_date': unified_strdate(self._search_regex(
r'class="inactive-color">\D+\s+(\d{4}-\d+-\d+)', webpage, 'upload_date', default=None)),
'view_count': int_or_none(self._search_regex(
r'#icon-eye"></use></svg>\n*<span class="mr-3">([\d ]+)',
... | video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
formats = self._extract_m3u8_formats(
self._search_regex(r'var\s+hlsUrl\s*=\s*\'([^\']+)', webpage, 'hls_url'), video_id, 'mp4', m3u8_id='hls')
self._sort_formats(formats)
return {
... | @@ -0,0 +1,125 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ orderedSet,
+ unified_strdate,
+)
+
+
+class JableIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?jable.tv/vid... | yt_dlp/extractor/jable.py | 26 | Python | 0.857 | suggestion | 563 | 51 | 51 | false | [Jable] Add extractor | 3,341 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mezbaul-h |
class JablePlaylistIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?jable.tv/(?:categories|models|tags)/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://jable.tv/models/kaede-karen/',
'info_dict': {
'id': 'kaede-karen',
'title': '楓カレン',
},
'playlist_count... | ```suggestion
self.url_result(player_url, JableIE)
``` | 'info_dict': {
'id': 'kaede-karen',
'title': '楓カレン',
},
'playlist_count': 34,
}, {
'url': 'https://jable.tv/categories/roleplay/',
'only_matching': True,
}, {
'url': 'https://jable.tv/tags/girl/',
'only_matching': True,
}]
... | @@ -0,0 +1,125 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ orderedSet,
+ unified_strdate,
+)
+
+
+class JableIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?jable.tv/vid... | yt_dlp/extractor/jable.py | 26 | Python | 0.571 | suggestion | 72 | 51 | 35 | false | [Jable] Add extractor | 3,341 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mezbaul-h |
'url': 'https://jable.tv/categories/roleplay/',
'only_matching': True,
}, {
'url': 'https://jable.tv/tags/girl/',
'only_matching': True,
}]
def _real_extract(self, url):
playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id)
... | ```suggestion
for player_url in orderedSet(re.findall(
r'href="(https://jable.tv/videos/[\w-]+/?)"',
self._download_webpage(url, playlist_id, query={
'mode': 'async',
'from': page_num + 1,
... | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
orderedSet,
unified_strdate,
)
class JableIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?jable.tv/videos/(?P<id>[\w-]+)'
_TESTS = [... | @@ -0,0 +1,125 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ orderedSet,
+ unified_strdate,
+)
+
+
+class JableIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?jable.tv/vid... | yt_dlp/extractor/jable.py | 26 | Python | 0.786 | suggestion | 491 | 41 | 108 | false | [Jable] Add extractor | 3,341 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mezbaul-h |
for player_url in orderedSet(
re.findall(
r'href="(https://jable.tv/videos/[\w-]+/?)"',
self._download_webpage(url, playlist_id, query={
'mode': 'async',
'from': page_num + 1,
... | ```suggestion
return self.playlist_result(
InAdvancePagedList(page_func, int_or_none(self._search_regex(
r'from:(\d+)">[^<]+\s*»', webpage, 'last page number', default=1)), 24),
playlist_id, self._search_regex(
r'<h2 class="h3-md mb-1">([^<]+)',... | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
orderedSet,
unified_strdate,
)
class JableIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?jable.tv/videos/(?P<id>[\w-]+)'
_TESTS = [... | @@ -0,0 +1,125 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ orderedSet,
+ unified_strdate,
+)
+
+
+class JableIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?jable.tv/vid... | yt_dlp/extractor/jable.py | 26 | Python | 0.786 | suggestion | 367 | 27 | 108 | false | [Jable] Add extractor | 3,341 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mezbaul-h |
'https://www.youtube.com/user/%s/videos' % user_id,
ie=YoutubeTabIE.ie_key(), video_id=user_id)
class YoutubeFavouritesIE(YoutubeBaseInfoExtractor):
IE_NAME = 'youtube:favorites'
IE_DESC = 'YouTube liked videos; ":ytfav" keyword (requires cookies)'
_VALID_URL = r':ytfav(?:ou?rite)?... | ```suggestion
IE_DESC = 'YouTube notifications; ":ytnotif" keyword (requires cookies)'
``` | }]
def _real_extract(self, url):
channel_id = self._match_id(url)
return self.url_result(
f'https://www.youtube.com/channel/{channel_id}/live',
ie=YoutubeTabIE.ie_key(), video_id=channel_id)
class YoutubeYtUserIE(InfoExtractor):
IE_DESC = 'YouTube user videos; "ytu... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)' | yt_dlp/extractor/youtube.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
ie=YoutubeTabIE.ie_key(), video_id=user_id)
class YoutubeFavouritesIE(YoutubeBaseInfoExtractor):
IE_NAME = 'youtube:favorites'
IE_DESC = 'YouTube liked videos; ":ytfav" keyword (requires cookies)'
_VALID_URL = r':ytfav(?:ou?rite)?s?'
_LOGIN_REQUIRED = True
_TESTS = [{
'url': ':... | ```suggestion
_VALID_URL = r':ytnotif(?:ication)?s?'
```
`--playlist-end` should be used to control number of videos, similar to `ytsubs` etc |
def _real_extract(self, url):
channel_id = self._match_id(url)
return self.url_result(
f'https://www.youtube.com/channel/{channel_id}/live',
ie=YoutubeTabIE.ie_key(), video_id=channel_id)
class YoutubeYtUserIE(InfoExtractor):
IE_DESC = 'YouTube user videos; "ytuser:" p... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | suggestion | 148 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
_TESTS = [{
'url': ':ytnotif',
'only_matching': True,
}, {
'url': ':ytnotifications:2',
'only_matching': True,
}]
@staticmethod
def _extract_notification_menu(response, continuation_list):
notification_list = traverse_obj(
response, ('actions', 0,... | ```suggestion
continuation_list[0] = None
for item in notification_list:
renderer = item.get('notificationRenderer')
if renderer:
yield renderer
continuation = item.get('continuationItemRenderer')
if continuation:
co... | _VALID_URL = r':ytfav(?:ou?rite)?s?'
_LOGIN_REQUIRED = True
_TESTS = [{
'url': ':ytfav',
'only_matching': True,
}, {
'url': ':ytfavorites',
'only_matching': True,
}]
def _real_extract(self, url):
return self.url_result(
'https://www.youtube.co... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | question | 408 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
def _real_extract(self, url):
return self.url_result(
'https://www.youtube.com/playlist?list=LL',
ie=YoutubeTabIE.ie_key())
class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
IE_NAME = 'youtube:notifications'
IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyw... | ```suggestion
notification_list = traverse_obj(
response,
('actions', 0, 'openPopupAction', 'popup', 'multiPageMenuRenderer', 'sections', 0, 'multiPageMenuNotificationSectionRenderer', 'items'),
('actions', 0, 'appendContinuationItemsAction', 'continuationItems'),
... |
def _real_extract(self, url):
user_id = self._match_id(url)
return self.url_result(
'https://www.youtube.com/user/%s/videos' % user_id,
ie=YoutubeTabIE.ie_key(), video_id=user_id)
class YoutubeFavouritesIE(YoutubeBaseInfoExtractor):
IE_NAME = 'youtube:favorites'
IE... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 1 | question | 409 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
if not notification_list:
notification_list = traverse_obj(
response, ('actions', 0, 'appendContinuationItemsAction', 'continuationItems'), expected_type=list)
for item in notification_list:
for key in ('notificationRenderer', 'continuationItemRenderer'):
... | removeprefix is 3.9+. Use `remove_start` | 'https://www.youtube.com/playlist?list=LL',
ie=YoutubeTabIE.ie_key())
class YoutubeNotificationsIE(YoutubeTabBaseInfoExtractor):
IE_NAME = 'youtube:notif'
IE_DESC = 'YouTube notifications; ":ytnotif" keyword (requires cookies)'
_VALID_URL = r':ytnotif(?:ication)?s?'
_LOGIN_REQU... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.286 | suggestion | 40 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
for key in ('notificationRenderer', 'continuationItemRenderer'):
value = item.get(key)
if value:
if key == 'notificationRenderer':
yield value
break
elif key == 'continuationItemRenderer':... | can be simplified with a single regex | class YoutubeNotificationsIE(YoutubeTabBaseInfoExtractor):
IE_NAME = 'youtube:notif'
IE_DESC = 'YouTube notifications; ":ytnotif" keyword (requires cookies)'
_VALID_URL = r':ytnotif(?:ication)?s?'
_LOGIN_REQUIRED = True
_TESTS = [{
'url': ':ytnotif',
'only_matching': True,
}, {
... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.071 | suggestion | 37 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
}, {
'url': ':ytnotifications:2',
'only_matching': True,
}]
@staticmethod
def _extract_notification_menu(response, continuation_list):
notification_list = traverse_obj(
response, ('actions', 0, 'openPopupAction', 'popup', 'multiPageMenuRenderer', 'sections', 0, 'mult... | ```suggestion
def _extract_notification_renderer(self, notification):
``` | 'url': ':ytfav',
'only_matching': True,
}, {
'url': ':ytfavorites',
'only_matching': True,
}]
def _real_extract(self, url):
return self.url_result(
'https://www.youtube.com/playlist?list=LL',
ie=YoutubeTabIE.ie_key())
class YoutubeNotificati... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.643 | refactor | 79 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
def _extract_notification(self, notification):
# notificationRenderer
video_id = traverse_obj(
notification, ('navigationEndpoint', 'watchEndpoint', 'videoId'), expected_type=str)
if not video_id:
return None
thumbnails = traverse_obj(notification, ('videoThum... | ```suggestion
@classmethod
def _extract_next_notification_continuation_data(cls, renderer):
``` | }]
def _extract_notification_menu(self, response, continuation_list):
notification_list = traverse_obj(
response,
('actions', 0, 'openPopupAction', 'popup', 'multiPageMenuRenderer', 'sections', 0, 'multiPageMenuNotificationSectionRenderer', 'items'),
('actions', 0, '... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | refactor | 106 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
title = None
if len(split_text) == 2:
title = split_text[1]
extra_info = {
'thumbnails': thumbnails,
'uploader': uploader,
}
return self.url_result(
f'https://www.youtube.com/watch?v={video_id}', ie=YoutubeIE.ie_key(),
v... | ```suggestion
return {
'ctoken': ctoken
} if ctoken else None
``` | yield entry
continuation = item.get('continuationItemRenderer')
if continuation:
continuation_list[0] = continuation
def _extract_notification_renderer(self, notification):
video_id = traverse_obj(
notification, ('navigationEndpoint', 'wat... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.571 | suggestion | 97 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
}
return self.url_result(
f'https://www.youtube.com/watch?v={video_id}', ie=YoutubeIE.ie_key(),
video_id=video_id, video_title=title, **extra_info)
@classmethod
def _extract_next_notification_continuation_data(cls, renderer):
# continuationItemRenderer
ct... | ```suggestion
for page in itertools.count():
``` | video_id = traverse_obj(
notification, ('navigationEndpoint', 'watchEndpoint', 'videoId'), expected_type=str)
url = f'https://www.youtube.com/watch?v={video_id}'
channel_id = None
if not video_id:
browse_ep = traverse_obj(
notification, ('navigatio... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.571 | suggestion | 58 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
@staticmethod
def _build_notification_continuation_query(ctoken):
query = {
'ctoken': ctoken
}
return query
def _notification_menu_entries(self, headers, max_requests):
continuation_list = [None]
request_count = 0
entries = []
while reque... | ```suggestion
yield entry
``` | # The direct /post url redirects to this in the browser
url = f'https://www.youtube.com/channel/{channel_id}/community?lb={post_id}'
channel = traverse_obj(
notification, ('contextualMenu', 'menuRenderer', 'items', 1, 'menuServiceItemRenderer', 'text', 'runs', 1, 'text'),
... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.571 | suggestion | 51 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
continuation_list[0] = value
return
continuation_list[0] = None
def _extract_notification(self, notification):
# notificationRenderer
video_id = traverse_obj(
notification, ('navigationEndpoint', 'watchEndpoint', 'videoId'), expect... | ```suggestion
return self.url_result(
f'https://www.youtube.com/watch?v={video_id}', YoutubeIE,
video_id, title, thumbnails=thumbnails, uploader=uploader)
```
or, if we end up extracting more fields, it's better to do:
```py
return {
'_type': 'url',
... | 'only_matching': True,
}, {
'url': ':ytnotifications',
'only_matching': True,
}]
def _extract_notification_menu(self, response, continuation_list):
notification_list = traverse_obj(
response,
('actions', 0, 'openPopupAction', 'popup', 'multiPageMenuRe... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 1 | refactor | 516 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
def _extract_notification(self, notification):
# notificationRenderer
video_id = traverse_obj(
notification, ('navigationEndpoint', 'watchEndpoint', 'videoId'), expected_type=str)
if not video_id:
return None
thumbnails = traverse_obj(notification, ('videoThu... | I personally don't like creating class/staticmethods without any reason. But 🤷
| 'only_matching': True,
}]
def _extract_notification_menu(self, response, continuation_list):
notification_list = traverse_obj(
response,
('actions', 0, 'openPopupAction', 'popup', 'multiPageMenuRenderer', 'sections', 0, 'multiPageMenuNotificationSectionRenderer', 'items'... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.214 | suggestion | 81 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
if not ctoken:
return
return cls._build_notification_continuation_query(ctoken)
@staticmethod
def _build_notification_continuation_query(ctoken):
query = {
'ctoken': ctoken
}
return query
def _notification_menu_entries(self, headers, max_requ... | generators are always iterable
```suggestion
for notification in self._extract_notification_menu(response, continuation_list):
``` | 'post id', default=None)
if not channel_id or not post_id:
return
# The direct /post url redirects to this in the browser
url = f'https://www.youtube.com/channel/{channel_id}/community?lb={post_id}'
channel = traverse_obj(
notifica... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | refactor | 145 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
return
return cls._build_notification_continuation_query(ctoken)
@staticmethod
def _build_notification_continuation_query(ctoken):
query = {
'ctoken': ctoken
}
return query
def _notification_menu_entries(self, headers, max_requests):
continua... | ```suggestion
for entry in map(self._extract_notification, self._extract_notification_menu(response, continuation_list)):
```
or even better, in `_extract_notification_menu`, directly `yield self._extract_notification(renderer)` | if not channel_id or not post_id:
return
# The direct /post url redirects to this in the browser
url = f'https://www.youtube.com/channel/{channel_id}/community?lb={post_id}'
channel = traverse_obj(
notification, ('contextualMenu', 'menuRenderer', ... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.857 | refactor | 243 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
return query
def _notification_menu_entries(self, headers, max_requests):
continuation_list = [None]
request_count = 0
entries = []
while request_count < max_requests:
query = {}
if continuation_list[0]:
query = self._extract_next_noti... | Why not just generate the headers inside `_notification_menu_entries`? Then this function isn't even needed | title = self._search_regex(
rf'{re.escape(channel)} [^:]+: (.+)', self._get_text(notification, 'shortMessage'),
'video title', default=None)
if title:
title = title.replace('\xad', '') # remove soft hyphens
upload_date = (strftime_or_none(self._extract_time_t... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.5 | question | 107 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
while request_count < max_requests:
query = {}
if continuation_list[0]:
query = self._extract_next_notification_continuation_data(continuation_list[0])
request_count += 1
response = self._extract_response(
note=f'Downloading API JSO... | ```suggestion
entries=self.get_notifications(), playlist_title='Youtube Notifications')
```
You can't set `ie` for playlist! | if self._configuration_arg('approximate_date', ie_key=YoutubeTabIE.ie_key())
else None)
return {
'_type': 'url',
'url': url,
'ie_key': (YoutubeIE if video_id else YoutubeTabIE).ie_key(),
'video_id': video_id,
... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.714 | suggestion | 139 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | krichbanana |
notification_list = traverse_obj(
response, ('actions', 0, 'openPopupAction', 'popup', 'multiPageMenuRenderer', 'sections', 0, 'multiPageMenuNotificationSectionRenderer', 'items'), expected_type=list)
if not notification_list:
notification_list = traverse_obj(
res... | there's also `_get_text` that's similar to traverse_obj but handles youtube's simpletext/runs | def _real_extract(self, url):
return self.url_result(
'https://www.youtube.com/playlist?list=LL',
ie=YoutubeTabIE.ie_key())
class YoutubeNotificationsIE(YoutubeTabBaseInfoExtractor):
IE_NAME = 'youtube:notif'
IE_DESC = 'YouTube notifications; ":ytnotif" keyword (requires co... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.5 | suggestion | 93 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | krichbanana |
ctoken = traverse_obj(
renderer, ('continuationEndpoint', 'getNotificationMenuEndpoint', 'ctoken'), expected_type=str)
if not ctoken:
return
return cls._build_notification_continuation_query(ctoken)
@staticmethod
def _build_notification_continuation_query(ctoken)... | only need `actions` if that is all you are accessing | post_id = self._search_regex(
r'/post/(.+)', traverse_obj(browse_ep, 'canonicalBaseUrl', expected_type=str),
'post id', default=None)
if not channel_id or not post_id:
return
# The direct /post url redirects to this in the browser
... | @@ -5505,6 +5505,109 @@ def _real_extract(self, url):
ie=YoutubeTabIE.ie_key())
+class YoutubeNotificationsIE(YoutubeBaseInfoExtractor):
+ IE_NAME = 'youtube:notifications'
+ IE_DESC = 'YouTube notification menu videos; ":ytnotif" keyword (requires cookies)'
+ _VALID_URL = r':ytnotif(?:ication... | yt_dlp/extractor/youtube.py | 26 | Python | 0.357 | suggestion | 52 | 51 | 51 | false | [youtube] Add :ytnotifications extractor | 3,347 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | krichbanana |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import url_or_none
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watc... | is the date in URL the upload date? If so, extract it | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_strdate,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.m... | @@ -0,0 +1,31 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import url_or_none
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/masters.py | 12 | Python | 0.286 | refactor | 53 | 32 | 37 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import url_or_none
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watc... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/)?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
``` | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_strdate,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.m... | @@ -0,0 +1,31 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import url_or_none
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html' | yt_dlp/extractor/masters.py | 7 | Python | 0.714 | suggestion | 123 | 32 | 32 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import url_or_none
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watc... | ```suggestion
content_resp = self._download_json(
f'https://www.masters.com/relatedcontent/rest/v2/masters_v1/en/content/masters_v1_{video_id}_en',
video_id)
``` | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_strdate,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.m... | @@ -0,0 +1,31 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import url_or_none
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/masters.py | 22 | Python | 0.714 | suggestion | 197 | 32 | 40 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
from ..utils import url_or_none
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
... | ```suggestion
'title': content_resp.get('title'),
``` | from ..utils import (
traverse_obj,
unified_strdate,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_in... | @@ -0,0 +1,31 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import url_or_none
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/masters.py | 26 | Python | 0.571 | suggestion | 67 | 30 | 38 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
'info_dict': {
... | ```suggestion
'thumbnail': traverse_obj(content_resp, ('images', 0, 'large'), expected_type=url_or_none),
```
if there are multiple thumbnails, extract them all | unified_strdate,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
'info_dict':... | @@ -0,0 +1,31 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import url_or_none
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/[\d]{4}-[\d]{2}-[\d]{2}/(?P<id>[0-9]+)/(.*)\.html'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/masters.py | 26 | Python | 0.929 | refactor | 175 | 28 | 36 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
unified_strdate,
traverse_obj,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.m... | ```suggestion
video_id, upload_date = self._match_valid_url(url).group('id', 'date')
``` | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_strdate,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.m... | @@ -0,0 +1,43 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import (
+ unified_strdate,
+ traverse_obj,
+)
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
+ _TESTS = [{
+... | yt_dlp/extractor/masters.py | 25 | Python | 0.571 | suggestion | 98 | 44 | 40 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
unified_strdate,
traverse_obj,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
... | _extract_m3u8_formats_and_subtitles | traverse_obj,
unified_strdate,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
... | @@ -0,0 +1,43 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import (
+ unified_strdate,
+ traverse_obj,
+)
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
+ _TESTS = [{
+... | yt_dlp/extractor/masters.py | 26 | Python | 0.143 | refactor | 35 | 41 | 37 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
'info_dict': {
'id': '16493755593805191',
'ex... | ```suggestion
thumbnails = [{'id': name, 'url': url} for name, url in traverse_obj(content_resp, ('images', 0)) or []]
``` | _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
'info_dict': {
'id': '16493755593805191',
'ex... | @@ -0,0 +1,43 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import (
+ unified_strdate,
+ traverse_obj,
+)
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
+ _TESTS = [{
+... | yt_dlp/extractor/masters.py | 26 | Python | 0.714 | suggestion | 132 | 35 | 31 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
'info_dict': {
'id': '16... | ```suggestion
thumbnails = [{'id': name, 'url': url} for name, url in traverse_obj(content_resp, ('images', 0), default={}).items()]
``` |
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.masters.com/en_US/watch/2022-04-07/16493755593805191/sungjae_im_thursday_interview_2022.html',
'info_dict': {
'id': '16... | @@ -0,0 +1,42 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import (
+ unified_strdate,
+ traverse_obj,
+)
+
+
+class MastersIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
+ _TESTS = [{
+... | yt_dlp/extractor/masters.py | 26 | Python | 0.714 | suggestion | 146 | 36 | 33 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
unified_strdate,
traverse_obj,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.m... | ```suggestion
traverse_obj,
unified_strdate,
``` | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_strdate,
)
class MastersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?masters\.com/en_US/watch/(?P<date>\d{4}-\d{2}-\d{2})/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.m... | @@ -0,0 +1,41 @@
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import (
+ unified_strdate,
+ traverse_obj, | yt_dlp/extractor/masters.py | 5 | Python | 0.571 | suggestion | 59 | 30 | 30 | false | [masters] Add extractor | 3,358 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | m4tu4g |
'view_count': self._get_count(playlist_stats, 1),
'availability': self._extract_availability(data),
'modified_date': strftime_or_none(last_updated_unix, '%Y%m%d'),
'playlist_count': self._get_count(playlist_stats, 0),
'channel_follower_count': self._get_count(... | This is needed to properly terminate mixes | 'url': uncropped_avatar,
'id': 'avatar_uncropped',
'preference': 1
})
channel_banners = self._extract_thumbnails(
data, ('header', ..., ['banner', 'mobileBanner', 'tvBanner']))
for banner in channel_banners:
... | @@ -4227,9 +4227,6 @@ def _extract_mix_playlist(self, playlist, playlist_id, data, ytcfg):
if start >= len(videos):
return
for video in videos[start:]:
- if video['id'] == first_id:
- self.to_screen('First video %s found again; Assuming end of... | yt_dlp/extractor/youtube.py | 26 | Python | 0.071 | suggestion | 42 | 51 | 51 | false | [youtube] Add YoutubeStoriesIE | 3,362 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'videoId': watch_endpoint.get('videoId') or last_id,
'index': watch_endpoint.get('index') or len(videos),
'params': watch_endpoint.get('params') or 'OAE%3D'
}
response = self._extract_response(
item_id='%s page %d' % (playlist_id, p... | There really is no benefit to using `_search_regex` here
```suggestion
is_known_unviewable = re.fullmatch(r'MLCT|RLTD[\w-]{21}[AQgw])', playlist_id)
```
the regex doesn't need to be so strict imo. But either's fine
```suggestion
is_known_unviewable = re.fullmatch(r'MLCT|RLTD[\w-]{22}', playlist_id... | 'thumbnails': primary_thumbnails + avatar_thumbnails + channel_banners,
'tags': tags,
'view_count': self._get_count(playlist_stats, 1),
'availability': self._extract_availability(data),
'modified_date': strftime_or_none(last_updated_unix, '%Y%m%d'),
... | @@ -4261,13 +4258,19 @@ def _extract_from_playlist(self, item_id, url, data, playlist, ytcfg):
playlist_url = urljoin(url, try_get(
playlist, lambda x: x['endpoint']['commandMetadata']['webCommandMetadata']['url'],
compat_str))
- if playlist_url and playlist_url != url:
+
+ ... | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | suggestion | 326 | 51 | 51 | false | [youtube] Add YoutubeStoriesIE | 3,362 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
class YoutubeSubscriptionsIE(YoutubeFeedsInfoExtractor):
IE_DESC = 'YouTube subscriptions feed; ":ytsubs" keyword (requires cookies)'
_VALID_URL = r':ytsub(?:scription)?s?'
_FEED_NAME = 'subscriptions'
_TESTS = [{
'url': ':ytsubs',
'only_matching': True,
}, {
'url': ':ytsubs... | ```suggestion
IE_DESC = 'YouTube channel stories; "ytstories:" prefix'
``` | }]
class YoutubeSearchURLIE(YoutubeTabBaseInfoExtractor):
IE_DESC = 'YouTube search URLs with sorting and filter support'
IE_NAME = YoutubeSearchIE.IE_NAME + '_url'
_VALID_URL = r'https?://(?:www\.)?youtube\.com/(?:results|search)\?([^#]+&)?(?:search_query|q)=(?:[^&]+)(?:[&#]|$)'
_TESTS = [{
... | @@ -5699,6 +5702,22 @@ class YoutubeHistoryIE(YoutubeFeedsInfoExtractor):
}]
+class YoutubeStoriesIE(InfoExtractor):
+ IE_DESC = 'YouTube channel stories; "ytstories:<channel id>' | yt_dlp/extractor/youtube.py | 26 | Python | 0.571 | suggestion | 80 | 51 | 51 | false | [youtube] Add YoutubeStoriesIE | 3,362 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
class YoutubeHistoryIE(YoutubeFeedsInfoExtractor):
IE_DESC = 'Youtube watch history; ":ythis" keyword (requires cookies)'
_VALID_URL = r':ythis(?:tory)?'
_FEED_NAME = 'history'
_TESTS = [{
'url': ':ythistory',
'only_matching': True,
}]
class YoutubeStoriesIE(InfoExtractor):
I... | ```suggestion
ie=YoutubeTabIE, video_id=playlist_id)
``` | 'title': 'youtube-dl test video',
}
}, {
'url': 'https://www.youtube.com/results?search_query=python&sp=EgIQAg%253D%253D',
'playlist_mincount': 5,
'info_dict': {
'id': 'python',
'title': 'python',
}
}, {
'url': 'https://www.yout... | @@ -5699,6 +5702,22 @@ class YoutubeHistoryIE(YoutubeFeedsInfoExtractor):
}]
+class YoutubeStoriesIE(InfoExtractor):
+ IE_DESC = 'YouTube channel stories; "ytstories:<channel id>'
+ IE_NAME = 'youtube:stories'
+ _VALID_URL = r'ytstories:(?:RLTD|UC)(?P<id>[A-Za-z0-9_-]{21}[AQgw])$'
+ _TESTS = [{
+ ... | yt_dlp/extractor/youtube.py | 26 | Python | 0.571 | suggestion | 70 | 51 | 51 | false | [youtube] Add YoutubeStoriesIE | 3,362 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
get_all=False, expected_type=list) or []
if is_first_continuation:
continuation = extract_header(continuation_items)
is_first_continuation = False
if continuation:
break
continue
... | why convert back and forth
```suggestion
token = f'\x12\r\x12\x0b{video_id}\x18\x062\'"\x11"\x0b{video_id}0\x00x\x020\x00B\x10comments-section'
return base64.b64encode(token.encode()).decode()
``` | page_num, comment_prog_str)
response = self._extract_response(
item_id=None, query=continuation,
ep='next', ytcfg=ytcfg, headers=headers, note=note_prefix,
check_get_keys='onResponseReceivedEndpoints' if not is_forced_continuation else Non... | @@ -2889,6 +2900,17 @@ def extract_thread(contents):
if continuation:
break
+ @staticmethod
+ def _generate_comment_continuation(video_id):
+ """
+ Generates initial comment section continuation token from given video id
+ """
+ b64_vid_id = base... | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | suggestion | 216 | 51 | 51 | false | [youtube] Add YoutubeStoriesIE | 3,362 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
playlist = try_get(
response, lambda x: x['contents']['twoColumnWatchNextResults']['playlist']['playlist'], dict)
def _extract_from_playlist(self, item_id, url, data, playlist, ytcfg):
title = playlist.get('title') or try_get(
data, lambda x: x['titleText']['simpleTe... | doesn't this have to be expanded to cover all the variants (like we discussed on discord for `playnext`)? | 'playlistId': playlist_id,
'videoId': watch_endpoint.get('videoId') or last_id,
'index': watch_endpoint.get('index') or len(videos),
'params': watch_endpoint.get('params') or 'OAE%3D'
}
response = self._extract_response(
... | @@ -4267,13 +4289,18 @@ def _extract_from_playlist(self, item_id, url, data, playlist, ytcfg):
playlist_url = urljoin(url, try_get(
playlist, lambda x: x['endpoint']['commandMetadata']['webCommandMetadata']['url'],
compat_str))
- if playlist_url and playlist_url != url:
+
+ ... | yt_dlp/extractor/youtube.py | 26 | Python | 0.5 | question | 105 | 51 | 51 | false | [youtube] Add YoutubeStoriesIE | 3,362 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
for qn in qns:
stream_data = self._call_api_stream(room_id, qn.get('qn'))
if stream_data.get('playurl_info'):
for stream in traverse_obj(stream_data, ('playurl_info', 'playurl', 'stream')):
for format in stream.get('format'):
f... | ```py
qns = {
80: '流畅',
150: '高清',
...
}
quality = qualities(qns)
for qn, desc in qns.items():
....
'quality': quality(qn),
``` | import base64
import hashlib
import itertools
import functools
import re
import math
from .common import InfoExtractor, SearchInfoExtractor
from ..compat import (
compat_parse_qs,
compat_urlparse,
compat_urllib_parse_urlparse
)
from ..utils import (
ExtractorError,
filter_dict,
int_or_none,
... | @@ -996,3 +996,115 @@ def _real_extract(self, url):
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('hori... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.786 | suggestion | 233 | 36 | 1,085 | false | [bilibili] Add extractor for live.bilibili.com | 3,406 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HE7086 |
'quality': -3,
}, {
'qn': 400,
'desc': '蓝光',
'quality': -2,
}, {
'qn': 10000,
'desc': '原画',
'quality': -1,
}, {
'qn': 20000,
'desc': '4K',
... | Is this meant to be fatal or not? If it is, use `[]`. Otherwise, make sure not to iterate/`.get` on `None`. Same issue throughout the code |
formats = []
for qn in self._FORMATS.keys():
stream_data = self._call_api('xlive/web-room/v2/index/getRoomPlayInfo', room_id, {
'room_id': room_id,
'qn': qn,
'codec': '0,1',
'format': '0,2',
'mask': '0',
... | @@ -996,3 +996,115 @@ def _real_extract(self, url):
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('hori... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.571 | question | 138 | 51 | 29 | false | [bilibili] Add extractor for live.bilibili.com | 3,406 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HE7086 |
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('horizontal_cover')), view_count=parse_count(series_info.get('view')))
class BiliLiveIE(InfoExtractor):
_VALID_URL = r'https?://live.bilibili.com/(?P<room_id>\d+... | json is the name of a std lib. Use different name | self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('horizontal_cover')), view_count=parse_count(series_info.get... | @@ -996,3 +996,115 @@ def _real_extract(self, url):
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('hori... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.143 | suggestion | 49 | 51 | 51 | false | [bilibili] Add extractor for live.bilibili.com | 3,406 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HE7086 |
_VALID_URL = r'https?://live.bilibili.com/(?P<room_id>\d+)'
_TESTS = [
{
'url': 'https://live.bilibili.com/196',
'info_dict': {
'id': '196',
'ext': 'flv',
},
'params': {
'skip_download': True,
},... | ```suggestion
ExtractorError(json.get('message') or 'Unable to download JSON metadata')
``` | class BiliLiveIE(InfoExtractor):
_VALID_URL = r'https?://live.bilibili.com/(?P<id>\d+)'
_TESTS = [{
'url': 'https://live.bilibili.com/196',
'info_dict': {
'id': '33989',
'description': "周六杂谈回,其他时候随机游戏。 | \n录播:@下播型泛式录播组。 | \n直播通知群(全员禁言):666906670,902092584,59971⑧481 (功能一样... | @@ -996,3 +996,115 @@ def _real_extract(self, url):
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('hori... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.929 | refactor | 105 | 51 | 51 | false | [bilibili] Add extractor for live.bilibili.com | 3,406 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HE7086 |
'id': '196',
'ext': 'flv',
},
'params': {
'skip_download': True,
},
'skip': 'extractor won\'t work while stream is not live'
}, {
'url': 'https://live.bilibili.com/196?broadcast_type=0&is_room_feed=1?spm_... | ```suggestion
raise ExtractorError('Streamer is not live', expected=True)
``` | 'id': '33989',
'description': "周六杂谈回,其他时候随机游戏。 | \n录播:@下播型泛式录播组。 | \n直播通知群(全员禁言):666906670,902092584,59971⑧481 (功能一样,别多加)",
'ext': 'flv',
'title': "太空狼人杀联动,不被爆杀就算赢",
'thumbnail': "https://i0.hdslb.com/bfs/live/new_room_cover/e607bc1529057ef4b332e1026e62cf46984... | @@ -996,3 +996,115 @@ def _real_extract(self, url):
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('hori... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.786 | refactor | 91 | 51 | 51 | false | [bilibili] Add extractor for live.bilibili.com | 3,406 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HE7086 |
'only_matching': True
}
]
def _call_api_base(self, path, video_id):
json = self._download_json('https://api.live.bilibili.com' + path, video_id)
if json.get('code') != 0:
if json.get('message'):
raise ExtractorError(json.get('message'))
... | ```suggestion
room_id = self._match_id(url)
```
rename the group accordingly | 'url': 'https://live.bilibili.com/196?broadcast_type=0&is_room_feed=1?spm_id_from=333.999.space_home.strengthen_live_card.click',
'only_matching': True
}]
_FORMATS = {
80: {'format_id': 'low', 'format_note': '流畅'},
150: {'format_id': 'high_res', 'format_note': '高清'},
250... | @@ -996,3 +996,115 @@ def _real_extract(self, url):
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('hori... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.643 | suggestion | 87 | 51 | 51 | false | [bilibili] Add extractor for live.bilibili.com | 3,406 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HE7086 |
'skip': 'extractor won\'t work while stream is not live'
}, {
'url': 'https://live.bilibili.com/196?broadcast_type=0&is_room_feed=1?spm_id_from=333.999.space_home.strengthen_live_card.click',
'only_matching': True
}
]
def _call_api_base(self, path, video_id):... | do these need to be functions? | },
'skip': 'not live'
}, {
'url': 'https://live.bilibili.com/196?broadcast_type=0&is_room_feed=1?spm_id_from=333.999.space_home.strengthen_live_card.click',
'only_matching': True
}]
_FORMATS = {
80: {'format_id': 'low', 'format_note': '流畅'},
150: {'format_id'... | @@ -996,3 +996,115 @@ def _real_extract(self, url):
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('hori... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.071 | question | 30 | 51 | 51 | false | [bilibili] Add extractor for live.bilibili.com | 3,406 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HE7086 |
'quality': 0,
}, {
'qn': 30000,
'desc': '杜比',
'quality': 1,
},
]
for qn in qns:
stream_data = self._call_api_stream(room_id, qn.get('qn'))
if stream_data.get('playurl_info'):
... | Not all people can type hanzi/kanji/hancha into console, or even copy-paste. For example, when one of the CJKV characters is the first character of selection on VSCode terminal, copied text won't include the first. `qn.get("desc")` should go into `format_note` | import base64
import hashlib
import itertools
import functools
import re
import math
from .common import InfoExtractor, SearchInfoExtractor
from ..compat import (
compat_parse_qs,
compat_urlparse,
compat_urllib_parse_urlparse
)
from ..utils import (
ExtractorError,
filter_dict,
int_or_none,
... | @@ -996,3 +996,115 @@ def _real_extract(self, url):
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
thumbnail=url_or_none(series_info.get('hori... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.786 | style | 260 | 43 | 1,085 | false | [bilibili] Add extractor for live.bilibili.com | 3,406 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | HE7086 |
from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
unified_timestamp,
)
class FifaIE(InfoExtractor):
_VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
_TESTS = [{
'url': 'https://www.fifa.com/fifaplus/en/watch/7on10qPcnyLa... | ```suggestion
'params': {'skip_download': 'm3u8'}
```
same for all | from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
unified_timestamp,
)
class FifaIE(InfoExtractor):
_VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
_TESTS = [{
'url': 'https://www.fifa.com/fifaplus/en/watch/7on10qPcnyLa... | @@ -0,0 +1,107 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class FifaIE(InfoExtractor):
+ _VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
+ _TESTS = [{
+ 'url': 'https://www.fifa.com... | yt_dlp/extractor/fifa.py | 23 | Python | 0.571 | suggestion | 77 | 48 | 48 | false | [Fifa.com] New Fifa Extractor | 3,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'ext': 'mp4',
'categories': ['FIFA Tournaments', 'Highlights'],
'thumbnail': 'https://digitalhub.fifa.com/transform/d8fe6f61-276d-4a73-a7fe-6878a35fd082/FIFAPLS_100EXTHL_2014BRAvGER_TMB',
'duration': 901,
'release_timestamp': 1404777600,
'release_d... | ```suggestion
video_id, locale = self._match_valid_url(url).group('id', 'locale')
``` | 'ext': 'mp4',
'categories': ['FIFA Tournaments', 'Highlights'],
'thumbnail': 'https://digitalhub.fifa.com/transform/d8fe6f61-276d-4a73-a7fe-6878a35fd082/FIFAPLS_100EXTHL_2014BRAvGER_TMB',
'duration': 901,
'release_timestamp': 1404777600,
'release_d... | @@ -0,0 +1,107 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class FifaIE(InfoExtractor):
+ _VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
+ _TESTS = [{
+ 'url': 'https://www.fifa.com... | yt_dlp/extractor/fifa.py | 26 | Python | 0.571 | suggestion | 95 | 51 | 51 | false | [Fifa.com] New Fifa Extractor | 3,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'duration': 901,
'release_timestamp': 1404777600,
'release_date': '20140708',
},
'expected_warnings': ['The stream has AES-128 encryption and neither ffmpeg nor pycryptodomex are available; Decryption will be performed natively, but will be extremely slow'],
}, {
... | ```suggestion
preconnect_link = self._search_regex(r'<link[^>]+rel\s*=\s*"preconnect"[^>]+href\s*=\s*"([^"]+)"', webpage, 'Preconnect Link')
``` | 'duration': 901,
'release_timestamp': 1404777600,
'release_date': '20140708',
},
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.fifa.com/fifaplus/fr/watch/3C6gQH9C2DLwzNx7BMRQdp',
'info_dict': {
'id': '3C6gQH9C2DLwzNx7BMR... | @@ -0,0 +1,107 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class FifaIE(InfoExtractor):
+ _VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
+ _TESTS = [{
+ 'url': 'https://www.fifa.com... | yt_dlp/extractor/fifa.py | 26 | Python | 0.714 | suggestion | 154 | 51 | 51 | false | [Fifa.com] New Fifa Extractor | 3,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
},
'expected_warnings': ['The stream has AES-128 encryption and neither ffmpeg nor pycryptodomex are available; Decryption will be performed natively, but will be extremely slow'],
}, {
'url': 'https://www.fifa.com/fifaplus/fr/watch/3C6gQH9C2DLwzNx7BMRQdp',
'info_dict': {
... | ```suggestion
json_data = self._download_json(
f'{preconnect_link}/video/GetVideoPlayerData/{video_id}', video_id,
'Downloading Video Player Data', query={'includeIdents': True, 'locale': locale})
``` | },
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.fifa.com/fifaplus/fr/watch/3C6gQH9C2DLwzNx7BMRQdp',
'info_dict': {
'id': '3C6gQH9C2DLwzNx7BMRQdp',
'title': 'Le but de Josimar contre le Irlande du Nord | Buts classiques',
'descripti... | @@ -0,0 +1,107 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class FifaIE(InfoExtractor):
+ _VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
+ _TESTS = [{
+ 'url': 'https://www.fifa.com... | yt_dlp/extractor/fifa.py | 26 | Python | 0.786 | suggestion | 236 | 51 | 51 | false | [Fifa.com] New Fifa Extractor | 3,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
content_data = self._download_json(
f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content Data', query={
'v': preplay_parameters.get('preplayAPIVersion'),
'tc': preplay_parameters.get('tokenCheckAlgorithmVersion'),
'... | ```suggestion
'categories': traverse_obj(video_details, (('videoCategory', 'videoSubcategory'),)),
``` | cid = f'{json_data["preIdentId"]},{json_data["verizonAssetId"]},{json_data["postIdentId"]}'
content_data = self._download_json(
f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content Data', query={
'v': preplay_parameters['preplayAPIVersion'... | @@ -0,0 +1,107 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class FifaIE(InfoExtractor):
+ _VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
+ _TESTS = [{
+ 'url': 'https://www.fifa.com... | yt_dlp/extractor/fifa.py | 26 | Python | 0.714 | suggestion | 116 | 30 | 31 | false | [Fifa.com] New Fifa Extractor | 3,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'postIdentId': json_data['postIdentId'],
})
cid = f'{json_data["preIdentId"]},{json_data["verizonAssetId"]},{json_data["postIdentId"]}'
content_data = self._download_json(
f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content D... | ```suggestion
'title': json_data.get('title'),
``` | 'adVideoId': json_data['externalVerizonAssetId'],
'preIdentId': json_data['preIdentId'],
'postIdentId': json_data['postIdentId'],
})
cid = f'{json_data["preIdentId"]},{json_data["verizonAssetId"]},{json_data["postIdentId"]}'
content_data = sel... | @@ -0,0 +1,106 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class FifaIE(InfoExtractor):
+ _VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
+ _TESTS = [{
+ 'url': 'https://www.fifa.com... | yt_dlp/extractor/fifa.py | 26 | Python | 0.571 | suggestion | 64 | 34 | 36 | false | [Fifa.com] New Fifa Extractor | 3,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
content_data = self._download_json(
f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content Data', query={
'v': preplay_parameters['preplayAPIVersion'],
'tc': preplay_parameters['tokenCheckAlgorithmVersion'],
'rn': pre... | u missed a comma. Make sure to re-run tests after changes! |
cid = f'{json_data["preIdentId"]},{json_data["verizonAssetId"]},{json_data["postIdentId"]}'
content_data = self._download_json(
f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content Data', query={
'v': preplay_parameters['preplayAPIVersion... | @@ -0,0 +1,106 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class FifaIE(InfoExtractor):
+ _VALID_URL = r'https?://www.fifa.com/fifaplus/(?P<locale>\w{2})/watch/(?P<id>\w+)/?'
+ _TESTS = [{
+ 'url': 'https://www.fifa.com... | yt_dlp/extractor/fifa.py | 26 | Python | 0.286 | suggestion | 58 | 30 | 32 | false | [Fifa.com] New Fifa Extractor | 3,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'_type': 'playlist',
'id': 'IWZ9Z08I',
'title': 'zing-chart-vn',
},
'playlist_mincount': 10,
}, {
'url': 'https://zingmp3.vn/zing-chart-tuan/Bai-hat-US-UK/IWZ9Z0BW.html',
'info_dict': {
'_type': 'playlist',
'id': 'IWZ9Z0BW',... | ```suggestion
return self.playlist_result(
self._entries(data['items']), chart_id, f'zing-chart-{data.get("country", "")}')
``` | 'title': 'zing-chart-vn',
},
'playlist_mincount': 10,
}, {
'url': 'https://zingmp3.vn/zing-chart-tuan/Bai-hat-US-UK/IWZ9Z0BW.html',
'info_dict': {
'id': 'IWZ9Z0BW',
'title': 'zing-chart-us',
},
'playlist_mincount': 10,
}, {
... | @@ -212,11 +233,188 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.714 | suggestion | 150 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
}]
def _fetch_page(self, song_id, type_url, page):
page += 1
api = self.get_api_with_signature(name_api=self._SLUG_API[type_url], param={
'id': song_id,
'type': 'genre',
'page': page,
'count': self._PER_PAGE
})
data = self._downloa... | why use `.get` when `_entries` will throw on None anyway? | }, {
'url': 'https://zingmp3.vn/the-loai-video/Han-Quoc/IWZ9Z08W.html',
'info_dict': {
'id': 'IWZ9Z08W',
'title': 'the-loai-video_Han-Quoc',
},
'playlist_mincount': 30,
}, {
'url': 'https://zingmp3.vn/the-loai-video/Khong-Loi/IWZ9Z086.html',
... | @@ -212,11 +233,188 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.429 | question | 57 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'count': self._PER_PAGE
})
data = self._download_json(api, song_id)['data']
return self._entries(data.get('items'))
def _real_extract(self, url):
song_id, type_url = self._match_valid_url(url).group('id', 'type')
entries = OnDemandPagedList(functools.partial(self... | ```suggestion
```
same everywhere | 'url': 'https://zingmp3.vn/the-loai-video/Khong-Loi/IWZ9Z086.html',
'info_dict': {
'id': 'IWZ9Z086',
'title': 'the-loai-video_Khong-Loi',
},
'playlist_mincount': 10,
}]
def _fetch_page(self, song_id, type_url, page):
page += 1
api = self.g... | @@ -212,11 +233,188 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.429 | suggestion | 35 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'_type': 'playlist',
'id': 'IWZ98609',
'title': 'Mr. Siro - video',
'description': 'md5:85ab29bd7b21725c12bf76fd1d6922e5',
},
'playlist_mincount': 15,
}]
def _fetch_page(self, user_id, type_url, page):
page += 1
name_api = self._SL... | ```suggestion
user_info = self._download_json(
self.get_api_with_signature(name_api=self._SLUG_API['info-artist'], param={}),
video_id=user_alias, query={'alias': user_alias})['data']
``` | }, {
'url': 'https://zingmp3.vn/Mr-Siro/single',
'info_dict': {
'id': 'IWZ98609',
'title': 'Mr. Siro - single',
'description': 'md5:85ab29bd7b21725c12bf76fd1d6922e5',
},
'playlist_mincount': 20,
}, {
'url': 'https://zingmp3.vn/Mr-Siro/v... | @@ -212,11 +233,188 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.857 | suggestion | 223 | 41 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'type': 'artist',
'page': page,
'count': self._PER_PAGE
})
data = self._download_json(api, user_id, query={'sort': 'new', 'sectionId': 'aSong'})['data']
return self._entries(data.get('items'))
def _real_extract(self, url):
user_alias, type_url = s... | ```suggestion
entries = [
self.url_result(urljoin(self._DOMAIN, link))
for link in traverse_obj(user_info, (
'sections', lambda _, v: v['link'] == f'/{user_alias}/{type_url}', 'items', 'link'))]
```
untested | 'description': 'md5:85ab29bd7b21725c12bf76fd1d6922e5',
},
'playlist_mincount': 15,
}]
def _fetch_page(self, user_id, type_url, page):
page += 1
name_api = self._SLUG_API['user-list-song'] if type_url == 'bai-hat' else self._SLUG_API['user-list-video']
api = s... | @@ -212,11 +233,188 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 1 | suggestion | 277 | 28 | 39 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'playlist_mincount': 9,
}, {
'url': 'https://zingmp3.vn/album/Nhung-Bai-Hat-Hay-Nhat-Cua-Mr-Siro-Mr-Siro/ZWZAEZZD.html',
'info_dict': {
'_type': 'playlist',
'id': 'ZWZAEZZD',
'title': 'Những Bài Hát Hay Nhất Của Mr. Siro',
},
'playlist_minc... | ```suggestion
_VALID_URL = r'https?://(?:mp3\.zing|zingmp3)\.vn/(?P<id>(?:zing-chart|moi-phat-hanh))/?(?:[#?]|$)'
``` | 'title': 'Lâu Đài Tình Ái',
},
'playlist_mincount': 9,
}, {
'url': 'https://zingmp3.vn/album/Nhung-Bai-Hat-Hay-Nhat-Cua-Mr-Siro-Mr-Siro/ZWZAEZZD.html',
'info_dict': {
'id': 'ZWZAEZZD',
'title': 'Những Bài Hát Hay Nhất Của Mr. Siro',
},
... | @@ -212,11 +233,188 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.714 | suggestion | 123 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
}
def _real_initialize(self):
if not self.get_param('cookiefile') and not self.get_param('cookiesfrombrowser'):
self._request_webpage(self.get_api_with_signature(name_api=self._SLUG_API['bai-hat'], param={'id': ''}),
None, note='Updating cookies')
... | ```suggestion
if item and item.get('link'):
yield self.url_result(urljoin(self._DOMAIN, item['link']))
```
is this what u meant? | }
def _real_initialize(self):
if not self.get_param('cookiefile') and not self.get_param('cookiesfrombrowser'):
self._request_webpage(self.get_api_with_signature(name_api=self._SLUG_API['bai-hat'], param={'id': ''}),
None, note='Updating cookies')
... | @@ -120,6 +139,11 @@ def get_api_with_signature(self, name_api, param):
}
return f'{self._DOMAIN}{name_api}?{urllib.parse.urlencode(data)}'
+ def _entries(self, items):
+ for item in items:
+ if item:
+ yield self.url_result(urljoin(self._DOMAIN, item.get('link'))... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.714 | question | 160 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'album': traverse_obj(album, 'name', 'title'),
'album_artist': traverse_obj(album, 'artistsNames', 'artists_names'),
}
def _real_initialize(self):
if not self.get_param('cookiefile') and not self.get_param('cookiesfrombrowser'):
self._request_webpage(self.get_api... | ```suggestion
for item in items or []:
```
see below comment | 'album': traverse_obj(album, 'name', 'title'),
'album_artist': traverse_obj(album, 'artistsNames', 'artists_names'),
}
def _real_initialize(self):
if not self.get_param('cookiefile') and not self.get_param('cookiesfrombrowser'):
self._request_webpage(self.get_api... | @@ -120,6 +139,11 @@ def get_api_with_signature(self, name_api, param):
}
return f'{self._DOMAIN}{name_api}?{urllib.parse.urlencode(data)}'
+ def _entries(self, items):
+ for item in items: | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.571 | suggestion | 71 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
class ZingMp3ChartMusicVideoIE(ZingMp3BaseIE):
_VALID_URL = r'https?://(?:mp3\.zing|zingmp3)\.vn/(?P<type>the-loai-video)/.+?/(?P<id>[^\.]+)'
IE_NAME = 'zingmp3:chart-music-video'
_TESTS = [{
'url': 'https://zingmp3.vn/the-loai-video/Viet-Nam/IWZ9Z08I.html',
'info_dict': {
'_type... | ```suggestion
return self._entries(data.get('items'))
```
see above comment | },
'playlist_mincount': 400,
}, {
'url': 'https://zingmp3.vn/the-loai-video/Au-My/IWZ9Z08O.html',
'info_dict': {
'id': 'IWZ9Z08O',
'title': 'the-loai-video_Au-My',
},
'playlist_mincount': 40,
}, {
'url': 'https://zingmp3.vn/the-loai... | @@ -212,11 +236,189 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.571 | suggestion | 86 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'info_dict': {
'_type': 'playlist',
'id': 'IWZ9Z08I',
'title': 'zing-chart-video',
'description': 'zing-chart-video',
},
'playlist_mincount': 400,
}]
def _fetch_page(self, song_id, type_url, page):
page += 1
api = self.get_... | as I asked in other PRs, why set a title that is useless? | 'id': 'IWZ9Z08O',
'title': 'the-loai-video_Au-My',
},
'playlist_mincount': 40,
}, {
'url': 'https://zingmp3.vn/the-loai-video/Han-Quoc/IWZ9Z08W.html',
'info_dict': {
'id': 'IWZ9Z08W',
'title': 'the-loai-video_Han-Quoc',
},
... | @@ -212,11 +236,189 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.286 | question | 57 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
api = self.get_api_with_signature(name_api=self._SLUG_API[type_url], param={
'id': song_id,
'type': 'genre',
'page': page,
'count': self._PER_PAGE
})
data = self._download_json(api, song_id)['data']
items = data.get('items')
if item... | ```suggestion
/?(?:[?#]|$)
``` | }, {
'url': 'https://zingmp3.vn/the-loai-video/Khong-Loi/IWZ9Z086.html',
'info_dict': {
'id': 'IWZ9Z086',
'title': 'the-loai-video_Khong-Loi',
},
'playlist_mincount': 10,
}]
def _fetch_page(self, song_id, type_url, page):
page += 1
api... | @@ -212,11 +236,189 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.571 | suggestion | 60 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
def _fetch_page(self, song_id, type_url, page):
page += 1
api = self.get_api_with_signature(name_api=self._SLUG_API[type_url], param={
'id': song_id,
'type': 'genre',
'page': page,
'count': self._PER_PAGE
})
data = self._download_json(a... | ```suggestion
(?:
/(?P<type>bai-hat|single|album|video)
``` | },
'playlist_mincount': 30,
}, {
'url': 'https://zingmp3.vn/the-loai-video/Khong-Loi/IWZ9Z086.html',
'info_dict': {
'id': 'IWZ9Z086',
'title': 'the-loai-video_Khong-Loi',
},
'playlist_mincount': 10,
}]
def _fetch_page(self, song_id, ty... | @@ -212,11 +236,189 @@ class ZingMp3AlbumIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:album'
def _process_data(self, data, song_id, type_url):
- def entries():
- for item in traverse_obj(data, ('song', 'items')) or []:
- entry = self._extract_item(item, song_id, type_url, False)
- ... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.857 | suggestion | 122 | 51 | 51 | false | [ZingMp3] Improve extractor | 3,423 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
simplecast_urls, video_id, video_title)
# Look for BBC iPlayer embed
matches = re.findall(r'setPlaylist\("(https?://www\.bbc\.co\.uk/iplayer/[^/]+/[\da-z]{8})"\)', webpage)
if matches:
return self.playlist_from_matches(matches, video_id, video_title, ie='BBCCoUk')
... | Move this into `SpotifyIE._extract_urls` | return self.playlist_from_matches(
simplecast_urls, video_id, video_title)
# Look for BBC iPlayer embed
matches = re.findall(r'setPlaylist\("(https?://www\.bbc\.co\.uk/iplayer/[^/]+/[\da-z]{8})"\)', webpage)
if matches:
return self.playlist_from_matches(m... | @@ -3164,6 +3164,13 @@ def _real_extract(self, url):
if sportbox_urls:
return self.playlist_from_matches(sportbox_urls, video_id, video_title, ie=SportBoxIE.ie_key())
+ # Look for embedded Spotify player
+ spotify_urls = re.findall(
+ r'<iframe[^>]+src="(https?://open\.s... | yt_dlp/extractor/generic.py | 26 | Python | 0.286 | refactor | 40 | 51 | 51 | false | [spotify] Recognise iframe embed URLs | 3,430 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | fstirlitz |
ydl.extract_info, 'https://127.0.0.1:%d/video.html' % self.port)
ydl = YoutubeDL({'logger': FakeLogger(), 'nocheckcertificate': True})
r = ydl.extract_info('https://127.0.0.1:%d/video.html' % self.port)
self.assertEqual(r['entries'][0]['url'], 'https://127.0.0.1:%d/vid.mp4' % self.p... | ```suggestion
ydl = YoutubeDL({
'logger': FakeLogger(),
# Disable client-side validation of unacceptable self-signed testcert.pem
# The test is of a check on the server side, so unaffected
'nocheckcertificate': True,
**params,
})
``` | Exception,
ydl.extract_info, 'https://127.0.0.1:%d/video.html' % self.port)
ydl = YoutubeDL({'logger': FakeLogger(), 'nocheckcertificate': True})
r = ydl.extract_info('https://127.0.0.1:%d/video.html' % self.port)
self.assertEqual(r['entries'][0]['url'], 'https://127.0.0... | @@ -84,6 +84,45 @@ def test_nocheckcertificate(self):
self.assertEqual(r['entries'][0]['url'], 'https://127.0.0.1:%d/vid.mp4' % self.port)
+class TestClientCert(unittest.TestCase):
+ def setUp(self):
+ certfn = os.path.join(TEST_DIR, 'testcert.pem')
+ self.certdir = os.path.join(TEST_DIR, ... | test/test_http.py | 26 | Python | 0.786 | suggestion | 317 | 51 | 51 | false | Add support for client certificate authentication | 3,435 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
downloaded. None for no limit.
max_views: An integer representing the maximum view count.
Videos that are more popular than that are not
downloaded.
Videos without view count information are always
... | similar to above
```suggestion
client_certificate: Path to client certificate file in PEM format. May include the private key.
client_certificate_key: Path to private key file for client certificate
client_certificate_pass: Password for certificate private key, if encrypted.
... | Videos that are more popular than that are not
downloaded.
Videos without view count information are always
downloaded. None for no limit.
download_archive: File name of a file where all downloads are recorded.
... | @@ -321,6 +321,10 @@ class YoutubeDL:
legacyserverconnect: Explicitly allow HTTPS connection to servers that do not
support RFC 5746 secure renegotiation
nocheckcertificate: Do not verify SSL certificates
+ certificate: Path to client certificate file in PEM format. May incl... | yt_dlp/YoutubeDL.py | 26 | Python | 0.786 | suggestion | 396 | 51 | 51 | false | Add support for client certificate authentication | 3,435 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
continue
info[count_key] = interaction_count
def extract_chapter_information(e):
chapters = [{
'title': part.get('name'),
'start_time': part.get('startOffset'),
'end_time': part.get('endOffset'),
} for p... | info must obey extractor specifications. `embedURL` is not a defined field | continue
info[count_key] = interaction_count
def extract_chapter_information(e):
chapters = [{
'title': part.get('name'),
'start_time': part.get('startOffset'),
'end_time': part.get('endOffset'),
} for p... | @@ -1503,6 +1503,7 @@ def extract_video_object(e):
author = e.get('author')
info.update({
'url': url_or_none(e.get('contentUrl')),
+ 'embedUrl': url_or_none(e.get('embedUrl')), | yt_dlp/extractor/common.py | 26 | Python | 0.429 | refactor | 74 | 51 | 51 | false | [npr]: get stream url from json-ld | 3,455 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | r5d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.