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
key = key[1:] value = json.loads(html.unescape(value)) attr[key] = value return attr def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) stream_meta = self._parse_vue_element_attr('...
- single quotes - dict key traversal is easier to read and write - `title` can be non-fatal (and should be, imo) - `uploader_id` should be a string, use `str_or_none` (import from utils) - it's always good to make sure info_dict values that need to be `int` or a url actually are (import `int_or_none` and `url_...
'live_status': 'was_live', }, 'params': {'skip_download': 'm3u8'}, }] def _parse_vue_element_attr(self, name, string, video_id): page_elem = self._search_regex(rf'(<{name}[^>]+>)', string, name) attrs = {} for key, value in extract_attributes(page_elem).items...
@@ -0,0 +1,55 @@ +import json +import html +import re + +from .common import InfoExtractor +from ..utils import traverse_obj + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' + _TESTS = [{ + 'url': 'https://zaiko.io/event/324868/stream/20571/20571', + ...
yt_dlp/extractor/zaiko.py
26
Python
0.857
refactor
1,256
29
51
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
import json import html import re from .common import InfoExtractor from ..utils import traverse_obj class ZaikoIE(InfoExtractor): _VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = [{ 'url': 'https://zaiko.io/event/324868/stream/20571/20571', 'info_dict': { ...
make sure to actually run this test, right now it fails without an `upload_date` value use `test/local_parameters.json` to pass cookies params for the test download, e.g.: ```json { "cookiesfrombrowser": [ "firefox", null, null, null ] } ```
from .common import InfoExtractor from ..utils import ( ExtractorError, extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = ...
@@ -0,0 +1,55 @@ +import json +import html +import re + +from .common import InfoExtractor +from ..utils import traverse_obj + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' + _TESTS = [{ + 'url': 'https://zaiko.io/event/324868/stream/20571/20571', + ...
yt_dlp/extractor/zaiko.py
18
Python
1
bug
274
43
43
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
from .common import InfoExtractor from ..utils import ( traverse_obj, extract_attributes, remove_start, unescapeHTML, url_or_none, str_or_none, int_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = [{ ...
sort (and remove `remove_start` if applying suggestion below) ```suggestion from ..utils import ( extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) ```
from .common import InfoExtractor from ..utils import ( ExtractorError, extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = ...
@@ -0,0 +1,71 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + extract_attributes, + remove_start, + unescapeHTML, + url_or_none, + str_or_none, + int_or_none, +)
yt_dlp/extractor/zaiko.py
10
Python
0.857
security
224
35
35
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
from .common import InfoExtractor from ..utils import ( traverse_obj, extract_attributes, remove_start, unescapeHTML, url_or_none, str_or_none, int_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = [{ ...
```suggestion 'title': 'ZAIKO STREAMING TEST', 'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)', ```
from .common import InfoExtractor from ..utils import ( ExtractorError, extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = ...
@@ -0,0 +1,71 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + extract_attributes, + remove_start, + unescapeHTML, + url_or_none, + str_or_none, + int_or_none, +) + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stre...
yt_dlp/extractor/zaiko.py
22
Python
0.714
suggestion
144
47
47
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
_TESTS = [{ 'url': 'https://zaiko.io/event/324868/stream/20571/20571', 'info_dict': { 'id': '324868', 'ext': 'mp4', 'title': 'ZAIKO STREAMING TEST', 'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)', 'uploader_id': '454', ...
Ah I see now, not all of the attributes on the player page are JSON. My bad. It doesn't look like any of the non-JSON attrs will ever be useful, so I think we can do this: ```suggestion if key.startswith(':'): attrs[key[1:]] = self._parse_json( value, video_id, trans...
_TESTS = [{ 'url': 'https://zaiko.io/event/324868/stream/20571/20571', 'info_dict': { 'id': '324868', 'ext': 'mp4', 'title': 'ZAIKO STREAMING TEST', 'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)', 'uploader_id': '454', ...
@@ -0,0 +1,71 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + extract_attributes, + remove_start, + unescapeHTML, + url_or_none, + str_or_none, + int_or_none, +) + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stre...
yt_dlp/extractor/zaiko.py
26
Python
0.857
security
363
51
51
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
from .common import InfoExtractor from ..utils import ( extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = [{ 'url': 'http...
need this for later ```suggestion ExtractorError, extract_attributes, ```
from .common import InfoExtractor from ..utils import ( ExtractorError, extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = ...
@@ -0,0 +1,67 @@ +from .common import InfoExtractor +from ..utils import ( + extract_attributes,
yt_dlp/extractor/zaiko.py
4
Python
0.786
refactor
85
29
29
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
from .common import InfoExtractor from ..utils import ( extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = [{ 'url': 'http...
apparently there are artist subdomains too, e.g. https://vark-live.zaiko.io/ ```suggestion _VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' ```
from .common import InfoExtractor from ..utils import ( ExtractorError, extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = ...
@@ -0,0 +1,67 @@ +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + int_or_none, + str_or_none, + traverse_obj, + unescapeHTML, + url_or_none, +) + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
yt_dlp/extractor/zaiko.py
13
Python
0.714
suggestion
183
38
38
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'title': 'ZAIKO STREAMING TEST', 'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)', 'uploader_id': '454', 'uploader': 'ZAIKO ZERO', 'timestamp': 1583809200, 'thumbnail': r're:https://[a-z0-9]+.cloudfront.net/[a-z0-9_]+/[a-z0-9_]+', ...
almost everything on the site is PPV, so also check if logged-in users have paid/can view. if user does not have tickets, redirect URL will be like https://vark-live.zaiko.io/_buy/1u0N:Rx:22e84 ```suggestion webpage, urlh = self._download_webpage_handle(url, video_id) final_url = urlh.geturl() ...
'ext': 'mp4', 'title': 'ZAIKO STREAMING TEST', 'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)', 'uploader_id': '454', 'uploader': 'ZAIKO ZERO', 'release_timestamp': 1583809200, 'thumbnail': r're:https://[a-z0-9]+.cloud...
@@ -0,0 +1,67 @@ +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + int_or_none, + str_or_none, + traverse_obj, + unescapeHTML, + url_or_none, +) + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' + _...
yt_dlp/extractor/zaiko.py
26
Python
1
refactor
541
50
51
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
from .common import InfoExtractor from ..utils import ( extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = [{ 'url': 'http...
It looks like the site is about 50% live content and livestreams use the same URL format as VOD, so might as well add support with this: ```suggestion status = traverse_obj(player_meta, ('initial_event_info', 'status', {str})) live_status, msg, expected = { 'vod': ('was_live', 'No VOD st...
stream_meta = self._parse_vue_element_attr('stream-page', webpage, video_id) player_page = self._download_webpage( stream_meta['stream-access']['video_source'], video_id, 'Downloading player page', headers={'referer': 'https://zaiko.io/'}) player_meta = self._parse_vue_e...
@@ -0,0 +1,67 @@ +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + int_or_none, + str_or_none, + traverse_obj, + unescapeHTML, + url_or_none, +) + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' + _...
yt_dlp/extractor/zaiko.py
26
Python
1
refactor
1,534
68
43
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
def _parse_vue_element_attr(self, name, string, video_id): page_elem = self._search_regex(rf'(<{name}[^>]+>)', string, name) attrs = {} for key, value in extract_attributes(page_elem).items(): if key.startswith(':'): attrs[key[1:]] = self._parse_json( ...
```suggestion 'formats': formats, 'live_status': live_status, ```
'params': {'skip_download': 'm3u8'}, }] def _parse_vue_element_attr(self, name, string, video_id): page_elem = self._search_regex(rf'(<{name}[^>]+>)', string, name) attrs = {} for key, value in extract_attributes(page_elem).items(): if key.startswith(':'): ...
@@ -0,0 +1,67 @@ +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + int_or_none, + str_or_none, + traverse_obj, + unescapeHTML, + url_or_none, +) + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' + _...
yt_dlp/extractor/zaiko.py
26
Python
0.571
suggestion
92
39
51
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
attrs[key[1:]] = self._parse_json( value, video_id, transform_source=unescapeHTML, fatal=False) return attrs def _real_extract(self, url): video_id = self._match_id(url) webpage, urlh = self._download_webpage_handle(url, video_id) if 'zaiko.io/lo...
livestream start time should be `release_timestamp` ```suggestion 'release_timestamp': ('stream', 'start', 'timestamp', {int_or_none}), ```
attrs = {} for key, value in extract_attributes(page_elem).items(): if key.startswith(':'): attrs[key[1:]] = self._parse_json( value, video_id, transform_source=unescapeHTML, fatal=False) return attrs def _real_extract(self, url): vide...
@@ -0,0 +1,67 @@ +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + int_or_none, + str_or_none, + traverse_obj, + unescapeHTML, + url_or_none, +) + + +class ZaikoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' + _...
yt_dlp/extractor/zaiko.py
26
Python
0.786
suggestion
158
34
51
false
[extractor/zaiko] Adding new extractor for zaiko.io
7,254
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'x-twitter-client-language': 'en', 'x-twitter-active-user': 'yes', 'Referer': 'https://twitter.com/', 'Origin': 'https://twitter.com', }) def build_login_json(*subtask_inputs): return json.dumps({ 'flow_token': self._flow_token...
Why not just remove the caching?
'x-twitter-active-user': 'yes', 'Referer': 'https://twitter.com/', 'Origin': 'https://twitter.com', }) def build_login_json(*subtask_inputs): return json.dumps({ 'flow_token': self._flow_token, 'subtask_inputs': subtask_inp...
@@ -90,14 +146,149 @@ def _search_dimensions_in_video_url(a_format, video_url): 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) + def _fetch...
yt_dlp/extractor/twitter.py
26
Python
0.143
question
32
51
51
false
[extractor/twitter] Add login support
7,258
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
def _perform_login(self, username, password): if len(username) == 10 and username.isdigit() and self._USER_TOKEN is None: self.report_login() otp_request_json = self._download_json(f'https://b2bapi.zee5.com/device/sendotp_v1.php?phoneno=91{username}', ...
Might be worth using `self.get_param('geo_bypass_country')` before `IN`
def _perform_login(self, username, password): if len(username) == 10 and username.isdigit() and self._USER_TOKEN is None: self.report_login() otp_request_json = self._download_json(f'https://b2bapi.zee5.com/device/sendotp_v1.php?phoneno=91{username}', ...
@@ -118,11 +120,16 @@ def _perform_login(self, username, password): self._USER_TOKEN = otp_verify_json.get('token') if not self._USER_TOKEN: raise ExtractorError(otp_request_json['message'], expected=True) - elif username.lower() == 'token' and len(password) > 1198: + ...
yt_dlp/extractor/zee5.py
26
Python
0.357
suggestion
71
51
51
false
[extractor/zee5] Fix extraction of new content
7,280
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import clean_html class Funker530IE(InfoExtractor): _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/video\/(?P<id>[^\/]+)\/?' ...
Tests are only running the first item in this list. How do I get it to run the embedded YouTube video test as well?
from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none class Funker530IE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' _TESTS = [{ '...
@@ -0,0 +1,75 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/...
yt_dlp/extractor/funker530.py
14
Python
0.357
question
115
39
39
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
Cyberes
Cyberes
} }, { 'url': 'https://funker530.com/video/my-friends-joined-the-russians-civdiv/', 'md5': '', 'info_dict': { 'id': '', 'ext': 'mp4', 'title': 'My “Friends” Joined the Russians - CivDiv', 'thumbnail': r're:^https?://.*\.jpg$', ...
Is converting it to a list okay if there's only one video? Do I need to do all found videos or is `[0]` ok? There should only be one embedded video on the page.
'ext': 'mp4', 'view_count': int, 'channel': 'Civ Div', 'comment_count': int, 'channel_follower_count': int, 'thumbnail': 'https://i.ytimg.com/vi/k-pk4bOvoac/maxresdefault.jpg', 'uploader_id': '@CivDiv', 'duration': 357, ...
@@ -0,0 +1,75 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/...
yt_dlp/extractor/funker530.py
26
Python
0.571
suggestion
160
43
47
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
Cyberes
Cyberes
'upload_date': '', 'description': 'md5:', } }] def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) rumble = RumbleEmbedIE(downloader=self._downloader) youtube = YoutubeIE(downloader=self...
What should I return if no video was found? Simply doing `return` makes yt-dlp print a warning.
'live_status': 'not_live', 'age_limit': 0, 'uploader': 'Civ Div', 'categories': ['People & Blogs'], 'title': 'My “Friends” joined the Russians.', 'availability': 'public', 'upload_date': '20230608', 'playable_in_embed': True...
@@ -0,0 +1,75 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/...
yt_dlp/extractor/funker530.py
26
Python
0.429
question
95
29
33
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
Cyberes
Cyberes
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import clean_html class Funker530IE(InfoExtractor): _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/video\/(?P<id>[^\/]+)\/?' ...
`unicode_literals` isn't necessary and IMO we should use the (non-fatal) `_search_regex` method instead of importing `re`
from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none class Funker530IE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' _TESTS = [{ '...
@@ -0,0 +1,75 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +
yt_dlp/extractor/funker530.py
5
Python
0.571
suggestion
124
30
30
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
bashonly
Cyberes
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import clean_html class Funker530IE(InfoExtractor): _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/video\/(?P<id>[^\/]+)\/?' ...
`python test/test_download.py TestDownload.test_Funker530_1` to run the 2nd test, and so forth
from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none class Funker530IE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' _TESTS = [{ '...
@@ -0,0 +1,75 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/...
yt_dlp/extractor/funker530.py
14
Python
0.357
suggestion
94
39
39
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
bashonly
Cyberes
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import clean_html class Funker530IE(InfoExtractor): _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/video\/(?P<id>[^\/]+)\/?' ...
don't need to escape forward slashes, and also watch out for queries and fragments at the end of the `id` ```suggestion _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' ```
from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none class Funker530IE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' _TESTS = [{ '...
@@ -0,0 +1,75 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/...
yt_dlp/extractor/funker530.py
13
Python
0.786
security
202
38
38
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
bashonly
Cyberes
'info_dict': { 'id': '', 'ext': 'mp4', 'title': 'My “Friends” Joined the Russians - CivDiv', 'thumbnail': r're:^https?://.*\.jpg$', 'uploader': '', 'width': '', 'height': '', 'fps': '', 'duration': '', ...
You were on the right track here. But since this site only offers embeds, IMO it makes more sense to return url results to their respective extractors. `_extract_embed_urls` is a classmethod so we can call it from the class. If no videos are found on the page, you could do one of the following: 1. `raise Extracto...
'channel_follower_count': int, 'thumbnail': 'https://i.ytimg.com/vi/k-pk4bOvoac/maxresdefault.jpg', 'uploader_id': '@CivDiv', 'duration': 357, 'channel_url': 'https://www.youtube.com/channel/UCgsCiwJ88up-YyMHo7hL5-A', 'tags': [], 'uploa...
@@ -0,0 +1,75 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/...
yt_dlp/extractor/funker530.py
26
Python
1
bug
1,221
39
43
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
bashonly
Cyberes
} }] def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) rumble = RumbleEmbedIE(downloader=self._downloader) youtube = YoutubeIE(downloader=self._downloader) found_rumble_videos = rumble._extract_embed_...
If we're going to return a url result, then we want `'_type': 'url_transparent'` in the return so that we're not extracting the description for no reason. We can use some `utils` like `get_element_by_class` and `strip_or_none` to reduce the regex load. And use `_search_regex` with `default=None` to make it non-fata...
'uploader': 'Civ Div', 'categories': ['People & Blogs'], 'title': 'My “Friends” joined the Russians.', 'availability': 'public', 'upload_date': '20230608', 'playable_in_embed': True, 'heatmap': 'count:100', } }] def _re...
@@ -0,0 +1,75 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?funker530\.com\/...
yt_dlp/extractor/funker530.py
26
Python
1
security
656
27
31
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
bashonly
Cyberes
# coding: utf-8 from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import clean_html, ExtractorError, strip_or_none, get_element_by_class class Funker530IE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' _TES...
sort class before function, then alphabetically or use isort ```suggestion from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none ```
from .common import InfoExtractor from .rumble import RumbleEmbedIE from .youtube import YoutubeIE from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none class Funker530IE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' _TESTS = [{ '...
@@ -0,0 +1,81 @@ +# coding: utf-8 + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html, ExtractorError, strip_or_none, get_element_by_class
yt_dlp/extractor/funker530.py
6
Python
0.929
refactor
166
31
31
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
bashonly
Cyberes
'channel_follower_count': int, 'thumbnail': 'https://i.ytimg.com/vi/k-pk4bOvoac/maxresdefault.jpg', 'uploader_id': '@CivDiv', 'duration': 357, 'channel_url': 'https://www.youtube.com/channel/UCgsCiwJ88up-YyMHo7hL5-A', 'tags': [], 'uploa...
There is no guarantee this is a list. You'd have to do `next(iter(...`. Or easier, just cast to `list` imo. Same for youtube
'uploader_id': '@CivDiv', 'duration': 357, 'channel_url': 'https://www.youtube.com/channel/UCgsCiwJ88up-YyMHo7hL5-A', 'tags': [], 'uploader_url': 'https://www.youtube.com/@CivDiv', 'channel_id': 'UCgsCiwJ88up-YyMHo7hL5-A', 'like_count':...
@@ -0,0 +1,81 @@ +# coding: utf-8 + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html, ExtractorError, strip_or_none, get_element_by_class + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?funker530\.com/vide...
yt_dlp/extractor/funker530.py
26
Python
0.643
suggestion
124
43
41
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
pukkandan
Cyberes
'uploader_url': 'https://www.youtube.com/@CivDiv', 'channel_id': 'UCgsCiwJ88up-YyMHo7hL5-A', 'like_count': int, 'description': 'md5:aef75ec3f59c07a0e39400f609b24429', 'live_status': 'not_live', 'age_limit': 0, 'uploader': 'Civ Div', ...
```suggestion if rumble_urls: info = {'url': rumble_urls[0], 'ie_key': RumbleEmbedIE.ie_key()} else: youtube_url = next(YoutubeIE._extract_embed_urls(url, webpage), None) if youtube_url: info = {'url': youtube_url, 'ie_key': YoutubeIE.ie_key()} ...
'like_count': int, 'description': 'md5:aef75ec3f59c07a0e39400f609b24429', 'live_status': 'not_live', 'age_limit': 0, 'uploader': 'Civ Div', 'categories': ['People & Blogs'], 'title': 'My “Friends” joined the Russians.', 'ava...
@@ -0,0 +1,81 @@ +# coding: utf-8 + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html, ExtractorError, strip_or_none, get_element_by_class + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?funker530\.com/vide...
yt_dlp/extractor/funker530.py
26
Python
0.857
refactor
351
37
35
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
pukkandan
Cyberes
'like_count': int, 'description': 'md5:aef75ec3f59c07a0e39400f609b24429', 'live_status': 'not_live', 'age_limit': 0, 'uploader': 'Civ Div', 'categories': ['People & Blogs'], 'title': 'My “Friends” joined the Russians.', 'ava...
```suggestion raise ExtractorError('No videos found on webpage', expected=True) ```
'live_status': 'not_live', 'age_limit': 0, 'uploader': 'Civ Div', 'categories': ['People & Blogs'], 'title': 'My “Friends” joined the Russians.', 'availability': 'public', 'upload_date': '20230608', 'playable_in_embed': True...
@@ -0,0 +1,81 @@ +# coding: utf-8 + +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import clean_html, ExtractorError, strip_or_none, get_element_by_class + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?funker530\.com/vide...
yt_dlp/extractor/funker530.py
26
Python
0.786
refactor
97
35
33
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
pukkandan
Cyberes
'uploader_url': 'https://www.youtube.com/@CivDiv', 'channel_id': 'UCgsCiwJ88up-YyMHo7hL5-A', 'like_count': int, 'description': 'md5:aef75ec3f59c07a0e39400f609b24429', 'live_status': 'not_live', 'age_limit': 0, 'uploader': 'Civ Div', ...
```suggestion rumble_url = list(RumbleEmbedIE._extract_embed_urls(url, webpage)) if rumble_url: info = {'url': rumble_url[0], 'ie_key': RumbleEmbedIE.ie_key()} else: youtube_url = list(YoutubeIE._extract_embed_urls(url, webpage)) if youtube_url: ...
'uploader_url': 'https://www.youtube.com/@CivDiv', 'channel_id': 'UCgsCiwJ88up-YyMHo7hL5-A', 'like_count': int, 'description': 'md5:aef75ec3f59c07a0e39400f609b24429', 'live_status': 'not_live', 'age_limit': 0, 'uploader': 'Civ Div', ...
@@ -0,0 +1,79 @@ +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' ...
yt_dlp/extractor/funker530.py
26
Python
0.857
refactor
394
37
37
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
bashonly
Cyberes
'url': 'https://funker530.com/video/my-friends-joined-the-russians-civdiv/', 'md5': 'a42c2933391210662e93e867d7124b70', 'info_dict': { 'id': 'k-pk4bOvoac', 'ext': 'mp4', 'view_count': int, 'channel': 'Civ Div', 'comment_count': int, ...
```suggestion 'playable_in_embed': True, 'heatmap': 'count:100', ```
'url': 'https://funker530.com/video/my-friends-joined-the-russians-civdiv/', 'md5': 'a42c2933391210662e93e867d7124b70', 'info_dict': { 'id': 'k-pk4bOvoac', 'ext': 'mp4', 'view_count': int, 'channel': 'Civ Div', 'comment_count': int, ...
@@ -0,0 +1,78 @@ +from .common import InfoExtractor +from .rumble import RumbleEmbedIE +from .youtube import YoutubeIE +from ..utils import ExtractorError, clean_html, get_element_by_class, strip_or_none + + +class Funker530IE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?funker530\.com/video/(?P<id>[^/?#]+)' ...
yt_dlp/extractor/funker530.py
26
Python
0.571
suggestion
95
50
51
false
add funker530 extractor
7,291
yt-dlp/yt-dlp
132,642
Python
bashonly
Cyberes
'info_dict': { 'id': 'breaking-news-no-laugh-newsroom-season-3', 'title': 'Breaking News No Laugh Newsroom - Season 3' } } ] def _fetch_page(self, url, season_id, page): page += 1 try: webpage = self._download_webpage( ...
try/except isn't needed for playlist pagination, plus formatting fixes: ```suggestion webpage = self._download_webpage( f'{url}?page={page}', season_id, note=f'Downloading page {page}') for item in get_elements_by_class('js-collection-item', webpage): item_url = self._search...
import functools from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( ExtractorError, OnDemandPagedList, clean_html, extract_attributes, get_element_by_class, get_element_by_id, get_elements_html_by_class, int_or_none, traverse_obj, unified_strda...
@@ -190,29 +194,44 @@ class DropoutSeasonIE(InfoExtractor): 'id': 'dimension-20-shriek-week-season-1', 'title': 'Dimension 20 Shriek Week - Season 1' } + }, + { + 'url': 'https://www.dropout.tv/breaking-news-no-laugh-newsroom/season:3', + ...
yt_dlp/extractor/dropout.py
26
Python
0.857
refactor
1,012
37
225
false
[extractor/dropout] Dropout season pagination
7,304
yt-dlp/yt-dlp
132,642
Python
bashonly
OverlordQ
webpage = self._download_webpage( f'{url}?page={page}', season_id, note=f'Downloading page {page}' ) for item in get_elements_by_class('js-collection-item', webpage): yield self.url_result( url=self._...
line too long ```suggestion return self.playlist_result( entries, f'{season_id}-season-{season_num}', f'{season_title} - Season {season_num}') ``` &nbsp; or better imo, you could inline entries (and remove var above) ```suggestion return self.playlist_result( OnDemandP...
import functools from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( ExtractorError, OnDemandPagedList, clean_html, extract_attributes, get_element_by_class, get_element_by_id, get_elements_html_by_class, int_or_none, traverse_obj, unified_strda...
@@ -190,29 +194,44 @@ class DropoutSeasonIE(InfoExtractor): 'id': 'dimension-20-shriek-week-season-1', 'title': 'Dimension 20 Shriek Week - Season 1' } + }, + { + 'url': 'https://www.dropout.tv/breaking-news-no-laugh-newsroom/season:3', + ...
yt_dlp/extractor/dropout.py
26
Python
0.857
refactor
494
27
225
false
[extractor/dropout] Dropout season pagination
7,304
yt-dlp/yt-dlp
132,642
Python
bashonly
OverlordQ
} }, { 'url': 'https://www.dropout.tv/dimension-20-shriek-week', 'note': 'Single-season series', 'playlist_count': 4, 'info_dict': { 'id': 'dimension-20-shriek-week-season-1', 'title': 'Dimension 20 Shriek Week -...
My bad, I was wrong. yt-dlp will catch the error and continue with playlist extraction, but the extractor & tests do fail. Let's do this then: ```suggestion webpage = self._download_webpage( f'{url}?page={page}', season_id, note=f'Downloading page {page}', expected_status=400) ```
} }, { 'url': 'https://www.dropout.tv/dimension-20-shriek-week', 'note': 'Single-season series', 'playlist_count': 4, 'info_dict': { 'id': 'dimension-20-shriek-week-season-1', 'title': 'Dimension 20 Shriek Week -...
@@ -190,29 +195,30 @@ class DropoutSeasonIE(InfoExtractor): 'id': 'dimension-20-shriek-week-season-1', 'title': 'Dimension 20 Shriek Week - Season 1' } + }, + { + 'url': 'https://www.dropout.tv/breaking-news-no-laugh-newsroom/season:3', + ...
yt_dlp/extractor/dropout.py
26
Python
1
bug
305
38
38
false
[extractor/dropout] Dropout season pagination
7,304
yt-dlp/yt-dlp
132,642
Python
bashonly
OverlordQ
json_ld = self._json_ld(raw_json_ld, video_id) ism_manifest_url = ( source.get('src') or next(json_ld.get('embedUrl') for json_ld in raw_json_ld if json_ld.get('@type') == 'VideoObject') ) formats, subtitles = self._extract_ism_formats_and_subtitles(ism_manifest_...
Why not merge_dict with the whole thing?
from .common import InfoExtractor from ..utils import extract_attributes, merge_dicts, remove_end class RheinMainTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rheinmaintv\.de/sendungen/(?:[\w-]+/)*(?P<video_id>(?P<display_id>[\w-]+)/vom-\d{2}\.\d{2}\.\d{4}(?:/\d+)?)' _TESTS = [{ 'url': 'https...
@@ -0,0 +1,100 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, remove_end, traverse_obj + + +class RheinMainTVIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?rheinmaintv\.de/sendungen/(?:[\w-]+/)*(?P<video_id>(?P<display_id>[\w-]+)/vom-\d{2}\.\d{2}\.\d{4}(?:/\d+)?)' + _TESTS ...
yt_dlp/extractor/rheinmaintv.py
26
Python
0.071
question
40
28
95
false
[extractor/rheinmaintv] Add extractor
7,311
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
'alt_title': 'Casino Mainz bei den Deutschen Meisterschaften', 'upload_date': '20221115', 'display_id': 'casino-mainz-bei-den-deutschen-meisterschaften', 'duration': 348.0, 'thumbnail': r're:^https://.+\.jpg', 'description': 'md5:70fc1660eeba96da17...
```suggestion ``` Is a known pattern
'alt_title': 'Casino Mainz bei den Deutschen Meisterschaften', 'upload_date': '20221115', 'display_id': 'casino-mainz-bei-den-deutschen-meisterschaften', 'duration': 348.0, 'thumbnail': r're:^https://.+\.jpg', 'description': 'md5:70fc1660eeba96da17...
@@ -0,0 +1,100 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, remove_end, traverse_obj + + +class RheinMainTVIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?rheinmaintv\.de/sendungen/(?:[\w-]+/)*(?P<video_id>(?P<display_id>[\w-]+)/vom-\d{2}\.\d{2}\.\d{4}(?:/\d+)?)' + _TESTS ...
yt_dlp/extractor/rheinmaintv.py
26
Python
0.429
suggestion
38
51
49
false
[extractor/rheinmaintv] Add extractor
7,311
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
'params': {'extractor_args': {'nhkradirulive': {'area': ['fukuoka']}}}, 'info_dict': { 'id': 'r2-fukuoka', 'title': 're:^NHKネットラジオ第2 福岡.+$', 'ext': 'm4a', 'thumbnail': 'https://www.nhk.or.jp/common/img/media/r2-200x200.png', 'live_status': 'is_...
you can use `_configuration_arg`'s default param instead of traversal ```suggestion area = self._configuration_arg('area', ['tokyo'])[0] ``` also, this needs to be documented in the "Extractor Arguments" section of the readme. but how does the website handle this? does it determine which area to serve th...
'params': {'extractor_args': {'nhkradirulive': {'area': ['fukuoka']}}}, 'info_dict': { 'id': 'r2-fukuoka', 'title': 're:^NHKネットラジオ第2 福岡.+$', 'ext': 'm4a', 'thumbnail': 'https://www.nhk.or.jp/common/img/media/r2-200x200.png', 'live_status': 'is_...
@@ -492,3 +495,74 @@ class NhkRadioNewsPageIE(InfoExtractor): def _real_extract(self, url): return self.url_result('https://www.nhk.or.jp/radio/ondemand/detail.html?p=F261_01', NhkRadiruIE) + + +class NhkRadiruLiveIE(InfoExtractor): + _GEO_COUNTRIES = ['JP'] + _VALID_URL = r'https?://www\.nhk\.or\...
yt_dlp/extractor/nhk.py
26
Python
1
refactor
423
51
51
false
[extractor/nhk] add NHK Radiru Live IE
7,332
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'title': 're:^NHKネットラジオ第2 福岡.+$', 'ext': 'm4a', 'thumbnail': 'https://www.nhk.or.jp/common/img/media/r2-200x200.png', 'live_status': 'is_live', }, }, { # fm, area specified 'url': 'https://www.nhk.or.jp/radio/player/?ch=fm', 'params': {...
first line too long, you can remove comment ```suggestion config = self._download_xml( 'https://www.nhk.or.jp/radio/config/config_web.xml', station, 'Downloading area information') data = config.find(f'.//data//area[.="{area}"]/..') ```
'title': 're:^NHKネットラジオ第2 福岡.+$', 'ext': 'm4a', 'thumbnail': 'https://www.nhk.or.jp/common/img/media/r2-200x200.png', 'live_status': 'is_live', }, }, { # fm, area specified 'url': 'https://www.nhk.or.jp/radio/player/?ch=fm', 'params': {...
@@ -492,3 +495,74 @@ class NhkRadioNewsPageIE(InfoExtractor): def _real_extract(self, url): return self.url_result('https://www.nhk.or.jp/radio/ondemand/detail.html?p=F261_01', NhkRadiruIE) + + +class NhkRadiruLiveIE(InfoExtractor): + _GEO_COUNTRIES = ['JP'] + _VALID_URL = r'https?://www\.nhk\.or\...
yt_dlp/extractor/nhk.py
26
Python
0.857
refactor
269
50
49
false
[extractor/nhk] add NHK Radiru Live IE
7,332
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
}, { # fm, area specified 'url': 'https://www.nhk.or.jp/radio/player/?ch=fm', 'params': {'extractor_args': {'nhkradirulive': {'area': ['sapporo']}}}, 'info_dict': { 'id': 'fm-sapporo', 'title': 're:^NHKネットラジオFM 札幌.+$', 'ext': 'm4a', 'th...
```suggestion if not data: raise ExtractorError('Invalid area. Valid areas are: %s' % ', '.join( [i.text for i in config.findall('.//data//area')]), expected=True) ```
}, { # fm, area specified 'url': 'https://www.nhk.or.jp/radio/player/?ch=fm', 'params': {'extractor_args': {'nhkradirulive': {'area': ['sapporo']}}}, 'info_dict': { 'id': 'fm-sapporo', 'title': 're:^NHKネットラジオFM 札幌.+$', 'ext': 'm4a', 'th...
@@ -492,3 +495,74 @@ class NhkRadioNewsPageIE(InfoExtractor): def _real_extract(self, url): return self.url_result('https://www.nhk.or.jp/radio/ondemand/detail.html?p=F261_01', NhkRadiruIE) + + +class NhkRadiruLiveIE(InfoExtractor): + _GEO_COUNTRIES = ['JP'] + _VALID_URL = r'https?://www\.nhk\.or\...
yt_dlp/extractor/nhk.py
26
Python
1
refactor
207
45
44
false
[extractor/nhk] add NHK Radiru Live IE
7,332
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'id': 'fm-sapporo', 'title': 're:^NHKネットラジオFM 札幌.+$', 'ext': 'm4a', 'thumbnail': 'https://www.nhk.or.jp/common/img/media/fm-200x200.png', 'live_status': 'is_live', } }] _NOA_STATION_IDS = {'r1': 'n1', 'r2': 'n2', 'fm': 'n3'} # lookup table is...
`.format()` is a bit cleaner than the replace imo ```suggestion noa_info = self._download_json( f'https:{config.find(".//url_program_noa").text}'.format(area=data.find('areakey').text), station) present_info = traverse_obj(noa_info, ('nowonair_list', self._NOA_STATION_IDS.get(station), '...
'id': 'fm-sapporo', 'title': 're:^NHKネットラジオFM 札幌.+$', 'ext': 'm4a', 'thumbnail': 'https://www.nhk.or.jp/common/img/media/fm-200x200.png', 'live_status': 'is_live', } }] _NOA_STATION_IDS = {'r1': 'n1', 'r2': 'n2', 'fm': 'n3'} def _real_ext...
@@ -492,3 +495,74 @@ class NhkRadioNewsPageIE(InfoExtractor): def _real_extract(self, url): return self.url_result('https://www.nhk.or.jp/radio/ondemand/detail.html?p=F261_01', NhkRadiruIE) + + +class NhkRadiruLiveIE(InfoExtractor): + _GEO_COUNTRIES = ['JP'] + _VALID_URL = r'https?://www\.nhk\.or\...
yt_dlp/extractor/nhk.py
26
Python
0.857
suggestion
335
40
39
false
[extractor/nhk] add NHK Radiru Live IE
7,332
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
}] _NOA_STATION_IDS = {'r1': 'n1', 'r2': 'n2', 'fm': 'n3'} # lookup table is easier than working it out def _real_extract(self, url): station = self._match_id(url) area = traverse_obj(self._configuration_arg('area'), 0) or "tokyo" config = self._download_xml('https://www.nhk.or.j...
we can simplify `title` extraction with a single traversal instead, and eliminate the need for the `service` var ```suggestion return { 'title': ' '.join(traverse_obj(present_info, (('service', 'area',), 'name', {str}))), 'id': join_nonempty(station, area), 'thumbnails...
}] _NOA_STATION_IDS = {'r1': 'n1', 'r2': 'n2', 'fm': 'n3'} def _real_extract(self, url): station = self._match_id(url) area = self._configuration_arg('area', ['tokyo'])[0] config = self._download_xml( 'https://www.nhk.or.jp/radio/config/config_web.xml', station, 'Downl...
@@ -492,3 +495,74 @@ class NhkRadioNewsPageIE(InfoExtractor): def _real_extract(self, url): return self.url_result('https://www.nhk.or.jp/radio/ondemand/detail.html?p=F261_01', NhkRadiruIE) + + +class NhkRadiruLiveIE(InfoExtractor): + _GEO_COUNTRIES = ['JP'] + _VALID_URL = r'https?://www\.nhk\.or\...
yt_dlp/extractor/nhk.py
26
Python
0.857
refactor
521
34
33
false
[extractor/nhk] add NHK Radiru Live IE
7,332
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
def _real_extract(self, url): station = self._match_id(url) area = traverse_obj(self._configuration_arg('area'), 0) or "tokyo" config = self._download_xml('https://www.nhk.or.jp/radio/config/config_web.xml', None, 'Downloading area information') data = config.find(f'.//data//area[.=...
I prefer this formatting/indent, but I guess either is fine ```suggestion 'url': 'url', 'width': ('width', {int_or_none}), 'height': ('height', {int_or_none}), })), ```
def _real_extract(self, url): station = self._match_id(url) area = self._configuration_arg('area', ['tokyo'])[0] config = self._download_xml( 'https://www.nhk.or.jp/radio/config/config_web.xml', station, 'Downloading area information') data = config.find(f'.//data//area[...
@@ -492,3 +495,74 @@ class NhkRadioNewsPageIE(InfoExtractor): def _real_extract(self, url): return self.url_result('https://www.nhk.or.jp/radio/ondemand/detail.html?p=F261_01', NhkRadiruIE) + + +class NhkRadiruLiveIE(InfoExtractor): + _GEO_COUNTRIES = ['JP'] + _VALID_URL = r'https?://www\.nhk\.or\...
yt_dlp/extractor/nhk.py
26
Python
0.857
suggestion
234
30
29
false
[extractor/nhk] add NHK Radiru Live IE
7,332
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
import re from .common import InfoExtractor from ..utils import ( parse_duration, traverse_obj, unescapeHTML, unified_timestamp, urljoin, url_or_none, join_nonempty, int_or_none, ExtractorError, ) class NhkBaseIE(InfoExtractor): _API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkwor...
sort these: classes before functions, then sort alphabetically or just use `isort`
import re from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, join_nonempty, parse_duration, traverse_obj, unescapeHTML, unified_timestamp, url_or_none, urljoin, ) class NhkBaseIE(InfoExtractor): _API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkwor...
@@ -7,7 +7,10 @@ unescapeHTML, unified_timestamp, urljoin, - url_or_none + url_or_none, + join_nonempty, + int_or_none, + ExtractorError,
yt_dlp/extractor/nhk.py
13
Python
0.429
style
83
38
38
false
[extractor/nhk] add NHK Radiru Live IE
7,332
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
}, { # radio 2, area specified # (the area doesnt actually matter, r2 is national) 'url': 'https://www.nhk.or.jp/radio/player/?ch=r2', 'params': {'extractor_args': {'nhkradirulive': {'area': ['fukuoka']}}}, 'info_dict': { 'id': 'r2-fukuoka', 'title': '...
agreed re: comment, but we can cleanup ```suggestion _NOA_STATION_IDS = {'r1': 'n1', 'r2': 'n2', 'fm': 'n3'} ```
}, { # radio 2, area specified # (the area doesnt actually matter, r2 is national) 'url': 'https://www.nhk.or.jp/radio/player/?ch=r2', 'params': {'extractor_args': {'nhkradirulive': {'area': ['fukuoka']}}}, 'info_dict': { 'id': 'r2-fukuoka', 'title': '...
@@ -492,3 +495,73 @@ class NhkRadioNewsPageIE(InfoExtractor): def _real_extract(self, url): return self.url_result('https://www.nhk.or.jp/radio/ondemand/detail.html?p=F261_01', NhkRadiruIE) + + +class NhkRadiruLiveIE(InfoExtractor): + _GEO_COUNTRIES = ['JP'] + _VALID_URL = r'https?://www\.nhk\.or\...
yt_dlp/extractor/nhk.py
26
Python
0.714
suggestion
119
51
51
false
[extractor/nhk] add NHK Radiru Live IE
7,332
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'uploader_id': ('upData', 'mid', {str_or_none}), 'like_count': ('videoData', 'stat', 'like', {int_or_none}), 'tags': ('tags', ..., 'tag_name'), 'thumbnail': ('videoData', 'pic', {url_or_none}), }), **festival_info, **tra...
Don't change the extractor name; it would break users' download archives. Revert the extractor name change in `_extractors.py` too. For the same reason, we don't want to change the `video_id` that is returned in the info_dict, but I understand that we need to omit the 'ep' prefix for the API queries. So let's match ...
note='Extracting festival video formats')['data'] festival_info = traverse_obj(initial_state, { 'uploader': ('videoInfo', 'upName'), 'uploader_id': ('videoInfo', 'upMid', {str_or_none}), 'like_count': ('videoStatus', 'like', {int_or_none}), ...
@@ -402,29 +402,29 @@ def _real_extract(self, url): } -class BiliBiliBangumiIE(BilibiliBaseIE): - _VALID_URL = r'(?x)https?://www\.bilibili\.com/bangumi/play/(?P<id>(?:ss|ep)\d+)' +class BiliBiliBangumiEpisodeIE(BilibiliBaseIE): + _VALID_URL = r'(?x)https?://www\.bilibili\.com/bangumi/play/ep(?P<id>\...
yt_dlp/extractor/bilibili.py
26
Python
0.857
refactor
888
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'episode_id': '267851', 'episode_number': 1, 'title': '1 残酷', 'duration': 1425.256, 'timestamp': 1554566400, 'upload_date': '20190406', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyri...
- add a `headers` var since we're using the same headers multiple times - use `episode_id` in the query ```suggestion headers = {'Referer': url, **self.geo_verification_headers()} play_info = self._download_json( 'https://api.bilibili.com/pgc/player/web/v2/playurl', video_id, ...
_TESTS = [{ 'url': 'https://www.bilibili.com/bangumi/play/ep267851', 'info_dict': { 'id': '267851', 'ext': 'mp4', 'series': '鬼灭之刃', 'series_id': '4358', 'season': '鬼灭之刃', 'season_id': '26801', 'season_number': 1, ...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.857
refactor
451
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'series': '鬼灭之刃', 'series_id': '4358', 'season': '鬼灭之刃', 'season_id': '26801', 'season_number': 1, 'episode': '残酷', 'episode_id': '267851', 'episode_number': 1, 'title': '1 残酷', 'duration': 1425.256, ...
The old code would only raise for `开通大会员观看` if there were also no formats extracted. Doesn't this change make it so we can never extract premium content? Is that the intent?
'http_headers': {'Referer': url}, } class BiliBiliBangumiIE(BilibiliBaseIE): _VALID_URL = r'https?://(?:www\.)?bilibili\.com/bangumi/play/(?P<id>ep\d+)' _TESTS = [{ 'url': 'https://www.bilibili.com/bangumi/play/ep267851', 'info_dict': { 'id': '267851', ...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.571
refactor
173
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
}, 'skip': 'According to the copyright owner\'s request, you may only watch the video after you are premium member.' }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) if '您所在的地区无法观看本片' in webpage: ...
use `headers` var, use `episode_id` in query ```suggestion bangumi_info = self._download_json( 'https://api.bilibili.com/pgc/view/web/season', video_id, 'Get episode details', query={'ep_id': episode_id}, headers=headers)['result'] ```
'series_id': '4358', 'season': '鬼灭之刃', 'season_id': '26801', 'season_number': 1, 'episode': '残酷', 'episode_id': '267851', 'episode_number': 1, 'title': '1 残酷', 'duration': 1425.256, 'timestamp': 15545...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.857
suggestion
272
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
webpage = self._download_webpage(url, video_id) if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') elif ('成为大会员免费看' in webpage or '正在观看预览,大会员免费看全片' in webpage or '开通大会员观看' in webpage): self.raise_login_required(...
Since we are extracting more information from this episode's dict, IMO it's better to extract that to a var instead of traversing the whole `bangumi_info` with its index every time we need metadata for this episode ```suggestion episode_number, episode_info = 1, {} for idx, ep in enumerate(traverse...
'episode_number': 1, 'title': '1 残酷', 'duration': 1425.256, 'timestamp': 1554566400, 'upload_date': '20190406', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyright owner\'s request, you may only w...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.857
refactor
511
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') elif ('成为大会员免费看' in webpage or '正在观看预览,大会员免费看全片' in webpage or '开通大会员观看' in webpage): self.raise_login_required('This video is for premium members only') play_i...
```suggestion season_id = bangumi_info.get('season_id') ``` why `or []`? typo?
'duration': 1425.256, 'timestamp': 1554566400, 'upload_date': '20190406', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyright owner\'s request, you may only watch the video after you are premium member.' }] def ...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.571
question
89
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
or '正在观看预览,大会员免费看全片' in webpage or '开通大会员观看' in webpage): self.raise_login_required('This video is for premium members only') play_info = self._download_json('https://api.bilibili.com/pgc/player/web/v2/playurl', video_id, 'Extracti...
use `traverse_obj` like the old code did ```suggestion traverse_obj(bangumi_info, ('seasons', ...))) ```
'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyright owner\'s request, you may only watch the video after you are premium member.' }] def _real_extract(self, url): video_id = self._match_id(url) episode_id = video_id[2:] web...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
123
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
video_id, 'Extracting episode', query={'fnval': '4048', 'ep_id': video_id}, headers={'Referer': url, **self.geo_verification_headers()})['result']['video_info'] formats = self.extract_formats...
if the `episode_info` suggestion above is applied, we can do this instead ```suggestion aid = episode_info.get('aid') ``` and inline `episode_info.get('cid')` as an arg for `extract_subtitles`
def _real_extract(self, url): video_id = self._match_id(url) episode_id = video_id[2:] webpage = self._download_webpage(url, video_id) if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') elif '正在观看预览,大会员免费看全片' in webpage: ...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.857
refactor
204
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
), 1) season_id = bangumi_info.get('season_id') or [] season_number = season_id and next(( idx + 1 for idx, e in enumerate( bangumi_info.get('seasons') or []) if e.get('season_id') == season_id ), None) aid = traverse_obj(bangumi_info, ('...
```suggestion **traverse_obj(bangumi_info, { 'series': ('series', 'series_title', {str}), 'series_id': ('series', 'series_id', {str_or_none}), 'thumbnail': ('square_cover', {url_or_none}), }), 'title': join_nonempty('title', 'long...
premium_only = play_info.get('code') == -10403 play_info = traverse_obj(play_info, ('result', 'video_info', {dict})) or {} formats = self.extract_formats(play_info) if not formats and (premium_only or '成为大会员抢先看' in webpage or '开通大会员观看' in webpage): self.raise_login_required(...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
674
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
idx + 1 for idx, e in enumerate( bangumi_info.get('seasons') or []) if e.get('season_id') == season_id ), None) aid = traverse_obj(bangumi_info, ('episodes', episode_number, 'aid')) cid = traverse_obj(bangumi_info, ('episodes', episode_number, 'cid')) ...
```suggestion 'subtitles': self.extract_subtitles(video_id, aid, episode_info.get('cid')), '__post_extractor': self.extract_comments(aid), 'http_headers': headers, ```
if not formats and (premium_only or '成为大会员抢先看' in webpage or '开通大会员观看' in webpage): self.raise_login_required('This video is for premium members only') bangumi_info = self._download_json( 'https://api.bilibili.com/pgc/view/web/season', video_id, 'Get episode details', ...
@@ -433,41 +433,56 @@ def _real_extract(self, url): if '您所在的地区无法观看本片' in webpage: raise GeoRestrictedError('This video is restricted') - elif ('开通大会员观看' in webpage and '__playinfo__' not in webpage - or '正在观看预览,大会员免费看全片' in webpage): + elif ('成为大会员免费看' in webpage + ...
yt_dlp/extractor/bilibili.py
26
Python
0.857
refactor
207
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'timestamp': traverse_obj(bangumi_info, ('episodes', episode_number - 1, 'pub_time')), 'duration': float_or_none(play_info.get('timelength'), scale=1000), 'subtitles': self.extract_subtitles(video_id, aid, cid), '__post_extractor': self.extract_comments(aid), ...
this will be fatal/wrong anyways if traversal returns None ```suggestion query={'season_id': initial_state['mediaInfo']['season_id']}, ```
return { 'id': video_id, 'formats': formats, **traverse_obj(bangumi_info, { 'series': ('series', 'series_title', {str}), 'series_id': ('series', 'series_id', {str_or_none}), 'thumbnail': ('square_cover', {url_or_none}), ...
@@ -487,16 +502,43 @@ def _real_extract(self, url): webpage = self._download_webpage(url, media_id) initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial_state', media_id) - episode_list = self._download_json( - 'https://api.bilibili.com/pgc/web/seas...
yt_dlp/extractor/bilibili.py
26
Python
0.714
bug
173
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'__post_extractor': self.extract_comments(aid), 'http_headers': {'Referer': url, **self.geo_verification_headers()}, } class BiliBiliBangumiMediaIE(InfoExtractor): _VALID_URL = r'https?://www\.bilibili\.com/bangumi/media/md(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.bi...
we can filter to force a list of useful results ```suggestion ('result', 'main_section', 'episodes', lambda _, v: url_or_none(v['share_url']) and v['id'])) ```
**traverse_obj(bangumi_info, { 'series': ('series', 'series_title', {str}), 'series_id': ('series', 'series_id', {str_or_none}), 'thumbnail': ('square_cover', {url_or_none}), }), 'title': join_nonempty('title', 'long_title', delim=' ', ...
@@ -487,16 +502,43 @@ def _real_extract(self, url): webpage = self._download_webpage(url, media_id) initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial_state', media_id) - episode_list = self._download_json( - 'https://api.bilibili.com/pgc/web/seas...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
174
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
class BiliBiliBangumiMediaIE(InfoExtractor): _VALID_URL = r'https?://www\.bilibili\.com/bangumi/media/md(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.bilibili.com/bangumi/media/md24097891', 'info_dict': { 'id': '24097891', }, 'playlist_mincount': 25, }] def ...
revert extractor name and add 'ep' prefix to video_id ```suggestion self.url_result(entry['share_url'], BiliBiliBangumiIE, f'ep{entry["id"]}') ```
'thumbnail': ('square_cover', {url_or_none}), }), 'title': join_nonempty('title', 'long_title', delim=' ', from_dict=episode_info), 'episode': episode_info.get('long_title'), 'episode_id': episode_id, 'episode_number': int_or_none(episode_info....
@@ -487,16 +502,43 @@ def _real_extract(self, url): webpage = self._download_webpage(url, media_id) initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial_state', media_id) - episode_list = self._download_json( - 'https://api.bilibili.com/pgc/web/seas...
yt_dlp/extractor/bilibili.py
26
Python
0.786
refactor
161
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
_TESTS = [{ 'url': 'https://www.bilibili.com/bangumi/media/md24097891', 'info_dict': { 'id': '24097891', }, 'playlist_mincount': 25, }] def _real_extract(self, url): media_id = self._match_id(url) webpage = self._download_webpage(url, media_id) ...
this is almost the same code as the `BiliBiliBangumiMediaIE`, maybe a baseclass would make sense? (and it also needs the same suggested changes applied)
'episode_id': episode_id, 'episode_number': int_or_none(episode_info.get('title')) or episode_number, 'season_id': str_or_none(season_id), 'season_number': season_number, 'timestamp': int_or_none(episode_info.get('pub_time')), 'duration': float_or_...
@@ -487,16 +502,43 @@ def _real_extract(self, url): webpage = self._download_webpage(url, media_id) initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial_state', media_id) - episode_list = self._download_json( - 'https://api.bilibili.com/pgc/web/seas...
yt_dlp/extractor/bilibili.py
26
Python
0.571
suggestion
152
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
from .behindkink import BehindKinkIE from .bellmedia import BellMediaIE from .beatbump import ( BeatBumpVideoIE, BeatBumpPlaylistIE, ) from .beatport import BeatportIE from .berufetv import BerufeTVIE from .bet import BetIE from .bfi import BFIPlayerIE from .bfmtv import ( BFMTVIE, BFMTVLiveIE, BFMT...
```suggestion BiliBiliBangumiIE, ```
from .behindkink import BehindKinkIE from .bellmedia import BellMediaIE from .beatbump import ( BeatBumpVideoIE, BeatBumpPlaylistIE, ) from .beatport import BeatportIE from .berufetv import BerufeTVIE from .bet import BetIE from .bfi import BFIPlayerIE from .bfmtv import ( BFMTVIE, BFMTVLiveIE, BFMT...
@@ -214,7 +214,8 @@ from .bild import BildIE from .bilibili import ( BiliBiliIE, - BiliBiliBangumiIE, + BiliBiliBangumiEpisodeIE,
yt_dlp/extractor/_extractors.py
26
Python
0.429
suggestion
42
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'duration': 1425.256, 'timestamp': 1554566400, 'upload_date': '20190406', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyright owner\'s request, you may only watch the video after you are premium member.' }] def ...
`_extract_formats` is non-fatal, so instead of adding another `raise_login_required` here, we can traverse the API response safely and save the error code as a var for the later premium check ```suggestion play_info = self._download_json( 'https://api.bilibili.com/pgc/player/web/v2/playurl', vide...
'duration': 1425.256, 'timestamp': 1554566400, 'upload_date': '20190406', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyright owner\'s request, you may only watch the video after you are premium member.' }] def ...
@@ -403,77 +415,95 @@ def _real_extract(self, url): class BiliBiliBangumiIE(BilibiliBaseIE): - _VALID_URL = r'(?x)https?://www\.bilibili\.com/bangumi/play/(?P<id>(?:ss|ep)\d+)' + _VALID_URL = r'https?://(?:www\.)?bilibili\.com/bangumi/play/(?P<id>ep\d+)/?(?:$|[#?])' _TESTS = [{ - 'url': 'https:...
yt_dlp/extractor/bilibili.py
26
Python
1
refactor
582
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyright owner\'s request, you may only watch the video after you are premium member.' }] def _real_extract(self, url): video_id = self._match_id(url) episode_id = video_id[2:] web...
to go along with the `play_info` suggestion above: ```suggestion if not formats and (premium_only or '成为大会员抢先看' in webpage or '开通大会员观看' in webpage): ```
'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyright owner\'s request, you may only watch the video after you are premium member.' }] def _real_extract(self, url): video_id = self._match_id(url) episode_id = video_id[2:] web...
@@ -403,77 +415,95 @@ def _real_extract(self, url): class BiliBiliBangumiIE(BilibiliBaseIE): - _VALID_URL = r'(?x)https?://www\.bilibili\.com/bangumi/play/(?P<id>(?:ss|ep)\d+)' + _VALID_URL = r'https?://(?:www\.)?bilibili\.com/bangumi/play/(?P<id>ep\d+)/?(?:$|[#?])' _TESTS = [{ - 'url': 'https:...
yt_dlp/extractor/bilibili.py
26
Python
0.714
suggestion
163
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'uploader_id': ('upData', 'mid', {str_or_none}), 'like_count': ('videoData', 'stat', 'like', {int_or_none}), 'tags': ('tags', ..., 'tag_name'), 'thumbnail': ('videoData', 'pic', {url_or_none}), }), **festival_info, **tra...
```suggestion _VALID_URL = r'https?://(?:www\.)?bilibili\.com/bangumi/play/(?P<id>ep\d+)' ``` as far as I can tell, it's just unnecessary complexity, unless you have an example (w/log) where this is needed
'uploader_id': ('upData', 'mid', {str_or_none}), 'like_count': ('videoData', 'stat', 'like', {int_or_none}), 'tags': ('tags', ..., 'tag_name'), 'thumbnail': ('videoData', 'pic', {url_or_none}), }), **festival_info, **tra...
@@ -403,77 +415,95 @@ def _real_extract(self, url): class BiliBiliBangumiIE(BilibiliBaseIE): - _VALID_URL = r'(?x)https?://www\.bilibili\.com/bangumi/play/(?P<id>(?:ss|ep)\d+)' + _VALID_URL = r'https?://(?:www\.)?bilibili\.com/bangumi/play/(?P<id>ep\d+)/?(?:$|[#?])'
yt_dlp/extractor/bilibili.py
26
Python
0.786
performance
212
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
aid = episode_info.get('aid') return { 'id': video_id, 'formats': formats, **traverse_obj(bangumi_info, { 'series': ('series', 'series_title', {str}), 'series_id': ('series', 'series_id', {str_or_none}), 'thumbnail': ('...
```suggestion _VALID_URL = r'https?://www\.bilibili\.com/bangumi/media/md(?P<id>\d+)' ```
return { 'id': video_id, 'formats': formats, **traverse_obj(bangumi_info, { 'series': ('series', 'series_title', {str}), 'series_id': ('series', 'series_id', {str_or_none}), 'thumbnail': ('square_cover', {url_or_none}), ...
@@ -403,77 +415,95 @@ def _real_extract(self, url): class BiliBiliBangumiIE(BilibiliBaseIE): - _VALID_URL = r'(?x)https?://www\.bilibili\.com/bangumi/play/(?P<id>(?:ss|ep)\d+)' + _VALID_URL = r'https?://(?:www\.)?bilibili\.com/bangumi/play/(?P<id>ep\d+)/?(?:$|[#?])' _TESTS = [{ - 'url': 'https:...
yt_dlp/extractor/bilibili.py
26
Python
0.571
suggestion
95
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'__post_extractor': self.extract_comments(aid), 'http_headers': headers, } class BiliBiliBangumiMediaIE(BilibiliBaseIE): _VALID_URL = r'https?://www\.bilibili\.com/bangumi/media/md(?P<id>\d+)/?(?:$|[#?])' _TESTS = [{ 'url': 'https://www.bilibili.com/bangumi/media/md2409...
```suggestion _VALID_URL = r'(?x)https?://www\.bilibili\.com/bangumi/play/ss(?P<id>\d+)' ```
'http_headers': headers, } class BiliBiliBangumiMediaIE(BilibiliBaseIE): _VALID_URL = r'https?://www\.bilibili\.com/bangumi/media/md(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.bilibili.com/bangumi/media/md24097891', 'info_dict': { 'id': '24097891', }, ...
@@ -485,16 +515,26 @@ class BiliBiliBangumiMediaIE(InfoExtractor): def _real_extract(self, url): media_id = self._match_id(url) webpage = self._download_webpage(url, media_id) + ss_id = self._search_json( + r'window\.__INITIAL_STATE__\s*=', webpage, 'initial_state', media_id)['m...
yt_dlp/extractor/bilibili.py
26
Python
0.571
suggestion
98
51
51
false
[extractor/Bilibili] Fixed bilibili bangumi extractors
7,337
yt-dlp/yt-dlp
132,642
Python
bashonly
GD-Slime
'info_dict': { 'id': '3862451954ad4bd58ae2ccefddb0bd33', 'ext': 'mp4', 'title': 'Опиши свой характер 3 словами🙃\n#психология #дружба #отношения', 'timestamp': 1674726985, 'like_count': int, 'description': 'Опиши свой характер 3 словами🙃\n...
revert indentation, this is what the linter was complaining about
'info_dict': { 'id': '3862451954ad4bd58ae2ccefddb0bd33', 'ext': 'mp4', 'title': 'Опиши свой характер 3 словами🙃\n#психология #дружба #отношения', 'timestamp': 1674726985, 'like_count': int, 'description': 'Опиши свой характер 3 словами🙃\n...
@@ -51,9 +52,9 @@ def _real_extract(self, url): nextjs_data = self._search_nextjs_data(webpage, video_id) media_data = ( - traverse_obj( - nextjs_data, ('props', 'pageProps', ('data', 'OpenGraphParameters')), get_all=False) - or self._download_json(f'https://yapp...
yt_dlp/extractor/yappy.py
26
Python
0.214
style
65
51
51
false
[extractor/yappy] Support /profile/ URLs
7,346
yt-dlp/yt-dlp
132,642
Python
bashonly
7vlad7
'playlist_count': 16, }] def _real_extract(self, url): profile_id = self._match_id(url) entries = [] for page_num in itertools.count(1): profile_data = self._download_json(f'https://yappy.media/api/video/list/{profile_id}?page={page_num}', ...
It's better to use a generator for this. You can use `traverse_obj` to safely traverse the JSON object and filter for dicts with a `uuid` key ```suggestion def entries(profile_id): for page_num in itertools.count(1): videos = traverse_obj(self._download_json( ...
from .common import InfoExtractor from ..utils import ( OnDemandPagedList, int_or_none, traverse_obj, unified_timestamp, url_or_none, ) class YappyIE(InfoExtractor): _VALID_URL = r'https?://yappy\.media/video/(?P<id>\w+)' _TESTS = [{ 'url': 'https://yappy.media/video/47fea6d8586f48...
@@ -97,3 +98,39 @@ def _real_extract(self, url): 'categories': traverse_obj(media_data, ('categories', ..., 'name')) or None, 'repost_count': int_or_none(media_data.get('sharingCount')) } + + +class YappyProfileIE(InfoExtractor): + _VALID_URL = r'https?://yappy\.media/profile/(?P<i...
yt_dlp/extractor/yappy.py
26
Python
0.857
suggestion
890
27
128
false
[extractor/yappy] Support /profile/ URLs
7,346
yt-dlp/yt-dlp
132,642
Python
bashonly
7vlad7
XVideosQuickiesIE ) from .xxxymovies import XXXYMoviesIE from .yahoo import ( YahooIE, YahooSearchIE, YahooJapanNewsIE, ) from .yandexdisk import YandexDiskIE from .yandexmusic import ( YandexMusicTrackIE, YandexMusicAlbumIE, YandexMusicPlaylistIE, YandexMusicArtistTracksIE, YandexMu...
```suggestion YappyProfileIE, ```
XVideosQuickiesIE ) from .xxxymovies import XXXYMoviesIE from .yahoo import ( YahooIE, YahooSearchIE, YahooJapanNewsIE, ) from .yandexdisk import YandexDiskIE from .yandexmusic import ( YandexMusicTrackIE, YandexMusicAlbumIE, YandexMusicPlaylistIE, YandexMusicArtistTracksIE, YandexMu...
@@ -2426,7 +2426,10 @@ ZenYandexChannelIE, ) from .yapfiles import YapFilesIE -from .yappy import YappyIE +from .yappy import ( + YappyIE, + YappyProfileIE
yt_dlp/extractor/_extractors.py
26
Python
0.429
suggestion
39
51
51
false
[extractor/yappy] Support /profile/ URLs
7,346
yt-dlp/yt-dlp
132,642
Python
bashonly
7vlad7
class YappyProfileIE(InfoExtractor): _VALID_URL = r'https?://yappy\.media/profile/(?P<id>\w+)' _TESTS = [{ 'url': 'https://yappy.media/profile/59a0c8c485e5410b9c43474bf4c6a373', 'info_dict': { 'id': '59a0c8c485e5410b9c43474bf4c6a373', }, 'playlist_mincount': 527, ...
Does each page have a diff number of videos? If so, @bashonly can merge. If the number is fixed, use pagedlist.
class YappyProfileIE(InfoExtractor): _VALID_URL = r'https?://yappy\.media/profile/(?P<id>\w+)' _TESTS = [{ 'url': 'https://yappy.media/profile/59a0c8c485e5410b9c43474bf4c6a373', 'info_dict': { 'id': '59a0c8c485e5410b9c43474bf4c6a373', }, 'playlist_mincount': 527, ...
@@ -97,3 +99,32 @@ def _real_extract(self, url): 'categories': traverse_obj(media_data, ('categories', ..., 'name')) or None, 'repost_count': int_or_none(media_data.get('sharingCount')) } + + +class YappyProfileIE(InfoExtractor): + _VALID_URL = r'https?://yappy\.media/profile/(?P<i...
yt_dlp/extractor/yappy.py
26
Python
0.429
suggestion
111
29
26
false
[extractor/yappy] Support /profile/ URLs
7,346
yt-dlp/yt-dlp
132,642
Python
pukkandan
7vlad7
_VALID_URL = r'https?://yappy\.media/profile/(?P<id>\w+)' _TESTS = [{ 'url': 'https://yappy.media/profile/59a0c8c485e5410b9c43474bf4c6a373', 'info_dict': { 'id': '59a0c8c485e5410b9c43474bf4c6a373', }, 'playlist_mincount': 527, }] def _real_extract(self, url):...
we want to use `OnDemandPagedList` since we don't know in advance how many entries there are (need to import from utils) ```suggestion def fetch_page(page_num): page_num += 1 videos = self._download_json( f'https://yappy.media/api/video/list/{profile_id}?page={page...
from .common import InfoExtractor from ..utils import ( OnDemandPagedList, int_or_none, traverse_obj, unified_timestamp, url_or_none, ) class YappyIE(InfoExtractor): _VALID_URL = r'https?://yappy\.media/video/(?P<id>\w+)' _TESTS = [{ 'url': 'https://yappy.media/video/47fea6d8586f48...
@@ -97,3 +99,32 @@ def _real_extract(self, url): 'categories': traverse_obj(media_data, ('categories', ..., 'name')) or None, 'repost_count': int_or_none(media_data.get('sharingCount')) } + + +class YappyProfileIE(InfoExtractor): + _VALID_URL = r'https?://yappy\.media/profile/(?P<i...
yt_dlp/extractor/yappy.py
26
Python
0.857
suggestion
757
27
128
false
[extractor/yappy] Support /profile/ URLs
7,346
yt-dlp/yt-dlp
132,642
Python
bashonly
7vlad7
from .common import InfoExtractor from ..utils import ( int_or_none, traverse_obj, unified_timestamp, url_or_none, OnDemandPagedList, ) class YappyIE(InfoExtractor): _VALID_URL = r'https?://yappy\.media/video/(?P<id>\w+)' _TESTS = [{ 'url': 'https://yappy.media/video/47fea6d8586f48...
move `OnDemandPagedList` to the top of utils imports sort classes before functions, then sort alphabetically (or just use `isort`)
from .common import InfoExtractor from ..utils import ( OnDemandPagedList, int_or_none, traverse_obj, unified_timestamp, url_or_none, ) class YappyIE(InfoExtractor): _VALID_URL = r'https?://yappy\.media/video/(?P<id>\w+)' _TESTS = [{ 'url': 'https://yappy.media/video/47fea6d8586f48...
@@ -3,7 +3,8 @@ int_or_none, traverse_obj, unified_timestamp, - url_or_none + url_or_none, + OnDemandPagedList,
yt_dlp/extractor/yappy.py
7
Python
0.571
style
131
32
32
false
[extractor/yappy] Support /profile/ URLs
7,346
yt-dlp/yt-dlp
132,642
Python
bashonly
7vlad7
stream_url = traverse_obj(player_meta, ('initial_event_info', 'endpoint', {url_or_none})) formats = self._extract_m3u8_formats( stream_url, video_id, live=True, fatal=False) if stream_url else [] if not formats: self.raise_no_formats(msg, expected=expected) retur...
support `www` subdomain because it works in browser are we certain the ticket ID is always 48 chars? would it hurt to be more lenient? ```suggestion _VALID_URL = r'https?://(?:www.\)?zaiko\.io/account/eticket/(?P<id>\w{48}=)' ```
'disconnected': ('post_live', 'Stream has been disconnected', True), 'live_to_disconnected': ('post_live', 'Stream has been disconnected', True), 'live': ('is_live', 'No livestream URL found was found', False), 'waiting': ('is_upcoming', 'Live event has not yet started', ...
@@ -90,3 +92,27 @@ def _real_extract(self, url): 'thumbnail': ('poster_url', {url_or_none}), })), } + + +class ZaikoETicketIE(ZaikoBaseIE): + _VALID_URL = r'https?://zaiko\.io/account/eticket/(?P<id>\w{48}=)'
yt_dlp/extractor/zaiko.py
26
Python
0.857
suggestion
237
47
51
false
[extractor/zaiko] Add support for eticket links on zaiko.io
7,347
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
'uploader': ('profile', 'name', {str}), 'uploader_id': ('profile', 'id', {str_or_none}), 'release_timestamp': ('stream', 'start', 'timestamp', {int_or_none}), 'categories': ('event', 'genres', ..., {lambda x: x or None}), }), **trav...
take the similar code from `ZaikoIE` and move it to a baseclass method, `_download_real_webpage` or something
return { 'id': video_id, 'formats': formats, 'live_status': live_status, **traverse_obj(stream_meta, { 'title': ('event', 'name', {str}), 'uploader': ('profile', 'name', {str}), 'uploader_id': ('profile', 'id', {str...
@@ -90,3 +92,27 @@ def _real_extract(self, url): 'thumbnail': ('poster_url', {url_or_none}), })), } + + +class ZaikoETicketIE(ZaikoBaseIE): + _VALID_URL = r'https?://zaiko\.io/account/eticket/(?P<id>\w{48}=)' + _TESTS = [{ + 'url': 'https://zaiko.io/account/eticket/00...
yt_dlp/extractor/zaiko.py
26
Python
0.571
suggestion
109
35
47
false
[extractor/zaiko] Add support for eticket links on zaiko.io
7,347
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
})), } class ZaikoETicketIE(ZaikoBaseIE): _VALID_URL = r'https?://zaiko\.io/account/eticket/(?P<id>\w{48}=)' _TESTS = [{ 'url': 'https://zaiko.io/account/eticket/000000000000000000000000000000000000000000000000=', 'only_matching': True, }] def _real_extract(self, u...
`traverse_obj` will prevent `url_result(None)` and can eliminate the need for the intermediate vars ```suggestion eticket = self._parse_vue_element_attr('eticket', webpage, ticket_id) return self.playlist_result( [self.url_result(stream, ZaikoIE) for stream in traverse_obj(eticket, ('s...
'uploader_id': ('profile', 'id', {str_or_none}), 'release_timestamp': ('stream', 'start', 'timestamp', {int_or_none}), 'categories': ('event', 'genres', ..., {lambda x: x or None}), }), **traverse_obj(player_meta, ('initial_event_info', { ...
@@ -90,3 +92,27 @@ def _real_extract(self, url): 'thumbnail': ('poster_url', {url_or_none}), })), } + + +class ZaikoETicketIE(ZaikoBaseIE): + _VALID_URL = r'https?://zaiko\.io/account/eticket/(?P<id>\w{48}=)' + _TESTS = [{ + 'url': 'https://zaiko.io/account/eticket/00...
yt_dlp/extractor/zaiko.py
26
Python
0.786
suggestion
522
27
39
false
[extractor/zaiko] Add support for eticket links on zaiko.io
7,347
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
from .yandexvideo import ( YandexVideoIE, YandexVideoPreviewIE, ZenYandexIE, ZenYandexChannelIE, ) from .yapfiles import YapFilesIE from .yappy import YappyIE from .yesjapan import YesJapanIE from .yinyuetai import YinYueTaiIE from .yle_areena import YleAreenaIE from .ynet import YnetIE from .youjizz im...
```suggestion from .zaiko import ( ZaikoIE, ZaikoETicketIE, ) ```
from .yandexvideo import ( YandexVideoIE, YandexVideoPreviewIE, ZenYandexIE, ZenYandexChannelIE, ) from .yapfiles import YapFilesIE from .yappy import YappyIE from .yesjapan import YesJapanIE from .yinyuetai import YinYueTaiIE from .yle_areena import YleAreenaIE from .ynet import YnetIE from .youjizz im...
@@ -2444,7 +2444,7 @@ from .youporn import YouPornIE from .yourporn import YourPornIE from .yourupload import YourUploadIE -from .zaiko import ZaikoIE +from .zaiko import ZaikoIE, ZaikoETicketIE
yt_dlp/extractor/_extractors.py
26
Python
0.571
suggestion
78
51
51
false
[extractor/zaiko] Add support for eticket links on zaiko.io
7,347
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
stream_url = traverse_obj(player_meta, ('initial_event_info', 'endpoint', {url_or_none})) formats = self._extract_m3u8_formats( stream_url, video_id, live=True, fatal=False) if stream_url else [] if not formats: self.raise_no_formats(msg, expected=expected) retur...
https://github.com/yt-dlp/yt-dlp/pull/7347#discussion_r1234217153 ```suggestion _VALID_URL = r'https?://(?:www.)?zaiko\.io/account/eticket/(?P<id>[\w=-]{49})' ```
'cancelled': ('not_live', 'Event has been cancelled', True), }.get(status) or ('not_live', f'Unknown event status "{status}"', False) stream_url = traverse_obj(player_meta, ('initial_event_info', 'endpoint', {url_or_none})) formats = self._extract_m3u8_formats( stream_ur...
@@ -90,3 +96,23 @@ def _real_extract(self, url): 'thumbnail': ('poster_url', {url_or_none}), })), } + + +class ZaikoETicketIE(ZaikoBaseIE): + _VALID_URL = r'https?://(?:www.)?zaiko\.io/account/eticket/(?P<id>\w{48}=)'
yt_dlp/extractor/zaiko.py
26
Python
0.714
suggestion
169
43
51
false
[extractor/zaiko] Add support for eticket links on zaiko.io
7,347
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
'title': ('event', 'name', {str}), 'uploader': ('profile', 'name', {str}), 'uploader_id': ('profile', 'id', {str_or_none}), 'release_timestamp': ('stream', 'start', 'timestamp', {int_or_none}), 'categories': ('event', 'genres', ..., {lambda...
```suggestion eticket = self._parse_vue_element_attr('eticket', webpage, ticket_id) return self.playlist_result( ```
'formats': formats, 'live_status': live_status, **traverse_obj(stream_meta, { 'title': ('event', 'name', {str}), 'uploader': ('profile', 'name', {str}), 'uploader_id': ('profile', 'id', {str_or_none}), 'release_timestamp...
@@ -90,3 +96,23 @@ def _real_extract(self, url): 'thumbnail': ('poster_url', {url_or_none}), })), } + + +class ZaikoETicketIE(ZaikoBaseIE): + _VALID_URL = r'https?://(?:www.)?zaiko\.io/account/eticket/(?P<id>\w{48}=)' + _TESTS = [{ + 'url': 'https://zaiko.io/account/e...
yt_dlp/extractor/zaiko.py
26
Python
0.714
suggestion
137
32
44
false
[extractor/zaiko] Add support for eticket links on zaiko.io
7,347
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
'artist': artist, 'track': title, 'formats': [{ 'url': audio['url'], 'ext': 'm4a', 'vcodec': 'none', 'acodec': 'mp3', 'container': 'm4a_dash', }], ...
`_search_json` makes it easier/more concise ```suggestion return self._search_json( r'<script[^>]+\bid="initial-state"[^>]*>', webpage, 'initial state', video_id, fatal=False) ```
'duration': int_or_none(audio.get('duration')), 'uploader': uploader, 'artist': artist, 'track': title, 'formats': [{ 'url': audio['url'], 'ext': 'm4a', 'vcodec': 'none', ...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.786
suggestion
203
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) class VKPlayBaseIE(InfoExtractor): def _extract_initial_state(self, url, video_id): webpage = self._dow...
IMO a better way to do this is to pass the entire `stream_info`/`record_info` vars to the method. It will reduce a bit more code duplication, and then we can use filtering in traversal to be safe (without try/except.) Also, I noticed that there was a dash manifest not being extracted, added code to handle that: ```s...
r'<a[^>]+href=(?:["\'])(/video(?:-?[\d_]+)[^"\']*)', get_element_html_by_id('wl_post_body', webpage)))) return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', ...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
1
refactor
1,815
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
class VKPlayIE(VKPlayBaseIE): _VALID_URL = r'https?://vkplay\.live/(?P<username>[^/]+)/record/(?P<id>[a-f0-9\-]+)' _TESTS = [{ 'url': 'https://vkplay.live/zitsmann/record/f5e6e3b5-dc52-4d14-965d-0680dd2882da', 'info_dict': { 'id': 'f5e6e3b5-dc52-4d14-965d-0680dd2882da', '...
if we have a fallback, might be a good idea to check here that we're getting what we're expecting: ```suggestion record_info = traverse_obj(initial_state, ('record', 'currentRecord', 'data', {dict})) ```
def _extract_formats(self, stream_info, video_id): formats = [] for stream in traverse_obj(stream_info, ( 'data', 0, 'playerUrls', lambda _, v: url_or_none(v['url']) and v['type'])): url = stream['url'] format_id = str_or_none(stream['type']) if fo...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.786
suggestion
214
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
_TESTS = [{ 'url': 'https://vkplay.live/zitsmann/record/f5e6e3b5-dc52-4d14-965d-0680dd2882da', 'info_dict': { 'id': 'f5e6e3b5-dc52-4d14-965d-0680dd2882da', 'ext': 'mp4', 'title': 'Atomic Heart (пробуем!) спасибо подписчику EKZO!', 'uploader': 'ZitsmanN...
f-string, line too long ```suggestion record_info = self._download_json( f'https://api.vkplay.live/v1/blog/{username}/public_video_stream/record/{video_id}', video_id) ``` I am curious though, is there a downside to using only the API instead of using it as fallback? Seems like it could...
for stream in traverse_obj(stream_info, ( 'data', 0, 'playerUrls', lambda _, v: url_or_none(v['url']) and v['type'])): url = stream['url'] format_id = str_or_none(stream['type']) if format_id in ('hls', 'live_hls', 'live_playback_hls') or '.m3u8' in url: ...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.857
refactor
414
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'ext': 'mp4', 'title': 'Atomic Heart (пробуем!) спасибо подписчику EKZO!', 'uploader': 'ZitsmanN', 'uploader_id': 13159830, 'release_timestamp': 1683461378, 'release_date': '20230507', 'thumbnail': r're:https://images.vkplay.live/public...
we can remove this if applying my `_extract_formats` suggestion ```suggestion ```
if format_id in ('hls', 'live_hls', 'live_playback_hls') or '.m3u8' in url: formats.extend(self._extract_m3u8_formats(url, video_id, m3u8_id=format_id, fatal=False)) elif format_id == 'dash': formats.extend(self._extract_mpd_formats(url, video_id, mpd_id=format_id...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.643
refactor
83
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'release_timestamp': 1683461378, 'release_date': '20230507', 'thumbnail': r're:https://images.vkplay.live/public_video_stream/record/f5e6e3b5-dc52-4d14-965d-0680dd2882da/preview\?change_time=\d+', 'duration': 10608, 'view_count': int, 'like_count':...
```suggestion 'formats': self._extract_formats(record_info, video_id), ```
elif format_id in ('live_dash', 'live_playback_dash'): self.write_debug(f'Not extracting unsupported format "{format_id}"') else: formats.append({ 'url': url, 'ext': 'mp4', 'format_id': format_id, ...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.643
refactor
88
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
if not record_info: record_info = self._download_json('https://api.vkplay.live/v1/blog/{username}/public_video_stream/record/{video_id}', video_id) playurls = traverse_obj(record_info, ('data', 0, 'playerUrls', ..., { 'url': ('url', {url_or_none}), 'format_id': ('type...
fix typo, and we should match URLs with fragments too ```suggestion _VALID_URL = r'https?://vkplay\.live/(?P<id>[^/]+)(?:[#?]|$)' ```
'thumbnail': ('previewUrl', {url_or_none}), 'view_count': ('count', 'views', {int_or_none}), 'like_count': ('count', 'likes', {int_or_none}), 'categories': ('category', 'title', {str}, {lambda x: [x] if x else None}), 'uploader': (('user', ('blog', 'owner')), ...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.786
suggestion
140
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
_TESTS = [{ 'url': 'https://vkplay.live/bayda', 'info_dict': { 'id': 'f02c321e-427b-408d-b12f-ae34e53e0ea2', 'ext': 'mp4', 'title': r're:эскапизм крута .*', 'uploader': 'Bayda', 'uploader_id': 12279401, 'release_timestamp': 1687...
same as above ```suggestion stream_info = traverse_obj(initial_state, ('stream', 'stream', 'data', 'stream', {dict})) ```
'view_count': int, 'like_count': int, 'categories': ['Atomic Heart'], }, 'params': {'skip_download': 'm3u8'}, }] def _real_extract(self, url): username, video_id = self._match_valid_url(url).groups() record_info = traverse_obj(self._download_...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.714
suggestion
132
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'info_dict': { 'id': 'f02c321e-427b-408d-b12f-ae34e53e0ea2', 'ext': 'mp4', 'title': r're:эскапизм крута .*', 'uploader': 'Bayda', 'uploader_id': 12279401, 'release_timestamp': 1687209962, 'release_date': '20230619', ...
line too long ```suggestion stream_info = self._download_json( f'https://api.vkplay.live/v1/blog/{username}/public_video_stream', username) ```
'categories': ['Atomic Heart'], }, 'params': {'skip_download': 'm3u8'}, }] def _real_extract(self, url): username, video_id = self._match_valid_url(url).groups() record_info = traverse_obj(self._download_json( f'https://api.vkplay.live/v1/blog/{username}...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.786
refactor
175
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'release_date': '20230619', 'thumbnail': r're:https://images.vkplay.live/public_video_stream/12279401/preview\?change_time=\d+', 'view_count': int, 'concurrent_view_count': int, 'like_count': int, 'categories': ['EVE Online'], 'live_sta...
`UserNotLive` is more appropriate here, and will allow users to `--wait-for-video` ```suggestion formats = self._extract_formats(stream_info, username) if not formats and not traverse_obj(stream_info, ('isOnline', {bool})): raise UserNotLive(video_id=username) ```
record_info = traverse_obj(self._download_json( f'https://api.vkplay.live/v1/blog/{username}/public_video_stream/record/{video_id}', video_id, fatal=False), ('data', 'record', {dict})) if not record_info: record_info = self._extract_from_initial_state(url, video_id, ...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.857
refactor
301
44
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'concurrent_view_count': int, 'like_count': int, 'categories': ['EVE Online'], 'live_status': 'is_live', }, 'skip': 'livestream', 'params': {'skip_download': True}, }] def _real_extract(self, url): username = self._match_id(url) ...
```suggestion 'formats': formats, ```
('data', 'record', {dict})) if not record_info: record_info = self._extract_from_initial_state(url, video_id, ('record', 'currentRecord', 'data')) return { **self._extract_common_meta(record_info), 'id': video_id, 'formats': self._extract_form...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.571
suggestion
51
41
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
stream_info = traverse_obj(initial_state, ('stream', 'stream', 'data', 'stream')) if not stream_info: stream_info = self._download_json(f'https://api.vkplay.live/v1/blog/{username}/public_video_stream', username) playurls = traverse_obj(stream_info, ('data', 0, 'playerUrls', ..., { ...
both extractors' return traversals are pretty similar, maybe you could use a baseclass method?
_TESTS = [{ 'url': 'https://vkplay.live/bayda', 'info_dict': { 'id': 'f02c321e-427b-408d-b12f-ae34e53e0ea2', 'ext': 'mp4', 'title': r're:эскапизм крута .*', 'uploader': 'Bayda', 'uploader_id': 12279401, 'release_timestamp': 1687...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.286
refactor
94
28
38
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
except Exception: pass else: formats.append(playurl) return formats class VKPlayIE(VKPlayBaseIE): _VALID_URL = r'https?://vkplay\.live/(?P<username>[^/]+)/record/(?P<id>[a-f0-9\-]+)' _TESTS = [{ 'url': 'https://vkplay.live/zitsman...
could do this, which will skip download and explain why we are doing so ```suggestion 'params': {'skip_download': 'm3u8'}, ```
video_info = traverse_obj(self._search_json( r'<script[^>]+\bid="initial-state"[^>]*>', webpage, 'initial state', video_id), path, expected_type=dict) if not video_info: raise ExtractorError('Unable to extract video info from html inline initial state') return...
@@ -701,3 +702,131 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + def _extract_initi...
yt_dlp/extractor/vk.py
26
Python
0.786
suggestion
137
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
formats = [] for stream in traverse_obj(stream_info, ( 'data', 0, 'playerUrls', lambda _, v: url_or_none(v['url']) and v['type'])): url = stream['url'] format_id = str_or_none(stream['type']) if format_id in ('hls', 'live_hls', 'live_playback_hls') or ...
This could return `[None]`, so let's do: ```suggestion 'categories': ('category', 'title', {str}, {lambda x: [x] if x else None}), ```
raise ExtractorError('Unable to extract video info from html inline initial state') return video_info def _extract_formats(self, stream_info, video_id): formats = [] for stream in traverse_obj(stream_info, ( 'data', 0, 'playerUrls', lambda _, v: url_or_none(v['ur...
@@ -701,3 +704,139 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.786
suggestion
149
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'params': {'skip_download': 'm3u8'}, }] def _real_extract(self, url): username, video_id = self._match_valid_url(url).groups() initial_state = self._extract_initial_state(url, video_id) record_info = traverse_obj(initial_state, ('record', 'currentRecord', 'data', {dict})) ...
```suggestion _VALID_URL = r'https?://vkplay\.live/(?P<id>[^/]+)/?(?:[#?]|$)' ```
'ext': 'mp4', 'title': 'Atomic Heart (пробуем!) спасибо подписчику EKZO!', 'uploader': 'ZitsmanN', 'uploader_id': '13159830', 'release_timestamp': 1683461378, 'release_date': '20230507', 'thumbnail': r're:https://images.vkplay.live/publ...
@@ -701,3 +704,139 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.571
suggestion
87
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'thumbnail': r're:https://images.vkplay.live/public_video_stream/record/f5e6e3b5-dc52-4d14-965d-0680dd2882da/preview\?change_time=\d+', 'duration': 10608, 'view_count': int, 'like_count': int, 'categories': ['Atomic Heart'], }, 'params': {'skip...
IMO these could also be moved into `_extract_common_meta`, see my other suggestion. `uploader_id` should be a string, so we want to use `str_or_none` to stringify potential integer values. I think for `uploader` we could just use `{str}` instead of `{str_or_none}`, if all we wanna do is check the type. Either is ...
class VKPlayIE(VKPlayBaseIE): _VALID_URL = r'https?://vkplay\.live/(?P<username>[^/]+)/record/(?P<id>[a-f0-9\-]+)' _TESTS = [{ 'url': 'https://vkplay.live/zitsmann/record/f5e6e3b5-dc52-4d14-965d-0680dd2882da', 'info_dict': { 'id': 'f5e6e3b5-dc52-4d14-965d-0680dd2882da', '...
@@ -701,3 +704,139 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.786
refactor
331
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'live_status': 'is_live', }, 'skip': 'livestream', 'params': {'skip_download': True}, }] def _real_extract(self, url): username = self._match_id(url) initial_state = self._extract_initial_state(url, username) stream_info = traverse_obj(initial_state,...
similar to the other return comment, I think these could all be moved into `_extract_common_meta` it's fine to return a `None` value for `concurrent_view_count` in `VKPlayIE._real_extract`
'release_timestamp': 1687209962, 'release_date': '20230619', 'thumbnail': r're:https://images.vkplay.live/public_video_stream/12279401/preview\?change_time=\d+', 'view_count': int, 'concurrent_view_count': int, 'like_count': int, 'categ...
@@ -701,3 +704,139 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.571
refactor
191
30
30
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
}] def _real_extract(self, url): username, video_id = self._match_valid_url(url).groups() initial_state = self._extract_initial_state(url, video_id) record_info = traverse_obj(initial_state, ('record', 'currentRecord', 'data', {dict})) if not record_info: record_inf...
if you return `id` with `_extract_common_meta` as suggested, just make sure to move this `id` below the unpacking
'title': 'Atomic Heart (пробуем!) спасибо подписчику EKZO!', 'uploader': 'ZitsmanN', 'uploader_id': '13159830', 'release_timestamp': 1683461378, 'release_date': '20230507', 'thumbnail': r're:https://images.vkplay.live/public_video_stream/record/f5e...
@@ -701,3 +704,139 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.571
refactor
113
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
for stream in traverse_obj(stream_info, ( 'data', 0, 'playerUrls', lambda _, v: url_or_none(v['url']) and v['type'])): url = stream['url'] format_id = str_or_none(stream['type']) if format_id in ('hls', 'live_hls', 'live_playback_hls') or '.m3u8' in url: ...
if you want to move all metadata extraction into the common method, we could do it like this. We need `get_all=False` since we are branching for `uploader` and `uploader_id`, or else we'll return a list of values for those fields ```suggestion 'id': ('id', {str_or_none}), 'uploader':...
return video_info def _extract_formats(self, stream_info, video_id): formats = [] for stream in traverse_obj(stream_info, ( 'data', 0, 'playerUrls', lambda _, v: url_or_none(v['url']) and v['type'])): url = stream['url'] format_id = str_or_none(stream...
@@ -701,3 +704,139 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.857
refactor
733
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
}) entries.extend(self.url_result(urljoin(url, entry), VKIE) for entry in set(re.findall( r'<a[^>]+href=(?:["\'])(/video(?:-?[\d_]+)[^"\']*)', get_element_html_by_id('wl_post_body', webpage)))) return self.playlist_result( entries, post_id, join_nonempty...
Since this is fatal now, we can reduce some more code duplication ```suggestion def _extract_initial_state(self, url, video_id, path): webpage = self._download_webpage(url, video_id) initial_state = traverse_obj(self._search_json( r'<script[^>]+\bid="initial-state"[^>]*>', webpage, ...
}) entries.extend(self.url_result(urljoin(url, entry), VKIE) for entry in set(re.findall( r'<a[^>]+href=(?:["\'])(/video(?:-?[\d_]+)[^"\']*)', get_element_html_by_id('wl_post_body', webpage)))) return self.playlist_result( entries, post_id, join_nonempty...
@@ -701,3 +704,142 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
1
refactor
521
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'ext': 'mp4', 'title': 'Atomic Heart (пробуем!) спасибо подписчику EKZO!', 'uploader': 'ZitsmanN', 'uploader_id': '13159830', 'release_timestamp': 1683461378, 'release_date': '20230507', 'thumbnail': r're:https://images.vkplay.live/publ...
if applying suggested change to `_extract_initial_state` we can do this ```suggestion initial_state = self._extract_initial_state(url, video_id, ('record', 'currentRecord', 'data')) ```
_VALID_URL = r'https?://vkplay\.live/(?P<username>[^/]+)/record/(?P<id>[a-f0-9\-]+)' _TESTS = [{ 'url': 'https://vkplay.live/zitsmann/record/f5e6e3b5-dc52-4d14-965d-0680dd2882da', 'info_dict': { 'id': 'f5e6e3b5-dc52-4d14-965d-0680dd2882da', 'ext': 'mp4', 'titl...
@@ -701,3 +704,142 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.857
refactor
200
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'title': r're:эскапизм крута .*', 'uploader': 'Bayda', 'uploader_id': 12279401, 'release_timestamp': 1687209962, 'release_date': '20230619', 'thumbnail': r're:https://images.vkplay.live/public_video_stream/12279401/preview\?change_time=\d+', ...
same here if we change `_extract_initial_state` ```suggestion initial_state = self._extract_initial_state(url, username, ('stream', 'stream', 'data', 'stream')) ```
'info_dict': { 'id': 'f02c321e-427b-408d-b12f-ae34e53e0ea2', 'ext': 'mp4', 'title': r're:эскапизм крута .*', 'uploader': 'Bayda', 'uploader_id': 12279401, 'release_timestamp': 1687209962, 'release_date': '20230619', ...
@@ -701,3 +704,142 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.786
refactor
179
39
36
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
_VALID_URL = r'https?://vkplay\.live/(?P<username>[^/]+)/record/(?P<id>[a-f0-9\-]+)' _TESTS = [{ 'url': 'https://vkplay.live/zitsmann/record/f5e6e3b5-dc52-4d14-965d-0680dd2882da', 'info_dict': { 'id': 'f5e6e3b5-dc52-4d14-965d-0680dd2882da', 'ext': 'mp4', 'titl...
can check expected_type like this to save on typing/reading ```suggestion ('data', 'record', {dict})) ```
'concurrent_view_count': ('count', 'viewers', {int_or_none}), }, get_all=False) class VKPlayIE(VKPlayBaseIE): _VALID_URL = r'https?://vkplay\.live/(?P<username>[^/]+)/record/(?P<id>[a-f0-9\-]+)' _TESTS = [{ 'url': 'https://vkplay.live/zitsmann/record/f5e6e3b5-dc52-4d14-965d-0680dd2...
@@ -701,3 +704,142 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.857
suggestion
120
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
class VKPlayBaseIE(InfoExtractor): _RESOLUTIONS = { 'tiny': '256x144', 'lowest': '426x240', 'low': '640x360', 'medium': '852x480', 'high': '1280x720', 'full_hd': '1920x1080', 'quad_hd': '2560x1440', } def _extract_initial_state(self, url, video_id): ...
fixing typo from my suggestion ```suggestion elif format_id == 'dash': ```
class VKPlayBaseIE(InfoExtractor): _RESOLUTIONS = { 'tiny': '256x144', 'lowest': '426x240', 'low': '640x360', 'medium': '852x480', 'high': '1280x720', 'full_hd': '1920x1080', 'quad_hd': '2560x1440', } def _extract_from_initial_state(self, url, video_...
@@ -701,3 +704,142 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.571
suggestion
89
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'tiny': '256x144', 'lowest': '426x240', 'low': '640x360', 'medium': '852x480', 'high': '1280x720', 'full_hd': '1920x1080', 'quad_hd': '2560x1440', } def _extract_initial_state(self, url, video_id): webpage = self._download_webpage(url, video_id) ...
On second thought this can just be debug output ```suggestion self.write_debug(f'Not extracting unsupported format "{format_id}"') ```
'tiny': '256x144', 'lowest': '426x240', 'low': '640x360', 'medium': '852x480', 'high': '1280x720', 'full_hd': '1920x1080', 'quad_hd': '2560x1440', } def _extract_from_initial_state(self, url, video_id, path): webpage = self._download_webpage(url, ...
@@ -701,3 +704,142 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.929
bug
153
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'title': 'Atomic Heart (пробуем!) спасибо подписчику EKZO!', 'uploader': 'ZitsmanN', 'uploader_id': '13159830', 'release_timestamp': 1683461378, 'release_date': '20230507', 'thumbnail': r're:https://images.vkplay.live/public_video_stream/record/f5e...
```suggestion **self._extract_common_meta(record_info), 'id': video_id, 'formats': self._extract_formats(record_info, video_id), ```
'ext': 'mp4', 'title': 'Atomic Heart (пробуем!) спасибо подписчику EKZO!', 'uploader': 'ZitsmanN', 'uploader_id': '13159830', 'release_timestamp': 1683461378, 'release_date': '20230507', 'thumbnail': r're:https://images.vkplay.live/publ...
@@ -701,3 +704,140 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.786
refactor
172
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
'like_count': int, 'categories': ['EVE Online'], 'live_status': 'is_live', }, 'skip': 'livestream', 'params': {'skip_download': True}, }] def _real_extract(self, url): username = self._match_id(url) stream_info = self._download_json( ...
```suggestion **self._extract_common_meta(stream_info), 'formats': formats, ```
'view_count': int, 'concurrent_view_count': int, 'like_count': int, 'categories': ['EVE Online'], 'live_status': 'is_live', }, 'skip': 'livestream', 'params': {'skip_download': True}, }] def _real_extract(self, url): us...
@@ -701,3 +704,140 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.786
refactor
106
28
27
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
formats.extend(self._extract_mpd_formats(url, video_id, mpd_id=format_id, fatal=False)) elif format_id in ('live_dash', 'live_playback_dash'): self.write_debug(f'Not extracting unsupported format "{format_id}"') else: formats.append({ ...
```suggestion 'is_live': ('isOnline', {bool}), 'concurrent_view_count': ('count', 'viewers', {int_or_none}), ```
formats.extend(self._extract_mpd_formats(url, video_id, mpd_id=format_id, fatal=False)) elif format_id in ('live_dash', 'live_playback_dash'): self.write_debug(f'Not extracting unsupported format "{format_id}"') else: formats.append({ ...
@@ -701,3 +704,140 @@ def _real_extract(self, url): return self.playlist_result( entries, post_id, join_nonempty(uploader, f'Wall post {post_id}', delim=' - '), clean_html(get_element_by_class('wall_post_text', webpage))) + + +class VKPlayBaseIE(InfoExtractor): + _RESOLUTIONS = { +...
yt_dlp/extractor/vk.py
26
Python
0.714
suggestion
139
51
51
false
[extractor/vkplay] Adding new extractor for vkplay.live
7,358
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt