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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cur_pos += 4
return f'https://{ext_domain}{decoded_url}'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
ext_domain, extr_id = self._search_regex(
r'https:\/\/(?P<ext_domain>[\w.-]+\.\w{3})\/embe... | too many `ExtractorError`s that say basically the same thing a `KeyError` would
```suggestion
encoded_url = video_json[0]['video_url']
``` | import base64
import binascii
from .common import InfoExtractor
from ..utils import ExtractorError, determine_ext, unified_strdate, url_or_none
from ..utils.traversal import traverse_obj
class ZenPornIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?zenporn\.com/video/(?P<id>\d+)'
_TESTS = [{
'url... | @@ -0,0 +1,151 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://(?:www\.)?zenporn\.com/video/(?P<id>\d+)'
+ _TES... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.929 | refactor | 149 | 44 | 119 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
def _decode_video_url(encoded_url):
""" This function is a reverse engineering from the website javascript """
# Replace lookalike characters and standardize map
translation = str.maketrans('АВСЕМ.,~', 'ABCEM+/=')
try:
return base64.b64decode(encoded_url.translate(transla... | `fatal=True` is the default
```suggestion
}, note='Downloading video metadata JSON')
``` | except (binascii.Error, ValueError):
return None
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
ext_domain, video_id = self._search_regex(
r'https://(?P<ext_domain>[\w.-]+\.\w{3})/embed/(?P<ex... | @@ -0,0 +1,128 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.714 | suggestion | 103 | 49 | 39 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
def _gen_info_url(self, ext_domain, extr_id, lifetime=86400):
""" This function is a reverse engineering from the website javascript """
result = '/'.join(str(int_or_none(extr_id) // i * i) for i in (1_000_000, 1_000, 1))
return f'https://{ext_domain}/api/json/video/{lifetime}/{result}.json'... | ```suggestion
note='Downloading video info JSON')
``` | def _decode_video_url(encoded_url):
""" This function is a reverse engineering from the website javascript """
# Replace lookalike characters and standardize map
translation = str.maketrans('АВСЕМ.,~', 'ABCEM+/=')
try:
return base64.b64decode(encoded_url.translate(transla... | @@ -0,0 +1,128 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.571 | suggestion | 67 | 51 | 45 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'age_limit': 18
}
}]
def _gen_info_url(self, ext_domain, extr_id, lifetime=86400):
""" This function is a reverse engineering from the website javascript """
result = '/'.join(str(int_or_none(extr_id) // i * i) for i in (1_000_000, 1_000, 1))
return f'https://{ext_do... | ```suggestion
webpage, 'embed info', group=('ext_domain', 'extr_id'))
``` | result = '/'.join(str(int(extr_id) // i * i) for i in (1_000_000, 1_000, 1))
return f'https://{ext_domain}/api/json/video/{lifetime}/{result}.json'
@staticmethod
def _decode_video_url(encoded_url):
""" This function is a reverse engineering from the website javascript """
# Repl... | @@ -0,0 +1,128 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.571 | suggestion | 87 | 51 | 49 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
try:
return base64.b64decode(encoded_url.translate(translation), validate=True).decode()
except (binascii.Error, ValueError):
return None
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
ext... | ```suggestion
decoded_url = self._decode_video_url(video_json[0]['video_url'])
``` | display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
ext_domain, video_id = self._search_regex(
r'https://(?P<ext_domain>[\w.-]+\.\w{3})/embed/(?P<extr_id>\d+)/',
webpage, 'embed info', group=('ext_domain', 'extr_id'))
info_json = s... | @@ -0,0 +1,128 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.571 | suggestion | 92 | 45 | 35 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
ext_domain, extr_id = self._search_regex(
r'https://(?P<ext_domain>[\w.-]+\.\w{3})/embed/(?P<extr_id>\d+)/',
webpage, 'embed info', group=('ext_domain', 'extr_id'), fatal=True)
info_json = self._download_json(
self._gen_info_url(ext_domain, extr_id), video_id,
... | if we're using index `0` for the download url we should probably use it here too, yeah?
```suggestion
'ext': traverse_obj(video_json, (0, 'format', {determine_ext})),
``` | self._gen_info_url(ext_domain, video_id), video_id, fatal=False)
video_json = self._download_json(
f'https://{ext_domain}/api/videofile.php', video_id, query={
'video_id': video_id,
'lifetime': 8640000,
}, note='Downloading video file JSON', e... | @@ -0,0 +1,128 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.786 | suggestion | 185 | 37 | 27 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
ext_domain, extr_id = self._search_regex(
r'https://(?P<ext_domain>[\w.-]+\.\w{3})/embed/(?P<extr_id>\d+)/',
webpage, 'embed info', group=('ext_domain', 'extr_id'), fatal=True)
info_j... | if we want to extract this value, we need to use a common info_dict field like `display_id`:
```suggestion
'display_id': extr_id,
```
although arguably this should be the `id` and `video_id` should actually be `display_id`.
whichever you decide, tests will need to be updated |
info_json = self._download_json(
self._gen_info_url(ext_domain, video_id), video_id, fatal=False)
video_json = self._download_json(
f'https://{ext_domain}/api/videofile.php', video_id, query={
'video_id': video_id,
'lifetime': 8640000,
... | @@ -0,0 +1,128 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.857 | refactor | 294 | 39 | 29 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
note='Downloading video info JSON', fatal=True)
video_json = self._download_json(
f'https://{ext_domain}/api/videofile.php', video_id, query={
'video_id': extr_id,
'lifetime': 8640000,
}, note='Downloading video metadata JSON', fatal=True)
... | ```suggestion
'upload_date': ('post_date', {unified_strdate}),
``` | import base64
import binascii
from .common import InfoExtractor
from ..utils import ExtractorError, determine_ext, unified_strdate, url_or_none
from ..utils.traversal import traverse_obj
class ZenPornIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?zenporn\.com/video/(?P<id>\d+)'
_TESTS = [{
'url... | @@ -0,0 +1,128 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.571 | suggestion | 84 | 30 | 119 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'title': 'Amateur students having a fuck fest at club',
'description': '',
'thumbnail': 'https://tn.txxx.tube/contents/videos_screenshots/12791000/12791908/288x162/1.jpg',
'upload_date': '20191005',
'uploader': 'Jackopenass',
'age_limit': 18
... | Since `None // i` will raise, we can also raise earlier by using `int`; that way the error message will be more clean
```suggestion
result = '/'.join(str(int(extr_id) // i * i) for i in (1_000_000, 1_000, 1))
``` | }
}, {
'url': 'https://zenporn.com/video/15872038/glad-you-came/',
'md5': '296ccab437f5bac6099433768449d8e1',
'info_dict': {
'id': '111585',
'display_id': '15872038',
'ext': 'mp4',
'title': 'Glad You Came',
'description': ''... | @@ -0,0 +1,125 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.929 | suggestion | 223 | 51 | 51 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | SirElderling |
import base64
import binascii
from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
traverse_obj,
unified_strdate,
url_or_none,
)
class ZenPornIE(InfoExtractor):
IE_DESC = 'ZenPorn'
_VALID_URL = r'https?://(?:www\.)?zenporn\.com/video/(?P<id>\d+)'
_TEST... | ```suggestion
import base64
import binascii
from .common import InfoExtractor
from ..utils import ExtractorError, determine_ext, unified_strdate, url_or_none
from ..utils.traversal import traverse_obj
``` | import base64
import binascii
from .common import InfoExtractor
from ..utils import ExtractorError, determine_ext, unified_strdate, url_or_none
from ..utils.traversal import traverse_obj
class ZenPornIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?zenporn\.com/video/(?P<id>\d+)'
_TESTS = [{
'url... | @@ -0,0 +1,124 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+) | yt_dlp/extractor/zenporn.py | 10 | Python | 1 | refactor | 212 | 35 | 35 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
def _decode_video_url(encoded_url):
""" This function is a reverse engineering from the website javascript """
# Replace lookalike characters and standardize map
translation = str.maketrans('АВСЕМ.,~', 'ABCEM+/=')
try:
return base64.b64decode(encoded_url.translate(transla... | `info_json` can be non-fatal since it is only metadata, & I've tweaked the notes for both API calls
```suggestion
info_json = self._download_json(
self._gen_info_url(ext_domain, video_id), video_id, fatal=False)
video_json = self._download_json(
f'https://{ext_domain}/api/... | return base64.b64decode(encoded_url.translate(translation), validate=True).decode()
except (binascii.Error, ValueError):
return None
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
ext_domain, ... | @@ -0,0 +1,124 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://(?:www\.)?zenporn\... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.786 | bug | 533 | 46 | 40 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'upload_date': '20231024',
'uploader': 'Martin Rudenko',
'age_limit': 18
}
}]
def _gen_info_url(self, ext_domain, extr_id, lifetime=86400):
""" This function is a reverse engineering from the website javascript """
result = '/'.join(str(int(extr_id) /... | for clarity I would change the var names too
```suggestion
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
ext_domain, video_id = self._search_regex(
``` |
def _gen_info_url(self, ext_domain, extr_id, lifetime=86400):
""" This function is a reverse engineering from the website javascript """
result = '/'.join(str(int(extr_id) // i * i) for i in (1_000_000, 1_000, 1))
return f'https://{ext_domain}/api/json/video/{lifetime}/{result}.json'
@... | @@ -0,0 +1,124 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://(?:www\.)?zenporn\... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.857 | suggestion | 219 | 51 | 51 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
ext_domain, extr_id = self._search_regex(
r'https://(?P<ext_domain>[\w.-]+\.\w{3})/embed/(?P<extr_id>\d+)/',
webpage, 'embed info', group=('ext_domain', 'ext... | ```suggestion
'id': video_id,
'display_id': display_id,
``` | ext_domain, video_id = self._search_regex(
r'https://(?P<ext_domain>[\w.-]+\.\w{3})/embed/(?P<extr_id>\d+)/',
webpage, 'embed info', group=('ext_domain', 'extr_id'))
info_json = self._download_json(
self._gen_info_url(ext_domain, video_id), video_id, fatal=False)
... | @@ -0,0 +1,124 @@
+import base64
+import binascii
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ZenPornIE(InfoExtractor):
+ IE_DESC = 'ZenPorn'
+ _VALID_URL = r'https?://(?:www\.)?zenporn\... | yt_dlp/extractor/zenporn.py | 26 | Python | 0.571 | suggestion | 86 | 38 | 32 | false | [ZenPorn] Add extractor | 8,509 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
self.handleError(record)
@register_rh
class RequestsRH(RequestHandler, InstanceStoreMixin):
"""Requests RequestHandler
https://github.com/psf/requests
"""
_SUPPORTED_URL_SCHEMES = ('http', 'https')
_SUPPORTED_ENCODINGS = tuple(SUPPORTED_ENCODINGS)
_SUPPORTED_PROXY_SCHEMES = ('http... | ```suggestion
logger.setLevel(logging.ERROR)
```
don't think this needs a comment imo. was supposed to be like this from the start | self.handleError(record)
@register_rh
class RequestsRH(RequestHandler, InstanceStoreMixin):
"""Requests RequestHandler
https://github.com/psf/requests
"""
_SUPPORTED_URL_SCHEMES = ('http', 'https')
_SUPPORTED_ENCODINGS = tuple(SUPPORTED_ENCODINGS)
_SUPPORTED_PROXY_SCHEMES = ('http... | @@ -255,7 +255,8 @@ def __init__(self, *args, **kwargs):
handler.setFormatter(logging.Formatter('requests: %(message)s'))
handler.addFilter(Urllib3LoggingFilter())
logger.addHandler(handler)
- logger.setLevel(logging.WARNING)
+ # Use ERROR to suppress pool reuse warning (could f... | yt_dlp/networking/_requests.py | 26 | Python | 0.857 | suggestion | 143 | 51 | 51 | false | [cleanup] Misc. (for 2023-11 release) | 8,510 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | Grub4K |
if final:
title = info_dict['fulltitle'] = info_dict.get('title')
if not title:
if title == '':
self.write_debug('Extractor gave empty title. Creating a generic title')
else:
self.report_warning('Extractor failed to ... | The thing that gives me pause about this is that it will make so many otherwise-passing download tests now fail
Also could probably just use `int()` here, but either way is fine | if final:
title = info_dict['fulltitle'] = info_dict.get('title')
if not title:
if title == '':
self.write_debug('Extractor gave empty title. Creating a generic title')
else:
self.report_warning('Extractor failed to ... | @@ -2586,6 +2586,9 @@ def _fill_common_fields(self, info_dict, final=True):
upload_date = datetime.datetime.fromtimestamp(info_dict[ts_key], datetime.timezone.utc)
info_dict[date_key] = upload_date.strftime('%Y%m%d')
+ if info_dict.get('release_year') is None and info_... | yt_dlp/YoutubeDL.py | 26 | Python | 0.571 | bug | 180 | 51 | 51 | false | Improve documentation and usage of release_year | 8,524 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
info = self.query_api(
f'song/detail?id={song_id}&ids=%5B{song_id}%5D', song_id, 'Downloading song info')['songs'][0]
formats = self.extract_formats(info)
lyrics = self._process_lyrics(self.query_api(
f'song/lyric?id={song_id}&lv=-1&tv=-1', song_id, 'Downloading lyrics... | Is there a reason you changed this to `str_or_none`? | original_ts_texts = re.findall(lyrics_expr, original)
translation_ts_dict = dict(re.findall(lyrics_expr, translated))
merged = '\n'.join(
join_nonempty(f'{timestamp}{text}', translation_ts_dict.get(timestamp, ''), delim=' / ')
for timestamp, text in original_ts_texts)
... | @@ -253,12 +253,15 @@ def _real_extract(self, url):
'formats': formats,
'alt_title': '/'.join(traverse_obj(info, (('transNames', 'alias'), ...))) or None,
'creator': ' / '.join(traverse_obj(info, ('artists', ..., 'name'))) or None,
+ 'album_artist': ' / '.join(traverse_... | yt_dlp/extractor/neteasemusic.py | 26 | Python | 0.429 | question | 52 | 51 | 51 | false | [ie/NeteaseMusic] more metadata | 8,531 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | LoserFox |
info = self.query_api(
f'song/detail?id={song_id}&ids=%5B{song_id}%5D', song_id, 'Downloading song info')['songs'][0]
formats = self.extract_formats(info)
lyrics = self._process_lyrics(self.query_api(
f'song/lyric?id={song_id}&lv=-1&tv=-1', song_id, 'Downloading lyrics... | ```suggestion
'thumbnail': ('album', 'picUrl', {url_or_none}),
'duration': ('duration', {self.kilo_or_none}),
'album': ('album', 'name', {str}),
``` | original_ts_texts = re.findall(lyrics_expr, original)
translation_ts_dict = dict(re.findall(lyrics_expr, translated))
merged = '\n'.join(
join_nonempty(f'{timestamp}{text}', translation_ts_dict.get(timestamp, ''), delim=' / ')
for timestamp, text in original_ts_texts)
... | @@ -253,12 +253,15 @@ def _real_extract(self, url):
'formats': formats,
'alt_title': '/'.join(traverse_obj(info, (('transNames', 'alias'), ...))) or None,
'creator': ' / '.join(traverse_obj(info, ('artists', ..., 'name'))) or None,
+ 'album_artist': ' / '.join(traverse_... | yt_dlp/extractor/neteasemusic.py | 26 | Python | 0.786 | suggestion | 200 | 51 | 51 | false | [ie/NeteaseMusic] more metadata | 8,531 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | LoserFox |
'creator': '李荣浩 / 朱正廷 / 陈立农 / 尤长靖 / ONER灵超 / ONER木子洋 / 杨非同 / 陆定昊',
'timestamp': 1522944000,
'upload_date': '20180405',
'description': 'md5:3650af9ee22c87e8637cb2dde22a765c',
'subtitles': {'lyrics': [{'ext': 'lrc'}]},
"duration": 256,
't... | how is this `album_artist` value an empty string when the extraction code ends with `or None`? | 'creator': '李荣浩 / 朱正廷 / 陈立农 / 尤长靖 / ONER灵超 / ONER木子洋 / 杨非同 / 陆定昊',
'timestamp': 1522944000,
'upload_date': '20180405',
'description': 'md5:3650af9ee22c87e8637cb2dde22a765c',
'subtitles': {'lyrics': [{'ext': 'lrc'}]},
"duration": 256,
't... | @@ -155,6 +159,9 @@ class NetEaseMusicIE(NetEaseMusicBaseIE):
'timestamp': 1202745600,
'duration': 263,
'thumbnail': r're:^http.*\.jpg',
+ 'album': 'Piano Solos Vol. 2',
+ 'album_artist': '', | yt_dlp/extractor/neteasemusic.py | 26 | Python | 0.429 | refactor | 94 | 51 | 51 | false | [ie/NeteaseMusic] more metadata | 8,531 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | LoserFox |
'creator': '李荣浩 / 朱正廷 / 陈立农 / 尤长靖 / ONER灵超 / ONER木子洋 / 杨非同 / 陆定昊',
'timestamp': 1522944000,
'upload_date': '20180405',
'description': 'md5:3650af9ee22c87e8637cb2dde22a765c',
'subtitles': {'lyrics': [{'ext': 'lrc'}]},
"duration": 256,
't... | ```suggestion
'album_artist': 'Dustin O\'Halloran',
``` | 'creator': '李荣浩 / 朱正廷 / 陈立农 / 尤长靖 / ONER灵超 / ONER木子洋 / 杨非同 / 陆定昊',
'timestamp': 1522944000,
'upload_date': '20180405',
'description': 'md5:3650af9ee22c87e8637cb2dde22a765c',
'subtitles': {'lyrics': [{'ext': 'lrc'}]},
"duration": 256,
't... | @@ -155,6 +159,9 @@ class NetEaseMusicIE(NetEaseMusicBaseIE):
'timestamp': 1202745600,
'duration': 263,
'thumbnail': r're:^http.*\.jpg',
+ 'album': 'Piano Solos Vol. 2',
+ 'album_artist': "Dustin O'Halloran", | yt_dlp/extractor/neteasemusic.py | 26 | Python | 0.571 | suggestion | 69 | 51 | 51 | false | [ie/NeteaseMusic] more metadata | 8,531 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | LoserFox |
'creator': 'Dustin O\'Halloran',
'upload_date': '20080211',
'timestamp': 1202745600,
'duration': 263,
'thumbnail': r're:^http.*\.jpg',
'album': 'Piano Solos Vol. 2',
'album_artist': "Dustin O'Halloran",
'average_rating': int... | ```suggestion
'album': '红色摇滚',
'album_artist': '侯牧人',
``` | 'upload_date': '20080211',
'timestamp': 1202745600,
'duration': 263,
'thumbnail': r're:^http.*\.jpg',
'album': 'Piano Solos Vol. 2',
'album_artist': 'Dustin O\'Halloran',
'average_rating': int,
},
}, {
'url': 'https:... | @@ -171,6 +178,8 @@ class NetEaseMusicIE(NetEaseMusicBaseIE):
'duration': 268,
'alt_title': '伴唱:现代人乐队 合唱:总政歌舞团',
'thumbnail': r're:^http.*\.jpg',
+ 'average_rating': int,
+ 'album_artist': '侯牧人', | yt_dlp/extractor/neteasemusic.py | 26 | Python | 0.571 | suggestion | 84 | 51 | 51 | false | [ie/NeteaseMusic] more metadata | 8,531 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | LoserFox |
import functools
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
extract_attributes,
get_element_by_class,
get_element_html_by_class,
get_elements_html_by_class,
traverse_obj,
unified_strdate,
urljoin
)
class TheGuardianPodcastIE(InfoExtractor):
_VALID_U... | Is the last non-capturing group necessary here?
Typically we use something like this when we are trying to prevent a playlist extractor's regex from matching an episode extractor's URLs, e.g. when the playlist URL is `www.example.com/season-1` and the episode URL is `www.example.com/season-1/episode-1`
Is it prot... | import itertools
from .common import InfoExtractor
from ..utils import (
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_class,
get_elements_html_by_class,
parse_qs,
traverse_obj,
unified_strdate,
urljoin
)
class TheGuardianPodcastIE(InfoExtractor):
_... | @@ -0,0 +1,134 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheGuardianPodc... | yt_dlp/extractor/theguardian.py | 17 | Python | 0.857 | refactor | 492 | 42 | 42 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'ext': 'mp3',
'title': 'The Covid inquiry | Politics Weekly UK - podcast',
'description': 'The Guardian’s Gaby Hinsliff talks to political editor Pippa Crerar about what we have learned from the Covid inquiry. And our political correspondent Kiran Stacey tells us how significant the ... | See my comment above about `TheGuardianPodcastIE._VALID_URL`. The playlist extractor and the podcast extractor do not share a common URL path, so this seems unnecessary.
```suggestion
_VALID_URL = r'https?://(?:www\.)?theguardian\.com/\w+/series/(?P<id>[\w-]+)'
``` | 'id': 'the-covid-inquiry-politics-weekly-uk-podcast',
'ext': 'mp3',
'title': 'The Covid inquiry | Politics Weekly UK - podcast',
'description': 'md5:207c98859c14903582b17d25b014046e',
'creator': 'Gaby Hinsliff',
'thumbnail': 'md5:28932a7b5a25b057be... | @@ -0,0 +1,134 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheGuardianPodc... | yt_dlp/extractor/theguardian.py | 26 | Python | 1 | refactor | 274 | 51 | 51 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'title': "The Guardian's Women's Football Weekly | Football | The Guardian",
'description': 'md5:e2cc021311e582d29935a73614a43f51'
},
'playlist_mincount': 69
}, {
'url': 'https://www.theguardian.com/news/series/todayinfocus',
'info_dict': {
'id': '... | The user could have passed a URL with `?page=2`, so we need to use the `query` param here to update it rather than appending to it with an f-string
Also, the site doesn't 404 when we request a page that doesn't exist, it just redirects to the first page (no query). That means if every page has 20 results, then we co... | 'title': "The Guardian's Women's Football Weekly",
'description': 'md5:e2cc021311e582d29935a73614a43f51'
},
'playlist_mincount': 69
}, {
'url': 'https://www.theguardian.com/news/series/todayinfocus?page=2',
'info_dict': {
'id': 'todayinfocus',
... | @@ -0,0 +1,134 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheGuardianPodc... | yt_dlp/extractor/theguardian.py | 26 | Python | 1 | suggestion | 735 | 46 | 47 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'id': 'the-audio-long-read',
'title': 'The Audio Long Read | News | The Guardian',
'description': 'md5:5462994a27527309562b25b6defc4ef3'
},
'playlist_mincount': 1008
}]
def _fetch_page(self, url, playlist_id, page):
page += 1
webpage = self._d... | Might be nice to extract a title without the " | The Guardian" junk at the end. Also use `clean_html` just in case
```suggestion
title = clean_html(get_element_by_class(
'index-page-header__title', webpage)) or self._generic_title(url, webpage)
description = self._og_search_description(w... | 'id': 'the-audio-long-read',
'title': 'The Audio Long Read',
'description': 'md5:5462994a27527309562b25b6defc4ef3'
},
'playlist_mincount': 996
}]
def _entries(self, url, playlist_id):
for page in itertools.count(1):
webpage, urlh = self._d... | @@ -0,0 +1,134 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheGuardianPodc... | yt_dlp/extractor/theguardian.py | 26 | Python | 0.857 | refactor | 414 | 31 | 32 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'info_dict': {
'id': 'theguardianswomensfootballweekly',
'title': "The Guardian's Women's Football Weekly",
'description': 'md5:e2cc021311e582d29935a73614a43f51'
},
'playlist_mincount': 69
}, {
'url': 'https://www.theguardian.com/news/series/todayi... | I think we should ignore the query passed with the URL. Sorry if that wasn't clear from my previous review comment. I was only trying to say we can't append to the URL with an f-string because of a potential query in the input URL
The most consistent behavior is to always extract all pages of the playlist, regardles... | 'info_dict': {
'id': 'theguardianswomensfootballweekly',
'title': "The Guardian's Women's Football Weekly",
'description': 'md5:e2cc021311e582d29935a73614a43f51'
},
'playlist_mincount': 69
}, {
'url': 'https://www.theguardian.com/news/series/todayi... | @@ -0,0 +1,137 @@
+import itertools
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheG... | yt_dlp/extractor/theguardian.py | 26 | Python | 0.643 | refactor | 399 | 51 | 49 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'id': 'todayinfocus',
'title': 'Today in Focus | Page 2 of 66 | News | The Guardian',
'description': 'md5:0f097764fc0d359e0b6eb537be0387e2'
},
'playlist_mincount': 1261
}, {
'url': 'https://www.theguardian.com/news/series/the-audio-long-read',
'inf... | `suitable` check likely isn't necessary unless this site also has the problem that radiocomercial did where it embeds its own playlist URL in place of unavailable episodes' URLs | 'id': 'todayinfocus',
'title': 'Today in Focus',
'description': 'md5:0f097764fc0d359e0b6eb537be0387e2'
},
'playlist_mincount': 1261
}, {
'url': 'https://www.theguardian.com/news/series/the-audio-long-read',
'info_dict': {
'id': 'the-aud... | @@ -0,0 +1,137 @@
+import itertools
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheG... | yt_dlp/extractor/theguardian.py | 26 | Python | 0.5 | suggestion | 177 | 42 | 40 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'title': 'Today in Focus',
'description': 'md5:0f097764fc0d359e0b6eb537be0387e2'
},
'playlist_mincount': 1261
}, {
'url': 'https://www.theguardian.com/news/series/the-audio-long-read',
'info_dict': {
'id': 'the-audio-long-read',
'title'... | we can use the `getter` kwarg of `playlist_from_matches` to simplify here. see suggestion below in the return
```suggestion
yield url_path
``` | 'id': 'todayinfocus',
'title': 'Today in Focus',
'description': 'md5:0f097764fc0d359e0b6eb537be0387e2'
},
'playlist_mincount': 1261
}, {
'url': 'https://www.theguardian.com/news/series/the-audio-long-read',
'info_dict': {
'id': 'the-aud... | @@ -0,0 +1,137 @@
+import itertools
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheGuardianPodcastIE(I... | yt_dlp/extractor/theguardian.py | 26 | Python | 0.786 | refactor | 161 | 42 | 40 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
for page in itertools.count(1):
webpage, urlh = self._download_webpage_handle(
url, playlist_id, f'Downloading page {page}', query={'page': page})
if '?' not in urlh.url:
break
episodes = get_elements_html_by_class('fc-item--type-media', webpa... | to go along with suggestion above in `_entries`
```suggestion
return self.playlist_from_matches(
self._entries(url, podcast_id), podcast_id, title, description=description,
ie=TheGuardianPodcastIE, getter=lambda x: urljoin('https://www.theguardian.com', x))
``` | import itertools
from .common import InfoExtractor
from ..utils import (
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_class,
get_elements_html_by_class,
parse_qs,
traverse_obj,
unified_strdate,
urljoin
)
class TheGuardianPodcastIE(InfoExtractor):
_... | @@ -0,0 +1,137 @@
+import itertools
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheGuardianPodcastIE(I... | yt_dlp/extractor/theguardian.py | 26 | Python | 0.929 | suggestion | 298 | 27 | 136 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'description': 'md5:5462994a27527309562b25b6defc4ef3'
},
'playlist_mincount': 996
}]
def _entries(self, url, playlist_id):
for page in itertools.count(1):
webpage, urlh = self._download_webpage_handle(
url, playlist_id, f'Downloading page {page}',... | a line that's a little long looks less weird here imo
```suggestion
'index-page-header__title', webpage) or get_element_by_class('flagship-audio__title', webpage))
``` | 'title': 'The Audio Long Read',
'description': 'md5:5462994a27527309562b25b6defc4ef3'
},
'playlist_mincount': 996
}]
def _entries(self, url, playlist_id):
for page in itertools.count(1):
webpage, urlh = self._download_webpage_handle(
u... | @@ -0,0 +1,137 @@
+import itertools
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheGuardianPodcastIE(I... | yt_dlp/extractor/theguardian.py | 26 | Python | 0.714 | suggestion | 182 | 33 | 31 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'title': 'The trials of Robert Habeck: is the world’s most powerful green politician doomed to fail? – podcast',
'description': 'A year ago, Germany’s vice-chancellor was one of the country’s best-liked public figures. Then came the tabloid-driven backlash. Now he has to win the argument all ove... | for long descriptions it's best to use md5
replace the `description` values with `md5:TODO`, run the tests, and they will and output an `md5:HASH` value for you to use | 'ext': 'mp3',
'title': 'The trials of Robert Habeck: is the world’s most powerful green politician doomed to fail? – podcast',
'description': 'md5:1b5cf6582d1771c6b7077784b5456994',
'creator': 'Philip Oltermann',
'thumbnail': 'md5:6e5c5ec43843e956e20be793722e9... | @@ -0,0 +1,137 @@
+import itertools
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ get_elements_html_by_class,
+ traverse_obj,
+ unified_strdate,
+ urljoin
+)
+
+
+class TheGuardianPodcastIE(I... | yt_dlp/extractor/theguardian.py | 26 | Python | 0.571 | suggestion | 170 | 51 | 51 | false | [TheGuardian] Add Extractor for podcasts | 8,535 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
class DuoplayIE(InfoExtractor):
_VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/'
_TESTS = [{
'note': 'S02E12',
'url': 'https://duoplay.ee/4312/siberi-vomm?ep=24',
'md5': '7ea7b16266ec1798743777df241883dd',
'info_dict': {
'id': '40792',
'ext': 'mp4',
... | this is the url it can play, if added to yt-dlp directly it will assemble hls and download mp4. what should I put to "formats"? | try_call,
unified_timestamp,
)
from ..utils.traversal import traverse_obj
class DuoplayIE(InfoExtractor):
_VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/[\w-]+/?(?:\?(?:[^#]+&)?ep=(?P<ep>\d+))?'
_TESTS = [{
'note': 'Siberi võmm S02E12',
'url': 'https://duoplay.ee/4312/siberi-vomm?ep=24... | @@ -0,0 +1,50 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ join_nonempty,
+ traverse_obj,
+ unified_timestamp,
+ update_url_query,
+)
+
+
+class DuoplayIE(InfoExtractor):
+ _VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/'
+ _TESTS = [{
+ 'note': 'S02E12',
... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.429 | question | 127 | 43 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | glensc | glensc |
'ext': 'mp4',
'title': 'Siberi võmm / Operatsioon "Öö"',
'thumbnail': r're:https://.+\.jpg(?:\?c=\d+)?$',
# 'description': 'md5:53cabf3c5d73150d594747f727431248',
'description': 'md5:8ef98f38569d6b8b78f3d350ccc6ade8',
'upload_date': '20170523',
... | ```suggestion
'manifest_url': manifest_url,
```
should just use `manifest_url` key here? | _TESTS = [{
'note': 'Siberi võmm S02E12',
'url': 'https://duoplay.ee/4312/siberi-vomm?ep=24',
'md5': '1ff59d535310ac9c5cf5f287d8f91b2d',
'info_dict': {
'id': '4312_24',
'ext': 'mp4',
'title': 'Operatsioon "Öö"',
'thumbnail': r're:https:... | @@ -0,0 +1,44 @@
+from .common import InfoExtractor
+from ..utils import (
+ join_nonempty,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class DuoplayIE(InfoExtractor):
+ _VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/'
+ _TESTS = [{
+ 'note': 'Siberi võmm S02E12',
+ 'url': 'https://duoplay... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.786 | question | 105 | 29 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | glensc | glensc |
'md5': '6aca68be71112314738dd17cced7f8bf',
'info_dict': {
'id': '17',
'ext': 'mp4',
'title': 'Episode 14',
'thumbnail': r're:https://.+\.jpg(?:\?c=\d+)?$',
'description': 'md5:4719b418e058c209def41d48b601276e',
'upload_date': '20100... | We can use the `get_element_text_and_html_by_tag` and `extract_attributes` functions from `..utils` to more easily retrieve the data. The `episode_attr` extraction can also be non-fatal, since it only contains metadata.
```suggestion
telecast_id, episode = self._match_valid_url(url).groups('id', 'ep')
... | 'episode_number': 12,
'episode_id': 24,
},
}, {
'note': 'Empty title',
'url': 'https://duoplay.ee/17/uhikarotid?ep=14',
'md5': '6aca68be71112314738dd17cced7f8bf',
'info_dict': {
'id': '17_14',
'ext': 'mp4',
'title': ... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ strip_or_none,
+)
+
+
+class DuoplayIE(InfoExtractor):
+ _VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/'
+ _TESTS = [{
+ 'note': 'Siberi võmm S02E12',
+ 'url': 'https://duoplay... | yt_dlp/extractor/duoplay.py | 26 | Python | 1 | refactor | 922 | 44 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
def _real_extract(self, url):
def decode_quot(s: str):
return s.replace(""", '"')
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
manifest_url = self._search_regex(r'<video-player[^>]+manifest-url="([^"]+)"', webpage, 'video-player')
... | With `traverse_obj` this can be written as:
```suggestion
'formats': self._extract_m3u8_formats(video_player['manifest-url'], video_id, 'mp4'),
**traverse_obj(episode_attr, {
'title': (None, ('subtitle', ('episode_id', {lambda x: f'Episode {x}'}))),
'descript... | 'series_id': '17',
'season': 'Season 2',
'season_number': 2,
'episode_id': 14,
'release_year': 2010,
},
}, {
'note': 'Movie',
'url': 'https://duoplay.ee/4325/naljamangud',
'md5': '2b0bcac4159a08b1844c2bfde06b1199',
'... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ strip_or_none,
+)
+
+
+class DuoplayIE(InfoExtractor):
+ _VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/'
+ _TESTS = [{
+ 'note': 'Siberi võmm S02E12',
+ 'url': 'https://duoplay... | yt_dlp/extractor/duoplay.py | 26 | Python | 1 | refactor | 1,137 | 28 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_timestamp,
strip_or_none,
)
class DuoplayIE(InfoExtractor):
_VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/'
_TESTS = [{
'note': 'Siberi võmm S02E12',
'url': 'https://duoplay.ee/4312/siberi-vomm?ep=24',
... | To make the other suggestions work, we need a couple more imports
```suggestion
from ..utils import (
extract_attributes,
get_element_text_and_html_by_tag,
int_or_none,
join_nonempty,
str_or_none,
try_call,
unified_timestamp,
)
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
extract_attributes,
get_element_text_and_html_by_tag,
int_or_none,
join_nonempty,
str_or_none,
try_call,
unified_timestamp,
)
from ..utils.traversal import traverse_obj
class DuoplayIE(InfoExtractor):
_VALID_UR... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ strip_or_none,
+) | yt_dlp/extractor/duoplay.py | 6 | Python | 0.857 | refactor | 314 | 31 | 31 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
'episode_number': 12,
'episode_id': 24,
},
}, {
'note': 'Empty title',
'url': 'https://duoplay.ee/17/uhikarotid?ep=14',
'md5': '6aca68be71112314738dd17cced7f8bf',
'info_dict': {
'id': '17',
'ext': 'mp4',
'title': 'Ep... | This test is currently failing due to `episode_number` and `episode` missing.
If you accept the other suggestion, then `episode_id` will also need to be removed, `series_id` needs to be made a string, and the `id` entries need to be updated to include the episode number.
I think it would be good to add a movie as ano... | 'timestamp': 1495567800,
'series': 'Siberi võmm',
'series_id': '4312',
'season': 'Season 2',
'season_number': 2,
'episode': 'Operatsioon "Öö"',
'episode_number': 12,
'episode_id': 24,
},
}, {
'note': 'Emp... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ strip_or_none,
+)
+
+
+class DuoplayIE(InfoExtractor):
+ _VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/'
+ _TESTS = [{
+ 'note': 'Siberi võmm S02E12',
+ 'url': 'https://duoplay... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.643 | bug | 330 | 50 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_timestamp,
strip_or_none,
)
class DuoplayIE(InfoExtractor):
_VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/'
_TESTS = [{
'note': 'Siberi võmm S02E12',
'url': 'https://duoplay.ee/4312/siberi-vomm?ep=24',
... | The episode number should also be extracted from the URL, with the video_id being constructed from both.
Currently, two different episodes would have the same video_id.
```suggestion
_VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/[\w-]+/?(?:\?(?:[^#]+&)?ep=(?P<ep>\d+))?'
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
extract_attributes,
get_element_text_and_html_by_tag,
int_or_none,
join_nonempty,
str_or_none,
try_call,
unified_timestamp,
)
from ..utils.traversal import traverse_obj
class DuoplayIE(InfoExtractor):
_VALID_UR... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ strip_or_none,
+)
+
+
+class DuoplayIE(InfoExtractor):
+ _VALID_URL = r'https://duoplay\.ee/(?P<id>\d+)/' | yt_dlp/extractor/duoplay.py | 10 | Python | 0.857 | refactor | 283 | 35 | 35 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
'episode': 'Operatsioon "Öö"',
'episode_number': 12,
},
}, {
'note': 'Empty title',
'url': 'https://duoplay.ee/17/uhikarotid?ep=14',
'md5': '6aca68be71112314738dd17cced7f8bf',
'info_dict': {
'id': '17_14',
'ext': 'mp4',
... | Sorry, this should have been `group` (singular) and not `groups` (plural).
```suggestion
telecast_id, episode = self._match_valid_url(url).group('id', 'ep')
``` | 'season_number': 2,
'episode': 'Operatsioon "Öö"',
'episode_number': 12,
'episode_id': 24,
},
}, {
'note': 'Empty title',
'url': 'https://duoplay.ee/17/uhikarotid?ep=14',
'md5': '6aca68be71112314738dd17cced7f8bf',
'info_dict': {... | @@ -0,0 +1,81 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ join_nonempty,
+ str_or_none,
+ try_call,
+ unified_timestamp,
+)
+from ..utils.traversal import traverse_obj
+
+
+class DuoplayIE(InfoExtractor):
+ ... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.929 | suggestion | 171 | 51 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
def _real_extract(self, url):
telecast_id, episode = self._match_valid_url(url).groups()
video_id = join_nonempty(telecast_id, episode, delim='_')
webpage = self._download_webpage(url, video_id)
video_player = try_call(lambda: extract_attributes(
get_element_text_and_htm... | Okay, so I looked a bit more at the data returned by the site, and it seems like if `episode_nr` is present, it is accurate, but `episode_id` is fairly frequently inaccurate.
I think it will be better to not provide an episode number, if there is a chance that it is incorrect.
I've also added cast extraction.
```sug... | },
}, {
'note': 'Movie',
'url': 'https://duoplay.ee/4325/naljamangud',
'md5': '2b0bcac4159a08b1844c2bfde06b1199',
'info_dict': {
'id': '4325',
'ext': 'mp4',
'title': 'Näljamängud',
'thumbnail': r're:https://.+\.jpg(?:\?c=\d+)?$'... | @@ -0,0 +1,81 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ join_nonempty,
+ str_or_none,
+ try_call,
+ unified_timestamp,
+)
+from ..utils.traversal import traverse_obj
+
+
+class DuoplayIE(InfoExtractor):
+ ... | yt_dlp/extractor/duoplay.py | 26 | Python | 1 | bug | 477 | 28 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
'timestamp': 1284661800,
'series': 'Ühikarotid',
'series_id': '17',
'season': 'Season 2',
'season_number': 2,
'episode': 'Episode 14',
'episode_number': 14,
},
}]
def _real_extract(self, url):
telecast_id, episo... | This now brings up the problem of the title. This is the best I came up with, tell me if you think this makes sense:
For movies, always use the title. For shows/series, first try the subtitle, then try to name it after the episode number and if all else fails also use the title.
```suggestion
'title': ep... | 'description': 'md5:4719b418e058c209def41d48b601276e',
'upload_date': '20100916',
'timestamp': 1284661800,
'series': 'Ühikarotid',
'series_id': '17',
'season': 'Season 2',
'season_number': 2,
'episode_id': 14,
'r... | @@ -0,0 +1,81 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ join_nonempty,
+ str_or_none,
+ try_call,
+ unified_timestamp,
+)
+from ..utils.traversal import traverse_obj
+
+
+class DuoplayIE(InfoExtractor):
+ ... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.857 | bug | 886 | 37 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
video_id = join_nonempty(telecast_id, episode, delim='_')
webpage = self._download_webpage(url, video_id)
video_player = try_call(lambda: extract_attributes(
get_element_text_and_html_by_tag('video-player', webpage)[1]))
if not video_player or not video_player.get('manifest-u... | No longer include series related data in movies:
```suggestion
'id': video_id,
'formats': self._extract_m3u8_formats(video_player['manifest-url'], video_id, 'mp4'),
**traverse_obj(episode_attr, {
'title': 'title',
'description': 'synopsis',
... | 'cast': 'count:9',
'upload_date': '20221214',
'timestamp': 1671054000,
'release_year': 2018,
},
}]
def _real_extract(self, url):
telecast_id, episode = self._match_valid_url(url).group('id', 'ep')
video_id = join_nonempty(telecast_id, epis... | @@ -0,0 +1,107 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ join_nonempty,
+ str_or_none,
+ try_call,
+ unified_timestamp,
+)
+from ..utils.traversal import traverse_obj
+
+
+class DuoplayIE(InfoExtractor):
+... | yt_dlp/extractor/duoplay.py | 26 | Python | 1 | refactor | 1,190 | 28 | 40 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
'season': 'Season 2',
'season_number': 2,
'episode': None,
'episode_number': None,
'episode_id': 14,
},
}, {
'note': 'Movie',
'url': 'https://duoplay.ee/4325/naljamangud',
'md5': '2b0bcac4159a08b1844c2bfde06b1199',
'... | And then these values are no longer in the test data.
```suggestion
'release_year': 2012,
``` | 'series_id': '17',
'season': 'Season 2',
'season_number': 2,
'episode_id': 14,
'release_year': 2010,
},
}, {
'note': 'Movie',
'url': 'https://duoplay.ee/4325/naljamangud',
'md5': '2b0bcac4159a08b1844c2bfde06b1199',
'... | @@ -0,0 +1,107 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ join_nonempty,
+ str_or_none,
+ try_call,
+ unified_timestamp,
+)
+from ..utils.traversal import traverse_obj
+
+
+class DuoplayIE(InfoExtractor):
+... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.714 | suggestion | 108 | 51 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
'series_id': '4312',
'season': 'Season 2',
'season_number': 2,
'episode': 'Operatsioon "Öö"',
'episode_number': 12,
'episode_id': 24,
},
}, {
'note': 'Empty title',
'url': 'https://duoplay.ee/17/uhikarotid?ep=14',
... | Oh, one last thing no need to include `None`. We also need to add the release year
```suggestion
'episode_id': 14,
'release_year': 2010,
``` | 'series': 'Siberi võmm',
'series_id': '4312',
'season': 'Season 2',
'season_number': 2,
'episode': 'Operatsioon "Öö"',
'episode_number': 12,
'episode_id': 24,
},
}, {
'note': 'Empty title',
'url': 'https://du... | @@ -0,0 +1,107 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ join_nonempty,
+ str_or_none,
+ try_call,
+ unified_timestamp,
+)
+from ..utils.traversal import traverse_obj
+
+
+class DuoplayIE(InfoExtractor):
+... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.714 | suggestion | 168 | 51 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
}, {
'note': 'Movie',
'url': 'https://duoplay.ee/4325/naljamangud',
'md5': '2b0bcac4159a08b1844c2bfde06b1199',
'info_dict': {
'id': '4325',
'ext': 'mp4',
'title': 'Näljamängud',
'thumbnail': r're:https://.+\.jpg(?:\?c=\d+)?$',
... | ```suggestion
'cast': 'count:9',
``` | },
}, {
'note': 'Movie',
'url': 'https://duoplay.ee/4325/naljamangud',
'md5': '2b0bcac4159a08b1844c2bfde06b1199',
'info_dict': {
'id': '4325',
'ext': 'mp4',
'title': 'Näljamängud',
'thumbnail': r're:https://.+\.jpg(?:\?c=\d+)?$'... | @@ -0,0 +1,118 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ join_nonempty,
+ str_or_none,
+ try_call,
+ unified_timestamp,
+)
+from ..utils.traversal import traverse_obj
+
+
+class DuoplayIE(InfoExtractor):
+... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.714 | suggestion | 50 | 51 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | glensc |
from .common import InfoExtractor
from ..utils import (
extract_attributes,
get_element_text_and_html_by_tag,
int_or_none,
join_nonempty,
str_or_none,
try_call,
unified_timestamp,
)
from ..utils.traversal import traverse_obj
class DuoplayIE(InfoExtractor):
_VALID_URL = r'https://duopla... | ```suggestion
from ..utils import (
ExtractorError,
extract_attributes,
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
extract_attributes,
get_element_text_and_html_by_tag,
int_or_none,
join_nonempty,
str_or_none,
try_call,
unified_timestamp,
)
from ..utils.traversal import traverse_obj
class DuoplayIE(InfoExtractor):
_VALID_UR... | @@ -0,0 +1,118 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes, | yt_dlp/extractor/duoplay.py | 3 | Python | 0.786 | refactor | 87 | 28 | 28 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | glensc |
},
}, {
'note': 'Movie without expiry',
'url': 'https://duoplay.ee/5501/pilvede-all.-neljas-ode',
'md5': '7abf63d773a49ef7c39f2c127842b8fd',
'info_dict': {
'id': '5501',
'ext': 'mp4',
'title': 'Pilvede all. Neljas õde',
'thumbna... | better to raise ExtractorError here to prevent ugliness when `--ignore-no-formats` is passed
```suggestion
raise ExtractorError('No video found', expected=True)
``` | 'release_year': 2012,
},
}, {
'note': 'Movie without expiry',
'url': 'https://duoplay.ee/5501/pilvede-all.-neljas-ode',
'md5': '7abf63d773a49ef7c39f2c127842b8fd',
'info_dict': {
'id': '5501',
'ext': 'mp4',
'title': 'Pilvede all.... | @@ -0,0 +1,118 @@
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ join_nonempty,
+ str_or_none,
+ try_call,
+ unified_timestamp,
+)
+from ..utils.traversal import traverse_obj
+
+
+class DuoplayIE(InfoExtractor):
+... | yt_dlp/extractor/duoplay.py | 26 | Python | 0.929 | bug | 179 | 51 | 51 | false | [duoplay] Add Duoplay extractor | 8,542 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | glensc |
)
from .jamendo import (
JamendoIE,
JamendoAlbumIE,
)
from .japandiet import (
ShugiinItvLiveIE,
ShugiinItvLiveRoomIE,
ShugiinItvVodIE,
SangiinInstructionIE,
SangiinIE,
)
from .jeuxvideo import JeuxVideoIE
from .jiosaavn import (
JioSaavnSongIE,
JioSaavnAlbumIE,
)
from .jove import J... | To make future expansion easier, this should be `ERRJupiterIE` in `err.py`. | JablePlaylistIE,
)
from .jamendo import (
JamendoIE,
JamendoAlbumIE,
)
from .japandiet import (
ShugiinItvLiveIE,
ShugiinItvLiveRoomIE,
ShugiinItvVodIE,
SangiinInstructionIE,
SangiinIE,
)
from .jeuxvideo import JeuxVideoIE
from .jiosaavn import (
JioSaavnSongIE,
JioSaavnAlbumIE,
... | @@ -872,6 +872,7 @@
JTBCIE,
JTBCProgramIE,
)
+from .jupiter import JupiterIE | yt_dlp/extractor/_extractors.py | 26 | Python | 0.429 | suggestion | 75 | 51 | 51 | false | Add jupiter.err.ee, jupiterpluss.err.ee info extractor | 8,549 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
'modified_date': '20230608',
'release_timestamp': 1686308700,
'timestamp': 1685145600,
'modified_timestamp': 1686252600,
'release_year': 2023,
'episode': 'Episode 0',
'episode_id': '1608990335',
'episode_number': 0,
... | Oh this should have just been:
```suggestion
self.report_drm(video_id)
``` | 'timestamp': 1685145600,
'modified_timestamp': 1686252600,
'release_year': 2023,
'episode': 'Episode 0',
'episode_id': '1608990335',
'episode_number': 0,
'season': 'Season 0',
'season_number': 0,
'series': 'Лесны... | @@ -0,0 +1,203 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ try_call,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class ERRJupiterIE(InfoExtractor):
+ _VALID_URL = r'https?://jupiter(?:pluss)?\.er... | yt_dlp/extractor/err.py | 26 | Python | 0.643 | suggestion | 89 | 51 | 51 | false | Add jupiter.err.ee, jupiterpluss.err.ee info extractor | 8,549 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
'alt_title': '',
'description': 'md5:065e721623e271e7a63e6540d409ca6b',
'release_date': '20230609',
'upload_date': '20230527',
'modified_date': '20230608',
'release_timestamp': 1686308700,
'timestamp': 1685145600,
'modified_... | ```suggestion
data = self._download_json(
'https://services.err.ee/api/v2/vodContent/getContentPageData', video_id,
query={'contentId': video_id})['data']['mainContent']
``` | 'release_date': '20230609',
'upload_date': '20230527',
'modified_date': '20230608',
'release_timestamp': 1686308700,
'timestamp': 1685145600,
'modified_timestamp': 1686252600,
'release_year': 2023,
'episode': 'Episode 0',
... | @@ -0,0 +1,203 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ try_call,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class ERRJupiterIE(InfoExtractor):
+ _VALID_URL = r'https?://jupiter(?:pluss)?\.er... | yt_dlp/extractor/err.py | 26 | Python | 0.786 | suggestion | 209 | 51 | 51 | false | Add jupiter.err.ee, jupiterpluss.err.ee info extractor | 8,549 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | glensc |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
data = self._download_json(
'https://services.err.ee/api/v2/vodContent/getContentPageData', video_id,
query={'contentId': video_id})['data']['mainContent']
media_data = traverse_obj(data, ('medias',... | I don't like redefining `url` within `_real_extract()`
```suggestion
for format_url in set(traverse_obj(media_data, ('src', ('hls', 'hls2', 'hlsNew'), {url_or_none}))):
fmts, subs = self._extract_m3u8_formats_and_subtitles(
format_url, video_id, 'mp4', m3u8_id='hls', fatal=False)... | }]
def _real_extract(self, url):
video_id = self._match_id(url)
data = self._download_json(
'https://services.err.ee/api/v2/vodContent/getContentPageData', video_id,
query={'contentId': video_id})['data']['mainContent']
media_data = traverse_obj(data, ('medias',... | @@ -0,0 +1,199 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class ERRJupiterIE(InfoExtractor):
+ _VALID_URL = r'https?://jupiter(?:pluss)?\.err\.ee/(?P<id>\d+)'
+ _TESTS = [{
... | yt_dlp/extractor/err.py | 26 | Python | 0.857 | refactor | 898 | 51 | 51 | false | Add jupiter.err.ee, jupiterpluss.err.ee info extractor | 8,549 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | glensc |
'key': 'efbb3ec0b8246f61adf1764c5a51213a',
'iv': '80621d19a1f19167b64cedb415b05d1c',
},
},
'params': {
'skip_download': 'm3u8',
},
}, {
'url': 'https://www.stacommu.jp/en/live/d2FJ3zLnndegZJCAEzGM3m',
'only_matching': Tr... | While at it, should the client version be updated?
```suggestion
'X-Client-Version': 'Chrome/JsCore/9.23.0/FirebaseCore-web',
```
Note: I didn't test this, but only looked at the JS. | 'key': 'efbb3ec0b8246f61adf1764c5a51213a',
'iv': '80621d19a1f19167b64cedb415b05d1c',
},
},
'params': {
'skip_download': 'm3u8',
},
}, {
'url': 'https://www.stacommu.jp/en/live/d2FJ3zLnndegZJCAEzGM3m',
'only_matching': Tr... | @@ -125,24 +149,83 @@ class StacommuLiveIE(StacommuBaseIE):
'params': {
'skip_download': 'm3u8',
},
+ }, {
+ 'url': 'https://www.stacommu.jp/en/live/d2FJ3zLnndegZJCAEzGM3m',
+ 'only_matching': True,
}]
_API_PATH = 'events'
def _real_extract(self, url):
... | yt_dlp/extractor/stacommu.py | 26 | Python | 0.786 | suggestion | 194 | 51 | 51 | false | [ie/theatercomplextown] Add extractors | 8,560 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | bashonly |
}, {
# iframe www.thisoldhouse.com
'url': 'https://www.thisoldhouse.com/21083431/seaside-transformation-the-westerly-project',
'only_matching': True,
}]
_LOGIN_URL = 'https://login.thisoldhouse.com/usernamepassword/login'
def _perform_login(self, username, password):
se... | Maybe this can be used instead?
```suggestion
login_info = {('client_id' if k == 'client' else k): v[0] for k, v in parse_qs(urlh.url).items()}
```
It would no longer filter out any additional URL parameters that might be present. Not sure if that is desired. | # iframe www.thisoldhouse.com
'url': 'https://www.thisoldhouse.com/21083431/seaside-transformation-the-westerly-project',
'only_matching': True,
}]
_LOGIN_URL = 'https://login.thisoldhouse.com/usernamepassword/login'
def _perform_login(self, username, password):
self._reque... | @@ -39,17 +55,63 @@ class ThisOldHouseIE(InfoExtractor):
'url': 'https://www.thisoldhouse.com/21083431/seaside-transformation-the-westerly-project',
'only_matching': True,
}]
- _ZYPE_TMPL = 'https://player.zype.com/embed/%s.html?api_key=hsOk_yMSPYNrT22e9pu8hihLXjaZf0JW5jsOWv4ZqyHJFvkJn6rtToHl0... | yt_dlp/extractor/thisoldhouse.py | 26 | Python | 0.857 | suggestion | 271 | 51 | 51 | false | [ie/thisoldhouse] Add login support | 8,561 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | bashonly |
'id': video_id,
**base_dict,
**infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_matching': True,
... | ```suggestion
if 'data-is-onlive="true"' not in webpage:
raise UserNotLive(video_id=uploader_id)
```
so we want to skip checking the live history page in this case? | return {
'id': video_id,
**base_dict,
**infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_mat... | @@ -248,16 +248,23 @@ def _real_extract(self, url):
'Pass "https://twitcasting.tv/{0}/show" to download the history'.format(uploader_id))
webpage = self._download_webpage(url, uploader_id)
+ is_live = 'data-is-onlive="true"' in webpage
+ if not is_live:
+ raise UserNotLi... | yt_dlp/extractor/twitcasting.py | 26 | Python | 0.786 | question | 188 | 51 | 51 | false | [extractor/twitcasting] Twitcasting Live webpage changed | 8,574 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JC-Chung |
}]
def _real_extract(self, url):
uploader_id = self._match_id(url)
self.to_screen(
'Downloading live video of user {0}. '
'Pass "https://twitcasting.tv/{0}/show" to download the history'.format(uploader_id))
webpage = self._download_webpage(url, uploader_id)
... | `_search_regex` will throw if we don't have a capture group in the 2nd pattern
```suggestion
is_live = self._search_regex(
(r'(?s)(<span\s*class="tw-movie-thumbnail-badge"\s*data-status="live">\s*LIVE)',
r'(data-is-onlive="true")'),
webpage, 'is live?', ... | 'expected_exception': 'UserNotLive',
}]
_PROTECTED_LIVE_RE = r'(?s)(<span\s*class="tw-movie-thumbnail2-badge"\s*data-status="live">\s*LIVE)'
def _real_extract(self, url):
uploader_id = self._match_id(url)
self.to_screen(
'Downloading live video of user {0}. '
... | @@ -248,16 +248,23 @@ def _real_extract(self, url):
'Pass "https://twitcasting.tv/{0}/show" to download the history'.format(uploader_id))
webpage = self._download_webpage(url, uploader_id)
+ is_live = 'data-is-onlive="true"' in webpage
+ if not is_live:
+ raise UserNotLi... | yt_dlp/extractor/twitcasting.py | 26 | Python | 0.786 | suggestion | 338 | 51 | 51 | false | [extractor/twitcasting] Twitcasting Live webpage changed | 8,574 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JC-Chung |
return {
'id': video_id,
**base_dict,
**infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_ma... | ```suggestion
webpage = self._download_webpage(url, uploader_id)
is_live = 'data-is-onlive="true"' in webpage
current_live = self._search_regex(
``` | }
return {
'id': video_id,
**base_dict,
**infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
... | @@ -250,14 +250,18 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, uploader_id)
current_live = self._search_regex( | yt_dlp/extractor/twitcasting.py | 26 | Python | 0.714 | suggestion | 176 | 51 | 51 | false | [extractor/twitcasting] Twitcasting Live webpage changed | 8,574 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JC-Chung |
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_matching': True,
}, {
'url': 'https://twitcasting.tv/c:unusedlive',
'expected... | ```suggestion
if is_live and not current_live:
``` | **infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_matching': True,
}, {
'url': 'https://twitcasting.tv/c:unused... | @@ -250,14 +250,18 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, uploader_id)
current_live = self._search_regex(
(r'data-type="movie" data-id="(\d+)">',
- r'tw-sound-flag-open-link" data-id="(\d+)" style=',),
+ r'tw-sound-flag-open-link" da... | yt_dlp/extractor/twitcasting.py | 26 | Python | 0.571 | suggestion | 60 | 51 | 51 | false | [extractor/twitcasting] Twitcasting Live webpage changed | 8,574 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JC-Chung |
return {
'id': video_id,
**base_dict,
**infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_ma... | otherwise `current_live` could be unbound during the check later
```suggestion
webpage = self._download_webpage(f'https://twitcasting.tv/{uploader_id}/show/', uploader_id)
current_live = None
is_live = self._search_regex(
``` | return {
'id': video_id,
**base_dict,
**infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_mat... | @@ -242,34 +242,22 @@ class TwitCastingLiveIE(InfoExtractor):
'expected_exception': 'UserNotLive',
}]
- _PROTECTED_LIVE_RE = r'(?s)(<span\s*class="tw-movie-thumbnail2-badge"\s*data-status="live">\s*LIVE)'
-
def _real_extract(self, url):
uploader_id = self._match_id(url)
self.to... | yt_dlp/extractor/twitcasting.py | 26 | Python | 1 | suggestion | 254 | 51 | 51 | false | [extractor/twitcasting] Changed to detect live streaming from show page | 8,601 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JC-Chung |
}
return {
'id': video_id,
**base_dict,
**infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
... | ```suggestion
# Check /show/ page so that password-protected and members-only livestreams can be found
webpage = self._download_webpage(f'https://twitcasting.tv/{uploader_id}/show/', uploader_id)
``` |
return {
'id': video_id,
**base_dict,
**infodict,
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_ma... | @@ -242,34 +242,23 @@ class TwitCastingLiveIE(InfoExtractor):
'expected_exception': 'UserNotLive',
}]
- _PROTECTED_LIVE_RE = r'(?s)(<span\s*class="tw-movie-thumbnail2-badge"\s*data-status="live">\s*LIVE)'
-
def _real_extract(self, url):
uploader_id = self._match_id(url)
self.to... | yt_dlp/extractor/twitcasting.py | 26 | Python | 0.929 | suggestion | 218 | 51 | 51 | false | [extractor/twitcasting] Changed to detect live streaming from show page | 8,601 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JC-Chung |
}
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_matching': True,
}, {
'url': 'https://twitcasting.tv/c:unusedlive',
'expected... | ```suggestion
# Current live is always first. If not currently live, value may be '0'
``` |
class TwitCastingLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/?#]+\.)?twitcasting\.tv/(?P<id>[^/?#]+)/?(?:[#?]|$)'
_TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo',
'only_matching': True,
}, {
'url': 'https://twitcasting.tv/c:unusedlive',
'expected_exception... | @@ -242,34 +242,23 @@ class TwitCastingLiveIE(InfoExtractor):
'expected_exception': 'UserNotLive',
}]
- _PROTECTED_LIVE_RE = r'(?s)(<span\s*class="tw-movie-thumbnail2-badge"\s*data-status="live">\s*LIVE)'
-
def _real_extract(self, url):
uploader_id = self._match_id(url)
self.to... | yt_dlp/extractor/twitcasting.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | [extractor/twitcasting] Changed to detect live streaming from show page | 8,601 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JC-Chung |
'age_limit': 17,
'_old_archive_ids': ['nintendo J2bXdmaTE6fe3dWJTPcc7m23FNbc_A1V'],
},
}, {
'url': 'https://www.nintendo.com/en-ca/nintendo-direct/08-31-2023/',
'info_dict': {
'ext': 'mp4',
'id': '2TB2w2rJhNYF84qQ9E57hU',
'display_i... | Maybe for clarity this could be `display_id` here already? I originally wanted to make this the `id` but that seemed to rudimentary since we have access to the internal media id | '_old_archive_ids': ['nintendo J2bXdmaTE6fe3dWJTPcc7m23FNbc_A1V'],
},
}, {
'url': 'https://www.nintendo.com/en-ca/nintendo-direct/08-31-2023/',
'info_dict': {
'ext': 'mp4',
'id': '2TB2w2rJhNYF84qQ9E57hU',
'display_id': '08-31-2023',
... | @@ -1,57 +1,101 @@
-import re
+import json
+from urllib.parse import quote
from .common import InfoExtractor
-from .ooyala import OoyalaIE
+from ..utils import (
+ ExtractorError,
+ make_archive_id,
+ remove_start,
+ unified_timestamp,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
cla... | yt_dlp/extractor/nintendo.py | 26 | Python | 0.571 | suggestion | 177 | 51 | 51 | false | [ie/nintendo] Fix Nintendo Direct extraction | 8,609 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | Grub4K |
import json
from urllib.parse import quote
from .common import InfoExtractor
from ..utils import (
ExtractorError,
make_archive_id,
remove_start,
unified_timestamp,
urljoin,
)
from ..utils.traversal import traverse_obj
class NintendoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nintend... | This seems too direct, and gives `17` for the first test. Should we use some of the other indicators perhaps? | 'variables': json.dumps({
'locale': parsed_locale,
'slug': slug,
}, separators=(',', ':')),
'extensions': json.dumps({
'persistedQuery': {
'version': 1,
'sha256Hash': '969b16fe9f08b686fa37bc44d1fd... | @@ -1,57 +1,101 @@
-import re
+import json
+from urllib.parse import quote
from .common import InfoExtractor
-from .ooyala import OoyalaIE
+from ..utils import (
+ ExtractorError,
+ make_archive_id,
+ remove_start,
+ unified_timestamp,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
cla... | yt_dlp/extractor/nintendo.py | 26 | Python | 0.571 | question | 109 | 102 | 46 | false | [ie/nintendo] Fix Nintendo Direct extraction | 8,609 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | Grub4K |
import json
from urllib.parse import quote
from .common import InfoExtractor
from ..utils import (
ExtractorError,
make_archive_id,
remove_start,
unified_timestamp,
urljoin,
)
from ..utils.traversal import traverse_obj
class NintendoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nintend... | I think it fits better as `tags` but mayhaps `categories`? | 'locale': parsed_locale,
'slug': slug,
}, separators=(',', ':')),
'extensions': json.dumps({
'persistedQuery': {
'version': 1,
'sha256Hash': '969b16fe9f08b686fa37bc44d1fd913b6188e65794bb5e341c54fa683a8004cb'
... | @@ -1,57 +1,101 @@
-import re
+import json
+from urllib.parse import quote
from .common import InfoExtractor
-from .ooyala import OoyalaIE
+from ..utils import (
+ ExtractorError,
+ make_archive_id,
+ remove_start,
+ unified_timestamp,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
cla... | yt_dlp/extractor/nintendo.py | 26 | Python | 0.429 | question | 58 | 102 | 45 | false | [ie/nintendo] Fix Nintendo Direct extraction | 8,609 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | Grub4K |
}, {
'url': 'https://www.nintendo.com/en-ca/nintendo-direct/08-31-2023/',
'info_dict': {
'ext': 'mp4',
'id': '2TB2w2rJhNYF84qQ9E57hU',
'display_id': '08-31-2023',
'title': 'Super Mario Bros. Wonder Direct 8.31.2023',
'timestamp': 1693465200... | not sure if this makes it any simpler, but at least a line is shorter
```suggestion
language, _, country = (locale or 'en').partition('-')
parsed_locale = f'{language.lower()}_{country.upper() or "US"}'
``` | 'url': 'https://www.nintendo.com/en-ca/nintendo-direct/08-31-2023/',
'info_dict': {
'ext': 'mp4',
'id': '2TB2w2rJhNYF84qQ9E57hU',
'display_id': '08-31-2023',
'title': 'Super Mario Bros. Wonder Direct 8.31.2023',
'timestamp': 1693465200,
... | @@ -1,57 +1,101 @@
-import re
+import json
+from urllib.parse import quote
from .common import InfoExtractor
-from .ooyala import OoyalaIE
+from ..utils import (
+ ExtractorError,
+ make_archive_id,
+ remove_start,
+ unified_timestamp,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
cla... | yt_dlp/extractor/nintendo.py | 26 | Python | 0.786 | suggestion | 226 | 51 | 51 | false | [ie/nintendo] Fix Nintendo Direct extraction | 8,609 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
'timestamp': 1567580400,
'description': 'md5:8aac2780361d8cb772b6d1de66d7d6f4',
'upload_date': '20190904',
'age_limit': 17,
'_old_archive_ids': ['nintendo J2bXdmaTE6fe3dWJTPcc7m23FNbc_A1V'],
},
}, {
'url': 'https://www.nintendo.com/en-ca/ni... | I would just `import urllib.parse` and use `urllib.parse.quote` to improve readability | 'description': 'md5:8aac2780361d8cb772b6d1de66d7d6f4',
'upload_date': '20190904',
'age_limit': 17,
'_old_archive_ids': ['nintendo J2bXdmaTE6fe3dWJTPcc7m23FNbc_A1V'],
},
}, {
'url': 'https://www.nintendo.com/en-ca/nintendo-direct/08-31-2023/',
'... | @@ -1,57 +1,101 @@
-import re
+import json
+from urllib.parse import quote
from .common import InfoExtractor
-from .ooyala import OoyalaIE
+from ..utils import (
+ ExtractorError,
+ make_archive_id,
+ remove_start,
+ unified_timestamp,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
cla... | yt_dlp/extractor/nintendo.py | 26 | Python | 0.429 | suggestion | 86 | 51 | 51 | false | [ie/nintendo] Fix Nintendo Direct extraction | 8,609 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
raise ExtractorError(f'No Nintendo Direct with id {slug} exists', expected=True)
errors = ', '.join(traverse_obj(response, ('errors', ..., 'message')))
if errors:
raise ExtractorError(f'GraphQL API error: {errors or "Unknown error"}')
asset_id = traverse_obj(direct_info... | since we're already checking `if str.startswith` we don't need `remove_start`
```suggestion
if asset_id.startswith('Legacy Videos/'):
result['_old_archive_ids'] = [make_archive_id(self, asset_id[14:])]
``` |
def _create_asset_url(self, path):
return urljoin('https://assets.nintendo.com/', urllib.parse.quote(path))
def _real_extract(self, url):
locale, slug = self._match_valid_url(url).group('locale', 'slug')
language, _, country = (locale or 'US').rpartition('-')
parsed_locale = f... | @@ -1,57 +1,101 @@
-import re
+import json
+import urllib.parse
from .common import InfoExtractor
-from .ooyala import OoyalaIE
+from ..utils import (
+ ExtractorError,
+ make_archive_id,
+ remove_start,
+ unified_timestamp,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
class Nintendo... | yt_dlp/extractor/nintendo.py | 26 | Python | 0.857 | suggestion | 229 | 29 | 51 | false | [ie/nintendo] Fix Nintendo Direct extraction | 8,609 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
mimetype2ext,
url_or_none,
)
from ..utils.traversal import traverse_obj
class VidlyIE(InfoExtractor):
_VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded.html\?(?:[^#/]+&)?link=)(?P<id>\w+)'
_EMBED_REGEX = [r'<script[^... | do you have any `_WEBPAGE_TESTS` we can add? | from .common import InfoExtractor
from ..utils import (
ExtractorError,
mimetype2ext,
url_or_none,
)
from ..utils.traversal import traverse_obj
class VidlyIE(InfoExtractor):
_VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded\.html\?(?:[^#]+&)?link=)(?P<id>\w+)'
_EMBED_REGEX = [r'<script[^... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidlyIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded.html\?(?:[^#/]+&)?link=)(?P<id>\w+)'
+ ... | yt_dlp/extractor/vidly.py | 13 | Python | 0.214 | question | 44 | 38 | 38 | false | [ie/vidly] Add extractor | 8,612 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'info_dict': {
'id': '7x0e6l',
'ext': 'mp4',
'title': '7x0e6l',
},
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.petfinder.com/dog/gus-57378930/tn/ooltewah/furever-furkids-rescue-tn592/',
'info_dict': {
'id': 'w8p5b0',
'ext... | we could do this and then unindent everything below it (and remove the duplicate raise ofc)
```suggestion
player_type = player.get('player') or ''
if player_type.startswith('jwplayer'):
return self._parse_jwplayer_data(player['config'], video_id)
elif player_type != 'vidlyplayer... | 'info_dict': {
'id': '7x0e6l',
'ext': 'mp4',
'title': '7x0e6l',
},
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.petfinder.com/dog/gus-57378930/tn/ooltewah/furever-furkids-rescue-tn592/',
'info_dict': {
'id': 'w8p5b0',
'ext... | @@ -0,0 +1,85 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidlyIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded.html\?(?:[^#/]+&)?link=)(?P<id>\w+)'
+ ... | yt_dlp/extractor/vidly.py | 26 | Python | 1 | refactor | 401 | 51 | 50 | false | [ie/vidly] Add extractor | 8,612 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
mimetype2ext,
url_or_none,
)
from ..utils.traversal import traverse_obj
class VidlyIE(InfoExtractor):
_VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded.html\?(?:[^#/]+&)?link=)(?P<id>\w+)'
_EMBED_REGEX = [r'<script[^... | ```suggestion
_VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded\.html\?(?:[^#]+&)?link=)(?P<id>\w+)'
_EMBED_REGEX = [r'<script[^>]+\bsrc=[\'"](?P<url>(?:https?:)?//vid\.ly/\w+/embed[^\'"]+)',
r'<iframe[^>]+\bsrc=[\'"](?P<url>(?:https?:)?//(?:s\.)?vid\.ly/embeded\.html\?(?:[^#\'"... | from .common import InfoExtractor
from ..utils import (
ExtractorError,
mimetype2ext,
url_or_none,
)
from ..utils.traversal import traverse_obj
class VidlyIE(InfoExtractor):
_VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded\.html\?(?:[^#]+&)?link=)(?P<id>\w+)'
_EMBED_REGEX = [r'<script[^... | @@ -0,0 +1,85 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidlyIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded.html\?(?:[^#/]+&)?link=)(?P<id>\w+)'
+ ... | yt_dlp/extractor/vidly.py | 13 | Python | 0.786 | suggestion | 348 | 38 | 38 | false | [ie/vidly] Add extractor | 8,612 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'title': '7x0e6l',
},
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.petfinder.com/dog/gus-57378930/tn/ooltewah/furever-furkids-rescue-tn592/',
'info_dict': {
'id': 'w8p5b0',
'ext': 'mp4',
'title': 'w8p5b0',
'thumbnail': r're:https:... | just for readability
```suggestion
raise ExtractorError(f'Unknown player type {player_type!r}')
formats = []
``` | 'title': '7x0e6l',
},
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.petfinder.com/dog/gus-57378930/tn/ooltewah/furever-furkids-rescue-tn592/',
'info_dict': {
'id': 'w8p5b0',
'ext': 'mp4',
'title': 'w8p5b0',
'thumbnail': r're:https:... | @@ -0,0 +1,85 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidlyIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded.html\?(?:[^#/]+&)?link=)(?P<id>\w+)'
+ ... | yt_dlp/extractor/vidly.py | 26 | Python | 0.929 | refactor | 138 | 49 | 47 | false | [ie/vidly] Add extractor | 8,612 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
player = self._search_json(r'initCallback\(', embed_script, 'player', video_id)
player_type = player.get('player') or ''
if player_type.startswith('jwplayer'):
return self._parse_jwplayer_data(player['config'], video_id)
elif not player_type.startswith('vidly'):
... | ```suggestion
fatal=False, note='Requesting higher quality m3u8 formats',
errnote='No higher quality m3u8 formats found') or [])
return {
``` | player = self._search_json(r'initCallback\(', embed_script, 'player', video_id)
player_type = player.get('player') or ''
if player_type.startswith('jwplayer'):
return self._parse_jwplayer_data(player['config'], video_id)
elif not player_type.startswith('vidly'):
... | @@ -0,0 +1,85 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidlyIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded.html\?(?:[^#/]+&)?link=)(?P<id>\w+)'
+ ... | yt_dlp/extractor/vidly.py | 26 | Python | 0.714 | suggestion | 179 | 31 | 29 | false | [ie/vidly] Add extractor | 8,612 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
def _real_extract(self, url):
video_id = self._match_id(url)
embed_script = self._download_webpage(
f'https://vid.ly/{video_id}/embed', video_id, headers={'Referer': 'https://vid.ly/'})
player = self._search_json(r'initCallback\(', embed_script, 'player', video_id)
play... | ```suggestion
for source, fid in [('source', 'sd'), ('source_hd', 'hd')]:
if traverse_obj(player, ('config', source, {url_or_none})):
formats.append({
'url': player['config'][source],
'format_id': f'http-{fid}',
'ext':... | def _real_extract(self, url):
video_id = self._match_id(url)
embed_script = self._download_webpage(
f'https://vid.ly/{video_id}/embed', video_id, headers={'Referer': 'https://vid.ly/'})
player = self._search_json(r'initCallback\(', embed_script, 'player', video_id)
play... | @@ -0,0 +1,85 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidlyIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:vid\.ly/|(?:s\.)?vid\.ly/embeded.html\?(?:[^#/]+&)?link=)(?P<id>\w+)'
+ ... | yt_dlp/extractor/vidly.py | 26 | Python | 0.786 | suggestion | 350 | 36 | 34 | false | [ie/vidly] Add extractor | 8,612 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'repost_count': int,
'thumbnail': 'https://static.vvvvid.it/img/thumbs/Dynit/Jojo/Jojo_S05Ep01-t.jpg',
'season': 'Season 5',
'season_number': 5,
},
'params': {
'skip_download': True,
'format': 'mp4',
},
}, {
'url... | Just add the custom user agent unconditionally imo. It's unlikely anyone wants custom UA here unless IE breaks.
Also, `_headers` looks like it should be a `@cached_property` | 'like_count': int,
'repost_count': int,
'thumbnail': 'https://static.vvvvid.it/img/thumbs/Dynit/Jojo/Jojo_S05Ep01-t.jpg',
'season': 'Season 5',
'season_number': 5,
},
'params': {
'skip_download': True,
'format': 'mp4',
... | @@ -78,11 +113,24 @@ class VVVVIDIE(InfoExtractor):
'only_matching': True
}]
_conn_id = None
+ _default_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.50 Safari/537.37'
+ _blocked_user_agents_regex = r'^Mozilla/5\.0 \(Windows NT 1... | yt_dlp/extractor/vvvvid.py | 26 | Python | 0.571 | performance | 176 | 51 | 51 | false | [ie/vvvvid] fix user agent and tests | 8,615 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Kyraminol |
import re
import functools
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import (
ExtractorError,
int_or_none,
str_or_none,
)
class VVVVIDIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?vvvvid\.it/(?:#!)?(?:show|anime|film|series)/'
_VALID_URL = r'%s(?P<s... | ```suggestion
import functools
import re
``` | import functools
import re
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import (
ExtractorError,
int_or_none,
str_or_none,
)
class VVVVIDIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?vvvvid\.it/(?:#!)?(?:show|anime|film|series)/'
_VALID_URL = r'%s(?P<s... | @@ -1,4 +1,5 @@
import re
+import functools | yt_dlp/extractor/vvvvid.py | 2 | Python | 0.429 | suggestion | 47 | 27 | 27 | false | [ie/vvvvid] fix user agent and tests | 8,615 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Kyraminol |
import re
import functools
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import (
ExtractorError,
int_or_none,
str_or_none,
)
class VVVVIDIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?vvvvid\.it/(?:#!)?(?:show|anime|film|series)/'
_VALID_URL = r'%s(?P<s... | do the new test URLs match their comment notes? | import functools
import re
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import (
ExtractorError,
int_or_none,
str_or_none,
)
class VVVVIDIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?vvvvid\.it/(?:#!)?(?:show|anime|film|series)/'
_VALID_URL = r'%s(?P<s... | @@ -14,29 +15,28 @@ class VVVVIDIE(InfoExtractor):
_VALID_URL = r'%s(?P<show_id>\d+)/[^/]+/(?P<season_id>\d+)/(?P<id>[0-9]+)' % _VALID_URL_BASE
_TESTS = [{
# video_type == 'video/vvvvid'
- 'url': 'https://www.vvvvid.it/#!show/434/perche-dovrei-guardarlo-di-dario-moccia/437/489048/ping-pong',
-... | yt_dlp/extractor/vvvvid.py | 18 | Python | 0.071 | question | 47 | 43 | 43 | false | [ie/vvvvid] fix user agent and tests | 8,615 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Kyraminol |
'episode': 'Golden Wind',
'episode_number': 1,
'episode_id': '9089',
'view_count': int,
'like_count': int,
'repost_count': int,
'thumbnail': 'https://static.vvvvid.it/img/thumbs/Dynit/Jojo/Jojo_S05Ep01-t.jpg',
'season': 'Sea... | We don't need to do anything with the params headers here. The headers that we pass to the `_download_webpage`/`_download_json`/etc methods already update the params headers, they don't overwrite them.
```suggestion
@functools.cached_property
def _headers(self):
return {
**self.geo_ve... | 'episode': 'Golden Wind',
'episode_number': 1,
'episode_id': '9089',
'view_count': int,
'like_count': int,
'repost_count': int,
'thumbnail': 'https://static.vvvvid.it/img/thumbs/Dynit/Jojo/Jojo_S05Ep01-t.jpg',
'season': 'Sea... | @@ -78,11 +114,18 @@ class VVVVIDIE(InfoExtractor):
'only_matching': True
}]
_conn_id = None
+ _default_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.50 Safari/537.37'
+
+ @functools.cached_property
+ def _headers(self):
+ ... | yt_dlp/extractor/vvvvid.py | 26 | Python | 0.857 | performance | 502 | 51 | 51 | false | [ie/vvvvid] fix user agent and tests | 8,615 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Kyraminol |
'episode_id': '9089',
'view_count': int,
'like_count': int,
'repost_count': int,
'thumbnail': 'https://static.vvvvid.it/img/thumbs/Dynit/Jojo/Jojo_S05Ep01-t.jpg',
'season': 'Season 5',
'season_number': 5,
},
'params': {
... | not necessary
```suggestion
def _real_initialize(self):
``` | 'episode_id': '9089',
'view_count': int,
'like_count': int,
'repost_count': int,
'thumbnail': 'https://static.vvvvid.it/img/thumbs/Dynit/Jojo/Jojo_S05Ep01-t.jpg',
'season': 'Season 5',
'season_number': 5,
},
'params': {
... | @@ -78,11 +114,18 @@ class VVVVIDIE(InfoExtractor):
'only_matching': True
}]
_conn_id = None
+ _default_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.50 Safari/537.37'
+
+ @functools.cached_property
+ def _headers(self):
+ ... | yt_dlp/extractor/vvvvid.py | 26 | Python | 0.571 | suggestion | 66 | 51 | 51 | false | [ie/vvvvid] fix user agent and tests | 8,615 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Kyraminol |
subtitles.setdefault(lang, []).append({
'ext': mimetype2ext(mime),
'url': src,
})
duration = info.get('duration')
tp_chapters = info.get('chapters', [])
chapters = []
if tp_chapters:
def _add_chapter(sta... | `info.get('keywords', {str_or_none})` is not correct -- you are trying to use a `traverse_obj`-style transformation as the default for `get()`. If the key `keywords` is not in `info` or if its value is `None`, then `get()` would default to a set containing the `str_or_none` function.
I think what you are trying to d... | 'url': src,
})
duration = info.get('duration')
tp_chapters = info.get('chapters', [])
chapters = []
if tp_chapters:
def _add_chapter(start_time, end_time):
start_time = float_or_none(start_time, 1000)
end_ti... | @@ -103,6 +105,36 @@ def _add_chapter(start_time, end_time):
for chapter in tp_chapters[:-1]:
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp_chapters[-1].get('startTime'), tp_chapters[-1].get('endTime') or duration)
+ info_keywords_str = ... | yt_dlp/extractor/theplatform.py | 26 | Python | 1 | suggestion | 767 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | trainman261 |
})
duration = info.get('duration')
tp_chapters = info.get('chapters', [])
chapters = []
if tp_chapters:
def _add_chapter(start_time, end_time):
start_time = float_or_none(start_time, 1000)
end_time = float_or_none(end_time, 100... | these should be moved down by where the values are extracted, but my other suggestion below will make initializing the variables unnecessary
```suggestion
``` | duration = info.get('duration')
tp_chapters = info.get('chapters', [])
chapters = []
if tp_chapters:
def _add_chapter(start_time, end_time):
start_time = float_or_none(start_time, 1000)
end_time = float_or_none(end_time, 1000)
i... | @@ -103,6 +105,36 @@ def _add_chapter(start_time, end_time):
for chapter in tp_chapters[:-1]:
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp_chapters[-1].get('startTime'), tp_chapters[-1].get('endTime') or duration)
+ info_keywords_str = ... | yt_dlp/extractor/theplatform.py | 26 | Python | 0.786 | refactor | 160 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | trainman261 |
tags = []
if (info_keywords_str is not None) and (info_keywords_str != ''):
tags = re.split(', |; |,', info_keywords_str)
location = None
series = None
season_number = None
# The following can be uncommented as soon as #7838 is merged:
# media_type = N... | With regex patterns, always use a raw string, e.g. `r'Backslashes\sAre\sOK'`. but regex is unnecessary anyways
We can use a helper function to reduce code duplication, except instead of using vars for `location` etc we could just inline them in the return below:
```suggestion
def extract_site_specific_fiel... | return traverse_obj(info, lambda k, v: v and k.endswith(f'${field}'), get_all=False)
return {
'title': info['title'],
'subtitles': subtitles,
'description': info['description'],
'thumbnail': info['defaultThumbnailUrl'],
'duration': float_o... | @@ -103,6 +105,36 @@ def _add_chapter(start_time, end_time):
for chapter in tp_chapters[:-1]:
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp_chapters[-1].get('startTime'), tp_chapters[-1].get('endTime') or duration)
+ info_keywords_str = ... | yt_dlp/extractor/theplatform.py | 26 | Python | 0.857 | refactor | 705 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | trainman261 |
location = None
series = None
season_number = None
# The following can be uncommented as soon as #7838 is merged:
# media_type = None
categories = []
categories_data = info.get('categories') or []
for x in categories_data:
if x.get('name') is n... | #7838 was merged already without adding the `media_type` field -- feel free to propose its addition in this PR | 'title': info['title'],
'subtitles': subtitles,
'description': info['description'],
'thumbnail': info['defaultThumbnailUrl'],
'duration': float_or_none(duration, 1000),
'timestamp': int_or_none(info.get('pubDate'), 1000) or None,
'uploa... | @@ -103,6 +105,36 @@ def _add_chapter(start_time, end_time):
for chapter in tp_chapters[:-1]:
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp_chapters[-1].get('startTime'), tp_chapters[-1].get('endTime') or duration)
+ info_keywords_str = ... | yt_dlp/extractor/theplatform.py | 26 | Python | 0.643 | suggestion | 110 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | trainman261 |
if (x.get('label') is None) or (x.get('label') == 'category'):
categories.append(x.get('name'))
# A number of sites have a prefix in front of some info keys followed by a '$' symbol.
# Search for known keys with the prefix.
for key in info.keys():
... | this should suffice
```suggestion
'creator': traverse_obj(info, ('author', {str})) or None,
``` | 'tags': traverse_obj(info, ('keywords', {lambda x: re.split(r'[;,]\s?', x) if x else None})),
'location': extract_site_specific_field('region'),
'series': extract_site_specific_field('show'),
'season_number': int_or_none(extract_site_specific_field('seasonNumber')),
... | @@ -113,6 +145,14 @@ def _add_chapter(start_time, end_time):
'timestamp': int_or_none(info.get('pubDate'), 1000) or None,
'uploader': info.get('billingCode'),
'chapters': chapters,
+ 'creator': info.get('author', {str_or_none}) if info.get('author', {str_or_none}) != ''... | yt_dlp/extractor/theplatform.py | 26 | Python | 0.786 | security | 110 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | trainman261 |
return
chapters.append({
'start_time': start_time,
'end_time': end_time,
})
for chapter in tp_chapters[:-1]:
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp... | we can use traversal filtering to simplify this part
```suggestion
categories = traverse_obj(info, (
'categories', lambda _, v: v.get('label') in ('category', None), 'name', {str})) or None
```
we can inline this in the return too | 'start_time': start_time,
'end_time': end_time,
})
for chapter in tp_chapters[:-1]:
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp_chapters[-1].get('startTime'), tp_chapters[-1].get('endTime'... | @@ -103,6 +105,36 @@ def _add_chapter(start_time, end_time):
for chapter in tp_chapters[:-1]:
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp_chapters[-1].get('startTime'), tp_chapters[-1].get('endTime') or duration)
+ info_keywords_str = ... | yt_dlp/extractor/theplatform.py | 26 | Python | 0.857 | refactor | 255 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | trainman261 |
originally a live stream.
live_status: None (=unknown), 'is_live', 'is_upcoming', 'was_live', 'not_live',
or 'post_live' (was live, but VOD is not yet processed)
If absent, automatically set from is_live, was_live
start_time: Time in seconds whe... | `media_type` will also need to be documented in the readme | is_live: True, False, or None (=unknown). Whether this video is a
live stream that goes on instead of a fixed-length video.
was_live: True, False, or None (=unknown). Whether this video was
originally a live stream.
live_status: None (=unknown), 'is_li... | @@ -379,6 +379,8 @@ class InfoExtractor:
'private', 'premium_only', 'subscriber_only', 'needs_auth',
'unlisted' or 'public'. Use 'InfoExtractor._availability'
to set it
+ media_type: The type of media, for instance a full show, an excerpt, a highligh... | yt_dlp/extractor/common.py | 26 | Python | 0.5 | suggestion | 58 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
'url': 'http://www.cbc.ca/player/play/2657631896',
'md5': 'e5e708c34ae6fca156aafe17c43e8b75',
'info_dict': {
'id': '2657631896',
'ext': 'mp3',
'title': 'CBC Montreal is organizing its first ever community hackathon!',
'description': 'The modern tec... | ```suggestion
'categories': ['AudioMobile/All in a Weekend Montreal'],
'tags': 'count:8',
```
Could you please make these changes in the other instances as well? | 'url': 'http://www.cbc.ca/player/play/2657631896',
'md5': 'e5e708c34ae6fca156aafe17c43e8b75',
'info_dict': {
'id': '2657631896',
'ext': 'mp3',
'title': 'CBC Montreal is organizing its first ever community hackathon!',
'description': 'The modern tec... | @@ -180,6 +180,24 @@ class CBCPlayerIE(InfoExtractor):
'thumbnail': 'http://thumbnails.cbc.ca/maven_legacy/thumbnails/sonali-karnick-220.jpg',
'chapters': [],
'duration': 494.811,
+ 'categories': [
+ 'AudioMobile/All in a Weekend Montreal',
+ ]... | yt_dlp/extractor/cbc.py | 26 | Python | 0.786 | question | 189 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
'episode': 'Episode 1',
'season_number': 1,
'episode_number': 1,
'chapters': [{'start_time': 0.0, 'end_time': 439.88}, {'start_time': 439.88, 'end_time': 1685.84}, {'start_time': 1685.84, 'end_time': 2682.0}],
},
}, {
'url': 'https://mediasetinfinity.m... | None values should not be added to the test
```suggestion
``` | 'episode': 'Episode 1',
'season_number': 1,
'episode_number': 1,
'chapters': [{'start_time': 0.0, 'end_time': 439.88}, {'start_time': 439.88, 'end_time': 1685.84}, {'start_time': 1685.84, 'end_time': 2682.0}],
},
}, {
'url': 'https://mediasetinfinity.m... | @@ -73,6 +73,10 @@ class MediasetIE(ThePlatformBaseIE):
'season_number': 5,
'episode_number': 5,
'chapters': [{'start_time': 0.0, 'end_time': 3409.08}, {'start_time': 3409.08, 'end_time': 6565.008}],
+ 'creator': None, | yt_dlp/extractor/mediaset.py | 26 | Python | 0.643 | suggestion | 63 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
def extract_site_specific_field(field):
# A number of sites have custom-prefixed keys, e.g. 'cbc$seasonNumber'
return next((info[k] for k in info if k.endswith(f'${field}') and info[k] != ''), None)
info_media_type = extract_site_specific_field('programmingType')
if not... | Can be inlined
```suggestion
'media_type': extract_site_specific_field('programmingType') or extract_site_specific_field('type'),
``` |
def extract_site_specific_field(field):
# A number of sites have custom-prefixed keys, e.g. 'cbc$seasonNumber'
return traverse_obj(info, lambda k, v: v and k.endswith(f'${field}'), get_all=False)
return {
'title': info['title'],
'subtitles': subtitles,
... | @@ -113,6 +121,14 @@ def _add_chapter(start_time, end_time):
'timestamp': int_or_none(info.get('pubDate'), 1000) or None,
'uploader': info.get('billingCode'),
'chapters': chapters,
+ 'creator': traverse_obj(info, ('author', {str})) or None,
+ 'categories': tr... | yt_dlp/extractor/theplatform.py | 26 | Python | 0.929 | refactor | 148 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
'season': 'Season 2015',
'season_number': 2015,
'media_type': 'Excerpt',
},
}, {
'url': 'http://www.cbc.ca/player/play/2164402062',
'md5': '33fcd8f6719b9dd60a5e73adcb83b9f6',
'info_dict': {
'id': '2164402062',
'ext': 'mp4',
... | ```suggestion
'categories': ['News/Canada/Windsor'],
'location': 'Windsor',
'tags': ['cancer'],
``` | 'season': 'Season 2015',
'season_number': 2015,
'media_type': 'Excerpt',
},
}, {
'url': 'http://www.cbc.ca/player/play/2164402062',
'md5': '33fcd8f6719b9dd60a5e73adcb83b9f6',
'info_dict': {
'id': '2164402062',
'ext': 'mp4',
... | @@ -195,25 +202,41 @@ class CBCPlayerIE(InfoExtractor):
'thumbnail': 'https://thumbnails.cbc.ca/maven_legacy/thumbnails/277/67/cancer_852x480_2164412612.jpg',
'chapters': [],
'duration': 186.867,
+ 'series': 'CBC News: Windsor at 6:00',
+ 'categories': [
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 0.714 | suggestion | 139 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
'episode_number': 1,
'chapters': [{'start_time': 0.0, 'end_time': 439.88}, {'start_time': 439.88, 'end_time': 1685.84}, {'start_time': 1685.84, 'end_time': 2682.0}],
},
}, {
'url': 'https://mediasetinfinity.mediaset.it/video/matrix/puntata-del-25-maggio_F309013801000501',
... | ```suggestion
'categories': ['Informazione'],
``` | 'episode_number': 1,
'chapters': [{'start_time': 0.0, 'end_time': 439.88}, {'start_time': 439.88, 'end_time': 1685.84}, {'start_time': 1685.84, 'end_time': 2682.0}],
},
}, {
'url': 'https://mediasetinfinity.mediaset.it/video/matrix/puntata-del-25-maggio_F309013801000501',
... | @@ -73,6 +73,9 @@ class MediasetIE(ThePlatformBaseIE):
'season_number': 5,
'episode_number': 5,
'chapters': [{'start_time': 0.0, 'end_time': 3409.08}, {'start_time': 3409.08, 'end_time': 6565.008}],
+ 'categories': [
+ 'Informazione',
+ ], | yt_dlp/extractor/mediaset.py | 26 | Python | 0.571 | suggestion | 63 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
'skip_download': True,
},
'skip': 'Dead link',
}, {
# WittyTV embed
'url': 'https://www.wittytv.it/mauriziocostanzoshow/ultima-puntata-venerdi-25-novembre/',
'info_dict': {
'id': 'F312172801000801',
'ext': 'mp4',
'title': 'Ultim... | ```suggestion
'categories': ['Intrattenimento'],
``` | 'skip': 'Dead link',
}, {
# WittyTV embed
'url': 'https://www.wittytv.it/mauriziocostanzoshow/ultima-puntata-venerdi-25-novembre/',
'info_dict': {
'id': 'F312172801000801',
'ext': 'mp4',
'title': 'Ultima puntata - Venerdì 25 novembre',
... | @@ -149,6 +152,9 @@ class MediasetIE(ThePlatformBaseIE):
'season_number': 12,
'episode': 'Episode 8',
'episode_number': 8,
+ 'categories': [
+ 'Intrattenimento',
+ ] | yt_dlp/extractor/mediaset.py | 26 | Python | 0.571 | suggestion | 66 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
class NBCIE(ThePlatformIE): # XXX: Do not subclass from concrete IE
_VALID_URL = r'https?(?P<permalink>://(?:www\.)?nbc\.com/(?:classic-tv/)?[^/]+/video/[^/]+/(?P<id>(?:NBCE|n)?\d+))'
_TESTS = [
{
'url': 'http://www.nbc.com/the-tonight-show/video/jimmy-fallon-surprises-fans-at-ben-jerrys/2... | ```suggestion
'categories': ['Series/The Tonight Show Starring Jimmy Fallon'],
``` | class NBCIE(ThePlatformIE): # XXX: Do not subclass from concrete IE
_VALID_URL = r'https?(?P<permalink>://(?:www\.)?nbc\.com/(?:classic-tv/)?[^/]+/video/[^/]+/(?P<id>(?:NBCE|n)?\d+))'
_TESTS = [
{
'url': 'http://www.nbc.com/the-tonight-show/video/jimmy-fallon-surprises-fans-at-ben-jerrys/2... | @@ -53,6 +53,11 @@ class NBCIE(ThePlatformIE): # XXX: Do not subclass from concrete IE
'chapters': 'count:1',
'tags': 'count:4',
'thumbnail': r're:https?://.+\.jpg',
+ 'categories': [
+ 'Series/The Tonight Show Starring Jimmy Fallon'
... | yt_dlp/extractor/nbc.py | 26 | Python | 0.714 | suggestion | 100 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
},
},
{
# new video_id format
'url': 'https://www.nbc.com/quantum-leap/video/bens-first-leap-nbcs-quantum-leap/NBCE125189978',
'info_dict': {
'id': 'NBCE125189978',
'ext': 'mp4',
'title': 'Ben\'s First Leap |... | ```suggestion
'categories': ['Series/Quantum Leap 2022'],
``` | # new video_id format
'url': 'https://www.nbc.com/quantum-leap/video/bens-first-leap-nbcs-quantum-leap/NBCE125189978',
'info_dict': {
'id': 'NBCE125189978',
'ext': 'mp4',
'title': 'Ben\'s First Leap | NBC\'s Quantum Leap',
... | @@ -131,6 +136,10 @@ class NBCIE(ThePlatformIE): # XXX: Do not subclass from concrete IE
'tags': 'count:10',
'age_limit': 0,
'thumbnail': r're:https?://.+\.jpg',
+ 'categories': [
+ 'Series/Quantum Leap 2022',
+ ], | yt_dlp/extractor/nbc.py | 26 | Python | 0.571 | suggestion | 79 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | trainman261 |
subtitles.setdefault(lang, []).append({
'ext': mimetype2ext(mime),
'url': src,
})
duration = info.get('duration')
tp_chapters = info.get('chapters', [])
chapters = []
if tp_chapters:
def _add_chapter(sta... | ```suggestion
return traverse_obj(info, lambda k, v: v and k.endswith(f'${field}'), get_all=False)
``` | subtitles.setdefault(lang, []).append({
'ext': mimetype2ext(mime),
'url': src,
})
duration = info.get('duration')
tp_chapters = info.get('chapters', [])
chapters = []
if tp_chapters:
def _add_chapter(sta... | @@ -104,6 +104,10 @@ def _add_chapter(start_time, end_time):
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp_chapters[-1].get('startTime'), tp_chapters[-1].get('endTime') or duration)
+ def extract_site_specific_field(field):
+ # A number ... | yt_dlp/extractor/theplatform.py | 26 | Python | 0.714 | suggestion | 116 | 51 | 51 | false | Improving ThePlatform Metadata extraction | 8,635 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trainman261 |
'like_count': int,
'dislike_count': int,
'comment_count': int,
'uploader': 'LinusTechTips',
'uploader_id': '59f94c0bdd241b70349eb72b',
'uploader_url': 'https://www.floatplane.com/channel/linustechtips/home',
'channel': 'GameLinked',
... | ```suggestion
if not any(traverse_obj(post_data, ('metadata', ('hasVideo', 'hasAudio')))):
``` | 'description': 'md5:80d612dcabf41b17487afcbe303ec57d',
'thumbnail': r're:^https?://.*\.jpe?g$',
'release_timestamp': 1700622000,
'release_date': '20231122',
'duration': 513,
'like_count': int,
'dislike_count': int,
'comment_... | @@ -0,0 +1,204 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ determine_ext,
+ int_or_none,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class FloatplaneIE(InfoExtractor):
+ _VALID_URL = r'https?:/... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
'format_id': 'name',
'format_note': 'label',
'width': 'width',
'height': 'height',
}),
**parse_codecs(quality.get('codecs')),
'url': url,
'ext':... | maybe use `format_field(traverse_obj(...), template='https://...')`? | for quality in traverse_obj(stream, ('resource', 'data', 'qualityLevels', ...)):
url = urljoin(stream['cdn'], format_path(traverse_obj(
stream, ('resource', 'data', 'qualityLevelParams', quality['name']))))
formats.append({
**traverse_o... | @@ -0,0 +1,204 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ determine_ext,
+ int_or_none,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class FloatplaneIE(InfoExtractor):
+ _VALID_URL = r'https?:/... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.429 | question | 68 | 51 | 51 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
if channel_id:
query['channel'] = channel_id
page_data = self._download_json(
'https://www.floatplane.com/api/v3/content/creator', display_id,
query=query, note=f'Downloading page {page+1}')
for post in page_data or []:
yield self.url_result(
... | ```suggestion
playlist_description=channel_data.get('about') or creator_data.get('about'))
``` | import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
determine_ext,
format_field,
int_or_none,
join_nonempty,
parse_codecs,
parse_iso8601,
urljoin,
)
from ..utils.traversal import traverse_obj
class FloatplaneI... | @@ -0,0 +1,271 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.714 | suggestion | 108 | 27 | 269 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
'id': post_id,
'display_id': post_id,
**traverse_obj(post_data, {
'title': 'title',
'description': ('text', {clean_html}),
'uploader': ('creator', 'title'),
'uploader_id': ('creator', 'id'),
'channel': ('... | ```suggestion
if len(items) > 1:
return self.playlist_result(items, **post_info)
post_info.update(items[0])
return post_info
``` | **traverse_obj(post_data, {
'title': 'title',
'description': ('text', {clean_html}),
'uploader': ('creator', 'title'),
'uploader_id': ('creator', 'id'),
'channel': ('channel', 'title'),
'channel_id': ('channel', ... | @@ -0,0 +1,271 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.714 | suggestion | 171 | 51 | 51 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
note=f'Downloading {media_typ} metadata')
stream = self._download_json(
'https://www.floatplane.com/api/v2/cdn/delivery', media_id,
query={
'type': 'vod' if media_typ == 'video' else 'aod',
'guid': metadata['guid']
... | ```suggestion
'width': ('width', {int}),
'height': ('height', {int}),
``` | f'https://www.floatplane.com/api/v3/content/{media_typ}', media_id, query={'id': media_id},
note=f'Downloading {media_typ} metadata')
stream = self._download_json(
'https://www.floatplane.com/api/v2/cdn/delivery', media_id, query={
'type':... | @@ -0,0 +1,271 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.714 | suggestion | 124 | 51 | 51 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
def _real_extract(self, url):
post_id = self._match_id(url)
post_data = self._download_json(
'https://www.floatplane.com/api/v3/content/post', post_id, query={'id': post_id},
note='Downloading post data', errnote='Unable to download post data')
if True not in traver... | ```suggestion
'https://www.floatplane.com/api/v2/cdn/delivery', media_id, query={
'type': 'vod' if media_typ == 'video' else 'aod',
'guid': metadata['guid']
}, note=f'Downloading {media_typ} stream data')
``` |
def _real_extract(self, url):
post_id = self._match_id(url)
post_data = self._download_json(
'https://www.floatplane.com/api/v3/content/post', post_id, query={'id': post_id},
note='Downloading post data', errnote='Unable to download post data')
if not any(traverse_... | @@ -0,0 +1,271 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.929 | suggestion | 285 | 51 | 51 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
if True not in traverse_obj(post_data, ('metadata', ('hasVideo', 'hasAudio'))):
raise ExtractorError('Post does not contain a video or audio track', expected=True)
items = []
for media in traverse_obj(post_data, (('videoAttachments', 'audioAttachments'), ...)):
media_id... | Not a huge fan of how this function looks, but nothing comes to mind. Maybe we can at least pull out `path` since its static? | note='Downloading post data', errnote='Unable to download post data')
if not any(traverse_obj(post_data, ('metadata', ('hasVideo', 'hasAudio')))):
raise ExtractorError('Post does not contain a video or audio track', expected=True)
items = []
for media in traverse_obj(po... | @@ -0,0 +1,271 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.5 | question | 125 | 51 | 51 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
formats.append({
**traverse_obj(quality, {
'format_id': 'name',
'format_note': 'label',
'width': ('width', {int}),
'height': ('height', {int}),
}),
... | We can shorten the lines a bit by passing both the object and field args
```suggestion
uploader_url = format_field(traverse_obj(
post_data, 'creator'), 'urlname', 'https://www.floatplane.com/channel/%s/home', default=None)
channel_url = format_field(traverse_obj(
post_data, ... | formats.append({
**traverse_obj(quality, {
'format_id': 'name',
'format_note': 'label',
'width': ('width', {int}),
'height': ('height', {int}),
}),
... | @@ -0,0 +1,268 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ format_field,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal impor... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.857 | suggestion | 809 | 51 | 51 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.