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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'url': format.get('url'),
'width': format.get('width'),
'height': format.get('height'),
'vcodec': vcodec,
} for format in videos_list or []]
if dash_manifest_raw:
formats.extend(self._parse_mpd_formats(self._parse_xml(dash_manifest_raw, media_i... | ```suggestion
comment_data = traverse_obj(product_info, ('edge_media_to_parent_comment', 'edges'), 'comments')
``` | 'url': format.get('url'),
'width': format.get('width'),
'height': format.get('height'),
'vcodec': vcodec,
} for format in videos_list or []]
if dash_manifest_raw:
formats.extend(self._parse_mpd_formats(self._parse_xml(dash_manifest_raw, media_i... | @@ -173,13 +173,13 @@ def _extract_product(self, product_info):
if isinstance(product_info, list):
product_info = product_info[0]
- comment_data = traverse_obj(product_info, ('edge_media_to_parent_comment', 'edges'))
+ comment_data = traverse_obj(product_info, ('edge_media_to_paren... | yt_dlp/extractor/instagram.py | 26 | Python | 0.714 | suggestion | 124 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
formats.extend(self._parse_mpd_formats(self._parse_xml(dash_manifest_raw, media_id), mpd_id='dash'))
self._sort_formats(formats)
thumbnails = [{
'url': thumbnail.get('url'),
'width': thumbnail.get('width'),
'height': thumbnail.get('height')
} for ... | ```suggestion
'id': traverse_obj(comment_dict, ('node', 'id'), ('pk')),
'text': traverse_obj(comment_dict, ('node', 'text'), 'text'),
'timestamp': traverse_obj(comment_dict, ('node', 'created_at'), 'created_at', expected_type=int_or_none),
``` | formats.extend(self._parse_mpd_formats(self._parse_xml(dash_manifest_raw, media_id), mpd_id='dash'))
self._sort_formats(formats)
thumbnails = [{
'url': thumbnail.get('url'),
'width': thumbnail.get('width'),
'height': thumbnail.get('height')
} for ... | @@ -173,13 +173,13 @@ def _extract_product(self, product_info):
if isinstance(product_info, list):
product_info = product_info[0]
- comment_data = traverse_obj(product_info, ('edge_media_to_parent_comment', 'edges'))
+ comment_data = traverse_obj(product_info, ('edge_media_to_paren... | yt_dlp/extractor/instagram.py | 26 | Python | 0.929 | suggestion | 283 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
}, {
'url': 'https://www.instagram.com/marvelskies.fc/reel/CWqAgUZgCku/',
'only_matching': True,
}]
@classmethod
def _extract_embed_urls(cls, url, webpage):
res = tuple(super()._extract_embed_urls(url, webpage))
if res:
return res
mobj = re.search(r'... | ```suggestion
fatal=False, errnote=False, note='Downloading video info',
headers=self._API_HEADERS), ('items', 0))
``` | 'title': 'Fingerboarding Tricks with @cass.fb',
'thumbnail': r're:^https?://.*\.jpg',
'duration': 53.83,
'timestamp': 1530032919,
'upload_date': '20180626',
'uploader_id': '25025320',
'uploader': 'Instagram',
'channel': 'ins... | @@ -367,47 +367,57 @@ def _real_extract(self, url):
video_id, url = self._match_valid_url(url).group('id', 'url')
media, webpage = {}, ''
+ if self._get_cookies(url).get('sessionid'):
+ info = traverse_obj(self._download_json(
+ f'{self._API_BASE_URL}/media/{_id_to_p... | yt_dlp/extractor/instagram.py | 26 | Python | 0.714 | suggestion | 153 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
res = tuple(super()._extract_embed_urls(url, webpage))
if res:
return res
mobj = re.search(r'<a[^>]+href=([\'"])(?P<link>[^\'"]+)\1',
get_element_by_attribute('class', 'instagram-media', webpage) or '')
if mobj:
return [mobj.group('link')... | ```suggestion
f'{self._API_BASE_URL}/media/{_id_to_pk(video_id)}/comments/?can_support_threading=true&permalink_enabled=false',
video_id, fatal=False, errnote=False, note='Downloading comments info',
headers=self._API_HEADERS) or {}
```
1. Why errnote=Fal... | 'channel': 'instagram',
'like_count': int,
'comment_count': int,
'comments': list,
'description': 'Meet Cass Hirst (@cass.fb), a fingerboarding pro who can perform tiny ollies and kickflips while blindfolded.',
},
'expected_warnings': [
... | @@ -367,47 +367,57 @@ def _real_extract(self, url):
video_id, url = self._match_valid_url(url).group('id', 'url')
media, webpage = {}, ''
+ if self._get_cookies(url).get('sessionid'):
+ info = traverse_obj(self._download_json(
+ f'{self._API_BASE_URL}/media/{_id_to_p... | yt_dlp/extractor/instagram.py | 26 | Python | 1 | refactor | 448 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
fatal=False, errnote=False, note='Downloading video info', headers={
**self._API_HEADERS
}), ('items', 0))
if info:
media.update(info)
comments_info = self._download_json(
f'{self._API_BASE_URL}/media/{_i... | ```py
if not csrf_token:
self.report_warning('No csrf token set by Instagram API', video_id)
else:
csrf_token = csrf_token.value if api_check.get('status') == 'ok' else None
if not csrf_token:
self.report_warning('Instagram API is not granting ac... | }, {
'url': 'https://www.instagram.com/tv/aye83DjauH/',
'only_matching': True,
}, {
'url': 'https://www.instagram.com/reel/CDUMkliABpa/',
'only_matching': True,
}, {
'url': 'https://www.instagram.com/marvelskies.fc/reel/CWqAgUZgCku/',
'only_matching': True,
... | @@ -367,47 +367,57 @@ def _real_extract(self, url):
video_id, url = self._match_valid_url(url).group('id', 'url')
media, webpage = {}, ''
+ if self._get_cookies(url).get('sessionid'):
+ info = traverse_obj(self._download_json(
+ f'{self._API_BASE_URL}/media/{_id_to_p... | yt_dlp/extractor/instagram.py | 26 | Python | 0.786 | security | 355 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
'X-CSRFToken': csrf_token_value,
'X-Requested-With': 'XMLHttpRequest',
'Referer': url,
}, query={
'query_hash': '9f8827793ef34641b2fb195d4d41151c',
'variables': json.dumps(variables, separators=(',', ':')),
})
... | ```suggestion
if not additional_data and not media:
``` | csrf_token = self._get_cookies('https://www.instagram.com').get('csrftoken')
if not csrf_token:
self.report_warning('No csrf token set by Instagram API', video_id)
else:
csrf_token = csrf_token.value if api_check.get('status') == 'ok' else None
if not csrf_to... | @@ -418,12 +428,12 @@ def _real_extract(self, url):
shared_data, ('entry_data', 'PostPage', 0, 'graphql', 'shortcode_media'),
('entry_data', 'PostPage', 0, 'media'), expected_type=dict) or {})
else:
- self.report_warning('Main webpage is locked behin... | yt_dlp/extractor/instagram.py | 26 | Python | 0.571 | suggestion | 73 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
} for product_media in carousel_media],
}
return {
**info_dict,
**self._extract_product_media(product_info)
}
def _get_comments(self, video_id):
comments_info = self._download_json(
f'{self._API_BASE_URL}/media/{_id_to_pk(vide... | ```suggestion
comment_data = traverse_obj(comments_info, ('edge_media_to_parent_comment', 'edges'), 'comments')
for comment_dict in comment_data or []:
yield {
'author': traverse_obj(comment_dict, ('node', 'owner', 'username'), ('user', 'username')),
'aut... | } for product_media in carousel_media],
}
return {
**info_dict,
**self._extract_product_media(product_info)
}
def _get_comments(self, video_id):
comments_info = self._download_json(
f'{self._API_BASE_URL}/media/{_id_to_pk(vide... | @@ -216,6 +207,24 @@ def _extract_product(self, product_info):
**self._extract_product_media(product_info)
}
+ def _get_comments(self, video_id):
+ comments_info = self._download_json(
+ f'{self._API_BASE_URL}/media/{_id_to_pk(video_id)}/comments/?can_support_threading=true&... | yt_dlp/extractor/instagram.py | 26 | Python | 1 | security | 995 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
class InstagramIE(InstagramBaseIE):
_VALID_URL = r'(?P<url>https?://(?:www\.)?instagram\.com(?:/[^/]+)?/(?:p|tv|reel)/(?P<id>[^/?#&]+))'
_EMBED_REGEX = [r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?instagram\.com/p/[^/]+/embed.*?)\1']
_TESTS = [{
'url': 'https://instagram.com/p/aye83Dja... | ```suggestion
'General metadata extraction failed',
'Main webpage is locked behind the login page',
``` | class InstagramIE(InstagramBaseIE):
_VALID_URL = r'(?P<url>https?://(?:www\.)?instagram\.com(?:/[^/]+)?/(?:p|tv|reel)/(?P<id>[^/?#&]+))'
_EMBED_REGEX = [r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?instagram\.com/p/[^/]+/embed.*?)\1']
_TESTS = [{
'url': 'https://instagram.com/p/aye83Djau... | @@ -268,27 +277,34 @@ class InstagramIE(InstagramBaseIE):
'comment_count': int,
'comments': list,
},
+ 'expected_warnings': [
+ 'General metadata extraction failed (some metadata might be missing).',
+ 'Main webpage is locked behind the login page. Retryin... | yt_dlp/extractor/instagram.py | 26 | Python | 0.786 | bug | 130 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
'General metadata extraction failed (some metadata might be missing).',
'Main webpage is locked behind the login page. Retrying with embed webpage (some metadata might be missing).',
],
}, {
# reel
'url': 'https://www.instagram.com/reel/Chunk8-jurw/',
'md5': '... | ```suggestion
'General metadata extraction failed',
'Main webpage is locked behind the login page',
``` | 'Main webpage is locked behind the login page',
],
}, {
# reel
'url': 'https://www.instagram.com/reel/Chunk8-jurw/',
'md5': 'f6d8277f74515fa3ff9f5791426e42b1',
'info_dict': {
'id': 'Chunk8-jurw',
'ext': 'mp4',
'title': 'Video by... | @@ -268,27 +277,34 @@ class InstagramIE(InstagramBaseIE):
'comment_count': int,
'comments': list,
},
+ 'expected_warnings': [
+ 'General metadata extraction failed (some metadata might be missing).',
+ 'Main webpage is locked behind the login page. Retryin... | yt_dlp/extractor/instagram.py | 26 | Python | 0.786 | bug | 130 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
},
}, {
'info_dict': {
'id': 'BQ0dTpOhuHT',
'ext': 'mp4',
'title': 'Video 2',
'thumbnail': r're:^https?://.*\.jpg',
'view_count': int,
},
}, {
'info_dict': {
'i... | ```suggestion
'General metadata extraction failed',
'Main webpage is locked behind the login page',
``` | }, {
'info_dict': {
'id': 'BQ0dTpOhuHT',
'ext': 'mp4',
'title': 'Video 2',
'thumbnail': r're:^https?://.*\.jpg',
'view_count': int,
},
}, {
'info_dict': {
'id': 'BQ0dT7RBFe... | @@ -297,25 +313,35 @@ class InstagramIE(InstagramBaseIE):
'id': 'BQ0dSaohpPW',
'ext': 'mp4',
'title': 'Video 1',
+ 'thumbnail': r're:^https?://.*\.jpg',
+ 'view_count': int,
},
}, {
'info_dict': {
... | yt_dlp/extractor/instagram.py | 26 | Python | 0.786 | bug | 130 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
'expected_warnings': [
'General metadata extraction failed (some metadata might be missing).',
'Main webpage is locked behind the login page. Retrying with embed webpage (some metadata might be missing).',
],
}, {
# IGTV
'url': 'https://www.instagram.com/tv/Bk... | ```suggestion
'General metadata extraction failed',
'Main webpage is locked behind the login page',
``` | 'General metadata extraction failed',
'Main webpage is locked behind the login page',
],
}, {
# IGTV
'url': 'https://www.instagram.com/tv/BkfuX9UB-eK/',
'info_dict': {
'id': 'BkfuX9UB-eK',
'ext': 'mp4',
'title': 'Fingerboard... | @@ -334,7 +360,11 @@ class InstagramIE(InstagramBaseIE):
'comment_count': int,
'comments': list,
'description': 'Meet Cass Hirst (@cass.fb), a fingerboarding pro who can perform tiny ollies and kickflips while blindfolded.',
- }
+ },
+ 'expected_warnings': [
+... | yt_dlp/extractor/instagram.py | 26 | Python | 0.786 | bug | 130 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
api_check = self._download_json(
f'{self._API_BASE_URL}/web/get_ruling_for_content/?content_type=MEDIA&target_id={_id_to_pk(video_id)}',
video_id, headers=self._API_HEADERS, fatal=False, note='Setting up session', errnote=False) or {}
csrf_token = self._get_cookies('https://www.i... | ```suggestion
'X-CSRFToken': csrf_token or '',
``` | api_check = self._download_json(
f'{self._API_BASE_URL}/web/get_ruling_for_content/?content_type=MEDIA&target_id={_id_to_pk(video_id)}',
video_id, headers=self._API_HEADERS, fatal=False, note='Setting up session', errnote=False) or {}
csrf_token = self._get_cookies('https://www.i... | @@ -367,47 +397,49 @@ def _real_extract(self, url):
video_id, url = self._match_valid_url(url).group('id', 'url')
media, webpage = {}, ''
+ if self._get_cookies(url).get('sessionid'):
+ info = traverse_obj(self._download_json(
+ f'{self._API_BASE_URL}/media/{_id_to_p... | yt_dlp/extractor/instagram.py | 26 | Python | 0.571 | security | 68 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
**info_dict,
**self._extract_product_media(product_media),
} for product_media in carousel_media],
}
return {
**info_dict,
**self._extract_product_media(product_info)
}
def _get_comments(self, video_id):
... | ```suggestion
}
``` | **info_dict,
**self._extract_product_media(product_media),
} for product_media in carousel_media],
}
return {
**info_dict,
**self._extract_product_media(product_info)
}
def _get_comments(self, video_id):
... | @@ -216,6 +207,22 @@ def _extract_product(self, product_info):
**self._extract_product_media(product_info)
}
+ def _get_comments(self, video_id):
+ comments_info = self._download_json(
+ f'{self._API_BASE_URL}/media/{_id_to_pk(video_id)}/comments/?can_support_threading=true&... | yt_dlp/extractor/instagram.py | 26 | Python | 0.429 | suggestion | 35 | 51 | 51 | false | [extractor/instagram] Fix missing metadata in post extractor | 4,708 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pritam20ps05 |
self.report_warning(
f'Triller does not use cookies for authentication. {self._login_hint("password")}')
def _create_guest(self):
guest = self._download_json(
f'{self._API_BASE_URL}/user/create_guest',
None, note='Creating guest session', data=b'', header... | ```suggestion
headers={'Origin': 'https://triller.co'}, query={'limit': limit}) or {}
``` | if not comment_info.get('comments'):
return
for comment_dict in comment_info['comments']:
yield {
'author': traverse_obj(comment_dict, ('author', 'username')),
'author_id': traverse_obj(comment_dict, ('author', 'user_id')),
'id': co... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'platform': 'Web',
'app_version': '',
})
if not guest.get('auth_token'):
raise ExtractorError('Unable to fetch required auth token for user extraction')
self._AUTH_TOKEN = guest.get('auth_token')
def _get_comments(self, video_id, limit=15):
... | ```suggestion
if not comment_info.get('comments'):
return
return [{
'author': traverse_obj(comment_dict, ('author', 'username')),
'author_id': traverse_obj(comment_dict, ('author', 'user_id')),
'id': comment_dict.get('id'),
'text': comme... | }
def _check_user_info(self, user_info):
if not user_info:
self.report_warning('Unable to extract user info')
elif user_info.get('private') and not user_info.get('followed_by_me'):
raise ExtractorError('This video is private', expected=True)
elif traverse... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.857 | security | 477 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
f'{self._API_BASE_URL}/api/videos/{video_id}/comments_v2',
video_id, fatal=False, note=False, errnote='Unable to extract comments',
headers={
'Origin': 'https://triller.co',
}, query={
'limit': limit,
}) or {}
comment_da... | ```suggestion
video_url = traverse_obj(video_info, 'video_url', 'stream_url')
``` |
def _parse_video_info(self, video_info, username, user_info=None):
video_uuid = video_info.get('video_uuid')
video_id = video_info.get('id')
formats = []
video_url = traverse_obj(video_info, 'video_url', 'stream_url')
if video_url:
formats.append({
... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.571 | suggestion | 91 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
}) or {}
comment_data = comment_info.get('comments', [])
comments = [{
'author': traverse_obj(comment_dict, ('author', 'username')),
'author_id': traverse_obj(comment_dict, ('author', 'user_id')),
'id': comment_dict.get('id'),
'text': comment_d... | ```suggestion
```
core code will set this | video_url = traverse_obj(video_info, 'video_url', 'stream_url')
if video_url:
formats.append({
'url': video_url,
'ext': 'mp4',
'vcodec': 'h264',
'width': video_info.get('width'),
'height': video_info.get('height'... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.429 | suggestion | 43 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
if video_url:
formats.append({
'url': video_url,
'ext': 'mp4',
'vcodec': 'h264',
'resolution': f'{video_info.get("width")}x{video_info.get("height")}',
'width': video_info.get('width'),
'height': video_in... | ```suggestion
resolution = video.get('resolution') or ''
formats.append({
'url': video['url'],
'ext': 'mp4',
'vcodec': video.get('codec'),
'vbr': int_or_none(video.get('bitrate'), 1000),
'width': int_or_none(r... | 'height': int_or_none(resolution.split('x')[1]),
'format_id': url_basename(video['url']).split('.')[0],
})
audio_url = video_info.get('audio_url')
if audio_url:
formats.append({
'url': audio_url,
'ext': 'm4a',
... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.786 | suggestion | 504 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
m3u8_id='hls', fatal=False, note=False))
self._sort_formats(formats)
comment_count = int_or_none(video_info.get('comment_count'))
comments = self._get_comments(video_id, comment_count)
return {
'id': str_or_none(video_id) or video_uuid,
'title': ... | ```suggestion
'__post_extractor': self.extract_comments(video_id, comment_count),
``` | 'uploader_url': f'https://triller.co/@{username}',
'extractor_key': TrillerIE.ie_key(),
'extractor': TrillerIE.IE_NAME,
'formats': formats,
'comment_count': comment_count,
'__post_extractor': self.extract_comments(video_id, comment_count),
... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.643 | refactor | 99 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
resolution = video.get('resolution')
bitrate = int_or_none(video.get('bitrate')) / 1000
video_url = video.get('url')
formats.append({
'url': video_url,
'ext': 'mp4',
'vcodec': video.get('codec'),
'vbr': bitra... | ```suggestion
'uploader_url': format_field(username, None, 'https://triller.co/@%s'),
``` | formats.extend(self._extract_m3u8_formats(
manifest_url, video_id, 'mp4', entry_protocol='m3u8_native',
m3u8_id='hls', fatal=False))
self._sort_formats(formats)
comment_count = int_or_none(video_info.get('comment_count'))
user_info = user_info or tra... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.786 | suggestion | 103 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'info_dict': {
'id': '71621339',
'ext': 'mp4',
'title': 'md5:4c91ea82760fe0fffb71b8c3aa7295fc',
'thumbnail': r're:^https://uploads\.cdn\.triller\.co/.+\.jpg$',
'description': 'md5:4c91ea82760fe0fffb71b8c3aa7295fc',
'uploader': 'charlidameli... | ```suggestion
username, video_uuid = self._match_valid_url(url).group('username', 'id')
``` | 'comment_count': int,
}
}]
def _real_extract(self, url):
username, video_uuid = self._match_valid_url(url).group('username', 'id')
video_info = traverse_obj(self._download_json(
f'{self._API_BASE_URL}/api/videos/{video_uuid}',
video_uuid, note='Downl... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.786 | suggestion | 101 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
username, video_uuid = self._match_valid_url(url).groups()
video_info = traverse_obj(self._download_json(
f'{self._API_BASE_URL}/api/videos/{video_uuid}',
video_uuid, note='Downloading video info API JSON',
errnote='Unable to download video info API JSON',
... | ```suggestion
user_info = video_info.get('user') or {}
if not user_info:
self.report_warning('Unable to extract user info')
elif user_info.get('private') and not user_info.get('followed_by_me'):
raise ExtractorError('This video is private', expected=True)
el... | 'url': 'https://triller.co/@theestallion',
'playlist_mincount': 9,
'info_dict': {
'id': '18992236',
'title': 'theestallion',
'thumbnail': r're:^https://uploads\.cdn\.triller\.co/.+\.jpg$',
}
}, {
'url': 'https://triller.co/@charlidamelio',
... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 1 | security | 541 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'thumbnail': r're:^https://uploads\.cdn\.triller\.co/.+\.jpg$',
}
}]
def _extract_video_list(self, username, user_id, limit=6):
query = {
'limit': limit,
}
for page in itertools.count(1):
for retry in self.RetryManager():
try:
... | ```suggestion
if not video_list.get('videos'):
break
yield from video_list['videos']
``` | 'Origin': 'https://triller.co',
}, query=query)
except ExtractorError as e:
if isinstance(e.cause, json.JSONDecodeError) and e.cause.pos == 0:
retry.error = e
continue
... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.714 | suggestion | 132 | 51 | 35 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
}
for page in itertools.count(1):
for retry in self.RetryManager():
try:
video_list = self._download_json(
f'{self._API_BASE_URL}/api/users/{user_id}/videos',
username, note=f'Downloading user video list page... | ```suggestion
query['before_time'] = traverse_obj(video_list, ('videos', -1, 'timestamp'))
if not query['before_time']:
break
``` | if not video_list.get('videos'):
break
yield from video_list['videos']
query['before_time'] = traverse_obj(video_list, ('videos', -1, 'timestamp'))
if not query['before_time']:
break
def _entries(self, videos, username, user_info):
... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.714 | suggestion | 173 | 51 | 28 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
if isinstance(e.cause, json.JSONDecodeError) and e.cause.pos == 0:
retry.error = e
continue
raise
yield from video_list.get('videos', [])
if not video_list.get('videos'):
break
bef... | ```suggestion
if not self._AUTH_TOKEN:
```
_IS_LOGGED_IN is not even needed as far as I can tell | import itertools
import json
from .common import InfoExtractor
from ..utils import (
int_or_none,
str_or_none,
traverse_obj,
unified_strdate,
unified_timestamp,
url_basename,
ExtractorError,
)
class TrillerBaseIE(InfoExtractor):
_NETRC_MACHINE = 'triller'
_AUTH_TOKEN = None
_A... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.714 | security | 107 | 51 | 305 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
if not login.get('auth_token'):
if login.get('error') == 1008:
raise ExtractorError('Unable to login: Incorrect password', expected=True)
raise ExtractorError('Unable to login')
self._AUTH_TOKEN = login.get('auth_token')
self._IS_LOGGED_IN = True
def... | ```suggestion
self._AUTH_TOKEN = guest['auth_token']
``` | raise ExtractorError('Unable to login: Incorrect password', expected=True)
raise ExtractorError('Unable to login')
self._AUTH_TOKEN = login['auth_token']
def _get_comments(self, video_id, limit=15):
comment_info = self._download_json(
f'{self._API_BASE_URL}/... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.571 | security | 66 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
yield {
**self._parse_video_info(video, user_info),
'extractor_key': TrillerIE.ie_key(),
'extractor': 'Triller',
}
def _real_extract(self, url):
username = self._match_id(url)
if not self._IS_LOGGED_IN:
self._create... | repeated code from above. Refactor into a function | import itertools
import json
from .common import InfoExtractor
from ..utils import (
int_or_none,
str_or_none,
traverse_obj,
unified_strdate,
unified_timestamp,
url_basename,
ExtractorError,
)
class TrillerBaseIE(InfoExtractor):
_NETRC_MACHINE = 'triller'
_AUTH_TOKEN = None
_A... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.286 | refactor | 50 | 34 | 305 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'Authorization': f'Bearer {self._AUTH_TOKEN}',
'Origin': 'https://triller.co',
}, query=query)
except ExtractorError as e:
if isinstance(e.cause, json.JSONDecodeError) and e.cause.pos == 0:
... | This can just be in `_parse_video_info`, no? | import itertools
import json
from .common import InfoExtractor
from ..utils import (
int_or_none,
str_or_none,
traverse_obj,
unified_strdate,
unified_timestamp,
url_basename,
ExtractorError,
)
class TrillerBaseIE(InfoExtractor):
_NETRC_MACHINE = 'triller'
_AUTH_TOKEN = None
_A... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.214 | question | 44 | 51 | 305 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
errnote='Unable to download user video list', headers={
'Authorization': f'Bearer {self._AUTH_TOKEN}',
'Origin': 'https://triller.co',
}, query=query)
except ExtractorError as e:
i... | ```suggestion
'extractor': TrillerIE.IE_NAME,
``` | import itertools
import json
from .common import InfoExtractor
from ..utils import (
int_or_none,
str_or_none,
traverse_obj,
unified_strdate,
unified_timestamp,
url_basename,
ExtractorError,
)
class TrillerBaseIE(InfoExtractor):
_NETRC_MACHINE = 'triller'
_AUTH_TOKEN = None
_A... | @@ -0,0 +1,339 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtractor):
+ _NETRC... | yt_dlp/extractor/triller.py | 26 | Python | 0.643 | refactor | 67 | 51 | 305 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
credentials = {
'username': username,
'password': password,
}
login = self._download_json(
f'{self._API_BASE_URL}/user/auth', None, note=False, fatal=False,
expected_status=400, headers={
'Content-Type': 'application/json',
... | ```suggestion
return [{
``` | 'username': username,
'password': password,
}
login = self._download_json(
f'{self._API_BASE_URL}/user/auth', None, note='Logging in',
fatal=False, expected_status=400, headers={
'Content-Type': 'application/json',
'Origin':... | @@ -0,0 +1,309 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ format_field,
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtr... | yt_dlp/extractor/triller.py | 26 | Python | 0.429 | suggestion | 37 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
def _check_user_info(self, user_info):
if not user_info:
self.report_warning('Unable to extract user info')
elif user_info.get('private') and not user_info.get('followed_by_me'):
raise ExtractorError('This video is private', expected=True)
elif traverse_obj(user_info,... | ```suggestion
video_set = video_info.get('video_set') or []
``` | if not user_info:
self.report_warning('Unable to extract user info')
elif user_info.get('private') and not user_info.get('followed_by_me'):
raise ExtractorError('This video is private', expected=True)
elif traverse_obj(user_info, 'blocked_by_user', 'blocking_user'):
... | @@ -0,0 +1,309 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ format_field,
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtr... | yt_dlp/extractor/triller.py | 26 | Python | 0.571 | suggestion | 73 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'vcodec': video.get('codec'),
'vbr': int_or_none(video.get('bitrate'), 1000),
'width': int_or_none(resolution.split('x')[0]),
'height': int_or_none(resolution.split('x')[1]),
'format_id': url_basename(video['url']).split('.')[0],
... | ```suggestion
user_info = user_info or traverse_obj(video_info, 'user', default={})
``` | 'vbr': int_or_none(video.get('bitrate'), 1000),
'width': int_or_none(resolution.split('x')[0]),
'height': int_or_none(resolution.split('x')[1]),
'format_id': url_basename(video['url']).split('.')[0],
})
audio_url = video_info.get('audio... | @@ -0,0 +1,309 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ format_field,
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtr... | yt_dlp/extractor/triller.py | 26 | Python | 0.643 | suggestion | 99 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
manifest_url = video_info.get('transcoded_url')
if manifest_url:
formats.extend(self._extract_m3u8_formats(
manifest_url, video_id, 'mp4', entry_protocol='m3u8_native',
m3u8_id='hls', fatal=False, note=False))
self._sort_formats(formats)
comme... | This makes `username` a mandatory field. Is that intentional? | if manifest_url:
formats.extend(self._extract_m3u8_formats(
manifest_url, video_id, 'mp4', entry_protocol='m3u8_native',
m3u8_id='hls', fatal=False))
self._sort_formats(formats)
comment_count = int_or_none(video_info.get('comment_count'))
use... | @@ -0,0 +1,309 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ format_field,
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtr... | yt_dlp/extractor/triller.py | 26 | Python | 0.429 | question | 61 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'width': 1080,
'view_count': int,
'like_count': int,
'artist': 'Dixie',
'track': 'Someone to Blame',
'webpage_url': 'https://triller.co/@charlidamelio/video/46c6fcfa-aa9e-4503-a50c-68444f44cddc',
'uploader_url': 'https://triller.co/@cha... | ```suggestion
user_info = self._check_user_info(video_info.get('user') or {})
``` | 'track': 'Someone to Blame',
'webpage_url': 'https://triller.co/@charlidamelio/video/46c6fcfa-aa9e-4503-a50c-68444f44cddc',
'uploader_url': 'https://triller.co/@charlidamelio',
'comment_count': int,
}
}]
def _real_extract(self, url):
username, vid... | @@ -0,0 +1,309 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ format_field,
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtr... | yt_dlp/extractor/triller.py | 26 | Python | 0.643 | suggestion | 91 | 51 | 51 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
retry.error = e
continue
raise
if not video_list.get('videos'):
break
yield from video_list['videos']
query['before_time'] = traverse_obj(video_list, ('videos', -1, 'timestamp'))
if not qu... | ```suggestion
videos = self._extract_video_list(username, user_id)
```
why LazyList? | yield from video_list['videos']
query['before_time'] = traverse_obj(video_list, ('videos', -1, 'timestamp'))
if not query['before_time']:
break
def _entries(self, videos, username, user_info):
for video in videos:
yield self._parse_video_info(... | @@ -0,0 +1,309 @@
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ format_field,
+ int_or_none,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ url_basename,
+ ExtractorError,
+ LazyList,
+)
+
+
+class TrillerBaseIE(InfoExtr... | yt_dlp/extractor/triller.py | 26 | Python | 0.643 | refactor | 95 | 31 | 26 | false | [extractor/triller] Add Triller extractor | 4,712 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'uploader': 'Mimicc',
'timestamp': 1605580939,
'upload_date': '20201117',
'uploader_id': '5156321',
'thumbnail': 'https://cdn.medal.tv/5156321/thumbnail-36787208-360p.jpg?t=1080p&c=202046&missing',
'uploader_url': 'https://medal.tv/users/5156321',
... | ```suggestion
def _real_extract(self, url):
video_id, path = self._match_valid_url(url).group('id', 'path')
``` | 'uploader': 'Mimicc',
'timestamp': 1605580939,
'upload_date': '20201117',
'uploader_id': '5156321',
'thumbnail': 'https://cdn.medal.tv/5156321/thumbnail-36787208-360p.jpg?t=1080p&c=202046&missing',
'uploader_url': 'https://medal.tv/users/5156321',
... | @@ -39,25 +63,46 @@ class MedalTVIE(InfoExtractor):
'timestamp': 1605580939,
'upload_date': '20201117',
'uploader_id': '5156321',
+ 'thumbnail': 'https://cdn.medal.tv/5156321/thumbnail-36787208-360p.jpg?t=1080p&c=202046&missing',
+ 'uploader_url': 'https://me... | yt_dlp/extractor/medaltv.py | 26 | Python | 0.786 | refactor | 126 | 51 | 51 | false | [extractor/medaltv] Fix extraction and account for new url format | 4,739 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
'comment_count': int,
'view_count': int,
'like_count': int,
'duration': 9,
}
}, {
'url': 'https://medal.tv/games/valorant/clips/37rMeFpryCC-9',
'only_matching': True,
}, {
'url': 'https://medal.tv/games/valorant/clips/2WRj40tpY_EU9'... | the recommended way now is to use `_search_json` | 'comment_count': int,
'view_count': int,
'like_count': int,
'duration': 9,
}
}, {
'url': 'https://medal.tv/games/valorant/clips/37rMeFpryCC-9',
'only_matching': True,
}, {
'url': 'https://medal.tv/games/valorant/clips/2WRj40tpY_EU9'... | @@ -39,25 +63,46 @@ class MedalTVIE(InfoExtractor):
'timestamp': 1605580939,
'upload_date': '20201117',
'uploader_id': '5156321',
+ 'thumbnail': 'https://cdn.medal.tv/5156321/thumbnail-36787208-360p.jpg?t=1080p&c=202046&missing',
+ 'uploader_url': 'https://me... | yt_dlp/extractor/medaltv.py | 26 | Python | 0.286 | suggestion | 48 | 51 | 51 | false | [extractor/medaltv] Fix extraction and account for new url format | 4,739 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
'only_matching': True,
}]
@classmethod
def _match_path(cls, url):
return cls._match_valid_url(url).group('path')
def _real_extract(self, url):
video_id = self._match_id(url)
path = self._match_path(url)
webpage = self._download_webpage(url, video_id)
n... | ```suggestion
api_response = self._download_json(
f'https://medal.tv/_next/data/{build_id}/{locale}/{path}/{video_id}.json', video_id)
``` | 'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
path = self._match_valid_url(url).group('path')
webpage = self._download_webpage(url, video_id)
next_data = self._search_json(
'<script[^>]*__NEXT_DATA__[^>]*>', webpage,... | @@ -39,25 +63,46 @@ class MedalTVIE(InfoExtractor):
'timestamp': 1605580939,
'upload_date': '20201117',
'uploader_id': '5156321',
+ 'thumbnail': 'https://cdn.medal.tv/5156321/thumbnail-36787208-360p.jpg?t=1080p&c=202046&missing',
+ 'uploader_url': 'https://me... | yt_dlp/extractor/medaltv.py | 26 | Python | 0.714 | suggestion | 161 | 51 | 51 | false | [extractor/medaltv] Fix extraction and account for new url format | 4,739 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
@classmethod
def _match_path(cls, url):
return cls._match_valid_url(url).group('path')
def _real_extract(self, url):
video_id = self._match_id(url)
path = self._match_path(url)
webpage = self._download_webpage(url, video_id)
next_data = self._parse_json(self._sear... | This is fine; but fyi, the currently reccomended way is:
```suggestion
clip = traverse_obj(api_response, ('pageProps', 'clip')) or {}
``` |
def _real_extract(self, url):
video_id = self._match_id(url)
path = self._match_valid_url(url).group('path')
webpage = self._download_webpage(url, video_id)
next_data = self._search_json(
'<script[^>]*__NEXT_DATA__[^>]*>', webpage,
'next data', video_id, en... | @@ -39,25 +63,46 @@ class MedalTVIE(InfoExtractor):
'timestamp': 1605580939,
'upload_date': '20201117',
'uploader_id': '5156321',
+ 'thumbnail': 'https://cdn.medal.tv/5156321/thumbnail-36787208-360p.jpg?t=1080p&c=202046&missing',
+ 'uploader_url': 'https://me... | yt_dlp/extractor/medaltv.py | 26 | Python | 0.714 | suggestion | 148 | 51 | 51 | false | [extractor/medaltv] Fix extraction and account for new url format | 4,739 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
raise ValueError(f'invalid {name} time range "{regex}". Must be of the form *start-end')
continue
try:
chapters.append(re.compile(regex))
except re.error as err:
raise ValueError(f'invalid {name} regex "{regex}" - {err}')
... | ```suggestion
profile, container = profile.split(':', 1)
``` | raise ValueError(f'invalid {name} time range "{regex}". Must be of the form *start-end')
continue
try:
chapters.append(re.compile(regex))
except re.error as err:
raise ValueError(f'invalid {name} regex "{regex}" - {err}')
... | @@ -352,12 +353,16 @@ def parse_chapters(name, value):
if browser_name not in SUPPORTED_BROWSERS:
raise ValueError(f'unsupported browser specified for cookies: "{browser_name}". '
f'Supported browsers are: {", ".join(sorted(SUPPORTED_BROWSERS))}')
+ elif browse... | yt_dlp/__init__.py | 26 | Python | 0.571 | suggestion | 78 | 51 | 51 | false | Add optional firefox container selection to --cookies-from-browser | 4,753 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
container_id = None
if container is not None:
containers_path = os.path.join(search_root, 'containers.json')
if not os.path.isfile(containers_path) or not os.access(containers_path, os.R_OK):
raise FileNotFoundError(f'could not read containers.json in {search_root}')
with op... | Don't check for int here and None above. Use the same check in both places |
container_id = None
if container is not None:
containers_path = os.path.join(search_root, 'containers.json')
if not os.path.isfile(containers_path) or not os.access(containers_path, os.R_OK):
raise FileNotFoundError(f'could not read containers.json in {search_root}')
with op... | @@ -135,7 +155,13 @@ def _extract_firefox_cookies(profile, logger):
cursor = None
try:
cursor = _open_database_copy(cookie_database_path, tmpdir)
- cursor.execute('SELECT host, name, value, path, expiry, isSecure FROM moz_cookies')
+ if isinstance(container_id, int): | yt_dlp/cookies.py | 26 | Python | 0.286 | suggestion | 74 | 51 | 51 | false | Add optional firefox container selection to --cookies-from-browser | 4,753 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
container_id = context.get('userContextId')
break
elif context.get('l10nID'):
if re.match(r'userContext([^\.]+)\.label', context.get('l10nID')).group() == container:
container_id = context.get('userContextId')
break
... | In this case, load only cookies from "no container" | try_call(lambda: re.fullmatch(r'userContext([^\.]+)\.label', context['l10nID']).group())
)), None)
if not isinstance(container_id, int):
raise ValueError(f'could not find firefox container "{container}" in containers.json')
cookie_database_path = _find_most_recently_used_fil... | @@ -135,7 +155,13 @@ def _extract_firefox_cookies(profile, logger):
cursor = None
try:
cursor = _open_database_copy(cookie_database_path, tmpdir)
- cursor.execute('SELECT host, name, value, path, expiry, isSecure FROM moz_cookies')
+ if isinstance(container_id, int):... | yt_dlp/cookies.py | 26 | Python | 0.214 | suggestion | 51 | 51 | 51 | false | Add optional firefox container selection to --cookies-from-browser | 4,753 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
help='Do not retrieve video comments unless the extraction is known to be quick (Alias: --no-get-comments)')
filesystem.add_option(
'--load-info-json', '--load-info',
dest='load_info_filename', metavar='FILE',
help='JSON file containing the video information (created with the "--writ... | ```suggestion
'profile, separated by a ":".'))
```
that is implied | help='Do not retrieve video comments unless the extraction is known to be quick (Alias: --no-get-comments)')
filesystem.add_option(
'--load-info-json', '--load-info',
dest='load_info_filename', metavar='FILE',
help='JSON file containing the video information (created with the "--writ... | @@ -1399,15 +1399,17 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
help='Do not read/dump cookies from/to file (default)')
filesystem.add_option(
'--cookies-from-browser',
- dest='cookiesfrombrowser', metavar='BROWSER[+KEYRING][:PROFILE]',
+ dest='cookiesfromb... | yt_dlp/options.py | 26 | Python | 0.571 | suggestion | 81 | 51 | 51 | false | Add optional firefox container selection to --cookies-from-browser | 4,753 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
help='Do not retrieve video comments unless the extraction is known to be quick (Alias: --no-get-comments)')
filesystem.add_option(
'--load-info-json', '--load-info',
dest='load_info_filename', metavar='FILE',
help='JSON file containing the video information (created with the "--writ... | ```suggestion
'Optionally, a Firefox container name can be specified after the profile separated by a ":"'))
``` | help='Do not retrieve video comments unless the extraction is known to be quick (Alias: --no-get-comments)')
filesystem.add_option(
'--load-info-json', '--load-info',
dest='load_info_filename', metavar='FILE',
help='JSON file containing the video information (created with the "--writ... | @@ -1399,15 +1399,17 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
help='Do not read/dump cookies from/to file (default)')
filesystem.add_option(
'--cookies-from-browser',
- dest='cookiesfrombrowser', metavar='BROWSER[+KEYRING][:PROFILE]',
+ dest='cookiesfromb... | yt_dlp/options.py | 26 | Python | 0.714 | suggestion | 126 | 51 | 51 | false | Add optional firefox container selection to --cookies-from-browser | 4,753 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
'duration': 369,
'upload_date': '20141216',
}
}, {
'url': 'http://screencast-o-matic.com/player/c2lD3BeOP... | Avoid `.+?`. This can cause catastrophic backtracking, and also breaks if the page has multiple forms | 'ext': 'mp4',
'title': 'Welcome to 3-4 Philosophy @ DECV!',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
'duration': 369,
'upload_date': '20141216... | @@ -32,8 +34,29 @@ class ScreencastOMaticIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
+ password = self.get_param('videopassword')
webpage = self._download_webpage(
'https://screencast-o-matic.com/player/' + video_id, video_id)
+
+ i... | yt_dlp/extractor/screencastomatic.py | 26 | Python | 0.571 | suggestion | 101 | 30 | 51 | false | [screencastomatic] Add support for protected videos | 4,761 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shreyasminocha |
'ext': 'mp4',
'title': 'Welcome to 3-4 Philosophy @ DECV!',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
'duration': 369,
'upload_date': '20141216... | ```py
password = self.get_param('videopassword')
if not pasword:
raise ExtractorError(...)
...
``` | 'info_dict': {
'id': 'c2lD3BeOPl',
'ext': 'mp4',
'title': 'Welcome to 3-4 Philosophy @ DECV!',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
... | @@ -32,8 +34,29 @@ class ScreencastOMaticIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
+ password = self.get_param('videopassword')
webpage = self._download_webpage(
'https://screencast-o-matic.com/player/' + video_id, video_id)
+
+ i... | yt_dlp/extractor/screencastomatic.py | 26 | Python | 0.929 | refactor | 107 | 32 | 51 | false | [screencastomatic] Add support for protected videos | 4,761 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shreyasminocha |
from .common import InfoExtractor
from ..utils import (
get_element_by_class,
int_or_none,
remove_start,
strip_or_none,
unified_strdate,
)
class ScreencastOMaticIE(InfoExtractor):
_VALID_URL = r'https?://screencast-o-matic\.com/(?:(?:watch|player)/|embed\?.*?\bsc=)(?P<id>[0-9a-zA-Z]+)'
_TE... | ```suggestion
'https://screencast-o-matic.com/player/password', video_id, 'Logging in',
``` | }, {
'url': 'http://screencast-o-matic.com/player/c2lD3BeOPl',
'only_matching': True,
}, {
'url': 'http://screencast-o-matic.com/embed?ff=true&sc=cbV2r4Q5TL&fromPH=true&a=1',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
... | @@ -32,8 +34,29 @@ class ScreencastOMaticIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
+ password = self.get_param('videopassword')
webpage = self._download_webpage(
'https://screencast-o-matic.com/player/' + video_id, video_id)
+
+ i... | yt_dlp/extractor/screencastomatic.py | 26 | Python | 0.857 | suggestion | 113 | 49 | 47 | false | [screencastomatic] Add support for protected videos | 4,761 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shreyasminocha |
from .common import InfoExtractor
from ..utils import (
unescapeHTML
)
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-... | ```suggestion
from ..utils import unescapeHTML
``` | from .common import InfoExtractor
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-a-year-rex-lee-on-intrusive-apps_4661688.... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ unescapeHTML
+) | yt_dlp/extractor/epoch.py | 4 | Python | 0.571 | security | 52 | 29 | 29 | false | [extractor/epoch] Add extractor | 4,772 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | tejasa97 |
'url': 'https://vs1.youmaker.com/assets/276c7f46-3bbf-475d-9934-b9bbe827cf0a/playlist.m3u8',
'title': 'The Communist Party’s Cyberattacks on America Explained; Rex Lee Talks Tech Hybrid Warfare',
'webpage_url_domain': 'theepochtimes.com',
'extractor': 'Epo... | Why didn't just use `html_extract_title` ? | from .common import InfoExtractor
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-a-year-rex-lee-on-intrusive-apps_4661688.... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ unescapeHTML
+)
+
+
+class EpochIE(InfoExtractor):
+ _VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
+ _TESTS = [
+ {
+ 'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-s... | yt_dlp/extractor/epoch.py | 26 | Python | 0.286 | refactor | 42 | 36 | 47 | false | [extractor/epoch] Add extractor | 4,772 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | tejasa97 |
{
'url': 'https://www.theepochtimes.com/kash-patel-a-6-year-saga-of-government-corruption-from-russiagate-to-mar-a-lago_4690250.html',
'info_dict': {
'id': '4690250',
'ext': 'mp4',
'url': 'http://vs1.youmaker.com/assets/aa9ceecd-a127-453d-a... | Use single quote
```suggestion
'id': video_id,
'ext': 'mp4',
'url': f'http://vs1.youmaker.com/assets/{youmaker_video_id}/playlist.m3u8',
``` | from .common import InfoExtractor
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-a-year-rex-lee-on-intrusive-apps_4661688.... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ unescapeHTML
+)
+
+
+class EpochIE(InfoExtractor):
+ _VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
+ _TESTS = [
+ {
+ 'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-s... | yt_dlp/extractor/epoch.py | 26 | Python | 0.786 | suggestion | 181 | 29 | 47 | false | [extractor/epoch] Add extractor | 4,772 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | tejasa97 |
from .common import InfoExtractor
from ..utils import (
unescapeHTML
)
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-... | ```suggestion
'id': '4661688',
``` | from .common import InfoExtractor
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-a-year-rex-lee-on-intrusive-apps_4661688.... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ unescapeHTML
+)
+
+
+class EpochIE(InfoExtractor):
+ _VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
+ _TESTS = [
+ {
+ 'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-s... | yt_dlp/extractor/epoch.py | 13 | Python | 0.571 | suggestion | 52 | 38 | 38 | false | [extractor/epoch] Add extractor | 4,772 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | tejasa97 |
from .common import InfoExtractor
from ..utils import (
unescapeHTML
)
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-... | ```suggestion
'title': '‘They Can Do Audio, Video, Physical Surveillance on You 24H/365D a Year’: Rex Lee on Intrusive Apps',
```
Same below | from .common import InfoExtractor
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-a-year-rex-lee-on-intrusive-apps_4661688.... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ unescapeHTML
+)
+
+
+class EpochIE(InfoExtractor):
+ _VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
+ _TESTS = [
+ {
+ 'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-s... | yt_dlp/extractor/epoch.py | 19 | Python | 0.714 | suggestion | 159 | 44 | 44 | false | [extractor/epoch] Add extractor | 4,772 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejasa97 |
{
'url': 'https://www.theepochtimes.com/kash-patel-a-6-year-saga-of-government-corruption-from-russiagate-to-mar-a-lago_4690250.html',
'info_dict': {
'id': '4690250',
'ext': 'mp4',
'url': 'http://vs1.youmaker.com/assets/aa9ceecd-a127-453d-a... | Use `_extract_m3u8_formats_and_subtitles` | from .common import InfoExtractor
class EpochIE(InfoExtractor):
_VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
_TESTS = [
{
'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-a-year-rex-lee-on-intrusive-apps_4661688.... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ unescapeHTML
+)
+
+
+class EpochIE(InfoExtractor):
+ _VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html'
+ _TESTS = [
+ {
+ 'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-s... | yt_dlp/extractor/epoch.py | 26 | Python | 0.286 | refactor | 41 | 29 | 47 | false | [extractor/epoch] Add extractor | 4,772 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejasa97 |
import json
from datetime import datetime
from .common import InfoExtractor
from ..utils import parse_duration
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is... | ```suggestion
json_info = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_showreel']
```
| from .common import InfoExtractor
from ..utils import parse_iso8601, traverse_obj, try_call
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Bev... | @@ -0,0 +1,79 @@
+import json
+from datetime import datetime
+from .common import InfoExtractor
+from ..utils import parse_duration
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanusta... | yt_dlp/extractor/prankcast.py | 25 | Python | 0.714 | suggestion | 130 | 50 | 50 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | columndeeply |
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-back-like-a-heart-attack-',
'info_dict': {
'id': '1561',
'ext': 'mp3',
'title': 'Beverly is back like a heart attack!',
'uploader': 'Devonanustart',
'upload_date': '20220825'
... | This block of code can rewritten something like:
``` var = json_info.get('key')``` | 'id': '1561',
'ext': 'mp3',
'title': 'Beverly is back like a heart attack!',
'display_id': 'Beverly-is-back-like-a-heart-attack-',
'timestamp': 1661391575,
'uploader': 'Devonanustart',
'channel_id': 4,
'duration': 7918,
... | @@ -0,0 +1,79 @@
+import json
+from datetime import datetime
+from .common import InfoExtractor
+from ..utils import parse_duration
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanusta... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.571 | suggestion | 83 | 51 | 41 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | columndeeply |
end_date = None
if 'end_date' in json_info['props']['pageProps']['ssr_data_showreel']:
end_date = json_info['props']['pageProps']['ssr_data_showreel']['end_date'].replace('Z', '')
# Get broadcast date
upload_date = None
if start_date is not None:
upload_... | I think `_parse_json` can be used here instead of `json.loads`. But i think `json_info['props']['pageProps']['ssr_data_showreel']['guests_json']` already in json, no ? | from .common import InfoExtractor
from ..utils import parse_iso8601, traverse_obj, try_call
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Bev... | @@ -0,0 +1,79 @@
+import json
+from datetime import datetime
+from .common import InfoExtractor
+from ..utils import parse_duration
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanusta... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.571 | question | 167 | 44 | 50 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | columndeeply |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
# Extract the JSON
json_info = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_showreel']
# Get the broadcast URL and the recordi... | Please correct me if i'm wrong, i think `start_date` and `end_date` can parsed with `parse_iso8601` from `utils` | 'duration': 7918,
'cast': ['Devonanustart', 'Phonelosers'],
'description': '',
'categories': ['prank'],
'tags': ['prank call', 'prank'],
'upload_date': '20220825'
}
}]
def _real_extract(self, url):
video_id, display_id = se... | @@ -0,0 +1,77 @@
+from datetime import datetime
+from .common import InfoExtractor
+from ..utils import parse_duration
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanustart/showreel/1... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.5 | bug | 112 | 51 | 34 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | columndeeply |
from .common import InfoExtractor
from ..utils import parse_iso8601
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)(?P<display_id>.+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-back-like-a-heart-attack-',... | You can change this line like this:'
```python
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
``` | from .common import InfoExtractor
from ..utils import parse_iso8601, traverse_obj, try_call
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Bev... | @@ -17,7 +16,9 @@ class PrankCastIE(InfoExtractor):
}]
def _real_extract(self, url):
- video_id = self._match_id(url)
+ match = self._match_valid_url(url).groupdict()
+ video_id, display_id = match['id'], match['display_id'] | yt_dlp/extractor/prankcast.py | 20 | Python | 0.786 | suggestion | 129 | 45 | 45 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | columndeeply |
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-back-like-a-heart-attack-',
'info_dict': {
'id': '1561',
'ext': ... | I think this should fatal. fstring is more preferred than `+` sign. I think you can rewrite it like this :
```suggestion
url = f'{json_info["broadcast_url"]}{json_info["recording_hash"]}.mp3'
```
Even better, you can inline this at return | class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-back-like-a-heart-attack-',
'info_dict': {
'id': '1561',
... | @@ -0,0 +1,71 @@
+from .common import InfoExtractor
+from ..utils import parse_iso8601
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-b... | yt_dlp/extractor/prankcast.py | 26 | Python | 1 | suggestion | 250 | 51 | 46 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | columndeeply |
# Extract the JSON
json_info = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_showreel']
# Get the broadcast URL and the recording hash.
# The full URL is {broadcast_url}/{recording_hash}.mp3
broadcast_url = json_info.get('broadcast_url')
re... | I think list comperhension can be used here | 'upload_date': '20220825'
}
}]
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
webpage = self._download_webpage(url, video_id)
json_info = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ss... | @@ -0,0 +1,71 @@
+from .common import InfoExtractor
+from ..utils import parse_iso8601
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-b... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.143 | suggestion | 43 | 51 | 29 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | columndeeply |
'upload_date': '20220825'
}
}]
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
webpage = self._download_webpage(url, video_id)
# Extract the JSON
json_info = self._search_nextjs_data(webpage, video_i... | This can be rewritten as:
```suggestion
guests = [] if not uploader else [uploader]
```
probably, you can use list comperhension for guest value | 'timestamp': 1661391575,
'uploader': 'Devonanustart',
'channel_id': 4,
'duration': 7918,
'cast': ['Devonanustart', 'Phonelosers'],
'description': '',
'categories': ['prank'],
'tags': ['prank call', 'prank'],
'upl... | @@ -0,0 +1,71 @@
+from .common import InfoExtractor
+from ..utils import parse_iso8601
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-b... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.786 | suggestion | 160 | 51 | 37 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | columndeeply |
from .common import InfoExtractor
from ..utils import parse_iso8601
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-back-like-a-heart-attack-'... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)'
``` | from .common import InfoExtractor
from ..utils import parse_iso8601, traverse_obj, try_call
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Bev... | @@ -0,0 +1,55 @@
+from .common import InfoExtractor
+from ..utils import parse_iso8601
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)' | yt_dlp/extractor/prankcast.py | 6 | Python | 0.857 | suggestion | 126 | 31 | 31 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | columndeeply |
from .common import InfoExtractor
from ..utils import parse_iso8601
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-back-like-a-heart-attack-'... | Unnecessary comment. Same below | from .common import InfoExtractor
from ..utils import parse_iso8601, traverse_obj, try_call
class PrankCastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Bev... | @@ -0,0 +1,55 @@
+from .common import InfoExtractor
+from ..utils import parse_iso8601
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-b... | yt_dlp/extractor/prankcast.py | 23 | Python | 0.071 | suggestion | 31 | 48 | 48 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | columndeeply |
_VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-back-like-a-heart-attack-',
'info_dict': {
'id': '1561',
'ext': 'mp3',
'title': 'Bever... | ```suggestion
guests = list(filter(None, [uploader] + traverse_obj(guests_json, (..., 'name'))))
``` | _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)'
_TESTS = [{
'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-back-like-a-heart-attack-',
'info_dict': {
'id': '1561',
'ext': 'mp3',
'titl... | @@ -0,0 +1,55 @@
+from .common import InfoExtractor
+from ..utils import parse_iso8601
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-b... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.714 | suggestion | 110 | 51 | 45 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | columndeeply |
}
}]
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
webpage = self._download_webpage(url, video_id)
# Extract the JSON
json_info = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_sho... | ```suggestion
parsed_duration = try_call(lambda: parse_iso8601(json_info['end_date']) - start_date)
``` | 'uploader': 'Devonanustart',
'channel_id': 4,
'duration': 7918,
'cast': ['Devonanustart', 'Phonelosers'],
'description': '',
'categories': ['prank'],
'tags': ['prank call', 'prank'],
'upload_date': '20220825'
}
}... | @@ -0,0 +1,55 @@
+from .common import InfoExtractor
+from ..utils import parse_iso8601
+
+
+class PrankCastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prankcast\.com/.*/showreel/(?P<id>\d+)-(?P<display_id>.+)'
+ _TESTS = [{
+ 'url': 'https://prankcast.com/Devonanustart/showreel/1561-Beverly-is-b... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.714 | suggestion | 113 | 42 | 36 | false | [extractor/prankcast] Add extractor | 4,774 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | columndeeply |
}, {
'id': 'orig',
'url': thumbnail,
'ext': 'jpg',
'preference': 1,
}] if thumbnail else None,
}
class IslamChannelSeriesIE(InfoExtractor):
_VALID_URL = r'https?://watch\.islamchannel\.tv/series/(?P<id>[a-f\d-]+)'
... | looks suitable for `playlist_from_matches` | }, {
'id': 'orig',
'url': thumbnail,
'ext': 'jpg',
'preference': 1,
}] if thumbnail else None,
}
class IslamChannelSeriesIE(InfoExtractor):
_VALID_URL = r'https?://watch\.islamchannel\.tv/series/(?P<id>[a-f\d-]+)'
... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj, urljoin
+
+
+class IslamChannelIE(InfoExtractor):
+ _VALID_URL = r'https?://watch\.islamchannel\.tv/watch/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://watch.islamchannel.tv/watch/38604310',
+ 'info_di... | yt_dlp/extractor/islamchannel.py | 26 | Python | 0.214 | suggestion | 42 | 27 | 27 | false | [extractor/IslamChannel] Add extractors | 4,779 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
if res is None:
msg = f'Failed to extract {name}: Could not parse value {v!r}'
if fatal:
raise ExtractorError(msg)
else:
self.report_warning(msg)
return res
def _set_cookie(self, domain, name, value, expire_time=None, port=None,
... | `;` is a valid character in a `quoted-string` cookie value.
```
>>> http.cookies.SimpleCookie('''chips="a;hoy"; vienna=finger''')
<SimpleCookie: chips='a;hoy' vienna='finger'>
>>>
```
Check https://github.com/python/cpython/blob/3.10/Lib/http/cookies.py for what is currently being done (and has been for 22 years... | msg = f'Failed to extract {name}: Could not parse value {v!r}'
if fatal:
raise ExtractorError(msg)
else:
self.report_warning(msg)
return res
def _set_cookie(self, domain, name, value, expire_time=None, port=None,
path='... | @@ -3633,7 +3633,23 @@ def _set_cookie(self, domain, name, value, expire_time=None, port=None,
def _get_cookies(self, url):
""" Return a http.cookies.SimpleCookie with the cookies for the url """
- return http.cookies.SimpleCookie(self._downloader._calc_cookies(url))
+ raw_cookie = self._d... | yt_dlp/extractor/common.py | 26 | Python | 0.857 | suggestion | 1,194 | 51 | 51 | false | Manually parse cookies | 4,780 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | Grub4K |
'userAgent': 'com.google.ios.youtube/17.33.2 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)'
}
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 5,
'REQUIRE_JS_PLAYER': False
},
'ios_embedded': {
'INNERTUBE_CONTEXT': {
'client': {
'clientNam... | might as well add in `deviceModel` for these other ones too | 'userAgent': 'com.google.ios.youtube/17.33.2 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)'
}
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 5,
'REQUIRE_JS_PLAYER': False
},
'ios_embedded': {
'INNERTUBE_CONTEXT': {
'client': {
'clientNam... | @@ -189,7 +189,8 @@
'INNERTUBE_CONTEXT': {
'client': {
'clientName': 'IOS_MUSIC',
- 'clientVersion': '5.18',
+ 'clientVersion': '5.21',
+ 'userAgent': 'com.google.ios.youtubemusic/5.21 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)' | yt_dlp/extractor/youtube.py | 26 | Python | 0.357 | suggestion | 59 | 51 | 51 | false | [youtube] Bump iOS clients versions & Add Creator/Music apps UA | 4,792 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | SamantazFox |
'duration': 4000.99,
'uploader': 'Sue Perkins: An hour or so with...',
'uploader_url': r're:https?://(?:www\.)?audioboom\.com/channel/perkins',
}
}, { # Direct mp3-file link
'url': 'https://audioboom.com/posts/8128496.mp3',
'md5': 'e329edf304d450def95c7f8... | ```suggestion
webpage = self._download_webpage(f'https://audioboom.com/posts/{video_id}', video_id)
``` | 'description': 'md5:0ed714ae0e81e5d9119cac2f618ad679',
'duration': 4000.99,
'uploader': 'Sue Perkins: An hour or so with...',
'uploader_url': r're:https?://(?:www\.)?audioboom\.com/channel/perkins',
}
}, { # Direct mp3-file link
'url': 'https://audiob... | @@ -27,14 +40,15 @@ class AudioBoomIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
- webpage = self._download_webpage(url, video_id)
+ webpage = self._download_webpage(
+ 'https://audioboom.com/posts/' + video_id, video_id) | yt_dlp/extractor/audioboom.py | 26 | Python | 0.714 | suggestion | 113 | 51 | 45 | false | [extractor/audioboom] Sanitize webpage URL before downloading | 4,803 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
'md5': 'e329edf304d450def95c7f86a9165ee1',
'info_dict': {
'id': '8128496',
'ext': 'mp3',
'title': 'TCRNo8 / DAILY 03 - In Control',
'description': 'md5:44665f142db74858dfa21c5b34787948',
'duration': 1689.7,
'uploader': 'Lost Dot Pod... | ```suggestion
r'data-react-class="V5DetailPagePlayer"\s*data-react-props=(["\'])(?P<json>{.+?})\1',
``` | 'url': 'https://audioboom.com/posts/8128496.mp3',
'md5': 'e329edf304d450def95c7f86a9165ee1',
'info_dict': {
'id': '8128496',
'ext': 'mp3',
'title': 'TCRNo8 / DAILY 03 - In Control',
'description': 'md5:44665f142db74858dfa21c5b34787948',
... | @@ -27,14 +40,15 @@ class AudioBoomIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
- webpage = self._download_webpage(url, video_id)
+ webpage = self._download_webpage(
+ 'https://audioboom.com/posts/' + video_id, video_id)
clip = None
... | yt_dlp/extractor/audioboom.py | 26 | Python | 0.714 | suggestion | 121 | 51 | 39 | false | [extractor/audioboom] Sanitize webpage URL before downloading | 4,803 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
containers_path = os.path.join(os.path.dirname(cookie_database_path), 'containers.json')
if not os.path.isfile(containers_path) or not os.access(containers_path, os.R_OK):
raise FileNotFoundError(f'could not read containers.json in {search_root}')
with open(containers_path, 'r') as c... | since originAttributes still may contain other values (ref: https://searchfox.org/mozilla-central/source/caps/OriginAttributes.cpp#205-240), what about something like:
```suggestion
cursor.execute(
'SELECT host, name, value, path, expiry, isSecure FROM moz_cookies WHERE NOT INSTR(... | containers_path = os.path.join(os.path.dirname(cookie_database_path), 'containers.json')
if not os.path.isfile(containers_path) or not os.access(containers_path, os.R_OK):
raise FileNotFoundError(f'could not read containers.json in {search_root}')
with open(containers_path, 'r') as c... | @@ -142,26 +147,21 @@ def _extract_firefox_cookies(profile, container, logger):
if not isinstance(container_id, int):
raise ValueError(f'could not find firefox container "{container}" in containers.json')
- cookie_database_path = _find_most_recently_used_file(search_root, 'cookies.sqlite', lo... | yt_dlp/cookies.py | 26 | Python | 0.857 | suggestion | 361 | 51 | 51 | false | Revert default behavior of --cookies-from-browser and firefox | 4,806 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | bashonly |
help='Write all fields to the infojson')
filesystem.add_option(
'--write-comments', '--get-comments',
action='store_true', dest='getcomments', default=False,
help=(
'Retrieve video comments to be placed in the infojson. '
'The comments are fetched even without... | in my opinion this line should be reverted, because otherwise it's not clear that 'BROWSER:CONTAINER' doesn't work (I haven't tested this PR, but I'm guessing that that wouldn't work) | help='Write all fields to the infojson')
filesystem.add_option(
'--write-comments', '--get-comments',
action='store_true', dest='getcomments', default=False,
help=(
'Retrieve video comments to be placed in the infojson. '
'The comments are fetched even without... | @@ -1400,12 +1400,14 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs):
help='Do not read/dump cookies from/to file (default)')
filesystem.add_option(
'--cookies-from-browser',
- dest='cookiesfrombrowser', metavar='BROWSER[+KEYRING][:PROFILE[:CONTAINER]]',
+ dest='... | yt_dlp/options.py | 26 | Python | 0.429 | suggestion | 183 | 51 | 51 | false | Revert default behavior of --cookies-from-browser and firefox | 4,806 | yt-dlp/yt-dlp | 132,642 | Python | gamer191 | bashonly |
'timestamp': 1661152289,
},
'params': {'format': 'ba[ext=mp3]'}
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.rova.nz/home/podcasts/socrates-walks-into-a-bar/the-trolley-problem---episode-1.html',
'info_dict': {
'id': 'VID02494',
'ext': 'mp4',
... | ```suggestion
for mobj in re.finditer(
rf'''(?x)<div\s+\bid=["']Player-Attributes-JWID[^>]+\b
data-request-url=["']{cls._VALID_URL_BASE_RE}["'][^>]+\b
data-asset-id=["']{cls._VALID_URL_ID_RE}["']''', webpage
):
``` | 'timestamp': 1661152289,
},
'params': {'format': 'ba[ext=mp3]'}
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.rova.nz/home/podcasts/socrates-walks-into-a-bar/the-trolley-problem---episode-1.html',
'info_dict': {
'id': 'VID02494',
'ext': 'mp4',
... | @@ -0,0 +1,105 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ float_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class MediaWorksNZVODIE(InfoExtractor):
+ _VALID_URL_BASE_RE = r'https?://vodupload-api\.mediaworks\.nz/library/asset/published/'
+... | yt_dlp/extractor/mediaworksnz.py | 26 | Python | 0.786 | suggestion | 272 | 51 | 51 | false | [extractor/mediaworksnz] Add MediaWorksNZVOD extractor | 4,817 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'id': 'VID02494',
'ext': 'mp4',
'title': 'The Trolley Problem',
'duration': 2843.56,
'channel': 'Other',
'timestamp': 1658356489,
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'Socrates Walks Into A Bar Podcast Episo... | ```suggestion
if asset.get('drm') not in ('NonDRM', None):
``` | 'id': 'VID02494',
'ext': 'mp4',
'title': 'The Trolley Problem',
'duration': 2843.56,
'channel': 'Other',
'timestamp': 1658356489,
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'Socrates Walks Into A Bar Podcast Episo... | @@ -0,0 +1,105 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ float_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class MediaWorksNZVODIE(InfoExtractor):
+ _VALID_URL_BASE_RE = r'https?://vodupload-api\.mediaworks\.nz/library/asset/published/'
+... | yt_dlp/extractor/mediaworksnz.py | 26 | Python | 0.571 | suggestion | 72 | 51 | 51 | false | [extractor/mediaworksnz] Add MediaWorksNZVOD extractor | 4,817 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
content_type = asset.get('type')
if content_type and content_type != 'video':
self.report_warning(f'Unknown content type: {content_type}' + bug_reports_message(), video_id)
formats, subtitles = self._extract_m3u8_formats_and_subtitles(asset['streamingUrl'], video_id)
audio_... | ```suggestion
'thumbnails': [{'url': thumbnail_url} for thumbnail_url in asset.get('thumbnails') or []],
``` | content_type = asset.get('type')
if content_type and content_type != 'video':
self.report_warning(f'Unknown content type: {content_type}' + bug_reports_message(), video_id)
formats, subtitles = self._extract_m3u8_formats_and_subtitles(asset['streamingUrl'], video_id)
audio_... | @@ -0,0 +1,105 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ float_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class MediaWorksNZVODIE(InfoExtractor):
+ _VALID_URL_BASE_RE = r'https?://vodupload-api\.mediaworks\.nz/library/asset/published/'
+... | yt_dlp/extractor/mediaworksnz.py | 26 | Python | 0.714 | suggestion | 122 | 30 | 30 | false | [extractor/mediaworksnz] Add MediaWorksNZVOD extractor | 4,817 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
}]
@classmethod
def _extract_embed_urls(cls, url, webpage):
for mobj in re.finditer(
rf'''(?x)<div\s+\bid=["']Player-Attributes-JWID[^>]+\b
data-request-url=["']{cls._VALID_URL_BASE_RE}["'][^>]+\b
data-asset-id=["']{cls._VALID_URL_ID_RE}["']''', webpage
)... | ```suggestion
asset, 'palyoutPathAudio', 'playoutpathaudio', expected_type=str)
```
get_all is not doing anything here:
```
traverse_obj(obj, A, B) => dict_get(obj, ('A', 'B')) => obj.get('A') or obj.get('B')
``` | }]
@classmethod
def _extract_embed_urls(cls, url, webpage):
for mobj in re.finditer(
rf'''(?x)<div\s+\bid=["']Player-Attributes-JWID[^>]+\b
data-request-url=["']{cls._VALID_URL_BASE_RE}["'][^>]+\b
data-asset-id=["']{cls._VALID_URL_ID_RE}["']''', webpage
)... | @@ -0,0 +1,105 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ float_or_none,
+ traverse_obj,
+ unified_timestamp,
+)
+
+
+class MediaWorksNZVODIE(InfoExtractor):
+ _VALID_URL_BASE_RE = r'https?://vodupload-api\.mediaworks\.nz/library/asset/published/'
+... | yt_dlp/extractor/mediaworksnz.py | 26 | Python | 0.929 | suggestion | 232 | 48 | 48 | false | [extractor/mediaworksnz] Add MediaWorksNZVOD extractor | 4,817 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'description': 'a JV Webinars video',
'upload_date': '20160518',
'timestamp': 1463607249,
'duration': 4987.11,
},
}, {
'url': 'wistia:sh7fpupwlt',
'only_matching': True,
}, {
'url': 'http://fast.wistia.net/embed/iframe/sh7fpupwlt',
... | Why does this need to be a separate extractor? | yield from re.finditer(
r'''(?sx)
<(?:div|section)[^>]+class=([\"'])(?:(?!\1).)*?(?P<type>wistia[a-z_0-9]+)\s*\bwistia_async_(?P<id>[a-z0-9]{10})\b(?:(?!\1).)*?\1
''', webpage)
@classmethod
def _extract_url_media_id(cls, url):
mobj = re.search(r'(?:wmedia... | @@ -145,17 +152,74 @@ class WistiaIE(WistiaBaseIE):
'only_matching': True,
}]
- # https://wistia.com/support/embed-and-share/video-on-your-website
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ embed_config = self._download_embed_config('medias', video_id, url)
+ ... | yt_dlp/extractor/wistia.py | 26 | Python | 0.143 | refactor | 46 | 51 | 51 | false | [extractor/wistia] Add support for channels | 4,819 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
# link to popup video, follow --no-playlist
'url': 'https://fast.wistia.net/embed/channel/3802iirk0l?wchannelid=3802iirk0l&wmediaid=sp5dqjzw3n',
'info_dict': {
'id': 'sp5dqjzw3n',
'ext': 'bin',
'title': 'The Roof S2: The Modern CRO',
'thumbnail': '... | `self._yes_playlist` is made to standardize these messages | 'url': 'https://fast.wistia.net/embed/channel/yvyvu7wjbg?wchannelid=yvyvu7wjbg',
'info_dict': {
'id': 'yvyvu7wjbg',
'title': 'Copysmith Tutorials and Education!',
'description': 'Learn all things Copysmith via short and informative videos!'
},
'playlis... | @@ -202,3 +261,74 @@ def _real_extract(self, url):
entries.append(self._extract_media(embed_config))
return self.playlist_result(entries, playlist_id)
+
+
+class WistiaChannelIE(WistiaBaseIE):
+ _VALID_URL = r'(?:wistiachannel:|%schannel/)%s' % (WistiaBaseIE._VALID_URL_BASE, WistiaBaseIE._VAL... | yt_dlp/extractor/wistia.py | 26 | Python | 0.357 | suggestion | 58 | 49 | 51 | false | [extractor/wistia] Add support for channels | 4,819 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
def _real_extract(self, url):
channel_id = self._match_id(url)
params = parse_qs(url)
media_id = traverse_obj(params, ('wmediaid', 0))
if not self._yes_playlist(channel_id, media_id, playlist_label='channel'):
return self.url_result(f'wistia:{media_id}', 'Wistia')
... | ```suggestion
entries = [
self.url_result(f'wistia:{video["hashedId"]}', WistiaIE, title=video.get('name'))
for video in traverse_obj(series, ('sections', ..., 'videos', ...)) or []
if video.get('hashedId')
]
``` | }]
_WEBPAGE_TESTS = [{
'url': 'https://www.profitwell.com/recur/boxed-out',
'info_dict': {
'id': '6jyvmqz6zs',
'title': 'Boxed Out',
'description': 'md5:14a8a93a1dbe236718e6a59f8c8c7bae',
},
'playlist_mincount': 30,
}, {
# section i... | @@ -202,3 +250,103 @@ def _real_extract(self, url):
entries.append(self._extract_media(embed_config))
return self.playlist_result(entries, playlist_id)
+
+
+class WistiaChannelIE(WistiaBaseIE):
+ _VALID_URL = r'(?:wistiachannel:|%schannel/)%s' % (WistiaBaseIE._VALID_URL_BASE, WistiaBaseIE._VA... | yt_dlp/extractor/wistia.py | 26 | Python | 0.786 | suggestion | 261 | 38 | 51 | false | [extractor/wistia] Add support for channels | 4,819 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
yield {
'id': str(item['id']),
'title': item.get('title'),
'description': item.get('description'),
'formats': formats,
'subtitles': subtitle,
'duration': parse_duration(item.get('durat... | ```suggestion
str(nextjs_json['id']),
title=nextjs_json.get('title') or self._html_search_meta(['title', 'og:title', 'twitter:title'], webpage),
description=nextjs_json.get('description') or self._html_search_meta(['description', 'twitter:description', 'og:description'], webpage),... | 'timestamp': 1660625449,
'upload_date': '20220816',
'thumbnail': 'https://cdn.nos.nl/image/2022/08/16/888178/1024x576a.jpg',
},
'playlist_count': 2,
}
]
def _entries(self, nextjs_json, display_id):
for item in nextjs_json['... | @@ -0,0 +1,70 @@
+from .common import InfoExtractor
+from ..utils import parse_duration, parse_iso8601, traverse_obj
+
+
+class NOSNLArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://nos\.nl/((?!video)(\w+/)?\w+/)\d+-(?P<display_id>[\w-]+)'
+ _TESTS = [
+ {
+ # only 1 video
+ 'url':... | yt_dlp/extractor/nosnl.py | 26 | Python | 0.786 | suggestion | 325 | 28 | 51 | false | [extractor/nos.nl] Add extractor | 4,822 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'id': str(item['id']),
'title': item.get('title'),
'description': item.get('description'),
'formats': formats,
'subtitles': subtitle,
'duration': parse_duration(item.get('duration')),
... |
Why is there no tests for tags/timestamp? | 'upload_date': '20220816',
'thumbnail': 'https://cdn.nos.nl/image/2022/08/16/888178/1024x576a.jpg',
},
'playlist_count': 2,
}
]
def _entries(self, nextjs_json, display_id):
for item in nextjs_json['items']:
if item.get('type') ... | @@ -0,0 +1,70 @@
+from .common import InfoExtractor
+from ..utils import parse_duration, parse_iso8601, traverse_obj
+
+
+class NOSNLArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://nos\.nl/((?!video)(\w+/)?\w+/)\d+-(?P<display_id>[\w-]+)'
+ _TESTS = [
+ {
+ # only 1 video
+ 'url':... | yt_dlp/extractor/nosnl.py | 26 | Python | 0.071 | question | 43 | 27 | 51 | false | [extractor/nos.nl] Add extractor | 4,822 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'title': '\'We hebben een huis vol met scheuren\'',
'duration': 95.0,
}
}, {
# more than 1 video
'url': 'https://nos.nl/artikel/2440409-vannacht-sliepen-weer-enkele-honderden-asielzoekers-in-ter-apel-buiten',
'info_dict': {
... | ```suggestion
for item in nextjs_json['items']:
``` | 'title': '\'We hebben een huis vol met scheuren\'',
'duration': 95.0,
'thumbnail': 'https://cdn.nos.nl/image/2022/08/12/887149/3840x2160a.jpg',
}
}, {
# more than 1 video
'url': 'https://nos.nl/artikel/2440409-vannacht-sliepen-w... | @@ -0,0 +1,70 @@
+from .common import InfoExtractor
+from ..utils import parse_duration, parse_iso8601, traverse_obj
+
+
+class NOSNLArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://nos\.nl/((?!video)(\w+/)?\w+/)\d+-(?P<display_id>[\w-]+)'
+ _TESTS = [
+ {
+ # only 1 video
+ 'url':... | yt_dlp/extractor/nosnl.py | 26 | Python | 0.571 | suggestion | 61 | 51 | 51 | false | [extractor/nos.nl] Add extractor | 4,822 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
}
]
def _get_video_thumbnails(self, image_data):
thumb_data = []
for image in image_data.get('16:9') or []:
thumb_data.append({
'url': traverse_obj(image, ('url', ...), get_all=False),
'width': image.get('width'),
'height': ima... | ```suggestion
'thumbnails': [{
'url': traverse_obj(image, ('url', ...), get_all=False),
'width': image.get('width'),
'height': image.get('height')
} for image in traverse_obj(item, ('imagesByRatio', ...)... | }
]
def _entries(self, nextjs_json, display_id):
for item in nextjs_json['items']:
if item.get('type') == 'video':
formats, subtitle = self._extract_m3u8_formats_and_subtitles(
traverse_obj(item, ('source', 'url')), display_id, ext='mp4')
... | @@ -0,0 +1,101 @@
+from .common import InfoExtractor
+from ..utils import parse_duration, parse_iso8601, traverse_obj
+
+
+class NOSNLArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://nos\.nl/((?!video)(\w+/)?\w+/)\d+-(?P<display_id>[\w-]+)'
+ _TESTS = [
+ {
+ # only 1 video
+ 'url'... | yt_dlp/extractor/nosnl.py | 26 | Python | 0.786 | suggestion | 328 | 51 | 48 | false | [extractor/nos.nl] Add extractor | 4,822 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
yield {
'id': str(item['id']),
'title': item.get('title'),
'description': item.get('description'),
'formats': formats,
'subtitles': subtitle,
'duration': parse_duration(item.get('durat... | Conventionally, the name `_entries` is used | 'height': image.get('height')
} for image in traverse_obj(item, ('imagesByRatio', ...))[0]],
}
elif item.get('type') == 'audio':
yield {
'id': str(item['id']),
'title': item.get('title'),
... | @@ -0,0 +1,101 @@
+from .common import InfoExtractor
+from ..utils import parse_duration, parse_iso8601, traverse_obj
+
+
+class NOSNLArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://nos\.nl/((?!video)(\w+/)?\w+/)\d+-(?P<display_id>[\w-]+)'
+ _TESTS = [
+ {
+ # only 1 video
+ 'url'... | yt_dlp/extractor/nosnl.py | 26 | Python | 0.286 | style | 43 | 36 | 30 | false | [extractor/nos.nl] Add extractor | 4,822 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'modified_timestamp': 1660452773,
'modified_date': '20220814',
'upload_date': '20220813',
'thumbnail': 'https://cdn.nos.nl/image/2022/07/18/880346/1024x576a.jpg',
'timestamp': 1660401384,
},
'playlist_count': 2,
... | ```suggestion
def _entries(self, nextjs_json, display_id):
``` | 'modified_timestamp': 1660452773,
'modified_date': '20220814',
'upload_date': '20220813',
'thumbnail': 'https://cdn.nos.nl/image/2022/07/18/880346/1024x576a.jpg',
'timestamp': 1660401384,
},
'playlist_count': 2,
... | @@ -0,0 +1,95 @@
+from .common import InfoExtractor
+from ..utils import parse_duration, parse_iso8601, traverse_obj
+
+
+class NOSNLArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://nos\.nl/((?!video)(\w+/)?\w+/)\d+-(?P<display_id>[\w-]+)'
+ _TESTS = [
+ {
+ # only 1 video
+ 'url':... | yt_dlp/extractor/nosnl.py | 26 | Python | 0.571 | suggestion | 68 | 51 | 51 | false | [extractor/nos.nl] Add extractor | 4,822 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'formats': formats,
'subtitles': subtitle,
'duration': parse_duration(item.get('duration')),
'thumbnails': [{
'url': traverse_obj(image, ('url', ...), get_all=False),
'width': image.get('width... | ```suggestion
'entries': self._entries(nextjs_json, display_id),
``` | 'formats': formats,
'subtitles': subtitle,
'duration': parse_duration(item.get('duration')),
'thumbnails': [{
'url': traverse_obj(image, ('url', ...), get_all=False),
'width': image.get('width... | @@ -0,0 +1,95 @@
+from .common import InfoExtractor
+from ..utils import parse_duration, parse_iso8601, traverse_obj
+
+
+class NOSNLArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://nos\.nl/((?!video)(\w+/)?\w+/)\d+-(?P<display_id>[\w-]+)'
+ _TESTS = [
+ {
+ # only 1 video
+ 'url':... | yt_dlp/extractor/nosnl.py | 26 | Python | 0.571 | suggestion | 82 | 36 | 36 | false | [extractor/nos.nl] Add extractor | 4,822 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'subtitles': subtitles,
'duration': parse_duration(json_api_data.get('duration')),
'timestamp': parse_iso8601(json_api_data.get('timestamp'))
}
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id... | should be an InAdvancePagedList with page_size=1 | import re
import urllib.parse
import uuid
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
join_nonempty,
parse_duration,
parse_iso8601,
traverse_obj,
try_get,
)
class MLBBaseIE(InfoExtractor):
def _real_extract(self, url):
display_id = self.... | @@ -347,3 +347,72 @@ def _real_extract(self, url):
'subtitles': subtitles,
'http_headers': {'Authorization': f'Bearer {self._access_token}'},
}
+
+
+class MLBArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.mlb\.com/news/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'htt... | yt_dlp/extractor/mlb.py | 26 | Python | 0.143 | suggestion | 48 | 31 | 383 | false | [extractor/mlb.py] Add MLBArticle extractor | 4,832 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
self._sort_formats(formats)
yield {
'id': video_slug,
'title': json_api_data.get('title'),
'description': json_api_data.get('description'),
'formats': formats,
'subtitles': subtitles,
'duration': parse_duration(json_api_data.get('du... | ```suggestion
content_video_query_id_list = traverse_obj(
content_real_info, ('parts', lambda _, v: v['typename'] == 'Video', 'id'))
``` | import re
import urllib.parse
import uuid
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
join_nonempty,
parse_duration,
parse_iso8601,
traverse_obj,
try_get,
)
class MLBBaseIE(InfoExtractor):
def _real_extract(self, url):
display_id = self.... | @@ -347,3 +347,72 @@ def _real_extract(self, url):
'subtitles': subtitles,
'http_headers': {'Authorization': f'Bearer {self._access_token}'},
}
+
+
+class MLBArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.mlb\.com/news/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'htt... | yt_dlp/extractor/mlb.py | 26 | Python | 0.857 | suggestion | 159 | 37 | 383 | false | [extractor/mlb.py] Add MLBArticle extractor | 4,832 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
class MLBArticleIE(InfoExtractor):
_VALID_URL = r'https?://www\.mlb\.com/news/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.mlb.com/news/manny-machado-robs-guillermo-heredia-reacts',
'info_dict': {
'id': '36db7394-343c-4ea3-b8ca-ead2e61bca9a',
'title': 'Machado\'s grab ... | why not add this to thumbnail? | class MLBArticleIE(InfoExtractor):
_VALID_URL = r'https?://www\.mlb\.com/news/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.mlb.com/news/manny-machado-robs-guillermo-heredia-reacts',
'info_dict': {
'id': '36db7394-343c-4ea3-b8ca-ead2e61bca9a',
'title': 'Machado\'s grab ... | @@ -347,3 +347,72 @@ def _real_extract(self, url):
'subtitles': subtitles,
'http_headers': {'Authorization': f'Bearer {self._access_token}'},
}
+
+
+class MLBArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.mlb\.com/news/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'htt... | yt_dlp/extractor/mlb.py | 26 | Python | 0.071 | question | 30 | 51 | 32 | false | [extractor/mlb.py] Add MLBArticle extractor | 4,832 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
json_api_data = self._download_json(
f'https://www.mlb.com/data-service/en/videos/{video_slug}', display_id)
formats, subtitles = [], {}
for playback_url in traverse_obj(json_api_data, ('playbacks', ..., 'url')) or []:
if determine_ext(playback_url) == 'm3u8':
... | Why is this not just being passed through to `MLBVideoIE` with a url_result? | import re
import urllib.parse
import uuid
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
join_nonempty,
parse_duration,
parse_iso8601,
traverse_obj,
try_get,
)
class MLBBaseIE(InfoExtractor):
def _real_extract(self, url):
display_id = self.... | @@ -347,3 +347,69 @@ def _real_extract(self, url):
'subtitles': subtitles,
'http_headers': {'Authorization': f'Bearer {self._access_token}'},
}
+
+
+class MLBArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.mlb\.com/news/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'htt... | yt_dlp/extractor/mlb.py | 26 | Python | 0.357 | question | 76 | 50 | 383 | false | [extractor/mlb.py] Add MLBArticle extractor | 4,832 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'id': video_id,
'title': traverse_obj(airings, (..., 'titles', 0, 'episodeName'), get_all=False),
'formats': formats,
'subtitles': subtitles,
'http_headers': {'Authorization': f'Bearer {self._access_token}'},
}
class MLBArticleIE(InfoExtractor):
... | ```suggestion
apollo_cache_json = self._search_json(r'window\.initState\s*=', webpage, 'window.initState', display_id)['apolloCache']
``` | 'id': video_id,
'title': traverse_obj(airings, (..., 'titles', 0, 'episodeName'), get_all=False),
'formats': formats,
'subtitles': subtitles,
'http_headers': {'Authorization': f'Bearer {self._access_token}'},
}
class MLBArticleIE(InfoExtractor):
... | @@ -347,3 +347,41 @@ def _real_extract(self, url):
'subtitles': subtitles,
'http_headers': {'Authorization': f'Bearer {self._access_token}'},
}
+
+
+class MLBArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.mlb\.com/news/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'htt... | yt_dlp/extractor/mlb.py | 26 | Python | 0.714 | performance | 147 | 45 | 40 | false | [extractor/mlb.py] Add MLBArticle extractor | 4,832 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
},
'playlist_count': 2,
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
apollo_cache_json = self._search_json(r'window\.initState\s*=\s*', webpage, 'window.initState', display_id)['apolloCache']
... | what do u think?
```suggestion
return self.playlist_from_matches(
traverse_obj(content_real_info, ('parts', lambda _, v: v['typename'] == 'Video', 'id')),
getter=lambda x: f'https://www.mlb.com/video/{apollo_cache_json[x]["slug"]}',
ie=MLBVideoIE, playlist_id=content_r... | import re
import urllib.parse
import uuid
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
join_nonempty,
parse_duration,
parse_iso8601,
traverse_obj,
try_get,
)
class MLBBaseIE(InfoExtractor):
def _real_extract(self, url):
display_id = self.... | @@ -347,3 +347,41 @@ def _real_extract(self, url):
'subtitles': subtitles,
'http_headers': {'Authorization': f'Bearer {self._access_token}'},
}
+
+
+class MLBArticleIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.mlb\.com/news/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'htt... | yt_dlp/extractor/mlb.py | 26 | Python | 0.929 | performance | 569 | 27 | 383 | false | [extractor/mlb.py] Add MLBArticle extractor | 4,832 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'modified_timestamp': 1655490556,
'modified_date': '20220617',
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._download_json(
f'https://booyah.live/api/v3/playbacks/{video_id}', video_id,
headers={'Booya... | You can inline this to avoid the variables
Also I think its better to set height than resolution, it will add the "p" automagically
```python
'height': video.get('resolution')
``` | 'id': '13887261322952306617',
'ext': 'mp4',
'view_count': int,
'duration': 30,
'channel_id': 90565760,
'like_count': int,
'title': 'Cayendo con estilo 😎',
'uploader': '♡LɪꜱGΛMER',
'comment_count': int,
... | @@ -0,0 +1,91 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 26 | Python | 0.786 | suggestion | 187 | 51 | 51 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | HobbyistDev |
video_id = self._match_id(url)
json_data = self._download_json(
f'https://booyah.live/api/v3/playbacks/{video_id}', video_id,
headers={'Booyah-Session-key': BooyahBaseIE._BOOYAH_SESSION_KEY})
formats = []
for video_data in json_data['playback']['endpoint_list']:
... | This can be non fatal
Also, probably here goes video_id
```python
f'https://booyah.live/api/v3/playbacks/{video_id}/comments/tops'
``` | 'title': 'Cayendo con estilo 😎',
'uploader': '♡LɪꜱGΛMER',
'comment_count': int,
'uploader_id': '90565760',
'thumbnail': 'https://resmambet-a.akamaihd.net/mambet-storage/Clip/90565760/90565760-27204374-fba0-409d-9d7b-63a48b5c0e75.jpg',
'upload_da... | @@ -0,0 +1,91 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 26 | Python | 0.714 | suggestion | 142 | 51 | 50 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | HobbyistDev |
'resolution': f'{video_data.get("resolution")}p' if video_data else None
}
watermark_fmt = {
'url': video_data.get('download_url'),
'ext': 'mp4',
'format_note': 'Watermarked',
'resolution': f'{video_data.get("resolut... | If the above is non fatal, we should check it first
```python
comment_data = []
if comment_json:
comment_data = [{
....
} for comment in comment_json.get('comment_list') or ()]
``` | }]
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._download_json(
f'https://booyah.live/api/v3/playbacks/{video_id}', video_id,
headers={'Booyah-Session-key': self._BOOYAH_SESSION_KEY})
formats = []
for video_data in json_d... | @@ -0,0 +1,91 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 26 | Python | 0.786 | suggestion | 198 | 44 | 40 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | HobbyistDev |
from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
if not BooyahBaseIE._BOOYAH_SESSION_KEY:
initial_request = self._request_webpage(
'https:/... | ```python
_VALID_URL = r'https?://booyah.live/clips/(?P<id>\d+)'
``` | from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
BooyahBaseIE._BOOYAH_SESSION_KEY = self._request_webpage(
'https://booyah.live/api/v3/auths/sessions', Non... | @@ -0,0 +1,91 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 16 | Python | 0.571 | suggestion | 71 | 41 | 41 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | HobbyistDev |
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
if not BooyahBaseIE._BOOYAH_SESSION_KEY:
initial_request = self._request_webpage(
'https://booyah.live/api/v3/auths/sessions... | If `comment_json = []`, it will fail on `comment_json.get('comment_list')`
```suggestion
def _get_comment_data(self, video_id):
comment_json = self._download_json(
f'https://booyah.live/api/v3/playbacks/{video_id}/comments/tops', video_id,
headers={'Booyah-Session-Key': Booyah... | from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
BooyahBaseIE._BOOYAH_SESSION_KEY = self._request_webpage(
'https://booyah.live/api/v3/auths/sessions', None, data=b'').getheader('booyah-ses... | @@ -0,0 +1,89 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 26 | Python | 0.786 | bug | 824 | 51 | 51 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | HobbyistDev |
from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
if not BooyahBaseIE._BOOYAH_SESSION_KEY:
initial_request = self._request_webpage(
'https:/... | ```suggestion
BooyahBaseIE._BOOYAH_SESSION_KEY = self._request_webpage(
'https://booyah.live/api/v3/auths/sessions', None, data=b'').getheader('booyah-session-key')
``` | from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
BooyahBaseIE._BOOYAH_SESSION_KEY = self._request_webpage(
'https://booyah.live/api/v3/auths/sessions', Non... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 12 | Python | 0.714 | security | 191 | 37 | 37 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
_TESTS = [{
'url': 'https://booyah.live/clips/13887261322952306617',
'info_dict': {
'id': '13887261322952306617',
'ext': 'mp4',
'view_count': int,
'duration': 30,
'channel_id': 90565760,
'like_count': int,
'title': '... | ```suggestion
headers={'Booyah-Session-key': self._BOOYAH_SESSION_KEY})
``` | 'info_dict': {
'id': '13887261322952306617',
'ext': 'mp4',
'view_count': int,
'duration': 30,
'channel_id': 90565760,
'like_count': int,
'title': 'Cayendo con estilo 😎',
'uploader': '♡LɪꜱGΛMER',
'comme... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 26 | Python | 0.571 | suggestion | 89 | 51 | 51 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
if not BooyahBaseIE._BOOYAH_SESSION_KEY:
initial_request = self._request_webpage(
'https:/... | ```suggestion
headers={'Booyah-Session-Key': self._BOOYAH_SESSION_KEY}, fatal=False) or {}
``` | from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
BooyahBaseIE._BOOYAH_SESSION_KEY = self._request_webpage(
'https://booyah.live/api/v3/auths/sessions', Non... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 17 | Python | 0.714 | suggestion | 108 | 42 | 42 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.