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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
# Podcast feed with no description
{
'url': 'https://www.deutschlandfunk.de/podcast-tolle-idee-100.html',
'info_dict': {
'id': 'podcast-tolle-idee-100',
'title': 'Wissenschaftspodcast - Tolle Idee! - Was wurde daraus?',
},
'... | Preferably, use playlist_from_matches | import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
traverse_obj,
url_or_none,
)
class DLFBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?deutschlandfunk\.de/'
_BUTTON_REGEX = r'(<button[^>]+alt="Anhören"[^>]+data... | @@ -0,0 +1,197 @@
+import re
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ extract_attributes,
+ int_or_none,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class DLFBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https?://(?:www\.)?deutschlandfunk\.de/'
+ _BUTTON_REGEX = r'(<bu... | yt_dlp/extractor/dlf.py | 26 | Python | 0.143 | suggestion | 37 | 27 | 193 | false | [extractor/dlf] Add support for Deutschlandfunk | 6,697 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nick-cd |
x_version = hashlib.sha1('_'.join((paths[-1], q['expires'][0], '5nFp9kmbNnHdAFhaqMvt')).encode()).hexdigest()
preference = qualities(['preview', '360', '540', 'Source'])
files = self._download_json(fileurl, video_id, headers={'X-Version': x_version})
for fmt in files:
yield... | ```suggestion
headers = {
'Authorization': f'Bearer {self._get_media_token()}',
} if username and password else None
``` | x_version = hashlib.sha1('_'.join((paths[-1], q['expires'][0], '5nFp9kmbNnHdAFhaqMvt')).encode()).hexdigest()
preference = qualities(['preview', '360', '540', 'Source'])
files = self._download_json(fileurl, video_id, headers={'X-Version': x_version})
for fmt in files:
yield... | @@ -79,13 +142,26 @@ def _extract_formats(self, video_id, fileurl):
def _real_extract(self, url):
video_id = self._match_id(url)
- video_data = self._download_json(f'https://api.iwara.tv/video/{video_id}', video_id, expected_status=lambda x: True)
+ username, password = self._get_login_inf... | yt_dlp/extractor/iwara.py | 26 | Python | 0.786 | security | 152 | 51 | 51 | false | [extractor/iwara] Add access token | 6,721 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | toomyzoom |
'quality': ('name', {preference}),
'height': ('name', {int_or_none}),
}, get_all=False)
def _real_extract(self, url):
video_id = self._match_id(url)
username, password = self._get_login_info()
if username and password:
headers = {
... | ```suggestion
elif errmsg == 'errors.notFound' and not username:
self.raise_login_required('Video may need login to view')
else:
raise ExtractorError(f'Iwara says: {errmsg}')
``` | 'quality': ('name', {preference}),
'height': ('name', {int_or_none}),
}, get_all=False)
def _real_extract(self, url):
video_id = self._match_id(url)
username, password = self._get_login_info()
headers = {
'Authorization': f'Bearer {sel... | @@ -79,13 +142,26 @@ def _extract_formats(self, video_id, fileurl):
def _real_extract(self, url):
video_id = self._match_id(url)
- video_data = self._download_json(f'https://api.iwara.tv/video/{video_id}', video_id, expected_status=lambda x: True)
+ username, password = self._get_login_inf... | yt_dlp/extractor/iwara.py | 26 | Python | 1 | refactor | 223 | 51 | 51 | false | [extractor/iwara] Add access token | 6,721 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | toomyzoom |
import functools
import urllib.parse
import hashlib
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
int_or_none,
mimetype2ext,
qualities,
traverse_obj,
unified_timestamp,
)
# https://github.com/yt-dlp/yt-dlp/issues/6671
class IwaraBas... | ```suggestion
_NETRC_MACHINE = 'iwara'
``` | import functools
import urllib.parse
import hashlib
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
int_or_none,
mimetype2ext,
qualities,
traverse_obj,
unified_timestamp,
)
# https://github.com/yt-dlp/yt-dlp/issues/6671
class IwaraBas... | @@ -14,7 +15,49 @@
)
-class IwaraIE(InfoExtractor):
+# https://github.com/yt-dlp/yt-dlp/issues/6671
+class IwaraBaseIE(InfoExtractor):
+ _USERTOKEN = None
+ _MEDIATOKEN = None
+ _NETRC_MACHINE = "iwara" | yt_dlp/extractor/iwara.py | 22 | Python | 0.429 | suggestion | 48 | 47 | 47 | false | [extractor/iwara] Add access token | 6,721 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | toomyzoom |
preference = qualities(['preview', '360', '540', 'Source'])
files = self._download_json(fileurl, video_id, headers={'X-Version': x_version})
for fmt in files:
yield traverse_obj(fmt, {
'format_id': 'name',
'url': ('src', ('view', 'download'), {self._p... | ```suggestion
elif errmsg: # None if success
```
lint error | preference = qualities(['preview', '360', '540', 'Source'])
files = self._download_json(fileurl, video_id, headers={'X-Version': x_version})
for fmt in files:
yield traverse_obj(fmt, {
'format_id': 'name',
'url': ('src', ('view', 'download'), {self._p... | @@ -79,12 +142,18 @@ def _extract_formats(self, video_id, fileurl):
def _real_extract(self, url):
video_id = self._match_id(url)
- video_data = self._download_json(f'https://api.iwara.tv/video/{video_id}', video_id, expected_status=lambda x: True)
+ username, password = self._get_login_inf... | yt_dlp/extractor/iwara.py | 26 | Python | 0.714 | suggestion | 71 | 51 | 51 | false | [extractor/iwara] Add access token | 6,721 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | toomyzoom |
class IdolPlusIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?idolplus\.com/z[us]/contents/?\?(?:[^#]+&)?albumId=(?P<id>\w+)'
_TESTS = [{
'url': 'https://idolplus.com/zs/contents?albumId=M012077298PPV00',
'md5': '2ace3f4661c943a2f7e79f0b88cea1e7',
'info_dict': {
'id': '... | Is this meant to test livestream? The test is no longer live. More importantly, livestreams must set `is_live=True`. VOD can set `was_live=True`, but that isn't mandatory. |
class IdolPlusIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?idolplus\.com/z[us]/(?:concert/|contents/?\?(?:[^#]+&)?albumId=)(?P<id>\w+)'
_TESTS = [{
'url': 'https://idolplus.com/zs/contents?albumId=M012077298PPV00',
'md5': '2ace3f4661c943a2f7e79f0b88cea1e7',
'info_dict': {
... | @@ -0,0 +1,105 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, try_call, url_or_none
+
+
+class IdolPlusIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?idolplus\.com/z[us]/contents/?\?(?:[^#]+&)?albumId=(?P<id>\w+)'
+ _TESTS = [{
+ 'url': 'https://idolplus.com/zs/contents?al... | yt_dlp/extractor/idolplus.py | 26 | Python | 0.5 | question | 171 | 51 | 51 | false | [extractor/idolplus] New extractor for idolplus.com | 6,732 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ping |
from .common import InfoExtractor
from ..utils import traverse_obj, try_call, url_or_none
class IdolPlusIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?idolplus\.com/z[us]/contents/?\?(?:[^#]+&)?albumId=(?P<id>\w+)'
_TESTS = [{
'url': 'https://idolplus.com/zs/contents?albumId=M012077298PPV00',
... | Is https://idolplus.com/zs/concert/M012323039PPV00 not being supported intentional? | from .common import InfoExtractor
from ..utils import traverse_obj, try_call, url_or_none
class IdolPlusIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?idolplus\.com/z[us]/(?:concert/|contents/?\?(?:[^#]+&)?albumId=)(?P<id>\w+)'
_TESTS = [{
'url': 'https://idolplus.com/zs/contents?albumId=M012077... | @@ -0,0 +1,105 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, try_call, url_or_none
+
+
+class IdolPlusIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?idolplus\.com/z[us]/contents/?\?(?:[^#]+&)?albumId=(?P<id>\w+)' | yt_dlp/extractor/idolplus.py | 6 | Python | 0.214 | question | 83 | 31 | 31 | false | [extractor/idolplus] New extractor for idolplus.com | 6,732 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ping |
subtitles[_type] = [{
'url': urljoin(base_url, result['%sUrl' % _type]),
'ext': 'vtt',
}]
formats = []
if result.get('viewMp4Url'):
formats.append({
'format_note': 'Camera stream',
'url'... | `a.get(b)[1]` etc are not safe. use traverse_obj | 'ext': 'vtt',
}]
formats = []
if data.get('viewMp4Url'):
formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
'width': int_or_none(traverse_obj(data, ('viewResolvtion... | @@ -53,42 +53,48 @@ def _real_extract(self, url):
r'(?s)window\.__data__\s*=\s*({.+?});',
webpage, 'data'), play_id, js_to_json)
+ info = self._download_json(
+ base_url + 'nws/recording/1.0/play/info/' + data['fileId'], play_id
+ )
+
+ result = info.get('resu... | yt_dlp/extractor/zoom.py | 26 | Python | 0.286 | suggestion | 48 | 40 | 38 | false | [extractor/zoom] Update extraction logic | 6,741 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shreyasminocha |
if form:
password = self.get_param('videopassword')
if not password:
raise ExtractorError(
'This video is protected by a passcode, use the --video-password option', expected=True)
is_meeting = form.get('useWhichPasswd') == 'meeting'
... | ```suggestion
data = self._download_json(
f'{base_url}nws/recording/1.0/play/info/{data["fileId"]}', play_id)['result']
``` | form = None
if form:
password = self.get_param('videopassword')
if not password:
raise ExtractorError(
'This video is protected by a passcode, use the --video-password option', expected=True)
is_meeting = form.get('useWhichPassw... | @@ -53,42 +53,48 @@ def _real_extract(self, url):
r'(?s)window\.__data__\s*=\s*({.+?});',
webpage, 'data'), play_id, js_to_json)
+ info = self._download_json(
+ base_url + 'nws/recording/1.0/play/info/' + data['fileId'], play_id
+ )
+
+ result = info.get('resu... | yt_dlp/extractor/zoom.py | 26 | Python | 0.714 | suggestion | 146 | 51 | 51 | false | [extractor/zoom] Update extraction logic | 6,741 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shreyasminocha |
r'(?s)window\.__data__\s*=\s*({.+?});',
webpage, 'data'), play_id, js_to_json)
data = self._download_json(
f'{base_url}nws/recording/1.0/play/info/{data["fileId"]}', play_id)['result']
subtitles = {}
for _type in ('transcript', 'cc', 'chapter'):
... | ```suggestion
'filesize_approx': traverse_obj(data, (
'recording', 'fileSizeInMB', {str_or_none}, {parse_filesize})),
``` | r'(?s)window\.__data__\s*=\s*({.+?});',
webpage, 'data'), play_id, js_to_json)
data = self._download_json(
f'{base_url}nws/recording/1.0/play/info/{data["fileId"]}', play_id)['result']
subtitles = {}
for _type in ('transcript', 'cc', 'chapter'):
... | @@ -67,28 +71,29 @@ def _real_extract(self, url):
formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
- 'width': int_or_none(data.get('viewResolvtionsWidth')),
- 'height': int_or_none(data.get('viewReso... | yt_dlp/extractor/zoom.py | 26 | Python | 0.714 | suggestion | 160 | 50 | 49 | false | [extractor/zoom] Update extraction logic | 6,741 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shreyasminocha |
formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
'width': int_or_none(traverse_obj(data, ('viewResolvtions', 0))),
'height': int_or_none(traverse_obj(data, ('viewResolvtions', 1))),
'f... | ```suggestion
'title': str_or_none(traverse_obj(data, ('meet', 'topic'))),
``` | formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
'width': int_or_none(traverse_obj(data, ('viewResolvtions', 0))),
'height': int_or_none(traverse_obj(data, ('viewResolvtions', 1))),
'f... | @@ -67,28 +71,29 @@ def _real_extract(self, url):
formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
- 'width': int_or_none(data.get('viewResolvtionsWidth')),
- 'height': int_or_none(data.get('viewReso... | yt_dlp/extractor/zoom.py | 26 | Python | 0.571 | suggestion | 92 | 33 | 32 | false | [extractor/zoom] Update extraction logic | 6,741 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shreyasminocha |
r'(?s)window\.__data__\s*=\s*({.+?});',
webpage, 'data'), play_id, js_to_json)
data = self._download_json(
f'{base_url}nws/recording/1.0/play/info/{data["fileId"]}', play_id)['result']
subtitles = {}
for _type in ('transcript', 'cc', 'chapter'):
... | ```suggestion
'filesize_approx': parse_filesize(str_or_none(traverse_obj(data, ('recording', 'fileSizeInMB')))),
``` | r'(?s)window\.__data__\s*=\s*({.+?});',
webpage, 'data'), play_id, js_to_json)
data = self._download_json(
f'{base_url}nws/recording/1.0/play/info/{data["fileId"]}', play_id)['result']
subtitles = {}
for _type in ('transcript', 'cc', 'chapter'):
... | @@ -67,28 +71,29 @@ def _real_extract(self, url):
formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
- 'width': int_or_none(data.get('viewResolvtionsWidth')),
- 'height': int_or_none(data.get('viewReso... | yt_dlp/extractor/zoom.py | 26 | Python | 0.714 | suggestion | 134 | 50 | 49 | false | [extractor/zoom] Update extraction logic | 6,741 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shreyasminocha |
import re
from .common import InfoExtractor
class HrefLiIE(InfoExtractor):
_VALID_URL = r'https?://href\.li/\?(?P<url>.+)'
_TESTS = [{
'url': 'https://href.li/?https://www.reddit.com/r/cats/comments/12bluel/my_cat_helps_me_with_water/?utm_source=share&utm_medium=android_app&utm_name=androidcss&utm_t... | ```suggestion
return self.url_result(self._match_valid_url(url).group('url'))
``` | from .common import InfoExtractor
class HrefLiRedirectIE(InfoExtractor):
IE_NAME = 'href.li'
IE_DESC = False # Do not list
_VALID_URL = r'https?://href\.li/\?(?P<url>.+)'
_TESTS = [{
'url': 'https://href.li/?https://www.reddit.com/r/cats/comments/12bluel/my_cat_helps_me_with_water/?utm_sourc... | @@ -0,0 +1,15 @@
+import re
+
+from .common import InfoExtractor
+
+
+class HrefLiIE(InfoExtractor):
+ _VALID_URL = r'https?://href\.li/\?(?P<url>.+)'
+
+ _TESTS = [{
+ 'url': 'https://href.li/?https://www.reddit.com/r/cats/comments/12bluel/my_cat_helps_me_with_water/?utm_source=share&utm_medium=android_ap... | yt_dlp/extractor/hrefli.py | 15 | Python | 0.571 | suggestion | 91 | 16 | 16 | false | [extractor/hrefli] new extractor | 6,762 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
thread_ids = traverse_obj(api_data, ('comment', 'threads', lambda _, v: v['isActive']))
legacy_danmaku = self._extract_legacy_comments(video_id, thread_ids, user_id_str, comment_user_key)
new_comments = traverse_obj(api_data, ('comment', 'nvComment'))
new_danmaku = self._extract_new_com... | What is this trying to do? Isn't this just:
```suggestion
api_url = traverse_obj(threads, (..., 'server'), get_all=False)
``` | thread_ids = traverse_obj(api_data, ('comment', 'threads', lambda _, v: v['isActive']))
legacy_danmaku = self._extract_legacy_comments(video_id, thread_ids, user_id_str, comment_user_key) or []
new_comments = traverse_obj(api_data, ('comment', 'nvComment'))
new_danmaku = self._extract_n... | @@ -477,23 +477,32 @@ def _get_subtitles(self, video_id, api_data, session_api_data):
user_id_str = session_api_data.get('serviceUserId')
thread_ids = traverse_obj(api_data, ('comment', 'threads', lambda _, v: v['isActive']))
- raw_danmaku = self._extract_all_comments(video_id, thread_ids, us... | yt_dlp/extractor/niconico.py | 26 | Python | 0.857 | question | 136 | 51 | 51 | false | [extractor/niconico] Download comments from the new endpoint | 6,773 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
hex_or_none = lambda x: x if re.fullmatch(r'(0x)?[\da-f]+', x, re.IGNORECASE) else None
info['hls_aes'] = traverse_obj(self._configuration_arg('hls_key', casesense=True), {
'uri': (0, {url_or_none}), 'key': (0, {hex_or_none}), 'iv': (1, {hex_or_none}),
}) or None
variant_qu... | Different formats can have different headers.
```suggestion
m3u8_format = next((f for f in self._downloader._get_formats(info)
if determine_protocol(f) == 'm3u8_native')), None)
if m3u8_format:
is_live = self._configuration_arg('is_live', [None])[0]
... | or urllib.parse.urlparse(manifest_url).query or None)
hex_or_none = lambda x: x if re.fullmatch(r'(0x)?[\da-f]+', x, re.IGNORECASE) else None
info['hls_aes'] = traverse_obj(self._configuration_arg('hls_key', casesense=True), {
'uri': (0, {url_or_none}), 'key': (0, {hex_or_no... | @@ -2205,6 +2233,23 @@ def _extra_manifest_info(self, info, manifest_url):
for fmt in self._downloader._get_formats(info):
fmt['url'] = update_url_query(fmt['url'], query)
+ # Attempt to detect live HLS or set VOD duration
+ m3u8_url = traverse_obj(self._downloader._get_for... | yt_dlp/extractor/generic.py | 26 | Python | 0.857 | refactor | 703 | 51 | 51 | false | [extractor/generic] Attempt to detect live HLS | 6,775 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'album': str_or_none(music_info.get('album')) or None,
'artist': music_author or None,
'formats': formats,
'subtitles': self.extract_subtitles(aweme_detail, aweme_id),
'thumbnails': thumbnails,
'duration': int_or_none(traverse_obj(video_info, 'dura... | `({str})` - the brackets are useless. Also, it's not needed due to `url_or_none` later
`{list}, ...` - what's the `{list}` for? | 'album': str_or_none(music_info.get('album')) or None,
'artist': music_author or None,
'formats': formats,
'subtitles': self.extract_subtitles(aweme_detail, aweme_id),
'thumbnails': thumbnails,
'duration': int_or_none(traverse_obj(video_info, 'dura... | @@ -344,76 +349,76 @@ def extract_addr(addr, add_meta={}):
'_format_sort_fields': ('quality', 'codec', 'size', 'br'),
}
- def _parse_aweme_video_web(self, aweme_detail, webpage_url):
+ def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id):
video_info = aweme_detail... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.571 | question | 129 | 51 | 51 | false | [extractor/tiktok] Fix and improve metadata extraction | 6,777 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(video(?P<id>[0-9]+)|watch)/'
_TEST = {
'url': 'https://pornez.net/video344819/mistresst-funny_penis_names-wmv/',
'md5': '2e19a0a1cff3a5dbea0e... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>[0-9]+)|watch)/'
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
get_element_by_class,
urljoin,
)
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>\w+)|watch)/'
_TESTS = [{
'url': 'https://pornez.net/video344819/mistresst-funny... | @@ -3,7 +3,7 @@
class PornezIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?pornez\.net/video(?P<id>[0-9]+)/'
+ _VALID_URL = r'https?://(?:www\.)?pornez\.net/(video(?P<id>[0-9]+)|watch)/' | yt_dlp/extractor/pornez.py | 6 | Python | 0.714 | suggestion | 101 | 31 | 31 | false | [pornez] Issues with missing url video id | 6,792 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | zhgwn |
from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>[0-9]+)|watch)/'
_TEST = {
'url': 'https://pornez.net/video344819/mistresst-funny_penis_names-wmv/',
'md5': '2e19a0a1cff3a5dbea... | this fixes #6298 too
```suggestion
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>\w+)|watch)/'
```
.
you can add this to tests:
```py
{
'url': 'https://pornez.net/videovzs27fj/tutor4k-e14-blue-wave-1080p-nbq-tutor4k-e14-blue-wave/',
'only_matching': True,
},
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
get_element_by_class,
urljoin,
)
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>\w+)|watch)/'
_TESTS = [{
'url': 'https://pornez.net/video344819/mistresst-funny... | @@ -3,7 +3,7 @@
class PornezIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?pornez\.net/video(?P<id>[0-9]+)/'
+ _VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>[0-9]+)|watch)/' | yt_dlp/extractor/pornez.py | 6 | Python | 0.786 | suggestion | 316 | 31 | 31 | false | [pornez] Issues with missing url video id | 6,792 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | zhgwn |
from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>[0-9]+)|watch)/'
_TEST = {
'url': 'https://pornez.net/video344819/mistresst-funny_penis_names-wmv/',
'md5': '2e19a0a1cff3a5dbea... | better to add this as a test instead of a comment
```suggestion
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
get_element_by_class,
urljoin,
)
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>\w+)|watch)/'
_TESTS = [{
'url': 'https://pornez.net/video344819/mistresst-funny... | @@ -19,6 +19,11 @@ class PornezIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
+ if video_id is None:
+ # For https://pornez.net/watch/leana+lovings+stiff+for+stepdaughter/ | yt_dlp/extractor/pornez.py | 23 | Python | 0.643 | suggestion | 69 | 48 | 48 | false | [pornez] Issues with missing url video id | 6,792 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | zhgwn |
from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>[0-9]+)|watch)/'
_TEST = {
'url': 'https://pornez.net/video344819/mistresst-funny_penis_names-wmv/',
'md5': '2e19a0a1cff3a5dbea... | ```suggestion
video_id = self._search_regex(
r'<link[^>]+\bhref=["\']https?://pornez.net/\?p=(\w+)["\']', webpage, 'id')
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
get_element_by_class,
urljoin,
)
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>\w+)|watch)/'
_TESTS = [{
'url': 'https://pornez.net/video344819/mistresst-funny... | @@ -19,6 +19,11 @@ class PornezIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
+ if video_id is None:
+ # For https://pornez.net/watch/leana+lovings+stiff+for+stepdaughter/
+ video_id = se... | yt_dlp/extractor/pornez.py | 26 | Python | 0.714 | suggestion | 155 | 48 | 51 | false | [pornez] Issues with missing url video id | 6,792 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | zhgwn |
from .common import InfoExtractor
from ..utils import traverse_obj
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<number_id>[0-9_-]+)/(?P<display_id>[a-zA-Z0-9_-]+)'
_TEST = {
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c... | Are you sure that the `display_id` is unique?
It seems like sometimes it can just be the title of the track (slug-ified), e.g. this URL: https://www.whyp.it/tracks/76863/vacation
is the numeric ID unique? would that be better to use as `id`? | from .common import InfoExtractor
from ..utils import (
float_or_none,
str_or_none,
traverse_obj,
url_or_none,
)
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WhypIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<number_id>[0-9_-]+)/(?P<display_id>[a-zA-Z0-9_-]+)' | yt_dlp/extractor/whyp.py | 6 | Python | 0.643 | question | 247 | 31 | 31 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
from .common import InfoExtractor
from ..utils import traverse_obj
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<number_id>[0-9_-]+)/(?P<display_id>[a-zA-Z0-9_-]+)'
_TEST = {
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c... | this change depends on the suggested change to `_VALID_URL`
```suggestion
unique_id = self._match_id(url)
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
str_or_none,
traverse_obj,
url_or_none,
)
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WhypIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<number_id>[0-9_-]+)/(?P<display_id>[a-zA-Z0-9_-]+)'
+ _TEST = {
+ 'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-... | yt_dlp/extractor/whyp.py | 26 | Python | 0.786 | suggestion | 120 | 46 | 51 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
'ext': 'mp3',
'duration': 52.82,
'uploader': 'Brad',
'uploader_id': 1,
'thumbnail': 'https://cdn.whyp.it/a537bb36-3373-4c61-96c8-27fc1b2f427a.jpg',
'vcodec': 'none',
}
}
def _real_extract(self, url):
mobj = self._match_vali... | Dict key traversal with `traverse_obj` can make the metadata extraction a bit less grueling.
`traverse_obj(data, {})` will always return a dict, so it is safe to unpack in return
It's a good idea to always call `float_or_none` or `int_or_none` on the duration value, in case it was a numeric string or otherwise inva... | 'info_dict': {
'url': 'https://cdn.whyp.it/50eb17cc-e9ff-4e18-b89b-dc9206a95cb1.mp3',
'id': '18337',
'title': 'Home Page Example Track',
'description': 'md5:bd758000fb93f3159339c852b5b9133c',
'ext': 'mp3',
'duration': 52.82,
'up... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WhypIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<number_id>[0-9_-]+)/(?P<display_id>[a-zA-Z0-9_-]+)'
+ _TEST = {
+ 'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-... | yt_dlp/extractor/whyp.py | 26 | Python | 0.857 | refactor | 1,037 | 32 | 37 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
'uploader_id': 1,
'thumbnail': 'https://cdn.whyp.it/a537bb36-3373-4c61-96c8-27fc1b2f427a.jpg',
'vcodec': 'none',
}
}
def _real_extract(self, url):
mobj = self._match_valid_url(url)
unique_id = mobj.group('number_id')
webpage = self._download_... | this can be inferred from its inclusion imo
```suggestion
``` | 'title': 'Home Page Example Track',
'description': 'md5:bd758000fb93f3159339c852b5b9133c',
'ext': 'mp3',
'duration': 52.82,
'uploader': 'Brad',
'uploader_id': '1',
'thumbnail': 'https://cdn.whyp.it/a537bb36-3373-4c61-96c8-27fc1b2f427a.j... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WhypIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<number_id>[0-9_-]+)/(?P<display_id>[a-zA-Z0-9_-]+)'
+ _TEST = {
+ 'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-... | yt_dlp/extractor/whyp.py | 26 | Python | 0.571 | suggestion | 63 | 29 | 34 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
from .common import InfoExtractor
from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TEST = {
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c11... | sort these
```suggestion
from ..utils import (
float_or_none,
str_or_none,
traverse_obj,
url_or_none,
)
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
str_or_none,
traverse_obj,
url_or_none,
)
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none | yt_dlp/extractor/whyp.py | 2 | Python | 0.714 | suggestion | 131 | 27 | 27 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
from .common import InfoExtractor
from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TEST = {
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c11... | ```suggestion
_TESTS = [{
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
str_or_none,
traverse_obj,
url_or_none,
)
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none
+
+
+class WhypIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
+ _TEST = { | yt_dlp/extractor/whyp.py | 7 | Python | 0.429 | suggestion | 35 | 32 | 32 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
from .common import InfoExtractor
from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TEST = {
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c11... | use md5 for long descriptions or other long metadata strings
```suggestion
'description': 'md5:bd758000fb93f3159339c852b5b9133c',
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
str_or_none,
traverse_obj,
url_or_none,
)
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none
+
+
+class WhypIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4... | yt_dlp/extractor/whyp.py | 14 | Python | 0.786 | suggestion | 148 | 39 | 39 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
from .common import InfoExtractor
from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TEST = {
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c11... | ```suggestion
},
}, {
'url': 'https://www.whyp.it/tracks/18337',
'only_matching': True,
}]
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
str_or_none,
traverse_obj,
url_or_none,
)
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none
+
+
+class WhypIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4... | yt_dlp/extractor/whyp.py | 22 | Python | 0.714 | suggestion | 132 | 46 | 47 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TEST = {
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c1187b42ebf8605284e3dc92aeb33d16',
'info_dict': {
'url': 'https://cdn.whyp.it/50eb17cc-e9ff-... | ```suggestion
unique_id = self._match_id(url)
webpage = self._download_webpage(url, unique_id)
data = self._search_nuxt_data(webpage, unique_id)['rawTrack']
``` | str_or_none,
traverse_obj,
url_or_none,
)
class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c1187b42ebf8605284e3dc92aeb33d16',
'info_dict':... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, float_or_none, str_or_none, url_or_none
+
+
+class WhypIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4... | yt_dlp/extractor/whyp.py | 26 | Python | 0.714 | suggestion | 188 | 43 | 48 | false | [extractor/whyp] Add extractor | 6,803 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | CoryTibbettsDev |
id = self._match_id(url)
data_json = self._download_json(f'https://api.gronkh.tv/v1/video/info?episode={id}', id)
m3u8_url = self._download_json(f'https://api.gronkh.tv/v1/video/playlist?episode={id}', id)['playlist_url']
formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8... | ```suggestion
'duration': float_or_none(data_json.get('source_length')),
'chapters': traverse_obj(data_json, (
'chapters', lambda _, v: float_or_none(v['offset']) is not None, {
'title': 'title',
'start_time': ('offset', {float_or_none... | 'only_matching': True,
}]
def _real_extract(self, url):
id = self._match_id(url)
data_json = self._download_json(f'https://api.gronkh.tv/v1/video/info?episode={id}', id)
m3u8_url = self._download_json(f'https://api.gronkh.tv/v1/video/playlist?episode={id}', id)['playlist_url']
... | @@ -56,6 +63,8 @@ def _real_extract(self, url):
'upload_date': unified_strdate(data_json.get('created_at')),
'formats': formats,
'subtitles': subtitles,
+ 'duration': data_json.get('source_length'),
+ 'chapters': chapters, | yt_dlp/extractor/gronkh.py | 26 | Python | 0.786 | suggestion | 384 | 51 | 51 | false | [extractor/gronkh] add duration and chapters | 6,817 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ghost |
'thumbnail': 'https://01.cdn.vod.farm/preview/6436746cce14e25f751260a692872b9b.jpg',
'upload_date': '20211001'
},
'params': {'skip_download': True}
}, {
'url': 'https://gronkh.tv/watch/stream/546',
'only_matching': True,
}]
def _real_extract(self, url... | this (L55-L57) can be removed
core code will set the last chapter's end_time from duration | 'ext': 'mp4',
'title': 'GTV0536, 2021-10-01 - MARTHA IS DEAD #FREiAB1830 !FF7 !horde !archiv',
'view_count': int,
'thumbnail': 'https://01.cdn.vod.farm/preview/6436746cce14e25f751260a692872b9b.jpg',
'upload_date': '20211001',
'duration': 32058,
... | @@ -48,6 +52,9 @@ def _real_extract(self, url):
'url': data_json['vtt_url'],
'ext': 'vtt',
})
+ if data_json.get('chapters'):
+ chapters = list(map(lambda x: {'title': x['title'], 'start_time': x['offset']}, data_json.get('chapters')))
+ chapte... | yt_dlp/extractor/gronkh.py | 26 | Python | 0.286 | suggestion | 93 | 51 | 51 | false | [extractor/gronkh] add duration and chapters | 6,817 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ghost |
import functools
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
traverse_obj,
unified_strdate,
float_or_none,
)
class GronkhIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/(?:watch/)?streams?/(?P<id>\d+)'
_TESTS = [{
'url': 'https://gronkh.... | ```suggestion
float_or_none,
traverse_obj,
unified_strdate,
``` | import functools
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
float_or_none,
traverse_obj,
unified_strdate,
)
class GronkhIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/(?:watch/)?streams?/(?P<id>\d+)'
_TESTS = [{
'url': 'https://gronkh.... | @@ -5,6 +5,7 @@
OnDemandPagedList,
traverse_obj,
unified_strdate,
+ float_or_none, | yt_dlp/extractor/gronkh.py | 8 | Python | 0.571 | suggestion | 79 | 33 | 33 | false | [extractor/gronkh] add duration and chapters | 6,817 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ghost |
import functools
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
traverse_obj,
unified_strdate,
float_or_none,
)
class GronkhIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/(?:watch/)?streams?/(?P<id>\d+)'
_TESTS = [{
'url': 'https://gronkh.... | ```suggestion
'chapters': 'count:3',
``` | import functools
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
float_or_none,
traverse_obj,
unified_strdate,
)
class GronkhIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gronkh\.tv/(?:watch/)?streams?/(?P<id>\d+)'
_TESTS = [{
'url': 'https://gronkh.... | @@ -19,7 +20,9 @@ class GronkhIE(InfoExtractor):
'title': 'H.O.R.D.E. - DAS ZWEiTE ZEiTALTER 🎲 Session 1',
'view_count': int,
'thumbnail': 'https://01.cdn.vod.farm/preview/9e2555d3a23bf4e5c5b7c6b3b70a9d84.jpg',
- 'upload_date': '20221111'
+ 'upload_date': '2... | yt_dlp/extractor/gronkh.py | 24 | Python | 0.571 | suggestion | 54 | 49 | 49 | false | [extractor/gronkh] add duration and chapters | 6,817 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ghost |
def _real_extract(self, url):
program_id = self._match_id(url)
webpage = self._download_webpage(f'https://www.nhk.or.jp/school/{program_id}/', program_id)
title = (self._generic_title('', webpage)
or self._html_search_regex(r'<h3>([^<]+?)とは?\s*</h3>', webpage, 'title', fat... | - accept `http` URLs
- `id` group is not useful since its value is only used for playlists and we are constructing our own equivalent `programme_id` below
```suggestion
_VALID_URL = r'https?://www\.nhk\.or\.jp/radio/(?:player/ondemand|ondemand/detail)\.html\?p=(?P<site>[\da-zA-Z]+)_(?P<corner>[\da-zA-Z]+)(?:_(?P... | def _real_extract(self, url):
program_id = self._match_id(url)
webpage = self._download_webpage(f'https://www.nhk.or.jp/school/{program_id}/', program_id)
title = (self._generic_title('', webpage)
or self._html_search_regex(r'<h3>([^<]+?)とは?\s*</h3>', webpage, 'title', fat... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | suggestion | 350 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
or self._html_search_regex(r'<h3>([^<]+?)とは?\s*</h3>', webpage, 'title', fatal=False))
title = re.sub(r'\s*\|\s*NHK\s+for\s+School\s*$', '', title) if title else None
description = self._html_search_regex(
r'(?s)<div\s+class="programDetail\s*">\s*<p>[^<]+</p>',
w... | `_type` is not necessary for tests; playlists need to have `playlist_mincount` or `playlist_count`
```suggestion
``` | or self._html_search_regex(r'<h3>([^<]+?)とは?\s*</h3>', webpage, 'title', fatal=False))
title = re.sub(r'\s*\|\s*NHK\s+for\s+School\s*$', '', title) if title else None
description = self._html_search_regex(
r'(?s)<div\s+class="programDetail\s*">\s*<p>[^<]+</p>',
w... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | suggestion | 118 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'id': '0449_01_3853544',
'series': 'ジャズ・トゥナイト',
'thumbnail': 'https://www.nhk.or.jp/prog/img/449/g449.jpg',
'timestamp': 1680969600,
'title': 'ジャズ・トゥナイト NEWジャズ特集',
'upload_date': '20230408',
'release_timestamp': 1680962400,
... | since its expiry is almost a year out, let's not skip this for now
```suggestion
'note': 'Expires on 2024-03-31',
``` | 'timestamp': 1680969600,
'title': 'ジャズ・トゥナイト NEWジャズ特集',
'upload_date': '20230408',
'release_timestamp': 1680962400,
'release_date': '20230408',
'was_live': True,
},
}, {
# playlist, airs every weekday so it should _hopefully_ be... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.714 | suggestion | 128 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'channel': 'NHK-FM',
'thumbnail': 'https://www.nhk.or.jp/prog/img/458/g458.jpg',
},
'playlist_mincount': 3, # airs every weekday so this should _hopefully_ be okay forever
'skip_download': True,
}, {
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=... | if they are not used by this extractor these comments are not pertinent imo
```suggestion
}]
``` | 'playlist_mincount': 3,
}, {
# one with letters in the id
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=F300_06_3738470',
'note': 'Expires on 2024-03-31',
'info_dict': {
'id': 'F300_06_3738470',
'ext': 'm4a',
'title': '有島武郎「一房の... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.786 | refactor | 103 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
file = headline['file_list'][0]
# this will break if there's an episode with multiple files, but i don't think that's ever actually the case
info = {}
url = file['file_name']
info['id'] = programme_id + '_' + headline['headline_id']
info['formats'] = self._extract_m3u8_... | see `_VALID_URL` comment about `id`/`video_id` and `programme_id`
```suggestion
site_id, corner_id, headline_id = self._match_valid_url(url).group('site', 'corner', 'headline')
``` | def _extract_episode_info(self, headline, programme_id, series_meta):
episode_id = f'{programme_id}_{headline["headline_id"]}'
episode = traverse_obj(headline, ('file_list', 0, {dict}))
return {
**series_meta,
'id': episode_id,
'formats': self._extract_m3... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.714 | suggestion | 191 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
url = file['file_name']
info['id'] = programme_id + '_' + headline['headline_id']
info['formats'] = self._extract_m3u8_formats(url, info['id'])
info['title'] = file.get('file_title')
info['description'] = file.get('file_title_sub')
# info['webpage_url'] = file.get('share... | one-time use variable can just be the argument instead
```suggestion
meta = self._download_json(
f'https://www.nhk.or.jp/radioondemand/json/{site_id}/bangumi_{programme_id}.json',
programme_id)['main']
``` | return {
**series_meta,
'id': episode_id,
'formats': self._extract_m3u8_formats(episode.get('file_name'), episode_id, fatal=False),
'container': 'm4a_dash', # force fixup, AAC-only HLS
'was_live': True,
'series': series_meta.get('title'),
... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | suggestion | 242 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
info['title'] = file.get('file_title')
info['description'] = file.get('file_title_sub')
# info['webpage_url'] = file.get('share_url')
info['thumbnail'] = headline.get('headline_image')
info['container'] = 'm4a_dash' # force fixup so seeking works
info['was_live'] = True ... | A dict will be easier to pass around. We can pass it to `_extract_episode_info` and let that method handle the info_dict update for single episodes and playlist entries, and also pass it to the playlist result
```suggestion
series_meta = traverse_obj(meta, {
'title': 'program_name',
... | 'container': 'm4a_dash', # force fixup, AAC-only HLS
'was_live': True,
'series': series_meta.get('title'),
'thumbnail': url_or_none(headline.get('headline_image')) or series_meta.get('thumbnail'),
**traverse_obj(episode, {
'title': 'file_title... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 1 | refactor | 451 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
pass
def _extract_episode_info(self, headline, programme_id):
file = headline['file_list'][0]
# this will break if there's an episode with multiple files, but i don't think that's ever actually the case
info = {}
url = file['file_name']
info['id'] = programme_i... | - inline metadata in `return` when possible
- f-strings are preferred
- no need for the `_decode_time` method, `unified_timestamp` can handle these strings
- dict key traversal with `traverse_obj` can be used to reduce repetitive `var.get()` code
- we can pass the `series_meta` dict to this method and unpack i... | },
}]
def _extract_episode_info(self, headline, programme_id, series_meta):
episode_id = f'{programme_id}_{headline["headline_id"]}'
episode = traverse_obj(headline, ('file_list', 0, {dict}))
return {
**series_meta,
'id': episode_id,
'formats... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 1 | refactor | 1,563 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
headline = (next((i for i in detail_list if i.get('headline_id') == headline_id), None))
result = self._extract_episode_info(headline, programme_id)
result['series'] = series
result['channel'] = channel
result['thumbnail'] = result.get('thumbnail') or thumbnai... | I would simplify this with `traverse_obj` and `playlist_result`
- `traverse_obj(meta, ('detail_list', ..., {dict}))` will branch out and return all dicts in the list
- `traverse_obj(meta, ('detail_list', lambda _, v: v['headline_id'] == headline_id))` will filter for dicts in the list where the `'headline_id'` ke... |
def entries():
for headline in traverse_obj(meta, ('detail_list', ..., {dict})):
yield self._extract_episode_info(headline, programme_id, series_meta)
return self.playlist_result(
entries(), programme_id, playlist_description=meta.get('site_detail'), **series_me... | @@ -334,3 +335,140 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | refactor | 1,106 | 27 | 27 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
webpage = self._download_webpage(f'https://www.nhk.or.jp/school/{program_id}/', program_id)
title = (self._generic_title('', webpage)
or self._html_search_regex(r'<h3>([^<]+?)とは?\s*</h3>', webpage, 'title', fatal=False))
title = re.sub(r'\s*\|\s*NHK\s+for\s+School\s*$', '', ti... | imo this all can be inferred from test URLs, `_VALID_URL` pattern, and `_real_extract` code
```suggestion
``` |
webpage = self._download_webpage(f'https://www.nhk.or.jp/school/{program_id}/', program_id)
title = (self._generic_title('', webpage)
or self._html_search_regex(r'<h3>([^<]+?)とは?\s*</h3>', webpage, 'title', fatal=False))
title = re.sub(r'\s*\|\s*NHK\s+for\s+School\s*$', '', ti... | @@ -334,3 +335,138 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.786 | refactor | 112 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
description = self._html_search_regex(
r'(?s)<div\s+class="programDetail\s*">\s*<p>[^<]+</p>',
webpage, 'description', fatal=False, group=0)
bangumi_list = self._download_json(
f'https://www.nhk.or.jp/school/{program_id}/meta/program.json', program_id)
# they... | use md5 for long description strings
change to `'description': 'md5:TODO',` and run test again, it will fail and give you the correct value | description = self._html_search_regex(
r'(?s)<div\s+class="programDetail\s*">\s*<p>[^<]+</p>',
webpage, 'description', fatal=False, group=0)
bangumi_list = self._download_json(
f'https://www.nhk.or.jp/school/{program_id}/meta/program.json', program_id)
# they... | @@ -334,3 +335,138 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.571 | bug | 141 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=0449_01_3853544',
'skip': 'Episode expired on 2023-04-16',
'info_dict': {
'channel': 'NHK-FM',
'description': '今回の前半は「NEWジャズ」特集と題して、曲名や演奏者の名前に「NEW」がつく演奏や、新人の初リーダー作などを集めて聴いていく。',
'ext': 'm4a',
... | test comments are more readable above the url/info_dict imo
```suggestion
# airs every weekday so this should _hopefully_ be okay forever
'url': 'https://www.nhk.or.jp/radio/ondemand/detail.html?p=0458_01',
'info_dict': {
'id': '0458_01',
'title': 'ベストオブクラシック',
... | 'info_dict': {
'channel': 'NHK-FM',
'description': 'md5:94b08bdeadde81a97df4ec882acce3e9',
'ext': 'm4a',
'id': '0449_01_3853544',
'series': 'ジャズ・トゥナイト',
'thumbnail': 'https://www.nhk.or.jp/prog/img/449/g449.jpg',
'timestamp': 16... | @@ -334,3 +335,138 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | suggestion | 534 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
}]
def _extract_episode_info(self, headline, programme_id, series_meta):
episode_id = f'{programme_id}_{headline["headline_id"]}'
episode = traverse_obj(headline, ('file_list', 0, {dict}))
return {
**series_meta,
'id': episode_id,
'formats': self._ext... | single-quotes
```suggestion
if site_id == 'F261':
``` | }]
def _extract_episode_info(self, headline, programme_id, series_meta):
episode_id = f'{programme_id}_{headline["headline_id"]}'
episode = traverse_obj(headline, ('file_list', 0, {dict}))
return {
**series_meta,
'id': episode_id,
'formats': self._ex... | @@ -334,3 +335,138 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.571 | suggestion | 64 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
site_id, corner_id, headline_id = self._match_valid_url(url).group('site', 'corner', 'headline')
programme_id = f'{site_id}_{corner_id}'
if site_id == "F261":
json_url = 'https://www.nhk.or.jp/s-media/news/news-site/list/v1/all.json'
else:
json_url = f'https://ww... | just a formatting/readability fix
```suggestion
yield self._extract_episode_info(headline, programme_id, series_meta)
return self.playlist_result(
``` | def _real_extract(self, url):
site_id, corner_id, headline_id = self._match_valid_url(url).group('site', 'corner', 'headline')
programme_id = f'{site_id}_{corner_id}'
if site_id == 'F261':
json_url = 'https://www.nhk.or.jp/s-media/news/news-site/list/v1/all.json'
else:
... | @@ -334,3 +335,138 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.786 | refactor | 180 | 47 | 49 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
programme_id, series_meta)
def entries():
for headline in traverse_obj(meta, ('detail_list', ..., {dict})):
yield self._extract_episode_info(headline, programme_id, series_meta)
return self.playlist_result(
entries(), programme_id, playlist_descri... | ```suggestion
return self.url_result('https://www.nhk.or.jp/radio/ondemand/detail.html?p=F261_01', NhkRadiruIE)
``` | 'detail_list', lambda _, v: v['headline_id'] == headline_id), get_all=False),
programme_id, series_meta)
def entries():
for headline in traverse_obj(meta, ('detail_list', ..., {dict})):
yield self._extract_episode_info(headline, programme_id, seri... | @@ -334,3 +335,138 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.714 | suggestion | 125 | 27 | 29 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
series_meta = traverse_obj(meta, {
'title': 'program_name',
'channel': 'media_name',
'thumbnail': (('thumbnail_c', 'thumbnail_p'), {url_or_none}),
}, get_all=False)
if headline_id:
return self._extract_episode_info(
traverse_obj(m... | ```suggestion
```
this should be `'params': {'skip_download': True},`, but playlists aren't downloaded anyways so it can be removed
| meta = self._download_json(json_url, programme_id)['main']
series_meta = traverse_obj(meta, {
'title': 'program_name',
'channel': 'media_name',
'thumbnail': (('thumbnail_c', 'thumbnail_p'), {url_or_none}),
}, get_all=False)
if headline_id:
... | @@ -334,3 +335,138 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.786 | suggestion | 135 | 38 | 40 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'series': 'らじる文庫 by ラジオ深夜便 ',
'release_timestamp': 1481126700,
'upload_date': '20211101',
}
}, {
# news
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=F261_01_3855109',
'skip': 'Expires on 2023-04-17',
'info_dict': {
... | ```suggestion
episode = traverse_obj(headline, ('file_list', 0, {dict}))
return {
``` | 'series': 'らじる文庫 by ラジオ深夜便 ',
'release_timestamp': 1481126700,
'upload_date': '20211101',
}
}, {
# news
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=F261_01_3855109',
'skip': 'Expires on 2023-04-17',
'info_dict': {
... | @@ -334,3 +335,139 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.714 | suggestion | 106 | 51 | 51 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
json_url = f'https://www.nhk.or.jp/radioondemand/json/{site_id}/bangumi_{programme_id}.json'
meta = self._download_json(json_url, programme_id)['main']
series_meta = traverse_obj(meta, {
'title': 'program_name',
'channel': 'media_name',
'thumbnail': (('t... | ```suggestion
_VALID_URL = r'https?://www\.nhk\.or\.jp/radionews/?(?:$|[?#])'
``` | else:
json_url = f'https://www.nhk.or.jp/radioondemand/json/{site_id}/bangumi_{programme_id}.json'
meta = self._download_json(json_url, programme_id)['main']
series_meta = traverse_obj(meta, {
'title': 'program_name',
'channel': 'media_name',
'th... | @@ -334,3 +335,139 @@ def _real_extract(self, url):
for x in traverse_obj(bangumi_list, ('part', ..., 'part-video-dasid')) or []]
return self.playlist_result(bangumis, program_id, title, description)
+
+
+class NhkRadiruIE(InfoExtractor):
+ _GEO_COUNTRIES = ['JP']
+ IE_DESC = 'NHK らじる (Rad... | yt_dlp/extractor/nhk.py | 26 | Python | 0.571 | suggestion | 87 | 42 | 43 | false | [extractor/nhk] Add NHK Radiru (らじる) extractor | 6,819 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
countries = ['AU']
if fatal:
self.raise_geo_restricted(countries=countries)
err = GeoRestrictedError(
'This Australian content is not available from your location due to geo restriction',
countries=countries)
... | none of this is necessary imo:
- geo-bypass works now that SBS is no longer using theplatform
- only format URLs are geo-restricted, and with this code m3u8 extraction doesn't actually `raise_geo_restricted`, it only warns about geo-blocking (because smil m3u8 extraction is always non-fatal), so the extractor n... | from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | @@ -70,34 +89,172 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2... | yt_dlp/extractor/sbs.py | 26 | Python | 0.857 | refactor | 458 | 51 | 159 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
_AUS_TV_PARENTAL_GUIDELINES = {
'P': 0,
'C': 7,
'G': 0,
'PG': 0,
'M': 14,
'MA15+': 15,
'MAV15+': 15,
'R18+': 18,
}
_PLAYER_API = 'https://www.sbs.com.au/api/v3'
_CATALOGUE_API = 'https://catalogue.pr.sbsod.com/'
def _call_api(self, vid... | one-time use var/functions that can be inlined instead, as i did in my suggestions below
```suggestion
``` | from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | @@ -70,34 +89,172 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2... | yt_dlp/extractor/sbs.py | 26 | Python | 0.786 | suggestion | 108 | 51 | 159 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
'MA15+': 15,
'MAV15+': 15,
'R18+': 18,
}
_PLAYER_API = 'https://www.sbs.com.au/api/v3'
_CATALOGUE_API = 'https://catalogue.pr.sbsod.com/'
def _call_api(self, video_id, path, query=None, data=None, headers=None, fatal=True):
return self._download_json(update_url_query(
... | this eliminates the need for the `_download_webpage_handle` and `_extract_m3u8_formats` redefinitions, and the `raise_geo_restricted` will trigger a retry with geo-bypass (or raise the appropriate error if geo-bypass is already in use)
```suggestion
formats, subtitles = self._extract_smil_formats_and_subtit... | from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | @@ -70,34 +89,172 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2... | yt_dlp/extractor/sbs.py | 26 | Python | 1 | refactor | 883 | 51 | 159 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
_PLAYER_API = 'https://www.sbs.com.au/api/v3'
_CATALOGUE_API = 'https://catalogue.pr.sbsod.com/'
def _call_api(self, video_id, path, query=None, data=None, headers=None, fatal=True):
return self._download_json(update_url_query(
self._CATALOGUE_API + path, query),
video_id, h... | ```suggestion
media = traverse_obj(self._download_json(
f'{self._PLAYER_API}/video_stream', video_id, fatal=False,
query={'id': video_id, 'context': 'tv'}), ('video_object', {dict})) or {}
``` | from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | @@ -70,34 +89,172 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2... | yt_dlp/extractor/sbs.py | 26 | Python | 0.786 | suggestion | 228 | 51 | 159 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
def _call_api(self, video_id, path, query=None, data=None, headers=None, fatal=True):
return self._download_json(update_url_query(
self._CATALOGUE_API + path, query),
video_id, headers=headers, fatal=fatal) or {}
def _get_smil_url(self, video_id):
return update_url_quer... | ```suggestion
media.update(self._download_json(
f'https://catalogue.pr.sbsod.com/mpx-media/{video_id}',
video_id, fatal=not media) or {})
``` | from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | @@ -70,34 +89,172 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2... | yt_dlp/extractor/sbs.py | 26 | Python | 0.714 | suggestion | 179 | 51 | 159 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
# utils candidate for use with traverse_obj()
def txt_or_none(s):
return (s.strip() or None) if isinstance(s, compat_str) else None
# expected_type fn for thumbs
def xlate_thumb(t):
u = url_or_none(t.get('contentUrl'))
return u and {
... | yt-dlp's `traverse_obj` can do some things that youtube-dl's cannot, so it doesn't really need any of these helpers
```suggestion
``` | from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | @@ -70,34 +89,172 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2... | yt_dlp/extractor/sbs.py | 26 | Python | 0.714 | refactor | 135 | 51 | 159 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
'description': traverse_media('description'),
'categories': traverse_media(
('genres', Ellipsis), ('taxonomy', ('genre', 'subgenre'), 'name')),
'tags': traverse_media(
(('consumerAdviceTexts', ('sbsSubCertification', 'consumerAdvice')), Ellipsis)),
... | I've tested this suggestion; the only difference from the old code is that `tags` and `categories` will return `None` instead of an empty list if no values are returned, so the test will need to be updated
```suggestion
**traverse_obj(media, {
'title': ('name', {str}),
'd... | from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | @@ -70,34 +89,172 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2... | yt_dlp/extractor/sbs.py | 26 | Python | 0.857 | suggestion | 1,848 | 28 | 159 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
'only_matching': True,
}, {
'url': 'http://www.sbs.com.au/news/video/471395907773/The-Feed-July-9',
'only_matching': True,
}, {
'url': 'https://www.sbs.com.au/ondemand/?play=1836638787723',
'only_matching': True,
}, {
'url': 'https://www.sbs.com.au/ondemand/pr... | geo-bypass
```suggestion
_GEO_COUNTRIES = ['AU']
_AUS_TV_PARENTAL_GUIDELINES = {
``` | }, {
'url': 'https://www.sbs.com.au/news/embeds/video/1840778819866',
'only_matching': True,
}, {
'url': 'https://www.sbs.com.au/ondemand/watch/1698704451971',
'only_matching': True,
}, {
'url': 'https://www.sbs.com.au/ondemand/movie/coherence/1469404227931',
... | @@ -70,34 +89,172 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2... | yt_dlp/extractor/sbs.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
def _real_extract(self, url):
video_id = self._match_id(url)
formats, subtitles = self._extract_smil_formats_and_subtitles(
update_url_query(f'{self._PLAYER_API}/video_smil', {'id': video_id}), video_id)
if not formats:
urlh = self._request_webpage(
... | ```suggestion
if traverse_obj(media, ('partOfSeries', {dict})):
media['epName'] = traverse_obj(media, ('title', {str}))
``` | formats, subtitles = self._extract_smil_formats_and_subtitles(
update_url_query(f'{self._PLAYER_API}/video_smil', {'id': video_id}), video_id)
if not formats:
urlh = self._request_webpage(
HEADRequest('https://sbs-vod-prod-01.akamaized.net/'), video_id,
... | @@ -70,34 +80,80 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/21... | yt_dlp/extractor/sbs.py | 26 | Python | 0.714 | suggestion | 146 | 51 | 51 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | vidiot720 |
}, {
'url': 'https://www.sbs.com.au/ondemand/news-series/dateline/dateline-2022/dateline-s2022-ep26/2072245827515',
'only_matching': True,
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching':... | does SBS still have livestreams? | 'url': 'https://www.sbs.com.au/ondemand/news-series/dateline/dateline-2022/dateline-s2022-ep26/2072245827515',
'only_matching': True,
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
... | @@ -70,34 +80,80 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/21... | yt_dlp/extractor/sbs.py | 26 | Python | 0.071 | question | 32 | 51 | 51 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
query={'id': video_id, 'context': 'tv'}), ('video_object', {dict})) or {}
media.update(self._download_json(
f'https://catalogue.pr.sbsod.com/mpx-media/{video_id}',
video_id, fatal=not media) or {})
# For named episodes, use the catalogue's title to set episode, rath... | for livestreams, `liveStream` is `True` in catalogue API JSON
```suggestion
'duration': ('duration', ({float_or_none}, {parse_duration})),
'is_live': ('liveStream', {bool}),
``` | media = traverse_obj(self._download_json(
f'{self._PLAYER_API}/video_stream', video_id, fatal=False,
query={'id': video_id, 'context': 'tv'}), ('video_object', {dict})) or {}
media.update(self._download_json(
f'https://catalogue.pr.sbsod.com/mpx-media/{video_id}',
... | @@ -70,34 +79,77 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/21... | yt_dlp/extractor/sbs.py | 26 | Python | 0.786 | suggestion | 213 | 42 | 45 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
from .common import InfoExtractor
from ..utils import (
float_or_none,
HEADRequest,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | sort class above function
```suggestion
HEADRequest,
float_or_none,
``` | from .common import InfoExtractor
from ..utils import (
HEADRequest,
float_or_none,
int_or_none,
parse_duration,
parse_iso8601,
traverse_obj,
update_url_query,
url_or_none,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'''(?x)
https?://(?:www\.)?sbs... | @@ -1,7 +1,13 @@
from .common import InfoExtractor
from ..utils import (
- smuggle_url,
- ExtractorError,
+ float_or_none,
+ HEADRequest, | yt_dlp/extractor/sbs.py | 4 | Python | 0.571 | suggestion | 83 | 29 | 29 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2116212803602',
'only_matching': True,
}]
_GEO_COUNTRIES = ['AU']
_AUS_TV_PARENTAL_GUIDELINES = {
'P': 0,
'C': 7,
'G': 0,
'PG': 0,
'M': 14,
'MA15+': 15,
'M... | looks like you made a typo in the domain name
```suggestion
HEADRequest('https://sbs-vod-prod-01.akamaized.net/'), video_id,
note='Checking geo-restriction', fatal=False, expected_status=403)
``` | 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/2116212803602',
'only_matching': True,
}]
_GEO_COUNTRIES = ['AU']
_AUS_TV_PARENTAL_GUIDELINES = {
'P': 0,
'C': 7,
'G': 0,
'PG': 0,
'M': 14,
'MA15+': 15,
'M... | @@ -70,34 +79,78 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/21... | yt_dlp/extractor/sbs.py | 26 | Python | 0.786 | suggestion | 231 | 51 | 51 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
_GEO_COUNTRIES = ['AU']
_AUS_TV_PARENTAL_GUIDELINES = {
'P': 0,
'C': 7,
'G': 0,
'PG': 0,
'M': 14,
'MA15+': 15,
'MAV15+': 15,
'R18+': 18,
}
_PLAYER_API = 'https://www.sbs.com.au/api/v3'
def _real_extract(self, url):
video_id = ... | fixing my own code
```suggestion
if urlh:
error_reasons = urlh.headers.get_all('x-error-reason') or []
if 'geo-blocked' in error_reasons:
self.raise_geo_restricted(countries=['AU'])
self.raise_no_formats('No formats are available', video_... |
_GEO_COUNTRIES = ['AU']
_AUS_TV_PARENTAL_GUIDELINES = {
'P': 0,
'C': 7,
'G': 0,
'PG': 0,
'M': 14,
'MA15+': 15,
'MAV15+': 15,
'R18+': 18,
}
_PLAYER_API = 'https://www.sbs.com.au/api/v3'
def _real_extract(self, url):
video_id = ... | @@ -70,34 +79,78 @@ class SBSIE(InfoExtractor):
}, {
'url': 'https://www.sbs.com.au/ondemand/tv-series/the-handmaids-tale/season-5/the-handmaids-tale-s5-ep1/2065631811776',
'only_matching': True,
+ }, {
+ 'url': 'https://www.sbs.com.au/ondemand/tv-program/autun-romes-forgotten-sister/21... | yt_dlp/extractor/sbs.py | 26 | Python | 0.929 | suggestion | 337 | 51 | 51 | false | [extractor/sbs] Overhaul extractor for new APIs | 6,839 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vidiot720 |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
raw_video_info = self._html_search_regex(
r'<script[^>]*id=["\']videos["\'][^>]*>([^<]+)</script>',
webpage, 'video info', default=None)
video_... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/(?P<id>[^/]+)(?:/trailers)?/?(?:$|[#?])'
``` | },
}, {
'url': 'http://www.rottentomatoes.com/m/toy_story_3',
'info_dict': {
'id': 'toy_story_3',
'title': 'Toy Story 3',
},
'playlist_mincount': 4,
}, {
'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers',
'info_dict': {
... | @@ -1,30 +1,96 @@
from .common import InfoExtractor
-from .internetvideoarchive import InternetVideoArchiveIE
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ parse_duration,
+ traverse_obj,
+ urljoin,
+)
class RottenTomatoesIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?rottento... | yt_dlp/extractor/rottentomatoes.py | 26 | Python | 0.714 | suggestion | 120 | 51 | 48 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
RedGifsIE,
RedGifsSearchIE,
RedGifsUserIE,
)
from .redtube import RedTubeIE
from .regiotv import RegioTVIE
from .rentv import (
RENTVIE,
RENTVArticleIE,
)
from .restudy import RestudyIE
from .reuters import ReutersIE
from .reverbnation import ReverbNationIE
from .rice import RICEIE
from .rmcdecouver... | I think it may be better do to this all in one extractor. See my following suggestions
```suggestion
``` | RedGifsIE,
RedGifsSearchIE,
RedGifsUserIE,
)
from .redtube import RedTubeIE
from .regiotv import RegioTVIE
from .rentv import (
RENTVIE,
RENTVArticleIE,
)
from .restudy import RestudyIE
from .reuters import ReutersIE
from .reverbnation import ReverbNationIE
from .rice import RICEIE
from .rmcdecouver... | @@ -1593,7 +1593,10 @@
RokfinSearchIE,
)
from .roosterteeth import RoosterTeethIE, RoosterTeethSeriesIE
-from .rottentomatoes import RottenTomatoesIE
+from .rottentomatoes import (
+ RottenTomatoesIE,
+ RottenTomatoesPlaylistIE, | yt_dlp/extractor/_extractors.py | 26 | Python | 0.786 | refactor | 106 | 51 | 51 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
js_to_json,
parse_duration,
traverse_obj,
urljoin,
)
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/[^/]+/trailers/(?P<id>[\da-zA-Z]+)'
_TESTS = [{
'url': 'http:... | We can extract 3 values here:
- `playlist` will be the base of the `playlist_id` variable
- `tr` will be checking if this is a trailers playlist, and we can use it to append `-trailers` to the `playlist_id` if so
- `id` is the optional `video_id`
```suggestion
_VALID_URL = r'https?://(?:www\.)?rottentomat... | from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
float_or_none,
get_element_by_class,
join_nonempty,
traverse_obj,
url_or_none,
)
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/(?P<playlist>[^/]+)(?:/(?P... | @@ -1,30 +1,96 @@
from .common import InfoExtractor
-from .internetvideoarchive import InternetVideoArchiveIE
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ parse_duration,
+ traverse_obj,
+ urljoin,
+)
class RottenTomatoesIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?rottento... | yt_dlp/extractor/rottentomatoes.py | 12 | Python | 0.857 | refactor | 395 | 37 | 37 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
_TESTS = [{
'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
'info_dict': {
'id': '11028566',
'ext': 'mp4',
'title': 'Best Tom Hanks Movies',
'description': 'We look at the filmography of America\'s Dad, as we count down our li... | We need to try to construct the `playlist_id` since /trailers/ URLs have different playlists than their non-trailers URL counterparts. `join_nonempty` can be imported from utils
```suggestion
playlist_id, trailers, video_id = self._match_valid_url(url).group('playlist', 'tr', 'id')
playlist_id = join... | class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/(?P<playlist>[^/]+)(?:/(?P<tr>trailers)(?:/(?P<id>\w+))?)?'
_TESTS = [{
'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
'info_dict': {
'id': '11028566',
... | @@ -1,30 +1,96 @@
from .common import InfoExtractor
-from .internetvideoarchive import InternetVideoArchiveIE
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ parse_duration,
+ traverse_obj,
+ urljoin,
+)
class RottenTomatoesIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?rottento... | yt_dlp/extractor/rottentomatoes.py | 26 | Python | 0.786 | suggestion | 417 | 51 | 51 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
'id': '11028566',
'ext': 'mp4',
'title': 'Best Tom Hanks Movies',
'description': 'We look at the filmography of America\'s Dad, as we count down our list of the best Tom Hanks movies.',
'thumbnail': r're:^https?://.*\.jpg$',
'duration': 1468.592
... | `js_to_json` is only needed if we are trying to parse a block of javascript that is JSON-like but not actually valid JSON, and needs to be transformed before parsing. This does not apply to what we find in this site's webpages, which is instead one big array of valid JSON. But since it is an array/list, we need to pass... | 'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
'info_dict': {
'id': '11028566',
'ext': 'mp4',
'title': 'Toy Story 3',
'description': 'From the creators of the beloved TOY STORY films, comes a story that will reunite the gang in a ... | @@ -1,30 +1,96 @@
from .common import InfoExtractor
-from .internetvideoarchive import InternetVideoArchiveIE
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ parse_duration,
+ traverse_obj,
+ urljoin,
+)
class RottenTomatoesIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?rottento... | yt_dlp/extractor/rottentomatoes.py | 26 | Python | 0.857 | suggestion | 604 | 51 | 51 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/[^/]+/trailers/(?P<id>[\da-zA-Z]+)'
_TESTS = [{
'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
'info_dict': {
'id': '11028566',
'ext': 'mp4',
... | We can call this `_extract_videos` method on both playlist entries and single videos to greatly simplify `_real_extract`
```suggestion
def _extract_videos(self, data, display_id):
for video in traverse_obj(data, (lambda _, v: v['publicId'] and v['file'] and v['type'] == 'hls')):
yield {
... |
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/(?P<playlist>[^/]+)(?:/(?P<tr>trailers)(?:/(?P<id>\w+))?)?'
_TESTS = [{
'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
'info_dict': {
'id': '11028566',
... | @@ -1,30 +1,96 @@
from .common import InfoExtractor
-from .internetvideoarchive import InternetVideoArchiveIE
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ parse_duration,
+ traverse_obj,
+ urljoin,
+)
class RottenTomatoesIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?rottento... | yt_dlp/extractor/rottentomatoes.py | 26 | Python | 1 | refactor | 838 | 51 | 51 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
'title': 'Best Tom Hanks Movies',
'description': 'We look at the filmography of America\'s Dad, as we count down our list of the best Tom Hanks movies.',
'thumbnail': r're:^https?://.*\.jpg$',
'duration': 1468.592
},
}, {
'url': 'https://www.rottentoma... | ```suggestion
```
then everything from this point and below could be replaced with:
```py
if video_id:
video_data = traverse_obj(data, lambda _, v: v['publicId'] == video_id)
if not video_data:
raise ExtractorError('Unable to extract video from webpage')
... | 'id': '11028566',
'ext': 'mp4',
'title': 'Toy Story 3',
'description': 'From the creators of the beloved TOY STORY films, comes a story that will reunite the gang in a whole new way.'
},
'skip': 'No longer available',
}, {
'url': 'https://www.r... | @@ -1,30 +1,96 @@
from .common import InfoExtractor
-from .internetvideoarchive import InternetVideoArchiveIE
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ parse_duration,
+ traverse_obj,
+ urljoin,
+)
class RottenTomatoesIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?rottento... | yt_dlp/extractor/rottentomatoes.py | 26 | Python | 1 | refactor | 928 | 51 | 51 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
js_to_json,
parse_duration,
traverse_obj,
urljoin,
)
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/[^/]+/trailers/(?P<id>[\da-zA-Z]+)'
_TESTS = [{
'url': 'http:... | This test is dead. When the URL is opened in browser, it redirects to an arbitrary video from the `/toy_story_3/trailers/` page, which is the "Best Tom Hanks Movies" video. That video's actual URL is https://www.rottentomatoes.com/m/toy_story_3/trailers/8FSKloB_r38Z
Either update the `url` and `id` to their real val... | from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
float_or_none,
get_element_by_class,
join_nonempty,
traverse_obj,
url_or_none,
)
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/(?P<playlist>[^/]+)(?:/(?P... | @@ -1,30 +1,96 @@
from .common import InfoExtractor
-from .internetvideoarchive import InternetVideoArchiveIE
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ parse_duration,
+ traverse_obj,
+ urljoin,
+)
class RottenTomatoesIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?rottento... | yt_dlp/extractor/rottentomatoes.py | 17 | Python | 0.571 | suggestion | 423 | 42 | 42 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
RedGifsIE,
RedGifsSearchIE,
RedGifsUserIE,
)
from .redtube import RedTubeIE
from .regiotv import RegioTVIE
from .rentv import (
RENTVIE,
RENTVArticleIE,
)
from .restudy import RestudyIE
from .reuters import ReutersIE
from .reverbnation import ReverbNationIE
from .rice import RICEIE
from .rmcdecouver... | ```suggestion
from .rottentomatoes import RottenTomatoesIE
``` | RedGifsIE,
RedGifsSearchIE,
RedGifsUserIE,
)
from .redtube import RedTubeIE
from .regiotv import RegioTVIE
from .rentv import (
RENTVIE,
RENTVArticleIE,
)
from .restudy import RestudyIE
from .reuters import ReutersIE
from .reverbnation import ReverbNationIE
from .rice import RICEIE
from .rmcdecouver... | @@ -1593,7 +1593,9 @@
RokfinSearchIE,
)
from .roosterteeth import RoosterTeethIE, RoosterTeethSeriesIE
-from .rottentomatoes import RottenTomatoesIE
+from .rottentomatoes import (
+ RottenTomatoesIE,
+) | yt_dlp/extractor/_extractors.py | 26 | Python | 0.571 | suggestion | 64 | 51 | 51 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
from .common import InfoExtractor
from ..utils import (
clean_html,
ExtractorError,
float_or_none,
get_element_by_class,
join_nonempty,
traverse_obj,
url_or_none,
)
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/(?P<playlist>[^/]+)(?:/(?P... | ```suggestion
ExtractorError,
clean_html,
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
float_or_none,
get_element_by_class,
join_nonempty,
traverse_obj,
url_or_none,
)
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/(?P<playlist>[^/]+)(?:/(?P... | @@ -1,30 +1,80 @@
from .common import InfoExtractor
-from .internetvideoarchive import InternetVideoArchiveIE
+from ..utils import (
+ clean_html,
+ ExtractorError, | yt_dlp/extractor/rottentomatoes.py | 4 | Python | 0.786 | refactor | 56 | 29 | 29 | false | [RottenTomatoes] fix: update rotten tomatoes regex and extraction | 6,844 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
check_response = self._download_webpage(check_req, None,
note='Confirming login')
if re.search(r'id="checkpointSubmitButton"', check_response) is not None:
self.report_warning('Unable to confirm login, you have to login in your ... | `..., ...` seems maybe too lax for the first traversal path? i.e. it could branch out and return the wrong dict instead of falling back to the other `get_first`s. Is all that branching necessary? Or can we be more specific?
If you think we need `..., ...`, suggestion:
```suggestion
uploader_data = (
... | check_response = self._download_webpage(check_req, None,
note='Confirming login')
if re.search(r'id="checkpointSubmitButton"', check_response) is not None:
self.report_warning('Unable to confirm login, you have to login in your ... | @@ -390,7 +390,11 @@ def extract_metadata(webpage):
k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict)
title = get_first(media, ('title', 'text'))
description = get_first(media, ('creation_story', 'comet_sections', 'message', 'story... | yt_dlp/extractor/facebook.py | 26 | Python | 0.857 | bug | 540 | 51 | 51 | false | [extractor/Facebook] fix: Username getting and liveViewerCount | 6,856 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ringus1 |
page_title = title or self._html_search_regex((
r'<h2\s+[^>]*class="uiHeaderTitle"[^>]*>(?P<content>[^<]*)</h2>',
r'(?s)<span class="fbPhotosPhotoCaption".*?id="fbPhotoPageCaption"><span class="hasCaption">(?P<content>.*?)</span>',
self._meta_regex('og:title')... | ```suggestion
view_count = parse_count(self._search_regex(
(r'\bviewCount\s*:\s*["\']([\d,.]+)', r'video_view_count["\']\s*:\s*(\d+)',), webpage, 'view count', default=None))
``` | r'<h2\s+[^>]*class="uiHeaderTitle"[^>]*>(?P<content>[^<]*)</h2>',
r'(?s)<span class="fbPhotosPhotoCaption".*?id="fbPhotoPageCaption"><span class="hasCaption">(?P<content>.*?)</span>',
self._meta_regex('og:title'), self._meta_regex('twitter:title'), r'<title>(?P<content>.+... | @@ -415,16 +419,20 @@ def extract_metadata(webpage):
# in https://www.facebook.com/yaroslav.korpan/videos/1417995061575415/
if thumbnail and not re.search(r'\.(?:jpg|png)', thumbnail):
thumbnail = None
- view_count = parse_count(self._search_regex(
- ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.786 | suggestion | 209 | 51 | 51 | false | [extractor/Facebook] fix: Username getting and liveViewerCount | 6,856 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ringus1 |
self._meta_regex('og:title'), self._meta_regex('twitter:title'), r'<title>(?P<content>.+?)</title>'
), webpage, 'title', default=None, group='content')
description = description or self._html_search_meta(
['description', 'og:description', 'twitter:description'],
... | We can combine these:
```suggestion
live_view_count = get_first(post, (
('video', (..., ..., 'attachments', ..., 'media')), 'liveViewerCount', {int_or_none}))
``` | ), webpage, 'title', default=None, group='content')
description = description or self._html_search_meta(
['description', 'og:description', 'twitter:description'],
webpage, 'description', default=None)
uploader = uploader_data.get('name') or (
... | @@ -415,16 +419,20 @@ def extract_metadata(webpage):
# in https://www.facebook.com/yaroslav.korpan/videos/1417995061575415/
if thumbnail and not re.search(r'\.(?:jpg|png)', thumbnail):
thumbnail = None
- view_count = parse_count(self._search_regex(
- ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.714 | suggestion | 194 | 51 | 51 | false | [extractor/Facebook] fix: Username getting and liveViewerCount | 6,856 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ringus1 |
(r'ownerName\s*:\s*"([^"]+)"', *self._og_regexes('title')), webpage, 'uploader', fatal=False))
timestamp = int_or_none(self._search_regex(
r'<abbr[^>]+data-utime=["\'](\d+)', webpage,
'timestamp', default=None))
thumbnail = self._html_search_m... | `live_view_count` should be `concurrent_view_count`
I think my suggestions condense `view_count` and `concurrent_view_count` enough that they could be inlined |
timestamp = int_or_none(self._search_regex(
r'<abbr[^>]+data-utime=["\'](\d+)', webpage,
'timestamp', default=None))
thumbnail = self._html_search_meta(
['og:image', 'twitter:image'], webpage, 'thumbnail', default=None)
# some webpages... | @@ -415,16 +419,20 @@ def extract_metadata(webpage):
# in https://www.facebook.com/yaroslav.korpan/videos/1417995061575415/
if thumbnail and not re.search(r'\.(?:jpg|png)', thumbnail):
thumbnail = None
- view_count = parse_count(self._search_regex(
- ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.571 | suggestion | 161 | 51 | 51 | false | [extractor/Facebook] fix: Username getting and liveViewerCount | 6,856 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ringus1 |
check_req = sanitized_Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.add_header('Content-Type', 'application/x-www-form-urlencoded')
check_response = self._download_webpage(check_req, None,
note='Confirming ... | Filtering in traversal is non-fatal, `.get` is unnecessary
and since we are already filtering for dict keys/values, `expected_type=dict` is not needed:
```suggestion
or get_first(post, (..., 'video', lambda k, v: k == 'owner' and v['name']))
```
but now that I think about it, this could pro... | check_req = sanitized_Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.add_header('Content-Type', 'application/x-www-form-urlencoded')
check_response = self._download_webpage(check_req, None,
note='Confirming ... | @@ -390,7 +390,11 @@ def extract_metadata(webpage):
k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict)
title = get_first(media, ('title', 'text'))
description = get_first(media, ('creation_story', 'comet_sections', 'message', 'story... | yt_dlp/extractor/facebook.py | 26 | Python | 1 | suggestion | 610 | 51 | 51 | false | [extractor/Facebook] fix: Username getting and liveViewerCount | 6,856 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ringus1 |
check_response = self._download_webpage(check_req, None,
note='Confirming login')
if re.search(r'id="checkpointSubmitButton"', check_response) is not None:
self.report_warning('Unable to confirm login, you have to login in your ... | ```suggestion
or get_first(post, ('node', 'actors', ..., {dict})) or {})
``` | check_response = self._download_webpage(check_req, None,
note='Confirming login')
if re.search(r'id="checkpointSubmitButton"', check_response) is not None:
self.report_warning('Unable to confirm login, you have to login in your ... | @@ -390,7 +390,11 @@ def extract_metadata(webpage):
k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict)
title = get_first(media, ('title', 'text'))
description = get_first(media, ('creation_story', 'comet_sections', 'message', 'story... | yt_dlp/extractor/facebook.py | 26 | Python | 0.571 | suggestion | 94 | 51 | 51 | false | [extractor/Facebook] fix: Username getting and liveViewerCount | 6,856 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ringus1 |
'md5': 'c8f263dd47e66cc17546b3abf47b5a77',
'info_dict': {
'id': 'wJnRqDHNe_u',
'ext': 'mp4',
'title': 'Gissy Talks: YouTube Alternatives',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'md5:e65036f0d4af80e0af191bd11af5195e',
... | we don't use the vars separately, and this can/should be fatal
```suggestion
src_path = f'{wvplayer_props["srcVID"]}/{wvplayer_props["srcUID"]}/{wvplayer_props["srcNAME"]}'
``` | 'id': 'wJnRqDHNe_u',
'ext': 'mp4',
'title': 'Gissy Talks: YouTube Alternatives',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'md5:e65036f0d4af80e0af191bd11af5195e',
'uploader': 'GissyEva',
'duration': 630.451,
}
},... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/wevidi.py | 26 | Python | 0.786 | suggestion | 187 | 51 | 51 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
'ext': 'mp4',
'title': 'Gissy Talks: YouTube Alternatives',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'md5:e65036f0d4af80e0af191bd11af5195e',
'uploader': 'GissyEva',
'duration': 630.451,
}
}]
def _extract_formats(self, ... | `traverse_obj` can make this safer (import from utils)
```suggestion
formats = []
for res in traverse_obj(wvplayer_props, ('resolutions', ..., {int}, {lambda x: x or None})):
```
does the site actually use `0` and we need to avoid it? if not, we could simplify to:
```suggestion
formats = ... | 'thumbnail': r're:^https?://.*\.jpg$',
'description': 'md5:e65036f0d4af80e0af191bd11af5195e',
'uploader': 'GissyEva',
'duration': 630.451,
}
}, {
'url': 'https://wevidi.net/watch/4m1c4yJR_yc',
'md5': 'c63ce5ca6990dce86855fc02ca5bc1ed',
... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/wevidi.py | 26 | Python | 0.857 | refactor | 406 | 51 | 51 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
}]
def _extract_formats(self, wvplayer_props):
# Taken from WeVidi player JS: https://wevidi.net/layouts/default/static/player.min.js
resolution_map = {
1: '144p',
2: '240p',
3: '360p',
4: '480p',
5: '720p',
6: '1080p'
... | 720p and 1080p resolutions have the same format_id and url path? how does that work? is it either/or?
(and 360p+480p, etc) | 'md5': 'c63ce5ca6990dce86855fc02ca5bc1ed',
'info_dict': {
'id': '4m1c4yJR_yc',
'ext': 'mp4',
'title': 'Enough of that! - Awesome Exilez Podcast',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'md5:96af99dd63468b2dfab3020560e3e9b2',
... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/wevidi.py | 26 | Python | 0.357 | style | 123 | 50 | 51 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
}]
def _extract_formats(self, wvplayer_props):
# Taken from WeVidi player JS: https://wevidi.net/layouts/default/static/player.min.js
resolution_map = {
1: '144p',
2: '240p',
3: '360p',
4: '480p',
5: '720p',
6: '1080p'
... | because of my other suggestion
```suggestion
'url': f'https://www.wevidi.net/videoplayback/{src_path}/{format_id}',
``` | 'md5': 'c63ce5ca6990dce86855fc02ca5bc1ed',
'info_dict': {
'id': '4m1c4yJR_yc',
'ext': 'mp4',
'title': 'Enough of that! - Awesome Exilez Podcast',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'md5:96af99dd63468b2dfab3020560e3e9b2',
... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/wevidi.py | 26 | Python | 0.786 | suggestion | 138 | 50 | 51 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
6: '1080p'
}
srcUID = wvplayer_props.get('srcUID')
srcVID = wvplayer_props.get('srcVID')
srcNAME = wvplayer_props.get('srcNAME')
resolutions = [res for res in wvplayer_props.get('resolutions') if res > 0]
formats = []
for res in resolutions:
... | inline in return
```suggestion
``` | }]
def _extract_formats(self, wvplayer_props):
# Taken from WeVidi player JS: https://wevidi.net/layouts/default/static/player.min.js
resolution_map = {
1: 144,
2: 240,
3: 360,
4: 480,
5: 720,
6: 1080
}
src... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/wevidi.py | 26 | Python | 0.429 | suggestion | 36 | 40 | 43 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
srcUID = wvplayer_props.get('srcUID')
srcVID = wvplayer_props.get('srcVID')
srcNAME = wvplayer_props.get('srcNAME')
resolutions = [res for res in wvplayer_props.get('resolutions') if res > 0]
formats = []
for res in resolutions:
format_id = str(-(res // -2) - ... | Better to use `_search_json`, though it's almost as brittle:
```suggestion
wvplayer_props = self._search_json(
r'WVPlayer\(', webpage, 'player', video_id,
transform_source=lambda x: js_to_json(x.replace('autoplay', '}')))
```
`js_to_json` doesn't handle `||` operators, whic... | # Taken from WeVidi player JS: https://wevidi.net/layouts/default/static/player.min.js
resolution_map = {
1: 144,
2: 240,
3: 360,
4: 480,
5: 720,
6: 1080
}
src_path = f'{wvplayer_props["srcVID"]}/{wvplayer_props["sr... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/wevidi.py | 26 | Python | 1 | suggestion | 1,247 | 37 | 40 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
formats = []
for res in resolutions:
format_id = str(-(res // -2) - 1)
formats.append({
'acodec': 'mp4a.40.2',
'ext': 'mp4',
'format_id': format_id,
'resolution': resolution_map.get(res),
'url': f'htt... | ```suggestion
'title': clean_html(get_element_by_class('video_title', webpage)),
``` | 3: 360,
4: 480,
5: 720,
6: 1080
}
src_path = f'{wvplayer_props["srcVID"]}/{wvplayer_props["srcUID"]}/{wvplayer_props["srcNAME"]}'
for res in traverse_obj(wvplayer_props, ('resolutions', ..., {int}, {lambda x: x or None})):
format_id = ... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/wevidi.py | 26 | Python | 0.571 | suggestion | 98 | 33 | 36 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
format_id = str(-(res // -2) - 1)
formats.append({
'acodec': 'mp4a.40.2',
'ext': 'mp4',
'format_id': format_id,
'resolution': resolution_map.get(res),
'url': f'https://www.wevidi.net/videoplayback/{srcVID}/{srcUID}/{... | clean just in case
```suggestion
'uploader': clean_html(get_element_by_class('username', webpage)),
``` | 5: 720,
6: 1080
}
src_path = f'{wvplayer_props["srcVID"]}/{wvplayer_props["srcUID"]}/{wvplayer_props["srcNAME"]}'
for res in traverse_obj(wvplayer_props, ('resolutions', ..., {int}, {lambda x: x or None})):
format_id = str(-(res // -2) - 1)
yield ... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
+ _TESTS = [{
+ 'url': 'https://... | yt_dlp/extractor/wevidi.py | 26 | Python | 0.786 | suggestion | 118 | 31 | 34 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
import json
import re
from .common import InfoExtractor
from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
class WeVidiIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})'
_TESTS = [{
'url': 'https://wevidi.net/watch/2th7UO5F4KV... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[\w-]{11})'
``` | from .common import InfoExtractor
from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json, traverse_obj
class WeVidiIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[\w-]{11})'
_TESTS = [{
'url': 'https://wevidi.net/watch/2th7UO5F4KV',
'md5'... | @@ -0,0 +1,105 @@
+import json
+import re
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[0-9A-Za-z_-]{11})' | yt_dlp/extractor/wevidi.py | 8 | Python | 0.571 | suggestion | 94 | 33 | 33 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | truedread |
'id': '4m1c4yJR_yc',
'ext': 'mp4',
'title': 'Enough of that! - Awesome Exilez Podcast',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'md5:96af99dd63468b2dfab3020560e3e9b2',
'uploader': 'eclecRC',
'duration': 6.804,
}
... | ```suggestion
yield {
```
No need for init-loop-append-return. You can wrap it in a `list` in `_real_extract` | 'id': '4m1c4yJR_yc',
'ext': 'mp4',
'title': 'Enough of that! - Awesome Exilez Podcast',
'thumbnail': r're:^https?://.*\.jpg$',
'description': 'md5:96af99dd63468b2dfab3020560e3e9b2',
'uploader': 'eclecRC',
'duration': 6.804,
}
... | @@ -0,0 +1,111 @@
+from .common import InfoExtractor
+from ..utils import clean_html, float_or_none, get_element_by_class, js_to_json, traverse_obj
+
+
+class WeVidiIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[\w-]{11})'
+ _TESTS = [{
+ 'url': 'https://wevidi.net/watch/2... | yt_dlp/extractor/wevidi.py | 26 | Python | 0.786 | refactor | 124 | 51 | 51 | false | [extractor/wevidi] Add support for WeVidi | 6,868 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | truedread |
if player_url is not None:
args += ['-rtmp_swfverify', player_url]
if page_url is not None:
args += ['-rtmp_pageurl', page_url]
if app is not None:
args += ['-rtmp_app', app]
if play_path is not None:
args +=... | think this should be done before we reach the downloader | args += ['-rtmp_swfverify', player_url]
if page_url is not None:
args += ['-rtmp_pageurl', page_url]
if app is not None:
args += ['-rtmp_app', app]
if play_path is not None:
args += ['-rtmp_playpath', play_path]
... | @@ -529,7 +529,9 @@ def _call_downloader(self, tmpfilename, info_dict):
selected_formats = info_dict.get('requested_formats') or [info_dict]
for i, fmt in enumerate(selected_formats):
if fmt.get('http_headers') and re.match(r'^https?://', fmt['url']):
- headers_dict = handl... | yt_dlp/downloader/external.py | 26 | Python | 0.286 | suggestion | 56 | 51 | 51 | false | Deprecate `Youtubedl-no-compression` header | 6,876 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | coletdjnz |
info = self._parse_media_info(
media_collection, content_id or video_id,
player_page.get('blockedByFsk'))
age_limit = None
description = player_page.get('synopsis')
maturity_content_rating = player_page.get('maturityContentRating')
if maturity_content_rati... | None of the test cases need/cover this block. Do we still want to keep it as an additional fallback ? | content_id, fatal=False) or {}
info = self._parse_media_info(
media_collection, content_id or video_id,
player_page.get('blockedByFsk'))
age_limit = None
description = player_page.get('synopsis')
maturity_content_rating = player_page.get('maturityC... | @@ -640,6 +658,12 @@ def _real_extract(self, url):
'description': description,
'timestamp': unified_timestamp(player_page.get('broadcastedOn')),
'series': try_get(player_page, lambda x: x['show']['title']),
+ 'thumbnail': try_get(player_page, lambda x: x['image']['src']... | yt_dlp/extractor/ard.py | 26 | Python | 0.357 | question | 101 | 28 | 32 | false | Add thumbnail for ARD Beta, Fixes #6889 | 6,890 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
content_id = str_or_none(try_get(
player_page, lambda x: x['tracking']['atiCustomVars']['contentId']))
media_collection = player_page.get('mediaCollection') or {}
if not media_collection and content_id:
media_collection = self._download_json(
'https://www.... | The SEO tags were using 1280, so that seems to be some default number decided by ard. But also bigger numbers work, I am just not sure if they are actually higher quality or just scaled up. The maximum resolution I could get in my test is 4096, higher numbers fell back on 4096. It is a strange number for image width th... | title = player_page['title']
content_id = str_or_none(try_get(
player_page, lambda x: x['tracking']['atiCustomVars']['contentId']))
media_collection = player_page.get('mediaCollection') or {}
if not media_collection and content_id:
media_collection = self._downloa... | @@ -640,6 +658,12 @@ def _real_extract(self, url):
'description': description,
'timestamp': unified_timestamp(player_page.get('broadcastedOn')),
'series': try_get(player_page, lambda x: x['show']['title']),
+ 'thumbnail': try_get(player_page, lambda x: x['image']['src']... | yt_dlp/extractor/ard.py | 26 | Python | 0.5 | suggestion | 488 | 35 | 39 | false | Add thumbnail for ARD Beta, Fixes #6889 | 6,890 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
class DacastIE(InfoExtractor):
_VALID_URL = r'https?://iframe\.dacast\.com/vod/(?P<user_id>[\w-]+)/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://iframe.dacast.com/vod/acae82153ef4d7a7344ae4eaa86af534/1c6143e3-5a06-371d-8695-19b96ea49090',
'info_dict': {
'id': '1c6143e3-5a06-371d-8695-... | These could be in a base class:
```suggestion
class DacastBaseIE(InfoExtractor):
@staticmethod
def _get_url_from_id(content_id):
url_type = 'playlist' if '-playlist-' in content_id else 'vod'
user_id, media_id = content_id.split(f'-{url_type}-')
return f'https://iframe.dacast.co... |
class DacastBaseIE(InfoExtractor):
_URL_TYPE = None
@classproperty
def _VALID_URL(cls):
return fr'https?://iframe\.dacast\.com/{cls._URL_TYPE}/(?P<user_id>[\w-]+)/(?P<id>[\w-]+)'
@classproperty
def _EMBED_REGEX(cls):
return [rf'<iframe[^>]+\bsrc=["\'](?P<url>{cls._VALID_URL})']
... | @@ -0,0 +1,122 @@
+import hashlib
+import re
+import time
+import urllib.error
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ float_or_none,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class DacastIE(InfoExtractor):
+ _VALID_URL = r'https?://iframe\.dacast\.com/vod/(?P<user_id... | yt_dlp/extractor/dacast.py | 26 | Python | 1 | refactor | 700 | 51 | 51 | false | [extractor/dacast] Add extractors | 6,896 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
query = {'contentId': f'{user_id}-vod-{video_id}', 'provider': 'universe'}
info = self._download_json(
'https://playback.dacast.com/content/info', video_id, query=query, fatal=False)
access = self._download_json(
'https://playback.dacast.com/content/access', video_id,
... | ```suggestion
```
Unused. RetryManager will either succeed or raise since you haven't set fatal=False | _URL_TYPE = 'vod'
_TESTS = [{
'url': 'https://iframe.dacast.com/vod/acae82153ef4d7a7344ae4eaa86af534/1c6143e3-5a06-371d-8695-19b96ea49090',
'info_dict': {
'id': '1c6143e3-5a06-371d-8695-19b96ea49090',
'ext': 'mp4',
'uploader_id': 'acae82153ef4d7a7344ae4eaa86af... | @@ -0,0 +1,122 @@
+import hashlib
+import re
+import time
+import urllib.error
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ float_or_none,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class DacastIE(InfoExtractor):
+ _VALID_URL = r'https?://iframe\.dacast\.com/vod/(?P<user_id... | yt_dlp/extractor/dacast.py | 26 | Python | 0.786 | suggestion | 105 | 51 | 51 | false | [extractor/dacast] Add extractors | 6,896 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
"""
following the same approach as the fix in [1]: if cookies fail to decrypt then attempt to decrypt
with an empty password. The failure detection is not the same as what chromium uses so the
results won't be perfect
References:
- [1] https://chromium.googlesource.... | it would be nice to log unknown prefixes on the other platforms as well to debug issues like https://github.com/yt-dlp/yt-dlp/issues/6880 but because mac and windows sometimes store plaintext cookies the log would be spammed with random values. In the Linux case though there is no valid reason for there to be an unknow... | """
following the same approach as the fix in [1]: if cookies fail to decrypt then attempt to decrypt
with an empty password. The failure detection is not the same as what chromium uses so the
results won't be perfect
References:
- [1] https://chromium.googlesource.... | @@ -396,25 +399,42 @@ def _v11_key(self):
@staticmethod
def derive_key(password):
# values from
- # https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_linux.cc
+ # https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_c... | yt_dlp/cookies.py | 26 | Python | 0.643 | bug | 415 | 51 | 51 | false | Cookie fixes | 6,897 | yt-dlp/yt-dlp | 132,642 | Python | mbway | mbway |
'playlist_mincount': 10,
}, {
'url': 'https://www.nicovideo.jp/series/12312/',
'info_dict': {
'id': '12312',
'title': 'バトルスピリッツ お勧めカード紹介(調整中)',
},
'playlist_mincount': 103,
}, {
'url': 'https://nico.ms/series/203559',
'only_matching... | Maybe it should parse JSON in `<script type="application/ld+json">` instead? | 'playlist_mincount': 10,
}, {
'url': 'https://www.nicovideo.jp/series/12312/',
'info_dict': {
'id': '12312',
'title': 'バトルスピリッツ お勧めカード紹介(調整中)',
},
'playlist_mincount': 103,
}, {
'url': 'https://nico.ms/series/203559',
'only_matching... | @@ -693,7 +693,7 @@ def _real_extract(self, url):
title = unescapeHTML(title)
playlist = [
self.url_result(f'https://www.nicovideo.jp/watch/{v_id}', video_id=v_id)
- for v_id in re.findall(r'data-href=[\'"](?:https://www\.nicovideo\.jp)?/watch/([a-z0-9]+)', webpage)]
+ ... | yt_dlp/extractor/niconico.py | 26 | Python | 0.571 | question | 77 | 51 | 51 | false | Niconico seriesIE no longer working after url update | 6,898 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | sqrtNOT |
}, {
'url': 'https://www.nicovideo.jp/series/12312/',
'info_dict': {
'id': '12312',
'title': 'バトルスピリッツ お勧めカード紹介(調整中)',
},
'playlist_mincount': 103,
}, {
'url': 'https://nico.ms/series/203559',
'only_matching': True,
}]
def _real_ex... | ```suggestion
return self.playlist_from_matches(
traverse_obj(json_data, ('itemListElement', ..., 'url')), list_id, title, ie=NiconicoIE)
``` | }, {
'url': 'https://www.nicovideo.jp/series/12312/',
'info_dict': {
'id': '12312',
'title': 'バトルスピリッツ お勧めカード紹介(調整中)',
},
'playlist_mincount': 103,
}, {
'url': 'https://nico.ms/series/203559',
'only_matching': True,
}]
def _real_ex... | @@ -692,8 +692,9 @@ def _real_extract(self, url):
if title:
title = unescapeHTML(title)
json_data = next(self._yield_json_ld(webpage, None, fatal=False))
- playlist = [self.url_result(item['url']) for item in json_data['itemListElement']]
- return self.playlist_result(playli... | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | suggestion | 164 | 51 | 51 | false | Niconico seriesIE no longer working after url update | 6,898 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sqrtNOT |
from .common import InfoExtractor
from ..utils import (
clean_html,
parse_duration,
str_or_none,
traverse_obj,
unified_strdate,
unified_timestamp,
urlhandle_detect_ext,
)
class GlobalPlayerBaseIE(InfoExtractor):
def _get_pageProps(self, url, video_id):
webpage = self._download... | snake case
```suggestion
def _get_page_props(self, url, video_id):
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
join_nonempty,
parse_duration,
str_or_none,
traverse_obj,
unified_strdate,
unified_timestamp,
urlhandle_detect_ext,
)
class GlobalPlayerBaseIE(InfoExtractor):
def _get_page_props(self, url, video_id):
webpa... | @@ -0,0 +1,272 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ parse_duration,
+ str_or_none,
+ traverse_obj,
+ unified_strdate,
+ unified_timestamp,
+ urlhandle_detect_ext,
+)
+
+
+class GlobalPlayerBaseIE(InfoExtractor):
+
+ def _get_pageProps(self, url, video_id): | yt_dlp/extractor/globalplayer.py | 15 | Python | 0.571 | suggestion | 77 | 40 | 40 | false | [extractors/globalplayer] add Global Player extractors | 6,903 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.