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
image = get_binding_value('player_image' + suffix) or {} image_url = image.get('url') if not image_url or '/player-placeholder' in image_url: continue thumbnails.append({ 'id': suffix[1:] if s...
```suggestion media_path = ((None, 'quoted_status'), 'extended_entities', 'media', lambda _, m: m['type'] != 'photo') for media in traverse_obj(status, media_path, expected_type=dict): ```
return extract_from_video_info(media) # amplify, promo_video_website, promo_video_convo, appplayer, # video_direct_message, poll2choice_video, poll3choice_video, # poll4choice_video, ... else: is_amplify = card_name == 'amplify' ...
@@ -503,90 +607,114 @@ def add_thumbnail(name, size): add_thumbnail(name, size) add_thumbnail('orig', media.get('original_info') or {}) - info.update({ + return { + 'id': media_id, 'formats': formats, 'subtitl...
yt_dlp/extractor/twitter.py
26
Python
0.929
suggestion
207
51
51
false
[extractor/twitter] Support multiple media
5,183
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
thumbnails.append({ 'id': suffix[1:] if suffix else 'medium', 'url': image_url, 'width': int_or_none(image.get('width')), 'height': int_or_none(image.get('height')), }) ...
```suggestion media_path = ((None, 'quoted_status'), 'extended_entities', 'media', lambda _, m: m['type'] != 'photo') media = map(extract_from_video_info, traverse_obj(status, media_path, expected_type=dict)) entries = [{**info, **data, 'display_id': twid} for data in media if data] ```
else: is_amplify = card_name == 'amplify' vmap_url = get_binding_value('amplify_url_vmap') if is_amplify else get_binding_value('player_stream_url') content_id = get_binding_value('%s_content_id' % (card_name if is_amplify else 'player')) forma...
@@ -503,90 +607,114 @@ def add_thumbnail(name, size): add_thumbnail(name, size) add_thumbnail('orig', media.get('original_info') or {}) - info.update({ + return { + 'id': media_id, 'formats': formats, 'subtitl...
yt_dlp/extractor/twitter.py
26
Python
1
refactor
315
51
51
false
[extractor/twitter] Support multiple media
5,183
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
return { 'formats': formats, 'subtitles': subtitles, 'thumbnails': thumbnails, 'duration': int_or_none(get_binding_value( 'content_duration_seconds')), } entries = [] ...
Not a necessary change, but I think it's better to make `extract_from_card_info` accept an input of `None` and then do: ```suggestion data = extract_from_card_info(status.get('card')) if data: entries.append({**info, **data, 'display_id': twid}) ```
thumbnails = [] for suffix in ('_small', '', '_large', '_x_large', '_original'): image = get_binding_value('player_image' + suffix) or {} image_url = image.get('url') if not image_url or '/player-placeholder' in image_url: ...
@@ -503,90 +607,114 @@ def add_thumbnail(name, size): add_thumbnail(name, size) add_thumbnail('orig', media.get('original_info') or {}) - info.update({ + return { + 'id': media_id, 'formats': formats, 'subtitl...
yt_dlp/extractor/twitter.py
26
Python
0.857
refactor
282
51
51
false
[extractor/twitter] Support multiple media
5,183
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
medias = traverse_obj(status, media_path, expected_type=dict, default=[]) for media in medias: if not media or media.get('type') == 'photo': continue data = extract_from_video_info(media) if data: entries.append({**info, **data, 'displ...
why isnt this just: ```suggestion if not url_or_none(expanded_url) or expanded_url == url: raise ExtractorError('No video could be found in this tweet', expected=True) return self.url_result(expanded_url, transparent=True, display_id=twid, **info) ``` `transparent_result['u...
'height': int_or_none(image.get('height')), }) return { 'formats': formats, 'subtitles': subtitles, 'thumbnails': thumbnails, 'duration': int_or_none(get_binding_value( ...
@@ -503,90 +607,114 @@ def add_thumbnail(name, size): add_thumbnail(name, size) add_thumbnail('orig', media.get('original_info') or {}) - info.update({ + return { + 'id': media_id, 'formats': formats, 'subtitl...
yt_dlp/extractor/twitter.py
26
Python
1
refactor
400
51
51
false
[extractor/twitter] Support multiple media
5,183
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
} entries = [] media_path = ((None, 'quoted_status'), 'extended_entities', 'media', ...) medias = traverse_obj(status, media_path, expected_type=dict, default=[]) for media in medias: if not media or media.get('type') == 'photo': continue ...
are you sure this should be transparent? Does this generally get passed to generic? If it's being passed to another extractor, this probably shouldn't be transparent
thumbnails.append({ 'id': suffix[1:] if suffix else 'medium', 'url': image_url, 'width': int_or_none(image.get('width')), 'height': int_or_none(image.get('height')), }) ...
@@ -503,90 +607,114 @@ def add_thumbnail(name, size): add_thumbnail(name, size) add_thumbnail('orig', media.get('original_info') or {}) - info.update({ + return { + 'id': media_id, 'formats': formats, 'subtitl...
yt_dlp/extractor/twitter.py
26
Python
0.429
refactor
165
51
51
false
[extractor/twitter] Support multiple media
5,183
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
data = extract_from_video_info(media) if data: entries.append({**info, **data, 'display_id': twid}) continue card = status.get('card') if card: data = extract_from_card_info(card) if data: entries.append({**inf...
Another way to handle compat is to set `_old_archive_ids`
'formats': formats, 'subtitles': subtitles, 'thumbnails': thumbnails, 'duration': int_or_none(get_binding_value( 'content_duration_seconds')), } media_path = ((None, 'quoted_status'), 'extend...
@@ -503,90 +607,114 @@ def add_thumbnail(name, size): add_thumbnail(name, size) add_thumbnail('orig', media.get('original_info') or {}) - info.update({ + return { + 'id': media_id, 'formats': formats, 'subtitl...
yt_dlp/extractor/twitter.py
26
Python
0.5
suggestion
57
51
51
false
[extractor/twitter] Support multiple media
5,183
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
if data: entries.append({**info, **data, 'display_id': twid}) continue card = status.get('card') if card: data = extract_from_card_info(card) if data: entries.append({**info, **data, 'display_id': twid}) if not ent...
I think u r misunderstanding `multi_video`. Can u explain why u set it here?
'thumbnails': thumbnails, 'duration': int_or_none(get_binding_value( 'content_duration_seconds')), } media_path = ((None, 'quoted_status'), 'extended_entities', 'media', lambda _, m: m['type'] != 'photo') videos = map(extra...
@@ -503,90 +607,114 @@ def add_thumbnail(name, size): add_thumbnail(name, size) add_thumbnail('orig', media.get('original_info') or {}) - info.update({ + return { + 'id': media_id, 'formats': formats, 'subtitl...
yt_dlp/extractor/twitter.py
26
Python
0.357
question
76
51
51
false
[extractor/twitter] Support multiple media
5,183
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
if not description: description = self._html_search_meta('description', webpage) else: programme_id, title, description, duration, formats, subtitles = self._download_playlist(group_id) self._sort_formats(formats) return { 'id': programme_id,...
```suggestion https?://(?:www\.)?(?: bbc\.(?:com|co\.uk)| bbcnewsd73hkzno2ini43t4gblxvycyac5aw4gnv7t2rccijh7745uqd\.onion| bbcweb3hytmzhn5d532owbu6oqadra5z3ar726vq5kgwwn6aucdccrad\.onion )/(?:[^/]+/)+(?P<id>[^/#?]+)''' ```
if not description: description = self._html_search_meta('description', webpage) else: programme_id, title, description, duration, formats, subtitles = self._download_playlist(group_id) self._sort_formats(formats) return { 'id': programme_id,...
@@ -591,7 +591,11 @@ def _real_extract(self, url): class BBCIE(BBCCoUkIE): IE_NAME = 'bbc' IE_DESC = 'BBC' - _VALID_URL = r'https?://(?:www\.)?bbc\.(?:com|co\.uk)/(?:[^/]+/)+(?P<id>[^/#?]+)' + _VALID_URL = r'''(?x) + https?://(?:www\.)?(?:(?:bbc\.(?:com|co\.uk))| + bbcnewsd73hkzno2ini43t4...
yt_dlp/extractor/bbc.py
26
Python
0.786
suggestion
280
51
51
false
[extractor/bbc] Full onion support
5,211
yt-dlp/yt-dlp
132,642
Python
pukkandan
DoubleCouponDay
'channel': 'Helen & Douglas House', 'comment_count': int, 'uploader_url': 'http://www.youtube.com/user/helendouglashouse', 'duration': 253, 'channel_url': 'https://www.youtube.com/channel/UCTChGezrZVmlYlpMlkmulPA', 'playable_in_embed': True, ...
```suggestion unquoted_html = unescapeHTML(urllib.parse.unquote(html)) ```
'channel': 'Helen & Douglas House', 'comment_count': int, 'uploader_url': 'http://www.youtube.com/user/helendouglashouse', 'duration': 253, 'channel_url': 'https://www.youtube.com/channel/UCTChGezrZVmlYlpMlkmulPA', 'playable_in_embed': True, ...
@@ -29,3 +32,88 @@ def _extract_from_webpage(self, url, webpage): }) self._sort_formats(entry['formats']) yield entry + + +class QuotedHTMLGenericExtensionIE(InfoExtractor): + """For common cases of quoted/escaped html parts in the webpage""" + _VALID_URL = False + IE_NAM...
yt_dlp/extractor/genericembeds.py
26
Python
0.571
security
88
33
29
false
[extr/generic:quoted-html] Extract embeds within commonly escaped HTML
5,213
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
'availability': 'public', 'view_count': int, 'channel': 'Helen & Douglas House', 'comment_count': int, 'uploader_url': 'http://www.youtube.com/user/helendouglashouse', 'duration': 253, 'channel_url': 'https://www.youtube.com/channel/UCT...
will never happen because of `.+` in regex ```suggestion ```
'availability': 'public', 'view_count': int, 'channel': 'Helen & Douglas House', 'comment_count': int, 'uploader_url': 'http://www.youtube.com/user/helendouglashouse', 'duration': 253, 'channel_url': 'https://www.youtube.com/channel/UCT...
@@ -29,3 +32,88 @@ def _extract_from_webpage(self, url, webpage): }) self._sort_formats(entry['formats']) yield entry + + +class QuotedHTMLGenericExtensionIE(InfoExtractor): + """For common cases of quoted/escaped html parts in the webpage""" + _VALID_URL = False + IE_NAM...
yt_dlp/extractor/genericembeds.py
26
Python
0.643
suggestion
62
35
31
false
[extr/generic:quoted-html] Extract embeds within commonly escaped HTML
5,213
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
import re from urllib.parse import unquote from .common import InfoExtractor from ..utils import make_archive_id, unescapeHTML class HTML5MediaEmbedIE(InfoExtractor): _VALID_URL = False IE_NAME = 'html5' _WEBPAGE_TESTS = [ { 'url': 'https://html.com/media/', 'info_dict': {...
```suggestion import urllib.parse ```
import re import urllib.parse from .common import InfoExtractor from ..utils import make_archive_id, unescapeHTML class HTML5MediaEmbedIE(InfoExtractor): _VALID_URL = False IE_NAME = 'html5' _WEBPAGE_TESTS = [ { 'url': 'https://html.com/media/', 'info_dict': { ...
@@ -1,5 +1,8 @@ +import re +from urllib.parse import unquote
yt_dlp/extractor/genericembeds.py
2
Python
0.429
suggestion
39
27
27
false
[extr/generic:quoted-html] Extract embeds within commonly escaped HTML
5,213
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
'age_limit': 0, 'channel_follower_count': int, 'channel_id': 'UCTChGezrZVmlYlpMlkmulPA', 'tags': 'count:6', 'categories': ['Nonprofits & Activism'], 'like_count': int, 'thumbnail': 'https://i.ytimg.com/vi/Tc7b_JGdZfw/hqdefault.jpg', ...
```suggestion if unquoted_html != html: combined += unquoted_html if combined: yield from self._extract_generic_embeds(url, combined) ```
import re import urllib.parse from .common import InfoExtractor from ..utils import make_archive_id, unescapeHTML class HTML5MediaEmbedIE(InfoExtractor): _VALID_URL = False IE_NAME = 'html5' _WEBPAGE_TESTS = [ { 'url': 'https://html.com/media/', 'info_dict': { ...
@@ -29,3 +32,88 @@ def _extract_from_webpage(self, url, webpage): }) self._sort_formats(entry['formats']) yield entry + + +class QuotedHTMLGenericExtensionIE(InfoExtractor): + """For common cases of quoted/escaped html parts in the webpage""" + _VALID_URL = False + IE_NAM...
yt_dlp/extractor/genericembeds.py
26
Python
0.786
refactor
190
27
116
false
[extr/generic:quoted-html] Extract embeds within commonly escaped HTML
5,213
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
{ 'url': 'https://html.com/media/', 'info_dict': { 'title': 'HTML5 Media', 'description': 'md5:933b2d02ceffe7a7a0f3c8326d91cc2a', }, 'playlist_count': 2 } ] def _extract_from_webpage(self, url, webpage): vid...
maybe just ```suggestion class QuotedHTMLIE(InfoExtractor): ```
{ 'url': 'https://html.com/media/', 'info_dict': { 'title': 'HTML5 Media', 'description': 'md5:933b2d02ceffe7a7a0f3c8326d91cc2a', }, 'playlist_count': 2 } ] def _extract_from_webpage(self, url, webpage): vid...
@@ -29,3 +32,84 @@ def _extract_from_webpage(self, url, webpage): }) self._sort_formats(entry['formats']) yield entry + + +class QuotedHTMLGenericExtensionIE(InfoExtractor):
yt_dlp/extractor/genericembeds.py
26
Python
0.643
refactor
67
51
51
false
[extr/generic:quoted-html] Extract embeds within commonly escaped HTML
5,213
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
return None m = re.match(r'^(?P<age>\d{1,2})\+?$', s) if m: return int(m.group('age')) s = s.upper() if s in US_RATINGS: return US_RATINGS[s] m = re.match(r'^TV[_-]?(%s)$' % '|'.join(k[3:] for k in TV_PARENTAL_GUIDELINES), s) if m: return TV_PARENTAL_GUIDELINES['T...
```suggestion STRING_QUOTES = '\'"' ```
return None m = re.match(r'^(?P<age>\d{1,2})\+?$', s) if m: return int(m.group('age')) s = s.upper() if s in US_RATINGS: return US_RATINGS[s] m = re.match(r'^TV[_-]?(%s)$' % '|'.join(k[3:] for k in TV_PARENTAL_GUIDELINES), s) if m: return TV_PARENTAL_GUIDELINES['T...
@@ -3275,6 +3275,8 @@ def strip_jsonp(code): def js_to_json(code, vars={}, *, strict=False): # vars is a dict of var, val pairs to substitute + STRING_QUOTES = '\'\"'
yt_dlp/utils.py
26
Python
0.429
suggestion
45
51
51
false
[utils] `js_to_json`: Fix unneccesary escape handling
5,217
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
m = re.match(r'^(?P<age>\d{1,2})\+?$', s) if m: return int(m.group('age')) s = s.upper() if s in US_RATINGS: return US_RATINGS[s] m = re.match(r'^TV[_-]?(%s)$' % '|'.join(k[3:] for k in TV_PARENTAL_GUIDELINES), s) if m: return TV_PARENTAL_GUIDELINES['TV-' + m.group(1)] ...
```suggestion STRING_RE = '|'.join(rf'{q}(?:[^{q}\\]*(?:\\.))*[^{q}\\]*{q}' for q in STRING_QUOTES) ``` OR untested, but this should work better ```suggestion STRING_RE = '|'.join(rf'{q}(?:(?<!\\)(?:\\\\)*\\{q}|[^{q}])*{q}' for q in STRING_QUOTES) ```
m = re.match(r'^(?P<age>\d{1,2})\+?$', s) if m: return int(m.group('age')) s = s.upper() if s in US_RATINGS: return US_RATINGS[s] m = re.match(r'^TV[_-]?(%s)$' % '|'.join(k[3:] for k in TV_PARENTAL_GUIDELINES), s) if m: return TV_PARENTAL_GUIDELINES['TV-' + m.group(1)] ...
@@ -3275,6 +3275,8 @@ def strip_jsonp(code): def js_to_json(code, vars={}, *, strict=False): # vars is a dict of var, val pairs to substitute + STRING_QUOTES = '\'\"' + STRING_RE = '|'.join(rf'''{q}(?:[^{q}\\]*(?:\\.))*[^{q}\\]*{q}''' for q in STRING_QUOTES)
yt_dlp/utils.py
26
Python
0.857
suggestion
266
51
51
false
[utils] `js_to_json`: Fix unneccesary escape handling
5,217
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
on = js_to_json('{/*comment\n*/077/*comment\n*/:/*comment\n*/077/*comment\n*/}') self.assertEqual(json.loads(on), {'63': 63}) on = js_to_json('{42:42}') self.assertEqual(json.loads(on), {'42': 42}) on = js_to_json('{/*comment\n*/42/*comment\n*/:/*comment\n*/42/*comment\n*/}') ...
```suggestion on = js_to_json(R'"\^\$\#"') self.assertEqual(json.loads(on), R'^$#', msg='Unnecessary escapes should be stripped') on = js_to_json('\'"\\""\'') self.assertEqual(json.loads(on), '"""', msg='Unnecessary quote escape should be escaped') ```
on = js_to_json('{/*comment\n*/077/*comment\n*/:/*comment\n*/077/*comment\n*/}') self.assertEqual(json.loads(on), {'63': 63}) on = js_to_json('{42:42}') self.assertEqual(json.loads(on), {'42': 42}) on = js_to_json('{/*comment\n*/42/*comment\n*/:/*comment\n*/42/*comment\n*/}') ...
@@ -1100,6 +1100,12 @@ def test_js_to_json_edgecases(self): on = js_to_json('[1,//{},\n2]') self.assertEqual(json.loads(on), [1, 2]) + on = js_to_json(R'"\^\$\#"') + self.assertEqual(json.loads(on), R"^$#", msg="Unneccesary escapes should be stripped") + + on = js_to_json('\'"\\...
test/test_utils.py
26
Python
0.857
security
291
51
51
false
[utils] `js_to_json`: Fix unneccesary escape handling
5,217
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'timestamp': 1664982341, 'thumbnail': r're:^https?://.*\.jpg$', }, }, { 'url': 'https://genius.com/videos/Breaking-down-drakes-certified-lover-boy-kanye-beef-way-2-sexy-cudi', 'md5': 'b8ed87a5efd1473bd027c20a969d4060', 'info_dict': { 'id': '6271792...
`_search_json(... transform_source=unescapeHTML)`
'upload_date': '20221005', 'timestamp': 1664982341, 'thumbnail': r're:^https?://.*\.jpg$', }, }, { 'url': 'https://genius.com/videos/Breaking-down-drakes-certified-lover-boy-kanye-beef-way-2-sexy-cudi', 'md5': 'b8ed87a5efd1473bd027c20a969d4060', 'i...
@@ -0,0 +1,130 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + js_to_json, + smuggle_url, + str_or_none, + traverse_obj, +) + + +class GeniusIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?genius\.com/videos/(?P<id>[^?/#]+)' + _TESTS = [{ + 'url': 'htt...
yt_dlp/extractor/genius.py
26
Python
0.214
security
49
51
51
false
[extractor/genius] Add extractor
5,221
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
}, }, { 'url': 'https://genius.com/Outkast-two-dope-boyz-in-a-cadillac-lyrics', 'playlist_mincount': 1, 'info_dict': { 'id': '36239', 'title': 'Two Dope Boyz (In a Cadillac)', 'description': 'Two Dope Boyz (In a Cadillac) by OutKast', }, ...
note to self: see if this can be done with `_search_json`. Ref #5111
'description': 'Heyy by Lil Baby', }, }, { 'url': 'https://genius.com/Outkast-two-dope-boyz-in-a-cadillac-lyrics', 'playlist_mincount': 1, 'info_dict': { 'id': '36239', 'title': 'Two Dope Boyz (In a Cadillac)', 'description': 'Two Dope ...
@@ -0,0 +1,130 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + js_to_json, + smuggle_url, + str_or_none, + traverse_obj, +) + + +class GeniusIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?genius\.com/videos/(?P<id>[^?/#]+)' + _TESTS = [{ + 'url': 'htt...
yt_dlp/extractor/genius.py
26
Python
0.357
suggestion
69
51
51
false
[extractor/genius] Add extractor
5,221
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) escaped_json = self._search_regex( r'window\.__PRELOADED_STATE__\s*=\s*JSON\.parse\((.*)\);', webpage, 'escaped json', display_id) unescaped_json = self._pars...
maybe this should give a message?
def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) json_string = self._search_json( r'window\.__PRELOADED_STATE__\s*=\s*JSON\.parse\(', webpage, 'json string', display_id, transform_source=js_to_json, con...
@@ -0,0 +1,130 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + js_to_json, + smuggle_url, + str_or_none, + traverse_obj, +) + + +class GeniusIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?genius\.com/videos/(?P<id>[^?/#]+)' + _TESTS = [{ + 'url': 'htt...
yt_dlp/extractor/genius.py
26
Python
0.143
question
33
35
32
false
[extractor/genius] Add extractor
5,221
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
unescaped_json = self._parse_json(escaped_json, display_id, transform_source=js_to_json) song_info = self._parse_json(unescaped_json, display_id) song_id = str_or_none(traverse_obj(song_info, ('songPage', 'song'))) if not song_id: raise ExtractorError('Song id not found in we...
Not worth it just to add `ie_key` imo ```suggestion else: entries.append(self.url_result(m['url'])) ```
r'window\.__PRELOADED_STATE__\s*=\s*JSON\.parse\(', webpage, 'json string', display_id, transform_source=js_to_json, contains_pattern=r'\'{(?s:.+)}\'') song_info = self._parse_json(json_string, display_id) song_id = str_or_none(traverse_obj(song_info, ('songPage', 'song'))) ...
@@ -0,0 +1,130 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + js_to_json, + smuggle_url, + str_or_none, + traverse_obj, +) + + +class GeniusIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?genius\.com/videos/(?P<id>[^?/#]+)' + _TESTS = [{ + 'url': 'htt...
yt_dlp/extractor/genius.py
26
Python
0.714
suggestion
143
29
26
false
[extractor/genius] Add extractor
5,221
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
class TxxxBaseIE(InfoExtractor): # some non-standard characters are used in the base64 string _BASE64_CHAR_REPL_MAP = { "\u0405": "S", "\u0406": "I", "\u0408": "J", "\u0410": "A", "\u0412": "B", "\u0415": "E", "\u041a": "K", "\u041c": "M", ...
why not just use `base64.b64decode(text, altchars=...)`
traverse_obj, try_call, urljoin, variadic, ) def decode_base64(text): return base64.b64decode(text.translate(text.maketrans({ '\u0405': 'S', '\u0406': 'I', '\u0408': 'J', '\u0410': 'A', '\u0412': 'B', '\u0415': 'E', '\u041a': 'K', '\u...
@@ -0,0 +1,307 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + qualities, +) + + +class TxxxBaseIE(InfoExtractor): + # some non-standard characters are used in the base64 string + _BASE64_CHAR_REPL_MAP = { + "\u0...
yt_dlp/extractor/txxx.py
26
Python
0.429
suggestion
55
51
51
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
'view_count': int, 'like_count': int, 'dislike_count': int, 'age_limit': 18, } }, { 'url': 'https://voyeurhit.tube/videos/332875/charlotte-stokely-elle-alexandra-malena-morgan-lingerie/', 'md5': '12b4666e9c3e60dafe9182e5d12aae33', 'info...
```suggestion video_id, host = self._match_valid_url(url).group('id', 'host') group_1 = str(1E3 * (int(video_id) // 1E3)) group_2 = str(1E6 * (int(video_id) // 1E6)) ```
'title': 'Mimi Rogers - Full Body Massage (Nude) compilation', 'uploader': '88bhuto', 'duration': 286, 'view_count': int, 'like_count': int, 'dislike_count': int, 'age_limit': 18, } }, { 'url': 'https://upornia.com/v...
@@ -0,0 +1,307 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + qualities, +) + + +class TxxxBaseIE(InfoExtractor): + # some non-standard characters are used in the base64 string + _BASE64_CHAR_REPL_MAP = { + "\u0...
yt_dlp/extractor/txxx.py
26
Python
0.714
suggestion
197
51
51
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
if not format_id: return None elif isinstance(format_id, list): return '' if len(format_id) == 0 else format_id[0].lstrip('_') else: return format_id.lstrip('_') class TxxxIE(TxxxBaseIE): _VALID_URL = r'''(?x) https?:// ...
id should be `/d+`, no? Also, capture display_id too
def get_formats(host, video_file): return [{ 'url': urljoin(f'https://{host}', decode_base64(video['video_url'])), 'format_id': try_call(lambda: variadic(video['format'])[0].lstrip('_')), 'quality': index, } for index, video in enumerate(video_file) if video.get('video_url')] class Txx...
@@ -0,0 +1,307 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + qualities, +) + + +class TxxxBaseIE(InfoExtractor): + # some non-standard characters are used in the base64 string + _BASE64_CHAR_REPL_MAP = { + "\u0...
yt_dlp/extractor/txxx.py
26
Python
0.429
suggestion
53
51
51
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
}] def _real_extract(self, url): video_id = self._match_id(url) group_1 = 0 if not video_id[:-3] else video_id[:-3] + '000' group_2 = 0 if not video_id[:-6] else video_id[:-6] + '000000' host = self._match_valid_url(url).group('host') video_info_url = 'https://%s/api/jso...
unnecessary, just use traverse_obj below
'like_count': int, 'dislike_count': int, 'age_limit': 18, } }, { 'url': 'https://upornia.tube/videos/1498858/twistys-malena-morgan-starring-at-dr-morgan-baller/', 'md5': '7ff7033340bc88a173198b7c22600e4f', 'info_dict': { 'id': '1498858'...
@@ -0,0 +1,307 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + qualities, +) + + +class TxxxBaseIE(InfoExtractor): + # some non-standard characters are used in the base64 string + _BASE64_CHAR_REPL_MAP = { + "\u0...
yt_dlp/extractor/txxx.py
26
Python
0.143
suggestion
40
51
51
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
host = self._match_valid_url(url).group('host') video_info_url = 'https://%s/api/json/video/86400/%s/%s/%s.json' % (host, group_2, group_1, video_id) video_path_url = 'https://%s/api/videofile.php?video_id=%s&lifetime=8640000' % (host, video_id) headers = { 'Referer': url, ...
This assumes the formats are already in order of quality. Is that true? If so, just set it directly in below loop using `enumerate`
'md5': '7ff7033340bc88a173198b7c22600e4f', 'info_dict': { 'id': '1498858', 'display_id': 'twistys-malena-morgan-starring-at-dr-morgan-baller', 'ext': 'mp4', 'title': 'Twistys - Malena Morgan starring at Dr. Morgan-Baller', 'uploader': 'mindgeek...
@@ -0,0 +1,307 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + qualities, +) + + +class TxxxBaseIE(InfoExtractor): + # some non-standard characters are used in the base64 string + _BASE64_CHAR_REPL_MAP = { + "\u0...
yt_dlp/extractor/txxx.py
26
Python
0.5
style
131
51
51
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
"\u0412": "B", "\u0415": "E", "\u041a": "K", "\u041c": "M", "\u041d": "H", "\u041e": "O", "\u0420": "P", "\u0421": "C", "\u0425": "X", ",": "/", ".": "+", "~": "=", } def _decode_base64(self, text): for from...
```suggestion return try_call(lambda: variadic(format_id)[0].lstrip('_')) ``` doesnt even need to be a function
return base64.b64decode(text.translate(text.maketrans({ '\u0405': 'S', '\u0406': 'I', '\u0408': 'J', '\u0410': 'A', '\u0412': 'B', '\u0415': 'E', '\u041a': 'K', '\u041c': 'M', '\u041d': 'H', '\u041e': 'O', '\u0420': 'P', ...
@@ -0,0 +1,307 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + qualities, +) + + +class TxxxBaseIE(InfoExtractor): + # some non-standard characters are used in the base64 string + _BASE64_CHAR_REPL_MAP = { + "\u0...
yt_dlp/extractor/txxx.py
26
Python
0.714
suggestion
122
51
51
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
'view_count': int, 'like_count': int, 'dislike_count': int, 'age_limit': 18, } }] def _real_extract(self, url): video_id, host, display_id = self._match_valid_url(url).group('id', 'host', 'display_id') group_1 = str(1000 * (int(video_id) /...
Error handling code should be moved to a function like this: https://github.com/yt-dlp/yt-dlp/blob/c7e4ab278a19e0d4e0eb9626660a4634df964364/yt_dlp/extractor/mildom.py#L19-L36
'md5': '7ff7033340bc88a173198b7c22600e4f', 'info_dict': { 'id': '1498858', 'display_id': 'twistys-malena-morgan-starring-at-dr-morgan-baller', 'ext': 'mp4', 'title': 'Twistys - Malena Morgan starring at Dr. Morgan-Baller', 'uploader': 'mindgeek...
@@ -0,0 +1,308 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + traverse_obj, + try_call, + urljoin, + variadic, +) + + +class TxxxBaseIE(InfoExtractor): + # some non-standard characters are used in the base64 stri...
yt_dlp/extractor/txxx.py
26
Python
0.571
refactor
175
51
51
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
chio0hai
class PornZogIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?pornzog\.com/video/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://pornzog.com/video/9125519/michelle-malone-dreamgirls-wild-wet-3/', 'info_dict': { 'id': '5119660', 'display_id': '', 'ext': 'mp4', ...
Why not just put the iframe detection in `TxxxIE._EMBED_URLS`?
import base64 import re from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, js_to_json, merge_dicts, parse_duration, traverse_obj, try_call, urljoin, variadic, ) def decode_base64(text): return base64.b64decode(text.translate(text.maketrans({ ...
@@ -0,0 +1,477 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + traverse_obj, + try_call, + urljoin, + variadic, +) + + +def decode_base64(text): + return base64.b64decode(text.translate(text.maketrans({...
yt_dlp/extractor/txxx.py
26
Python
0.357
question
62
27
419
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
views = stat['userInteractionCount'] elif stat['interactionType'] == 'http://schema.org/LikeAction': likes = stat['userInteractionCount'] elif stat['interactionType'] == 'http://schema.org/DislikeAction': dislikes = stat['userInteractionCount'] ...
duplicate code from txxx. Generalize into a function
import base64 import re from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, js_to_json, merge_dicts, parse_duration, traverse_obj, try_call, urljoin, variadic, ) def decode_base64(text): return base64.b64decode(text.translate(text.maketrans({ ...
@@ -0,0 +1,477 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_duration, + traverse_obj, + try_call, + urljoin, + variadic, +) + + +def decode_base64(text): + return base64.b64decode(text.translate(text.maketrans({...
yt_dlp/extractor/txxx.py
26
Python
0.214
refactor
52
51
419
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
'quality': index, } for index, video in enumerate(video_file) if video.get('video_url')] class TxxxIE(InfoExtractor): _DOMAINS = ( 'hclips.com', 'hdzog.com', 'hdzog.tube', 'hotmovs.com', 'hotmovs.tube', 'inporn.com', 'privatehomeclips.com', ...
Add _WEBPAGE_TESTS to test this
class TxxxIE(InfoExtractor): _DOMAINS = ( 'hclips.com', 'hdzog.com', 'hdzog.tube', 'hotmovs.com', 'hotmovs.tube', 'inporn.com', 'privatehomeclips.com', 'tubepornclassic.com', 'txxx.com', 'txxx.tube', 'upornia.com', 'upo...
@@ -0,0 +1,438 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + js_to_json, + parse_duration, + traverse_obj, + try_call, + urljoin, + variadic, +) + + +def decode_base64(text): + return base64.b64decode(text.translate...
yt_dlp/extractor/txxx.py
26
Python
0.071
suggestion
31
51
51
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
'id': '101569', 'display_id': 'triple-threat-with-lia-lor-malena-morgan-and-dani-daniels', 'ext': 'mp4', 'title': 'Triple Threat With Lia Lor, Malena Morgan And Dani Daniels', 'description': 'md5:285357d9d3a00ce5acb29f39f826dbf6', 'uploader': 'Patr...
Add this to `js_to_json` and use it
class PornTopIE(InfoExtractor): _VALID_URL = r'https?://(?P<host>(?:www\.)?porntop\.com)/video/(?P<id>\d+)(?:/(?P<display_id>[^/?]+))?' _TESTS = [{ 'url': 'https://porntop.com/video/101569/triple-threat-with-lia-lor-malena-morgan-and-dani-daniels/', 'md5': '612ba7b3cb99455b382972948e200b08', ...
@@ -0,0 +1,438 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + js_to_json, + parse_duration, + traverse_obj, + try_call, + urljoin, + variadic, +) + + +def decode_base64(text): + return base64.b64decode(text.translate...
yt_dlp/extractor/txxx.py
26
Python
0.286
suggestion
35
51
43
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
'ext': 'mp4', 'title': 'Triple Threat With Lia Lor, Malena Morgan And Dani Daniels', 'description': 'md5:285357d9d3a00ce5acb29f39f826dbf6', 'uploader': 'PatrickBush', 'duration': 480, 'view_count': int, 'like_count': int, 'd...
this one would still have to be manually done ig
_VALID_URL = r'https?://(?P<host>(?:www\.)?porntop\.com)/video/(?P<id>\d+)(?:/(?P<display_id>[^/?]+))?' _TESTS = [{ 'url': 'https://porntop.com/video/101569/triple-threat-with-lia-lor-malena-morgan-and-dani-daniels/', 'md5': '612ba7b3cb99455b382972948e200b08', 'info_dict': { ...
@@ -0,0 +1,438 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + js_to_json, + parse_duration, + traverse_obj, + try_call, + urljoin, + variadic, +) + + +def decode_base64(text): + return base64.b64decode(text.translate...
yt_dlp/extractor/txxx.py
26
Python
0.071
suggestion
48
51
41
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
webpage = self._download_webpage(url, video_id) # find the VideoObject json object video_obj_text = self._search_regex( r'<script[^>]*>[^<]*schemaJson\s*=\s*(?P<json_ld>[^<]+VideoObject[^<]+)\s*;\s*var\s+script\s*=[^<]*</script>', webpage, 'VideoObject', group='json_ld'...
Why do you say this is not to json+ld specs? It looks like ```py self._json_ld({'@context': '', 'video': video_obj}, ...) ```
'dislike_count': int, 'age_limit': 18, 'timestamp': 1609455029, 'upload_date': '20201231', 'thumbnail': 'https://tn.porntop.com/media/tn/sources/101569_1.jpg', } }] def _real_extract(self, url): video_id, host, display_id = self._match...
@@ -0,0 +1,438 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + js_to_json, + parse_duration, + traverse_obj, + try_call, + urljoin, + variadic, +) + + +def decode_base64(text): + return base64.b64decode(text.translate...
yt_dlp/extractor/txxx.py
26
Python
0.714
question
132
47
27
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
# find the VideoObject json object video_obj_text = self._search_regex( r'<script[^>]*>[^<]*schemaJson\s*=\s*(?P<json_ld>[^<]+VideoObject[^<]+)\s*;\s*var\s+script\s*=[^<]*</script>', webpage, 'VideoObject', group='json_ld') # there are javascript code within the declarat...
```suggestion return merge_dicts({ 'id': video_id, 'display_id': display_id, 'age_limit': 18, 'formats': formats, }, info) ```
import base64 import re from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, js_to_json, merge_dicts, parse_duration, traverse_obj, try_call, urljoin, variadic, ) def decode_base64(text): return base64.b64decode(text.translate(text.maketrans({ ...
@@ -0,0 +1,438 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + js_to_json, + parse_duration, + traverse_obj, + try_call, + urljoin, + variadic, +) + + +def decode_base64(text): + return base64.b64decode(text.translate...
yt_dlp/extractor/txxx.py
26
Python
0.714
suggestion
197
27
419
false
[txxx] Add extractor
5,240
yt-dlp/yt-dlp
132,642
Python
pukkandan
chio0hai
'title': 'valentinazoe (Uploads)' }, 'playlist_mincount': 75 }, { 'url': 'https://www.veoh.com/users/PiensaLibre', 'info_dict': { 'id': 'PiensaLibre', 'title': 'PiensaLibre (Uploads)' }, ...
```suggestion total_vids = 0 ``` snake case in python
'playlist_mincount': 75 }, { 'url': 'https://www.veoh.com/users/PiensaLibre', 'info_dict': { 'id': 'PiensaLibre', 'title': 'PiensaLibre (Uploads)' }, 'playlist_mincount': 2 }] _PAGE_SIZE = 16 de...
@@ -123,3 +130,91 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))' + IE_NAME = 'veoh:user' + + _TESTS = [ + ...
yt_dlp/extractor/veoh.py
26
Python
0.571
suggestion
64
51
47
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
coletdjnz
tntmod54321
if permalink_url: return self.url_result( permalink_url, VeohIE.ie_key() if VeohIE.suitable(permalink_url) else None, str_or_none(cand['permalinkId']), cand['title']) for e in res...
no need for _extract_videos to be a separate function imo.
import functools import json from .common import InfoExtractor from ..utils import ( ExtractorError, OnDemandPagedList, int_or_none, parse_duration, qualities, try_get, ) class VeohIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P<id>...
@@ -123,3 +130,91 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))' + IE_NAME = 'veoh:user' + + _TESTS = [ + ...
yt_dlp/extractor/veoh.py
26
Python
0.286
refactor
58
30
190
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
coletdjnz
tntmod54321
payload = json.dumps({'username': uploader, 'maxResults': 16, 'page': i + 1, 'requestName': 'userPage'}).encode('utf-8') headers = { 'x-csrf-token': authtoken, 'content-type': 'application/json;charset=UTF-8' } for retry in self.RetryManage...
id and title should be non-fatal here; only url is required here.
import functools import json from .common import InfoExtractor from ..utils import ( ExtractorError, OnDemandPagedList, int_or_none, parse_duration, qualities, try_get, ) class VeohIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P<id>...
@@ -123,3 +130,91 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))' + IE_NAME = 'veoh:user' + + _TESTS = [ + ...
yt_dlp/extractor/veoh.py
26
Python
0.286
suggestion
65
51
190
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
coletdjnz
tntmod54321
for i in itertools.count(): payload = json.dumps({'username': uploader, 'maxResults': 16, 'page': i + 1, 'requestName': 'userPage'}).encode('utf-8') headers = { 'x-csrf-token': authtoken, 'content-type': 'application/json;charset=UTF-8' } ...
should the url always be for VeohIE? if so, just have ```suggestion VeohIE.ie_key(), ``` otherwise if it can be for any extractor, just leave it blank
import functools import json from .common import InfoExtractor from ..utils import ( ExtractorError, OnDemandPagedList, int_or_none, parse_duration, qualities, try_get, ) class VeohIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P<id>...
@@ -123,3 +130,91 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))' + IE_NAME = 'veoh:user' + + _TESTS = [ + ...
yt_dlp/extractor/veoh.py
26
Python
0.786
refactor
185
51
190
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
coletdjnz
tntmod54321
def _get_authtoken(self, page, uploader=None): webpage = self._download_webpage(page, uploader) return self._search_regex( r'csrfToken: "(?P<token>[0-9a-zA-Z]{40})"', webpage, 'request token', group='token') def _get_videos(self, uploader, authtoken=None): if aut...
this outer try except does nothing? also I don't think you are making use of the retry manager here (do you need retries?)
note=f'Downloading videos page {page + 1}', headers={ 'x-csrf-token': self._TOKEN, 'content-type': 'application/json;charset=UTF-8' }, data=json.dumps({ 'username': uploader, 'maxResults': self._PAGE_SIZE, ...
@@ -123,3 +130,91 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))' + IE_NAME = 'veoh:user' + + _TESTS = [ + ...
yt_dlp/extractor/veoh.py
26
Python
0.429
suggestion
125
51
31
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
coletdjnz
tntmod54321
_TESTS = [ { 'url': 'https://www.veoh.com/users/valentinazoe', 'info_dict': { 'id': 'valentinazoe', 'title': 'valentinazoe (Uploads)' }, 'playlist_mincount': 75 }, { 'url': 'https://www.veoh.com/user...
I'd relax the regex a little bit ```suggestion r'csrfToken:\s*(["\'])(?P<token>[0-9a-zA-Z]{40})\1', webpage, ``` is the csrf token always 40 characters long?
{ 'url': 'https://www.veoh.com/users/valentinazoe', 'info_dict': { 'id': 'valentinazoe', 'title': 'valentinazoe (Uploads)' }, 'playlist_mincount': 75 }, { 'url': 'https://www.veoh.com/users/PiensaLibre', ...
@@ -123,3 +130,91 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))' + IE_NAME = 'veoh:user' + + _TESTS = [ + ...
yt_dlp/extractor/veoh.py
26
Python
0.714
security
175
51
51
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
coletdjnz
tntmod54321
VeohIE.ie_key() if VeohIE.suitable(permalink_url) else None, str_or_none(cand['permalinkId']), cand['title']) for e in response['videos'] or []: yield resolve_entry(e) totalVids += len(response['videos']) if (t...
uploader will always be a string ```suggestion uploader) ```
import functools import json from .common import InfoExtractor from ..utils import ( ExtractorError, OnDemandPagedList, int_or_none, parse_duration, qualities, try_get, ) class VeohIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P<id>...
@@ -123,3 +130,91 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))' + IE_NAME = 'veoh:user' + + _TESTS = [ + ...
yt_dlp/extractor/veoh.py
26
Python
0.571
suggestion
74
27
190
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
coletdjnz
tntmod54321
categories = metadata.get('categoryPath') if not categories: category = try_get(video, lambda x: x['category'].strip().removeprefix('category_')) categories = [category] if category else None tags = video.get('tags') return { 'id': video_id, ...
```suggestion _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<id>[\w-]+)' ```
if not categories: category = try_get(video, lambda x: x['category'].strip().removeprefix('category_')) categories = [category] if category else None tags = video.get('tags') return { 'id': video_id, 'title': title, 'description': vide...
@@ -123,3 +130,80 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))'
yt_dlp/extractor/veoh.py
26
Python
0.643
suggestion
89
51
51
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
pukkandan
tntmod54321
note=f'Downloading videos page {i + 1}') if not response['success']: raise ExtractorError('unsuccessful veoh user videos request') def resolve_entry(*candidates): for cand in candidates: if not isinstance(cand, dict): ...
```suggestion uploader = self._match_id(url) ```
import functools import json from .common import InfoExtractor from ..utils import ( ExtractorError, OnDemandPagedList, int_or_none, parse_duration, qualities, try_get, ) class VeohIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P<id>...
@@ -123,3 +130,80 @@ def _real_extract(self, url): 'categories': categories, 'tags': tags.split(', ') if tags else None, } + + +class VeohUserIE(VeohIE): + _VALID_URL = r'https?://(?:www\.)?veoh\.com/users/(?P<user>([\da-zA-Z_\-]+))' + IE_NAME = 'veoh:user' + + _TESTS = [ + ...
yt_dlp/extractor/veoh.py
26
Python
0.571
suggestion
58
33
190
false
Veoh user IE support
5,242
yt-dlp/yt-dlp
132,642
Python
pukkandan
tntmod54321
import json import re from urllib.error import HTTPError from .common import InfoExtractor from .periscope import PeriscopeBaseIE, PeriscopeIE from ..compat import ( compat_parse_qs, compat_urllib_parse_unquote, compat_urllib_parse_urlparse, ) from ..utils import ( ExtractorError, dict_get, flo...
```suggestion import urllib.error ```
import json import re import urllib.error from .common import InfoExtractor from .periscope import PeriscopeBaseIE, PeriscopeIE from ..compat import functools # isort: split from ..compat import ( compat_parse_qs, compat_urllib_parse_unquote, compat_urllib_parse_urlparse, ) from ..utils import ( Extra...
@@ -1,9 +1,10 @@ +import json import re +from urllib.error import HTTPError
yt_dlp/extractor/twitter.py
3
Python
0.571
suggestion
39
28
28
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'description': "Fly over Pluto's icy Norgay Mountains and Sputnik Plain in this @NASANewHorizons #PlutoFlyby video. https://t.co/BJYgOjSeGA", 'uploader': 'NASA', 'uploader_id': 'NASA', 'timestamp': 1437408129, 'upload_date': '20150720', ...
Are u sure this should be removed? Broken test is better than wrong test
'md5': '7137eca597f72b9abbe61e5ae0161399', 'info_dict': { 'id': '623160978427936768', 'ext': 'mp4', 'title': "NASA - Fly over Pluto's icy Norgay Mountains and Sputnik Plain in this @NASANewHorizons #PlutoFlyby video.", 'description'...
@@ -211,7 +265,6 @@ class TwitterIE(TwitterBaseIE): 'duration': 12.922, 'timestamp': 1442188653, 'upload_date': '20150913', - 'age_limit': 18,
yt_dlp/extractor/twitter.py
26
Python
0.286
bug
72
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'withSuperFollowsUserFields': True, 'withV2Timeline': True, 'withVoice': True, }, 'features': { 'graphql_is_translatable_rweb_tweet_is_translatable_enabled': False, 'interactive_text_enabled': True, '...
```suggestion force_graphql = bool(self._configuration_arg('force_graphql')) ```
# poll2choice_video card 'url': 'https://twitter.com/CAF_Online/status/1349365911120195585', 'only_matching': True, }, { # poll3choice_video card 'url': 'https://twitter.com/SamsungMobileSA/status/1348609186725289984', 'only_matching': True, }, { # poll4ch...
@@ -552,10 +701,84 @@ class TwitterIE(TwitterBaseIE): 'only_matching': True, }] + def _graphql_to_legacy(self, data, twid): + def filter_tweet(_, obj): + return obj['entryId'] == f'tweet-{twid}' + + path = ('threaded_conversation_with_injections_v2', 'instructions', 0, 'entri...
yt_dlp/extractor/twitter.py
26
Python
0.571
suggestion
90
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
}, 'features': { 'graphql_is_translatable_rweb_tweet_is_translatable_enabled': False, 'interactive_text_enabled': True, 'responsive_web_edit_tweet_api_enabled': True, 'responsive_web_enhance_cards_enabled': True, 're...
warning is unnecessary. If you need the message, put it in debug/stdout ```suggestion if not use_graphql and self._configuration_arg('force_graphql'): self.write_debug('Forced usage of GraphQL API') use_graphql = True ```
}, { # poll3choice_video card 'url': 'https://twitter.com/SamsungMobileSA/status/1348609186725289984', 'only_matching': True, }, { # poll4choice_video card 'url': 'https://twitter.com/SouthamptonFC/status/1347577658079641604', 'only_matching': True, }] de...
@@ -552,10 +701,84 @@ class TwitterIE(TwitterBaseIE): 'only_matching': True, }] + def _graphql_to_legacy(self, data, twid): + def filter_tweet(_, obj): + return obj['entryId'] == f'tweet-{twid}' + + path = ('threaded_conversation_with_injections_v2', 'instructions', 0, 'entri...
yt_dlp/extractor/twitter.py
26
Python
1
bug
258
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
for name, size in media.get('sizes', {}).items(): add_thumbnail(name, size) add_thumbnail('orig', media.get('original_info') or {}) return { 'id': media_id, 'formats': formats, 'subtitles': subtitles, ...
I'd change these to `yield` instead, but this is fine too
title = f'{uploader} - {title}' uploader_id = user.get('screen_name') tags = [] for hashtag in (try_get(status, lambda x: x['entities']['hashtags'], list) or []): hashtag_text = hashtag.get('text') if not hashtag_text: continue tag...
@@ -642,31 +865,30 @@ def get_binding_value(k): card_name = card['name'].split(':')[-1] if card_name == 'player': - return { + return [{
yt_dlp/extractor/twitter.py
26
Python
0.429
suggestion
57
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) return formats, subtitles @staticmethod def _search_dimensions_in_video_url(a_format, video_url): m = re.search(r'/(?P<width>\d+)x(?P<height>\d+)/', video_url) if m: a_format.upda...
```suggestion if self.is_logged_in: ```
if video_url not in urls: fmts, subs = self._extract_variant_formats({'url': video_url}, video_id) formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) return formats, subtitles @staticmethod def _search_dimensions_in_video_url(a_format, vi...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.429
suggestion
49
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
def is_logged_in(self): return bool(self._get_cookies(self._API_BASE).get('auth_token')) def _call_api(self, path, video_id, query={}, graphql=False): cookies = self._get_cookies(self._API_BASE) base_headers = {} csrf_cookie = cookies.get('ct0') if csrf_cookie: ...
```suggestion if not self.is_logged_in: ```
}) @functools.cached_property def is_logged_in(self): return bool(self._get_cookies(self._API_BASE).get('auth_token')) def _call_api(self, path, video_id, query={}, graphql=False): cookies = self._get_cookies(self._API_BASE) headers = {} csrf_cookie = cookies.g...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.571
suggestion
57
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
urls.append(video_variant.attrib['url']) fmts, subs = self._extract_variant_formats( video_variant.attrib, video_id) formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) video_url = strip_or_none(xpath_text(vmap_data, './/MediaFi...
```suggestion @functools.cached_property def is_logged_in(self): return bool(self._get_cookies(self._API_BASE).get('auth_token')) ```
video_variant.attrib['url'] = compat_urllib_parse_unquote( video_variant.attrib['url']) urls.append(video_variant.attrib['url']) fmts, subs = self._extract_variant_formats( video_variant.attrib, video_id) formats.extend(fmts) su...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.714
security
153
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'graphql_is_translatable_rweb_tweet_is_translatable_enabled': False, 'interactive_text_enabled': True, 'responsive_web_edit_tweet_api_enabled': True, 'responsive_web_enhance_cards_enabled': True, 'responsive_web_graphql_timeline_navigation_...
```suggestion if self.is_logged_in or self._configuration_arg('force_graphql'): self.write_debug(f'Using GraphQL API (Auth = {self.logged_in}') ```
# poll4choice_video card 'url': 'https://twitter.com/SouthamptonFC/status/1347577658079641604', 'only_matching': True, }] def _graphql_to_legacy(self, data, twid): result = traverse_obj(data, ( 'threaded_conversation_with_injections_v2', 'instructions', 0, 'entries',...
@@ -552,10 +704,84 @@ class TwitterIE(TwitterBaseIE): 'only_matching': True, }] + def _graphql_to_legacy(self, data, twid): + def filter_tweet(_, obj): + return obj['entryId'] == f'tweet-{twid}' + + path = ('threaded_conversation_with_injections_v2', 'instructions', 0, 'entri...
yt_dlp/extractor/twitter.py
26
Python
0.857
bug
170
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
import json import re import urllib.error from .common import InfoExtractor from .periscope import PeriscopeBaseIE, PeriscopeIE from ..compat import ( compat_parse_qs, compat_urllib_parse_unquote, compat_urllib_parse_urlparse, ) from ..utils import ( ExtractorError, dict_get, float_or_none, ...
```suggestion from ..compat import functools # isort: split from ..compat import ( ```
import json import re import urllib.error from .common import InfoExtractor from .periscope import PeriscopeBaseIE, PeriscopeIE from ..compat import functools # isort: split from ..compat import ( compat_parse_qs, compat_urllib_parse_unquote, compat_urllib_parse_urlparse, ) from ..utils import ( Extra...
@@ -1,9 +1,10 @@ +import json import re +import urllib.error from .common import InfoExtractor from .periscope import PeriscopeBaseIE, PeriscopeIE from ..compat import (
yt_dlp/extractor/twitter.py
8
Python
0.571
suggestion
90
33
33
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
video_url = strip_or_none(xpath_text(vmap_data, './/MediaFile')) if video_url not in urls: fmts, subs = self._extract_variant_formats({'url': video_url}, video_id) formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) return formats, subtitle...
```suggestion cookies = self._get_cookies(self._API_BASE) headers = {} csrf_cookie = cookies.get('ct0') if csrf_cookie: headers['x-csrf-token'] = csrf_cookie.value ```
formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) video_url = strip_or_none(xpath_text(vmap_data, './/MediaFile')) if video_url not in urls: fmts, subs = self._extract_variant_formats({'url': video_url}, video_id) formats.extend(fmts)...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.786
security
219
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
subtitles = self._merge_subtitles(subtitles, subs) return formats, subtitles @staticmethod def _search_dimensions_in_video_url(a_format, video_url): m = re.search(r'/(?P<width>\d+)x(?P<height>\d+)/', video_url) if m: a_format.update({ 'width': int...
```suggestion headers.update({ ```
fmts, subs = self._extract_variant_formats({'url': video_url}, video_id) formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) return formats, subtitles @staticmethod def _search_dimensions_in_video_url(a_format, video_url): m = re.search(r'...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.429
suggestion
48
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
}) def is_logged_in(self): return bool(self._get_cookies(self._API_BASE).get('auth_token')) def _call_api(self, path, video_id, query={}, graphql=False): cookies = self._get_cookies(self._API_BASE) base_headers = {} csrf_cookie = cookies.get('ct0') if csrf_...
```suggestion headers['Authorization'] = f'Bearer {bearer_token}' ```
'width': int(m.group('width')), 'height': int(m.group('height')), }) @functools.cached_property def is_logged_in(self): return bool(self._get_cookies(self._API_BASE).get('auth_token')) def _call_api(self, path, video_id, query={}, graphql=False): ...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.571
security
83
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
is_logged_in = self.is_logged_in() if is_logged_in: base_headers.update({ 'x-twitter-auth-type': 'OAuth2Session', 'x-twitter-client-language': 'en', 'x-twitter-active-user': 'yes', }) error = None result = None ...
```suggestion self._TOKENS[bearer_token] = guest_token_response.get('guest_token') if not self._TOKENS[bearer_token]: raise ExtractorError('Could not retrieve guest token') ```
csrf_cookie = cookies.get('ct0') if csrf_cookie: headers['x-csrf-token'] = csrf_cookie.value if self.is_logged_in: headers.update({ 'x-twitter-auth-type': 'OAuth2Session', 'x-twitter-client-language': 'en', 'x-twitter-activ...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
1
refactor
246
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
a_format.update({ 'width': int(m.group('width')), 'height': int(m.group('height')), }) def is_logged_in(self): return bool(self._get_cookies(self._API_BASE).get('auth_token')) def _call_api(self, path, video_id, query={}, graphql=False): ...
```suggestion result, last_error = None, None ```
m = re.search(r'/(?P<width>\d+)x(?P<height>\d+)/', video_url) if m: a_format.update({ 'width': int(m.group('width')), 'height': int(m.group('height')), }) @functools.cached_property def is_logged_in(self): return bool(self._get_coo...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.714
suggestion
59
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
guest_token_response = self._download_json( self._API_BASE + 'guest/activate.json', video_id, 'Downloading guest token', data=b'', headers=headers) guest_token = guest_token_response.get('guest_token') if not gu...
```suggestion if last_error: raise last_error elif not isinstance(e.cause, urllib.error.HTTPError) or e.cause.code != 404: raise last_error = e ```
headers.pop('x-guest-token', None) guest_token_response = self._download_json( self._API_BASE + 'guest/activate.json', video_id, 'Downloading guest token', data=b'', headers=headers) self._TOKENS[bearer_token] =...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
1
suggestion
241
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
guest_token = guest_token_response.get('guest_token') if not guest_token: raise ExtractorError('Could not retrieve guest token') self._TOKENS[bearer_token] = guest_token headers['x-guest-token'] = self._TOKENS[bearer_t...
```suggestion 'Only one media item can be extracted') ```
'Downloading guest token', data=b'', headers=headers) self._TOKENS[bearer_token] = guest_token_response.get('guest_token') if not self._TOKENS[bearer_token]: raise ExtractorError('Could not retrieve guest token') he...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.643
refactor
79
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
headers['x-guest-token'] = self._TOKENS[bearer_token] try: allowed_status = {400, 403, 404} if graphql else {403} result = self._download_json( (self._GRAPHQL_API_BASE if graphql else self._API_BASE) + path, video_id, h...
```suggestion if result.get('errors'): error_message = ', '.join(set(traverse_obj( result, ('errors', ..., 'message'), expected_type=str))) or 'Unknown error' ```
try: allowed_status = {400, 403, 404} if graphql else {403} result = self._download_json( (self._GRAPHQL_API_BASE if graphql else self._API_BASE) + path, video_id, headers=headers, query=query, expected_status=allowed_status) ...
@@ -81,28 +86,80 @@ def _search_dimensions_in_video_url(a_format, video_url): 'height': int(m.group('height')), }) - def _call_api(self, path, video_id, query={}): - headers = { - 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D...
yt_dlp/extractor/twitter.py
26
Python
0.929
suggestion
202
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'only_matching': True, }, { # video_direct_message card 'url': 'https://twitter.com/qarev001/status/1348948114569269251', 'only_matching': True, }, { # poll2choice_video card 'url': 'https://twitter.com/CAF_Online/status/1349365911120195585', 'only_matchin...
```suggestion result = traverse_obj(data, ( 'threaded_conversation_with_injections_v2', 'instructions', 0, 'entries', lambda _, v: v['entryId'] == f'tweet-{twid}', 'content', 'itemContent', 'tweet_results', 'result' ), expected_type=dict, default={}, get_all=Fals...
}, { 'url': 'https://twitter.com/primevideouk/status/1578401165338976258', 'playlist_count': 2, 'info_dict': { 'id': '1578401165338976258', 'title': str, 'description': 'md5:659a6b517a034b4cee5d795381a2dc41', 'uploader': str, 'uploa...
@@ -552,10 +704,84 @@ class TwitterIE(TwitterBaseIE): 'only_matching': True, }] + def _graphql_to_legacy(self, data, twid): + def filter_tweet(_, obj): + return obj['entryId'] == f'tweet-{twid}' + + path = ('threaded_conversation_with_injections_v2', 'instructions', 0, 'entri...
yt_dlp/extractor/twitter.py
26
Python
0.929
security
327
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'only_matching': True, }, { # poll2choice_video card 'url': 'https://twitter.com/CAF_Online/status/1349365911120195585', 'only_matching': True, }, { # poll3choice_video card 'url': 'https://twitter.com/SamsungMobileSA/status/1348609186725289984', 'only_mat...
```suggestion cause = traverse_obj(result, ('tombstone', 'text', 'text'), expected_type=str) raise ExtractorError(f'Twitter API says: {cause or "Unknown error"}', expected=True) ```
'id': '1578401165338976258', 'title': str, 'description': 'md5:659a6b517a034b4cee5d795381a2dc41', 'uploader': str, 'uploader_id': 'primevideouk', 'timestamp': 1665155137, 'upload_date': '20221007', 'age_limit': 0, ...
@@ -552,10 +704,84 @@ class TwitterIE(TwitterBaseIE): 'only_matching': True, }] + def _graphql_to_legacy(self, data, twid): + def filter_tweet(_, obj): + return obj['entryId'] == f'tweet-{twid}' + + path = ('threaded_conversation_with_injections_v2', 'instructions', 0, 'entri...
yt_dlp/extractor/twitter.py
26
Python
1
refactor
208
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
card_name = card['name'].split(':')[-1] if card_name == 'player': yield { '_type': 'url', 'url': get_binding_value('player_url'), } elif card_name == 'periscope_broadcast': yield { ...
```suggestion yield from map(extract_from_video_info, traverse_obj( unified_card, ('media_entities', ...), expected_type=dict)) ```
media_id = traverse_obj(media, 'id_str', 'id', expected_type=str_or_none) self.write_debug(f'Extracting from video info: {media_id}') video_info = media.get('video_info') or {} formats = [] subtitles = {} for variant in video_info.get('variants', ...
@@ -642,31 +868,30 @@ def get_binding_value(k): card_name = card['name'].split(':')[-1] if card_name == 'player': - return { + yield { '_type': 'url', 'url': get_binding_value('player_url'), } ...
yt_dlp/extractor/twitter.py
26
Python
0.929
refactor
170
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'withSuperFollowsTweetFields': True, 'withSuperFollowsUserFields': True, 'withV2Timeline': True, 'withVoice': True, }, 'features': { 'graphql_is_translatable_rweb_tweet_is_translatable_enabled': False, ...
```suggestion self.write_debug(f'Using GraphQL API (Auth = {self.is_logged_in}') ```
'only_matching': True, }, { # video_direct_message card 'url': 'https://twitter.com/qarev001/status/1348948114569269251', 'only_matching': True, }, { # poll2choice_video card 'url': 'https://twitter.com/CAF_Online/status/1349365911120195585', 'only_matchin...
@@ -552,10 +697,77 @@ class TwitterIE(TwitterBaseIE): 'only_matching': True, }] + def _graphql_to_legacy(self, data, twid): + result = traverse_obj(data, ( + 'threaded_conversation_with_injections_v2', 'instructions', 0, 'entries', + lambda _, v: v['entryId'] == f'tweet-{...
yt_dlp/extractor/twitter.py
26
Python
0.714
bug
98
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'like_count': int, 'tags': ['HurricaneIan'], 'age_limit': 0, }, }, { 'url': 'https://twitter.com/i/web/status/1579846363218870272', 'info_dict': { 'id': '1579846355576659970', 'display_id': '1579846363218870272', 'ext': ...
While this PR was going, the Tweet has been deleted. A new test should be added in place.
'tags': [], 'age_limit': 0, }, 'playlist_count': 4, 'params': {'skip_download': True}, }, { 'url': 'https://twitter.com/MesoMax919/status/1575560063510810624', 'info_dict': { 'id': '1575559336759263233', 'display_id': '157556006...
@@ -514,6 +581,102 @@ class TwitterIE(TwitterBaseIE): }, 'playlist_count': 4, 'params': {'skip_download': True}, + }, { + 'url': 'https://twitter.com/MesoMax919/status/1575560063510810624', + 'info_dict': { + 'id': '1575559336759263233', + 'display_id': ...
yt_dlp/extractor/twitter.py
26
Python
0.286
suggestion
89
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
'withSuperFollowsTweetFields': True, 'withSuperFollowsUserFields': True, 'withV2Timeline': True, 'withVoice': True, }, 'features': { 'graphql_is_translatable_rweb_tweet_is_translatable_enabled': False, ...
```suggestion self.write_debug(f'Using GraphQL API (Auth = {self.is_logged_in})') ```
def _graphql_to_legacy(self, data, twid): result = traverse_obj(data, ( 'threaded_conversation_with_injections_v2', 'instructions', 0, 'entries', lambda _, v: v['entryId'] == f'tweet-{twid}', 'content', 'itemContent', 'tweet_results', 'result' ), expected_type=di...
@@ -552,10 +715,77 @@ class TwitterIE(TwitterBaseIE): 'only_matching': True, }] + def _graphql_to_legacy(self, data, twid): + result = traverse_obj(data, ( + 'threaded_conversation_with_injections_v2', 'instructions', 0, 'entries', + lambda _, v: v['entryId'] == f'tweet-{...
yt_dlp/extractor/twitter.py
26
Python
0.714
bug
99
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
'live_status': 'was_live', 'timestamp': 1659877956397, }, 'params': { 'skip_download': True, # requires ffmpeg }, }, { # Twitter Space not started yet 'url': 'https://twitter.com/i/spaces/1mnGeRyljQPJX', 'info_dict': { ...
I think this should not be a seperate function. Pulling it back in to the extract function means we don't have to pop the `media_key` from the returned dict.
'id': '1yNGaQLWpejGj', 'ext': 'mp4', 'title': 'Andrea May Sahouri - Periscope Broadcast', 'uploader': 'Andrea May Sahouri', 'uploader_id': '1PXEdBZWpGwKe', 'thumbnail': r're:^https?://[^?#]+\.jpg\?token=', 'view_count': int, }, ...
@@ -816,6 +1049,138 @@ def _real_extract(self, url): return info +class TwitterSpacesIE(TwitterBaseIE): + IE_NAME = 'twitter:spaces' + _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/spaces/(?P<id>[0-9a-zA-Z]{13})' + _TWITTER_GRAPHQL = 'https://twitter.com/i/api/graphql/HPEisOmj1epUNLCWTYhUWw/' + + ...
yt_dlp/extractor/twitter.py
26
Python
0.571
refactor
157
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
}, 'params': { 'skip_download': True, # requires ffmpeg }, }, { # Twitter Space not started yet 'url': 'https://twitter.com/i/spaces/1mnGeRyljQPJX', 'info_dict': { 'id': '1mnGeRyljQPJX', 'title': '@staderlabs x Hedera AMA w/ @defig...
```suggestion SPACE_STATUS = { ```
'title': 'Andrea May Sahouri - Periscope Broadcast', 'uploader': 'Andrea May Sahouri', 'uploader_id': '1PXEdBZWpGwKe', 'thumbnail': r're:^https?://[^?#]+\.jpg\?token=', 'view_count': int, }, } def _real_extract(self, url): broadcast_id...
@@ -816,6 +1049,138 @@ def _real_extract(self, url): return info +class TwitterSpacesIE(TwitterBaseIE): + IE_NAME = 'twitter:spaces' + _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/spaces/(?P<id>[0-9a-zA-Z]{13})' + _TWITTER_GRAPHQL = 'https://twitter.com/i/api/graphql/HPEisOmj1epUNLCWTYhUWw/' + + ...
yt_dlp/extractor/twitter.py
26
Python
0.429
suggestion
44
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
'title': '@staderlabs x Hedera AMA w/ @defigirlxoxo, @bmgentile, & @thehbarbull', 'description': 'Twitter Space partecipated by nobody yet.', 'uploader': 'Hedera', 'uploader_id': 'hedera', 'live_status': 'is_upcoming', 'timestamp': 1662394668924, ...
```suggestion participants = join_nonempty(*traverse_obj(data, ('participants', 'speakers', ..., 'display_name')), delim=', ') or 'nobody yet.' ``` But I wonder if we even have to use `join_nonempty` then, as the `None` should be filtered by `traverse_obj` already? ```suggestion participants = ', '...
broadcast_id = self._match_id(url) broadcast = self._call_api( 'broadcasts/show.json', broadcast_id, {'ids': broadcast_id})['broadcasts'][broadcast_id] info = self._parse_broadcast_data(broadcast, broadcast_id) media_key = broadcast['media_key'] source = s...
@@ -816,6 +1049,138 @@ def _real_extract(self, url): return info +class TwitterSpacesIE(TwitterBaseIE): + IE_NAME = 'twitter:spaces' + _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/spaces/(?P<id>[0-9a-zA-Z]{13})' + _TWITTER_GRAPHQL = 'https://twitter.com/i/api/graphql/HPEisOmj1epUNLCWTYhUWw/' + + ...
yt_dlp/extractor/twitter.py
26
Python
0.857
suggestion
418
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
'standardized_nudges_misinfo': True, 'tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled': False, 'vibe_api_enabled': True, }, } def _real_extract(self, url): space_id = self._match_id(url) space_data = self._c...
```suggestion m3u8_url = traverse_obj(source, 'noRedirectPlaybackUrl', 'location', expected_type=str) ```
'responsive_web_edit_tweet_api_enabled': True, 'responsive_web_enhance_cards_enabled': True, 'responsive_web_uc_gql_enabled': True, 'spaces_2022_h2_clipping': True, 'spaces_2022_h2_spaces_communities': False, 'standardized_n...
@@ -816,6 +1049,138 @@ def _real_extract(self, url): return info +class TwitterSpacesIE(TwitterBaseIE): + IE_NAME = 'twitter:spaces' + _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/spaces/(?P<id>[0-9a-zA-Z]{13})' + _TWITTER_GRAPHQL = 'https://twitter.com/i/api/graphql/HPEisOmj1epUNLCWTYhUWw/' + + ...
yt_dlp/extractor/twitter.py
26
Python
0.857
suggestion
119
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
'ext': 'mp4', 'title': 'Vivi - Vivi founder @lior_rauchy announcing our new student feedback tool live at @EduTECH_AU #EduTECH2019', 'uploader': 'Vivi', 'uploader_id': '1eVjYOLGkGrQL', 'thumbnail': r're:^https?://.*\.jpg', 'tags': ['EduTECH2019'], ...
I would maybe add the test to the back, as to not change test numbering? For example I've referenced 18 and 19 before, but they moved up to 19 and 20 now.
'duration': 111.278, 'timestamp': 1527623489, 'upload_date': '20180529', 'uploader_url': 'https://twitter.com/LisPower1', 'comment_count': int, 'repost_count': int, 'like_count': int, 'tags': [], 'age_limit': 0, ...
@@ -448,6 +498,23 @@ class TwitterIE(TwitterBaseIE): 'view_count': int, }, 'add_ie': ['TwitterBroadcast'], + }, { + # Twitter Spaces + 'url': 'https://twitter.com/MoniqueCamarra/status/1550101959377551360', + 'info_dict': { + 'id': '1lPJqmBeeNAJb', + ...
yt_dlp/extractor/twitter.py
26
Python
0.429
suggestion
154
51
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
import re from .common import InfoExtractor from .periscope import PeriscopeBaseIE, PeriscopeIE from ..compat import ( compat_HTTPError, compat_parse_qs, compat_urllib_parse_unquote, compat_urllib_parse_urlparse, ) from ..utils import ( ExtractorError, dict_get, float_or_none, format_fi...
I think I like `traverse_obj` more for this. ```suggestion live_status = traverse_obj(self.SPACE_STATUS, metadata.get('state'), casesense=False) ```
'withReplays': True, 'withSuperFollowsUserFields': True, 'withSuperFollowsTweetFields': True, }, 'features': { 'dont_mention_me_view_api_enabled': True, 'interactive_text_enabled': True, 'responsive_w...
@@ -1165,11 +1148,11 @@ def _build_graphql_query(self, space_id): def _real_extract(self, url): space_id = self._match_id(url) - space_data = self._call_graphql_api('HPEisOmj1epUNLCWTYhUWw/AudioSpaceById', space_id) + space_data = self._call_graphql_api('HPEisOmj1epUNLCWTYhUWw/AudioSpaceBy...
yt_dlp/extractor/twitter.py
26
Python
0.714
suggestion
159
835
51
false
[extractor/twitter] Base extractor api overhaul
5,247
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
if i < len(chapters) - 1: chapters[i + 1]['start_time'] = c['start_time'] continue else: old_c = new_chapters[-1] if i < len(chapters) - 1: next_c = chapters[i + 1] ...
These should give the short names for sponsor sections
if i < len(chapters) - 1: chapters[i + 1]['start_time'] = c['start_time'] continue else: old_c = new_chapters[-1] if i < len(chapters) - 1: next_c = chapters[i + 1] ...
@@ -295,8 +295,8 @@ def _remove_tiny_rename_sponsors(self, chapters): c.update({ 'category': category, 'categories': cats,
yt_dlp/postprocessor/modify_chapters.py
26
Python
0.286
suggestion
54
51
51
false
[SponsorBlock] Add support for chapter category
5,260
yt-dlp/yt-dlp
132,642
Python
pukkandan
ajayyy
# Ignore milliseconds difference at the start. if start_end[0] <= 1: start_end[0] = 0 # Make POI chapters 1 sec so that we can properly mark them if s['category'] in self.POI_CATEGORIES.keys(): start_end[1] += 1 # Ignore millise...
It doesn't really matter what this field is called, So I've reverted it to keep the diff small
# Ignore milliseconds difference at the start. if start_end[0] <= 1: start_end[0] = 0 # Make POI chapters 1 sec so that we can properly mark them if s['category'] in self.POI_CATEGORIES.keys(): start_end[1] += 1 # Ignore millise...
@@ -68,12 +72,13 @@ def duration_filter(s): def to_chapter(s): (start, end), cat = s['segment'], s['category'] + title = s['description'] if cat == 'chapter' else self.CATEGORIES[cat] return { 'start_time': start, 'end_time': end, ...
yt_dlp/postprocessor/sponsorblock.py
26
Python
0.214
suggestion
94
48
48
false
[SponsorBlock] Add support for chapter category
5,260
yt-dlp/yt-dlp
132,642
Python
pukkandan
ajayyy
def duration_filter(s): start_end = s['segment'] # Ignore entire video segments (https://wiki.sponsor.ajay.app/w/Types). if start_end == (0, 0): return False # Ignore milliseconds difference at the start. if start_end[0] <= 1: ...
To clarify, `description` is present if and only if categories is 'chapter', correct? Is there any case where a chapter doesn't have description or where a sponsor has one?
def duration_filter(s): start_end = s['segment'] # Ignore entire video segments (https://wiki.sponsor.ajay.app/w/Types). if start_end == (0, 0): return False # Ignore milliseconds difference at the start. if start_end[0] <= 1: ...
@@ -68,12 +72,13 @@ def duration_filter(s): def to_chapter(s): (start, end), cat = s['segment'], s['category'] + title = s['description'] if cat == 'chapter' else self.CATEGORIES[cat]
yt_dlp/postprocessor/sponsorblock.py
26
Python
0.5
question
172
51
51
false
[SponsorBlock] Add support for chapter category
5,260
yt-dlp/yt-dlp
132,642
Python
pukkandan
ajayyy
'id': '60c7c443da18892ebfe85ed7', 'ext': 'mp4', 'title': 'ВОТ ЭТО Focus. Деды Морозы на гидроциклах', 'description': 'md5:f3db3d995763b9bbb7b56d4ccdedea89', 'thumbnail': 're:^https://avatars.dzeninfra.ru/', 'uploader': 'AcademeG DailyStream' ...
This URL still works in browser, and so should continue to work in yt-dlp
'info_dict': { 'id': '60c7c443da18892ebfe85ed7', 'ext': 'mp4', 'title': 'ВОТ ЭТО Focus. Деды Морозы на гидроциклах', 'description': 'md5:f3db3d995763b9bbb7b56d4ccdedea89', 'thumbnail': 're:^https://avatars.dzeninfra.ru/', 'uploader': 'Acade...
@@ -188,54 +188,43 @@ def _real_extract(self, url): class ZenYandexIE(InfoExtractor): - _VALID_URL = r'https?://zen\.yandex\.ru(?:/video)?/(media|watch)/(?:(?:id/[^/]+/|[^/]+/)(?:[a-z0-9-]+)-)?(?P<id>[a-z0-9-]+)' + _VALID_URL = r'https?://dzen\.ru(?:/video)?/(media|watch)/(?:(?:id/[^/]+/|[^/]+/)(?:[a-z0-9-]+...
yt_dlp/extractor/yandexvideo.py
26
Python
0.286
suggestion
73
51
51
false
[zen.yandex.ru] Fix download
5,268
yt-dlp/yt-dlp
132,642
Python
pukkandan
lksj
from .common import InfoExtractor from ..utils import ( traverse_obj, ) class YleAreenaIE(InfoExtractor): _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd6423804182d32f8ac', 'info_dict': { ...
```suggestion from ..utils import traverse_obj ```
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils import int_or_none, traverse_obj, url_or_none class YleAreenaIE(InfoExtractor): _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[\d-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd642...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +)
yt_dlp/extractor/yle_areena.py
4
Python
0.571
suggestion
52
29
29
false
Add areena.yle.fi video download support
5,270
yt-dlp/yt-dlp
132,642
Python
pukkandan
vitkhab
from .common import InfoExtractor from ..utils import ( traverse_obj, ) class YleAreenaIE(InfoExtractor): _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd6423804182d32f8ac', 'info_dict': { ...
```suggestion _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[\d-]+)' ```
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils import int_or_none, traverse_obj, url_or_none class YleAreenaIE(InfoExtractor): _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[\d-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd642...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class YleAreenaIE(InfoExtractor): + _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)'
yt_dlp/extractor/yle_areena.py
8
Python
0.571
suggestion
79
33
33
false
Add areena.yle.fi video download support
5,270
yt-dlp/yt-dlp
132,642
Python
pukkandan
vitkhab
) class YleAreenaIE(InfoExtractor): _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd6423804182d32f8ac', 'info_dict': { 'id': '0_a3tjk92c', 'ext': 'mp4', 'title': 'K...
```suggestion video_data = self._download_json( f'https://player.api.yle.fi/v1/preview/{video_id}.json?app_id=player_static_prod&app_key=8930d72170e48303cf5f3867780d549b', video_id) ```
class YleAreenaIE(InfoExtractor): _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[\d-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd6423804182d32f8ac', 'info_dict': { 'id': '0_a3tjk92c', 'ext': 'mp4', 'title': 'Pouc...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class YleAreenaIE(InfoExtractor): + _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' + _TESTS = [{ + 'url': 'https://areena.yle.fi/1-4371942', + 'md5': '932edda0ecf5dfd6423804182d32f8ac', + ...
yt_dlp/extractor/yle_areena.py
26
Python
0.786
suggestion
221
39
51
false
Add areena.yle.fi video download support
5,270
yt-dlp/yt-dlp
132,642
Python
pukkandan
vitkhab
traverse_obj, ) class YleAreenaIE(InfoExtractor): _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd6423804182d32f8ac', 'info_dict': { 'id': '0_a3tjk92c', 'ext': 'mp4', ...
are u sure the app_key is static?
from ..utils import int_or_none, traverse_obj, url_or_none class YleAreenaIE(InfoExtractor): _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[\d-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd6423804182d32f8ac', 'info_dict': { 'id': '0_a3tj...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class YleAreenaIE(InfoExtractor): + _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' + _TESTS = [{ + 'url': 'https://areena.yle.fi/1-4371942', + 'md5': '932edda0ecf5dfd6423804182d32f8ac', + ...
yt_dlp/extractor/yle_areena.py
26
Python
0.071
question
33
40
51
false
Add areena.yle.fi video download support
5,270
yt-dlp/yt-dlp
132,642
Python
pukkandan
vitkhab
_VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' _TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd6423804182d32f8ac', 'info_dict': { 'id': '0_a3tjk92c', 'ext': 'mp4', 'title': 'K1, J2: Pouchit | Modernit miehet', ...
Is it worth downloading the webpage for this?
_TESTS = [{ 'url': 'https://areena.yle.fi/1-4371942', 'md5': '932edda0ecf5dfd6423804182d32f8ac', 'info_dict': { 'id': '0_a3tjk92c', 'ext': 'mp4', 'title': 'Pouchit', 'description': 'md5:d487309c3abbe5650265bbd1742d2f82', 'series': '...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class YleAreenaIE(InfoExtractor): + _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' + _TESTS = [{ + 'url': 'https://areena.yle.fi/1-4371942', + 'md5': '932edda0ecf5dfd6423804182d32f8ac', + ...
yt_dlp/extractor/yle_areena.py
26
Python
0.071
question
45
35
51
false
Add areena.yle.fi video download support
5,270
yt-dlp/yt-dlp
132,642
Python
pukkandan
vitkhab
'id': '0_a3tjk92c', 'ext': 'mp4', 'title': 'K1, J2: Pouchit | Modernit miehet', 'thumbnail': r're:^https?://.*\.jpg$', 'uploader_id': 'ovp@yle.fi', 'duration': 1435, 'view_count': int, 'upload_date': '20181204', ...
```suggestion 'ie_key': KalturaIE.ie_key(), ``` import the IE
'ext': 'mp4', 'title': 'Pouchit', 'description': 'md5:d487309c3abbe5650265bbd1742d2f82', 'series': 'Modernit miehet', 'season': 'Season 1', 'season_number': 1, 'episode': 'Episode 2', 'episode_number': 2, 'thumbn...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class YleAreenaIE(InfoExtractor): + _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' + _TESTS = [{ + 'url': 'https://areena.yle.fi/1-4371942', + 'md5': '932edda0ecf5dfd6423804182d32f8ac', + ...
yt_dlp/extractor/yle_areena.py
26
Python
0.571
suggestion
76
30
51
false
Add areena.yle.fi video download support
5,270
yt-dlp/yt-dlp
132,642
Python
pukkandan
vitkhab
'title': 'K1, J2: Pouchit | Modernit miehet', 'thumbnail': r're:^https?://.*\.jpg$', 'uploader_id': 'ovp@yle.fi', 'duration': 1435, 'view_count': int, 'upload_date': '20181204', 'timestamp': 1543916210, } }] def _real_e...
shouldnt this be: ```suggestion 'thumbnails': traverse_obj(info, ('thumbnails', ..., {'url': 'url'})), ``` This will extract all available thumbnails
'description': 'md5:d487309c3abbe5650265bbd1742d2f82', 'series': 'Modernit miehet', 'season': 'Season 1', 'season_number': 1, 'episode': 'Episode 2', 'episode_number': 2, 'thumbnail': 'http://cfvod.kaltura.com/p/1955031/sp/195503100/thu...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class YleAreenaIE(InfoExtractor): + _VALID_URL = r'https?://areena\.yle\.fi/(?P<id>[0-9-]+)' + _TESTS = [{ + 'url': 'https://areena.yle.fi/1-4371942', + 'md5': '932edda0ecf5dfd6423804182d32f8ac', + ...
yt_dlp/extractor/yle_areena.py
26
Python
0.786
refactor
165
28
51
false
Add areena.yle.fi video download support
5,270
yt-dlp/yt-dlp
132,642
Python
pukkandan
vitkhab
from json import JSONDecodeError from urllib.error import HTTPError from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_call, try_get, urljoin) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'h...
```suggestion import json import urllib.error ``` make necessary changes below
import json import urllib.error from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_get, urljoin, ) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError
yt_dlp/extractor/cinetecamilano.py
2
Python
0.786
suggestion
84
27
27
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
from json import JSONDecodeError from urllib.error import HTTPError from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_call, try_get, urljoin) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'h...
```suggestion urljoin, ) ```
import json import urllib.error from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_get, urljoin, ) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + parse_iso8601, + strip_or_none, + traverse_obj, + try_call, + try_get, + urljoin)
yt_dlp/extractor/cinetecamilano.py
12
Python
0.429
suggestion
35
37
37
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
from json import JSONDecodeError from urllib.error import HTTPError from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_call, try_get, urljoin) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'h...
```suggestion _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id>\d+)' ``` it does nothing
import json import urllib.error from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_get, urljoin, ) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + parse_iso8601, + strip_or_none, + traverse_obj, + try_call, + try_get, + urljoin) + + +class CinetecaMilanoIE(Info...
yt_dlp/extractor/cinetecamilano.py
16
Python
0.714
suggestion
111
41
41
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
from json import JSONDecodeError from urllib.error import HTTPError from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_call, try_get, urljoin) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'h...
```suggestion 'thumbnail': r're:.+\.png', ```
import json import urllib.error from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_get, urljoin, ) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + parse_iso8601, + strip_or_none, + traverse_obj, + try_call, + try_get, + urljoin) + + +class CinetecaMilanoIE(Info...
yt_dlp/extractor/cinetecamilano.py
24
Python
0.571
suggestion
59
49
49
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
from json import JSONDecodeError from urllib.error import HTTPError from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_call, try_get, urljoin) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'h...
```suggestion 'modified_date': '20200520', ```
import json import urllib.error from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_get, urljoin, ) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + parse_iso8601, + strip_or_none, + traverse_obj, + try_call, + try_get, + urljoin) + + +class CinetecaMilanoIE(Info...
yt_dlp/extractor/cinetecamilano.py
26
Python
0.571
suggestion
60
51
51
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
from json import JSONDecodeError from urllib.error import HTTPError from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_call, try_get, urljoin) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'h...
```suggestion 'title': 'Il draghetto Gris\u00f9 (4 episodi)', ```
import json import urllib.error from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_iso8601, strip_or_none, traverse_obj, try_get, urljoin, ) class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + parse_iso8601, + strip_or_none, + traverse_obj, + try_call, + try_get, + urljoin) + + +class CinetecaMilanoIE(Info...
yt_dlp/extractor/cinetecamilano.py
22
Python
0.571
suggestion
79
47
47
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
'info_dict': { 'id': '1942', 'ext': 'mp4', 'title': "Il draghetto Gris\u00f9 (4 episodi)", 'release_date': '20220129', 'thumbnail': 're:.+\\.png', 'description': 'md5:5328cbe080b93224712b6f17fcaf2c01', 'modified_date': "20200520...
```suggestion if ((isinstance(e.cause, HTTPError) and e.cause.code == 500) or isinstance(e.cause, JSONDecodeError)): ```
'info_dict': { 'id': '1942', 'ext': 'mp4', 'title': 'Il draghetto Gris\u00f9 (4 episodi)', 'release_date': '20220129', 'thumbnail': r're:.+\.png', 'description': 'md5:5328cbe080b93224712b6f17fcaf2c01', 'modified_date': '20200520...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + parse_iso8601, + strip_or_none, + traverse_obj, + try_call, + try_get, + urljoin) + + +class CinetecaMilanoIE(Info...
yt_dlp/extractor/cinetecamilano.py
26
Python
0.929
suggestion
155
46
44
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id>\d+)/?' _TESTS = [{ 'url': 'https://www.cinetecamilano.it/film/1942', 'info_dict': { 'id': '1942', 'ext': 'mp4', 'title': "Il draghetto Gris\u00f9 (4 episod...
```suggestion 'Authorization': try_get(self._get_cookies('https://www.cinetecamilano.it'), lambda x: f'Bearer {x["cnt-token"].value}') or '' ```
class CinetecaMilanoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.cinetecamilano.it/film/1942', 'info_dict': { 'id': '1942', 'ext': 'mp4', 'title': 'Il draghetto Gris\u00f9 (4 episodi)...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + parse_iso8601, + strip_or_none, + traverse_obj, + try_call, + try_get, + urljoin) + + +class CinetecaMilanoIE(Info...
yt_dlp/extractor/cinetecamilano.py
26
Python
0.714
security
166
50
48
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
try: film_json = self._download_json( f'https://www.cinetecamilano.it/api/catalogo/{video_id}', video_id, headers={ 'Referer': url, 'Authorization': try_get(self._get_cookies('https://www.cinetecamilano.it'), lambda x: f"Bearer ...
```suggestion 'thumbnail': urljoin(url, try_get(archive, lambda x: x['thumb']['src'].replace('/public/', '/storage/'))), ``` no need to import both
try: film_json = self._download_json( f'https://www.cinetecamilano.it/api/catalogo/{video_id}/?', video_id, headers={ 'Referer': url, 'Authorization': try_get(self._get_cookies('https://www.cinetecamilano.it'), lambda x: f'Beare...
@@ -0,0 +1,63 @@ +from json import JSONDecodeError +from urllib.error import HTTPError +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + parse_iso8601, + strip_or_none, + traverse_obj, + try_call, + try_get, + urljoin) + + +class CinetecaMilanoIE(Info...
yt_dlp/extractor/cinetecamilano.py
26
Python
0.786
suggestion
162
30
28
false
[extractor/cinetecamilano] Add extractor
5,279
yt-dlp/yt-dlp
132,642
Python
pukkandan
timendum
import itertools import re from .common import InfoExtractor from ..compat import compat_str, compat_HTTPError from ..utils import ( determine_ext, int_or_none, parse_iso8601, try_get, unescapeHTML, ExtractorError, ) class RumbleEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ru...
```suggestion 'title': unescapeHTML(video.get('title')), ```
sys_msg = traverse_obj(video, ('sys', 'msg')) if sys_msg: self.report_warning(sys_msg, video_id=video_id) if video.get('live') == 0: live_status = 'not_live' if video.get('livestream_has_dvr') is None else 'was_live' elif video.get('live') == 1: live...
@@ -92,18 +175,28 @@ def _real_extract(self, url): } author = video.get('author') or {} + thumbnails = [{key: mapping[t_key] for t_key, key in self.THUMBNAIL_MAPPING.items() + if t_key in mapping} for mapping in video.get('t', ())] + if not thumbnails and 'i' in v...
yt_dlp/extractor/rumble.py
26
Python
0.571
security
74
141
51
false
[rumble] add HLS formats
5,280
yt-dlp/yt-dlp
132,642
Python
pukkandan
flashdagger
import itertools import re from .common import InfoExtractor from ..compat import compat_str, compat_HTTPError from ..utils import ( determine_ext, int_or_none, parse_iso8601, try_get, unescapeHTML, ExtractorError, ) class RumbleEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ru...
what will `video['duration']` be in this case?
'format_id': '%s-%sp' % (ext, height), 'height': int_or_none(height), 'fps': video.get('fps'), **traverse_obj(meta, { 'tbr': 'bitrate', 'filesize': 'size', 'width': 'w'...
@@ -92,18 +175,28 @@ def _real_extract(self, url): } author = video.get('author') or {} + thumbnails = [{key: mapping[t_key] for t_key, key in self.THUMBNAIL_MAPPING.items() + if t_key in mapping} for mapping in video.get('t', ())] + if not thumbnails and 'i' in v...
yt_dlp/extractor/rumble.py
26
Python
0.214
question
46
141
51
false
[rumble] add HLS formats
5,280
yt-dlp/yt-dlp
132,642
Python
pukkandan
flashdagger
import itertools import re from .common import InfoExtractor from ..compat import compat_str, compat_HTTPError from ..utils import ( determine_ext, int_or_none, parse_iso8601, try_get, unescapeHTML, ExtractorError, ) class RumbleEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ru...
```suggestion thumbnails = traverse_obj(video, ('t', ..., {'url': 'i', 'width': 'w', 'height': 'h'}) if not thumbnails and video.get('i'): thumbnails = [{'url': video['i']}] ```
return embeds return [f'https://rumble.com/embed/{mobj.group("id")}' for mobj in re.finditer( r'<script>\s*Rumble\(\s*"play"\s*,\s*{\s*[\'"]video[\'"]\s*:\s*[\'"](?P<id>[0-9a-z]+)[\'"]', webpage)] def _real_extract(self, url): video_id = self._match_id(url) video = s...
@@ -92,18 +175,28 @@ def _real_extract(self, url): } author = video.get('author') or {} + thumbnails = [{key: mapping[t_key] for t_key, key in self.THUMBNAIL_MAPPING.items() + if t_key in mapping} for mapping in video.get('t', ())] + if not thumbnails and 'i' in v...
yt_dlp/extractor/rumble.py
26
Python
0.786
suggestion
209
141
51
false
[rumble] add HLS formats
5,280
yt-dlp/yt-dlp
132,642
Python
pukkandan
flashdagger
import itertools import re from .common import InfoExtractor from ..compat import compat_str, compat_HTTPError from ..utils import ( determine_ext, int_or_none, parse_iso8601, try_get, unescapeHTML, ExtractorError, ) class RumbleEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ru...
```suggestion formats.append({ 'ext': ext, 'url': video_info['url'], 'format_id': '%s-%sp' % (ext, height), 'height': int_or_none(height), 'fps': video.get('fps'), **traverse_ob...
'channel_url': 'https://rumble.com/c/RichSementa', 'thumbnail': 'https://sp.rmbl.ws/s8/1/P/j/f/A/PjfAe.OvCc-small-911-Audio-From-The-Man-Who-.jpg', 'timestamp': 1654892716, 'uploader': 'Mr Producer Media', 'upload_date': '20220610', ...
@@ -62,26 +123,48 @@ def _extract_embed_urls(cls, url, webpage): def _real_extract(self, url): video_id = self._match_id(url) video = self._download_json( - 'https://rumble.com/embedJS/', video_id, - query={'request': 'video', 'v': video_id}) - title = unescapeHTML(vi...
yt_dlp/extractor/rumble.py
26
Python
0.786
suggestion
1,075
141
51
false
[rumble] add HLS formats
5,280
yt-dlp/yt-dlp
132,642
Python
pukkandan
flashdagger
'channel_url': author.get('url'), 'duration': int_or_none(video.get('duration')), 'uploader': author.get('name'), } class RumbleChannelIE(InfoExtractor): _VALID_URL = r'(?P<url>https?://(?:www\.)?rumble\.com/(?:c|user)/(?P<id>[^&?#$/]+))' _TESTS = [{ 'url':...
```suggestion sys_msg = traverse_obj(video, ('sys', 'msg')) ```
'uploader': 'Rumble Events', 'live_status': 'was_live', }, 'params': {'skip_download': True} }, { 'url': 'https://rumble.com/embed/ufe9n.v5pv5f', 'only_matching': True, }] _WEBPAGE_TESTS = [ { 'note': 'Rumble embed', 'u...
@@ -62,26 +123,48 @@ def _extract_embed_urls(cls, url, webpage): def _real_extract(self, url): video_id = self._match_id(url) video = self._download_json( - 'https://rumble.com/embedJS/', video_id, - query={'request': 'video', 'v': video_id}) - title = unescapeHTML(vi...
yt_dlp/extractor/rumble.py
26
Python
0.571
suggestion
73
38
51
false
[rumble] add HLS formats
5,280
yt-dlp/yt-dlp
132,642
Python
pukkandan
flashdagger
import itertools import re from .common import InfoExtractor from ..compat import compat_str, compat_HTTPError from ..utils import ( determine_ext, int_or_none, parse_iso8601, try_get, unescapeHTML, ExtractorError, ) class RumbleEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ru...
```suggestion ``` doesnt do anything
'ext': 'mp4', 'timestamp': 1612662578, 'uploader': 'LovingMontana', 'channel': 'LovingMontana', 'upload_date': '20210207', 'title': 'Winter-loving dog helps girls dig a snow fort ', 'channel_url': 'https://ru...
@@ -62,26 +123,48 @@ def _extract_embed_urls(cls, url, webpage): def _real_extract(self, url): video_id = self._match_id(url) video = self._download_json( - 'https://rumble.com/embedJS/', video_id, - query={'request': 'video', 'v': video_id}) - title = unescapeHTML(vi...
yt_dlp/extractor/rumble.py
26
Python
0.429
suggestion
38
141
51
false
[rumble] add HLS formats
5,280
yt-dlp/yt-dlp
132,642
Python
pukkandan
flashdagger
import itertools import re from .common import InfoExtractor from ..compat import compat_str, compat_HTTPError from ..utils import ( determine_ext, int_or_none, parse_iso8601, try_get, unescapeHTML, ExtractorError, ) class RumbleEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ru...
```suggestion if not video_info.get('url'): continue ```
'ext': 'mp4', 'timestamp': 1612662578, 'uploader': 'LovingMontana', 'channel': 'LovingMontana', 'upload_date': '20210207', 'title': 'Winter-loving dog helps girls dig a snow fort ', 'channel_url': 'https://ru...
@@ -62,26 +123,48 @@ def _extract_embed_urls(cls, url, webpage): def _real_extract(self, url): video_id = self._match_id(url) video = self._download_json( - 'https://rumble.com/embedJS/', video_id, - query={'request': 'video', 'v': video_id}) - title = unescapeHTML(vi...
yt_dlp/extractor/rumble.py
26
Python
0.571
suggestion
95
141
51
false
[rumble] add HLS formats
5,280
yt-dlp/yt-dlp
132,642
Python
pukkandan
flashdagger