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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'locale': 'en-us',
'$skip': skip,
})
items = traverse_obj(playlist_info, (
'results', ..., 'url', {lambda x: self.url_result(f'https://learn.microsoft.com/en-us{x}')}))
yield from items
skip += len(items)
if skip... | ```suggestion
_VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w-]+/)?shows/[\w-]+/(?P<id>[^?#/]+)'
``` | url_paths = traverse_obj(playlist_info, ('results', ..., 'url', {str}))
for url_path in url_paths:
yield self.url_result(f'https://learn.microsoft.com/en-us{url_path}')
skip += len(url_paths)
if skip >= playlist_info.get('count', 0) or not url_paths:
... | @@ -63,3 +71,253 @@ def _real_extract(self, url):
'subtitles': subtitles,
'thumbnails': thumbnails,
}
+
+
+class MicrosoftMediusBaseIE(InfoExtractor):
+ @staticmethod
+ def _sub_to_dict(subtitle_list):
+ subtitles = {}
+ for sub in subtitle_list:
+ subti... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.714 | suggestion | 111 | 51 | 51 | false | [ie/microsoftembed] Add extractors for dev materials | 9,177 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
'info_dict': {
'id': 'd44e1a03-a0e5-45c2-9496-5c9fa08dc94c',
'ext': 'ismv',
'title': 'What is the Difference Between a Terminal and a Shell? (Part 2 of 20)',
'description': 'md5:7bbbfb593d21c2cf2babc3715ade6b88',
'timestamp': 1676339547,
'u... | filter instead of transform here, same as above
```suggestion
'subtitles': self._sub_to_dict(traverse_obj(video_info, (
'publicVideo', 'captions', lambda _, v: url_or_none(v['url']), {
'tag': ('language', {str}),
'url': 'url',
}... | 'title': 'What is the Difference Between a Terminal and a Shell? (Part 2 of 20)',
'description': 'md5:7bbbfb593d21c2cf2babc3715ade6b88',
'timestamp': 1676339547,
'upload_date': '20230214',
'thumbnail': r're:https://learn\.microsoft\.com/video/media/.*\.png',
... | @@ -63,3 +71,253 @@ def _real_extract(self, url):
'subtitles': subtitles,
'thumbnails': thumbnails,
}
+
+
+class MicrosoftMediusBaseIE(InfoExtractor):
+ @staticmethod
+ def _sub_to_dict(subtitle_list):
+ subtitles = {}
+ for sub in subtitle_list:
+ subti... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.857 | suggestion | 329 | 51 | 51 | false | [ie/microsoftembed] Add extractors for dev materials | 9,177 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
'timestamp': 1676339547,
'upload_date': '20230214',
'thumbnail': r're:https://learn\.microsoft\.com/video/media/.*\.png',
'subtitles': 'count:14',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_... | do it like this or else you could get `'url': False`
```suggestion
'thumbnails': ('publicVideo', 'thumbnailOtherSizes', ..., {'url': {url_or_none}}),
``` | 'subtitles': 'count:14',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
entry_id = self._html_search_meta('entryId', webpage, 'entryId', fatal=True)
video_info = self._download_json(
... | @@ -63,3 +71,253 @@ def _real_extract(self, url):
'subtitles': subtitles,
'thumbnails': thumbnails,
}
+
+
+class MicrosoftMediusBaseIE(InfoExtractor):
+ @staticmethod
+ def _sub_to_dict(subtitle_list):
+ subtitles = {}
+ for sub in subtitle_list:
+ subti... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.786 | suggestion | 172 | 51 | 51 | false | [ie/microsoftembed] Add extractors for dev materials | 9,177 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
entry_id = self._html_search_meta('entryId', webpage, 'entryId', fatal=True)
video_info = self._download_json(
f'https://learn.microsoft.com/api/video/public/v1/... | ```suggestion
_VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w-]+/)?events/[\w-]+/(?P<id>[^?#/]+)'
``` | webpage = self._download_webpage(url, video_id)
entry_id = self._html_search_meta('entryId', webpage, 'entryId', fatal=True)
video_info = self._download_json(
f'https://learn.microsoft.com/api/video/public/v1/entries/{entry_id}', video_id)
return {
'id': entry_id... | @@ -63,3 +71,253 @@ def _real_extract(self, url):
'subtitles': subtitles,
'thumbnails': thumbnails,
}
+
+
+class MicrosoftMediusBaseIE(InfoExtractor):
+ @staticmethod
+ def _sub_to_dict(subtitle_list):
+ subtitles = {}
+ for sub in subtitle_list:
+ subti... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.714 | suggestion | 112 | 51 | 51 | false | [ie/microsoftembed] Add extractors for dev materials | 9,177 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
'thumbnails': ('publicVideo', 'thumbnailOtherSizes', ..., {url_or_none}, {lambda x: x and {'url': x}}),
}),
}
class MicrosoftLearnSessionIE(InfoExtractor):
_VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w\-]+/)?events/[\w\-]+/(?P<id>[^?#/]+)'
_TESTS = [{
'url': ... | Original impl had `default=None`. Do we want to warn when a timestamp is not found? Or `default=None` again?
```suggestion
'timestamp': parse_iso8601(
self._html_search_meta('startDate', webpage, 'startDate', default=None)),
``` | }
class MicrosoftLearnSessionIE(InfoExtractor):
_VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w-]+/)?events/[\w-]+/(?P<id>[^?#/]+)'
_TESTS = [{
'url': 'https://learn.microsoft.com/en-us/events/build-2022/ts01-rapidly-code-test-ship-from-secure-cloud-developer-environments',
'info_... | @@ -63,3 +71,253 @@ def _real_extract(self, url):
'subtitles': subtitles,
'thumbnails': thumbnails,
}
+
+
+class MicrosoftMediusBaseIE(InfoExtractor):
+ @staticmethod
+ def _sub_to_dict(subtitle_list):
+ subtitles = {}
+ for sub in subtitle_list:
+ subti... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.786 | suggestion | 260 | 51 | 51 | false | [ie/microsoftembed] Add extractors for dev materials | 9,177 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
'description': 'md5:f26c1a85d41c1cffd27a0279254a25c3',
'timestamp': 1653408600,
'upload_date': '20220524',
'thumbnail': r're:https://mediusimg\.event\.microsoft\.com/video-\d+/thumbnail\.jpg.*',
},
}]
def _real_extract(self, url):
video_id = self.... | ```suggestion
r'https?://build\.microsoft\.com/[\w-]+/sessions/(?P<id>[\da-f-]+)',
r'https?://build\.microsoft\.com/[\w-]+/(?P<id>sessions)/?(?:[?#]|$)',
``` | 'upload_date': '20220524',
'thumbnail': r're:https://mediusimg\.event\.microsoft\.com/video-\d+/thumbnail\.jpg.*',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
metainfo = {
... | @@ -63,3 +71,253 @@ def _real_extract(self, url):
'subtitles': subtitles,
'thumbnails': thumbnails,
}
+
+
+class MicrosoftMediusBaseIE(InfoExtractor):
+ @staticmethod
+ def _sub_to_dict(subtitle_list):
+ subtitles = {}
+ for sub in subtitle_list:
+ subti... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.714 | suggestion | 176 | 51 | 51 | false | [ie/microsoftembed] Add extractors for dev materials | 9,177 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
}
class MicrosoftLearnSessionIE(InfoExtractor):
_VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w-]+/)?events/[\w-]+/(?P<id>[^?#/]+)'
_TESTS = [{
'url': 'https://learn.microsoft.com/en-us/events/build-2022/ts01-rapidly-code-test-ship-from-secure-cloud-developer-environments',
'info_... |
```suggestion
'timestamp': parse_iso8601(self._html_search_meta('startDate', webpage, 'startDate')),
``` | }
class MicrosoftLearnSessionIE(InfoExtractor):
_VALID_URL = r'https?://learn\.microsoft\.com/(?:[\w-]+/)?events/[\w-]+/(?P<id>[^?#/]+)'
_TESTS = [{
'url': 'https://learn.microsoft.com/en-us/events/build-2022/ts01-rapidly-code-test-ship-from-secure-cloud-developer-environments',
'info_... | @@ -63,3 +72,250 @@ def _real_extract(self, url):
'subtitles': subtitles,
'thumbnails': thumbnails,
}
+
+
+class MicrosoftMediusBaseIE(InfoExtractor):
+ @staticmethod
+ def _sub_to_dict(subtitle_list):
+ subtitles = {}
+ for sub in subtitle_list:
+ subti... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.714 | suggestion | 120 | 51 | 51 | false | [ie/microsoftembed] Add extractors for dev materials | 9,177 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
'only_matching': True,
}, {
'url': 'https://www.flextv.co.kr/channels/746/live',
'only_matching': True,
}]
def _real_extract(self, url):
channel_id = self._match_id(url)
try:
stream_data = self._download_json(
f'https://api.flextv.co.kr/a... | need to raise for else
```suggestion
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
raise UserNotLive(video_id=channel_id)
raise
``` | 'id': '231638',
'ext': 'mp4',
'title': r're:^214하나만\.\.\. ',
'thumbnail': r're:^https?://.+\.jpg',
'upload_date': r're:\d{8}',
'timestamp': int,
'live_status': 'is_live',
'channel': 'Hi별',
'channel_id': '244396',... | @@ -0,0 +1,50 @@
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ url_or_none,
+ UserNotLive,
+)
+
+
+class FlexTVIE(InfoExtractor):
+ _VALID_URL = r'https?:... | yt_dlp/extractor/flextv.py | 26 | Python | 1 | refactor | 228 | 34 | 46 | false | [FlexTV] Add extractor | 9,178 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
url_or_none,
UserNotLive,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/channels/(?P<id>\d+)/live'
_TESTS = [{
'url': 'https://www.flextv.co.kr/channels/570421/live',
'only_matching': True,
}, {
'url': 'https://www.flextv.co.kr/channels/7... | this is ok to be fatal
```suggestion
playlist_url = stream_data['sources'][0]['url']
``` | url_or_none,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/channels/(?P<id>\d+)/live'
_TESTS = [{
'url': 'https://www.flextv.co.kr/channels/231638/live',
'info_dict': {
'id': '231638',
'ext': 'mp4',
'title': r're:^214하... | @@ -0,0 +1,50 @@
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ url_or_none,
+ UserNotLive,
+)
+
+
+class FlexTVIE(InfoExtractor):
+ _VALID_URL = r'https?:... | yt_dlp/extractor/flextv.py | 26 | Python | 0.571 | suggestion | 99 | 43 | 51 | false | [FlexTV] Add extractor | 9,178 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
}, {
'url': 'https://www.flextv.co.kr/channels/746/live',
'only_matching': True,
}]
def _real_extract(self, url):
channel_id = self._match_id(url)
try:
stream_data = self._download_json(
f'https://api.flextv.co.kr/api/channels/{channel_id}/stream... | unless we know that we need to stringify (e.g. int id => str), it's better to just expect type with `{str}`
```suggestion
'title': ('stream', 'title', {str}),
``` | 'ext': 'mp4',
'title': r're:^214하나만\.\.\. ',
'thumbnail': r're:^https?://.+\.jpg',
'upload_date': r're:\d{8}',
'timestamp': int,
'live_status': 'is_live',
'channel': 'Hi별',
'channel_id': '244396',
},
'skip': ... | @@ -0,0 +1,50 @@
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ url_or_none,
+ UserNotLive,
+)
+
+
+class FlexTVIE(InfoExtractor):
+ _VALID_URL = r'https?:... | yt_dlp/extractor/flextv.py | 26 | Python | 0.929 | suggestion | 181 | 33 | 45 | false | [FlexTV] Add extractor | 9,178 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
def _real_extract(self, url):
channel_id = self._match_id(url)
try:
stream_data = self._download_json(
f'https://api.flextv.co.kr/api/channels/{channel_id}/stream?option=all', channel_id)
except ExtractorError as e:
if isinstance(e.cause, HTTPError) ... | `channel_id` needs to be a string so we actually wanna call `str_or_none` there
```suggestion
'channel': ('owner', 'name', {str}),
'channel_id': ('owner', 'id', {str_or_none}),
``` | 'timestamp': int,
'live_status': 'is_live',
'channel': 'Hi별',
'channel_id': '244396',
},
'skip': 'The channel is offline',
}, {
'url': 'https://www.flextv.co.kr/channels/746/live',
'only_matching': True,
}]
def _real_extract(se... | @@ -0,0 +1,50 @@
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ url_or_none,
+ UserNotLive,
+)
+
+
+class FlexTVIE(InfoExtractor):
+ _VALID_URL = r'https?:... | yt_dlp/extractor/flextv.py | 26 | Python | 0.786 | suggestion | 216 | 29 | 41 | false | [FlexTV] Add extractor | 9,178 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
int_or_none,
parse_iso8601,
str_or_none,
traverse_obj,
url_or_none,
UserNotLive,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/chann... | add an actual test, you can use regex for the title, and `int` for the timestamp if needed | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
UserNotLive,
parse_iso8601,
str_or_none,
traverse_obj,
url_or_none,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/channels/(?P<id>\d+)/l... | @@ -0,0 +1,50 @@
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ url_or_none,
+ UserNotLive,
+)
+
+
+class FlexTVIE(InfoExtractor):
+ _VALID_URL = r'https?:... | yt_dlp/extractor/flextv.py | 19 | Python | 0.429 | suggestion | 90 | 44 | 44 | false | [FlexTV] Add extractor | 9,178 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
parse_iso8601,
str_or_none,
traverse_obj,
UserNotLive,
url_or_none,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/channels/(?P<id>\d+)/l... | why does this channel_id differ from the url channel_id? | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
UserNotLive,
parse_iso8601,
str_or_none,
traverse_obj,
url_or_none,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/channels/(?P<id>\d+)/l... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ UserNotLive,
+ url_or_none,
+)
+
+
+class FlexTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?flextv... | yt_dlp/extractor/flextv.py | 26 | Python | 0.214 | question | 56 | 51 | 51 | false | [FlexTV] Add extractor | 9,178 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
parse_iso8601,
str_or_none,
traverse_obj,
UserNotLive,
url_or_none,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/channels/(?P<id>\d+)/l... | ```suggestion
ExtractorError,
UserNotLive,
parse_iso8601,
str_or_none,
traverse_obj,
``` | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
UserNotLive,
parse_iso8601,
str_or_none,
traverse_obj,
url_or_none,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/channels/(?P<id>\d+)/l... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ UserNotLive, | yt_dlp/extractor/flextv.py | 8 | Python | 0.929 | refactor | 114 | 33 | 33 | false | [FlexTV] Add extractor | 9,178 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
if [f.get('width'), f.get('height')] == _QUALITY.get(tbr):
format_copy[1] = f.copy()
format_copy[1]['tbr'] = tbr
# prefer format with similar bitrate because there might be
# multiple video with the same resolution but different bitrate
... | Isn't this what `IE._check_formats()`/`IE._is_valid_url()` are for? | if [f.get('width'), f.get('height')] == _QUALITY.get(tbr):
format_copy[1] = f.copy()
format_copy[1]['tbr'] = tbr
# prefer format with similar bitrate because there might be
# multiple video with the same resolution but different bitrate
... | @@ -166,6 +167,14 @@ def get_format_info(tbr):
'fps': 25,
}
+ # Check if MP4 download is available | yt_dlp/extractor/rai.py | 26 | Python | 0.357 | question | 67 | 51 | 51 | false | [rai] fix #9154 | 9,189 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | nixxo |
# prefer format with similar bitrate because there might be
# multiple video with the same resolution but different bitrate
format_copy = format_copy[0] or format_copy[1] or {}
return {
'format_id': f'https-{tbr}',
'width': format_copy.get... | ```suggestion
HEADRequest(_MP4_TMPL % (relinker_url, '*')), video_id, 'Checking MP4 availability')
``` |
# prefer format with similar bitrate because there might be
# multiple video with the same resolution but different bitrate
format_copy = format_copy[0] or format_copy[1] or {}
return {
'format_id': f'https-{tbr}',
'width': format_copy.get... | @@ -166,6 +167,14 @@ def get_format_info(tbr):
'fps': 25,
}
+ # Check if MP4 download is available
+ try:
+ self._request_webpage(
+ HEADRequest(_MP4_TMPL % (relinker_url, '*')), video_id=video_id, note='Checking MP4 availability') | yt_dlp/extractor/rai.py | 26 | Python | 0.714 | suggestion | 120 | 51 | 51 | false | [rai] fix #9154 | 9,189 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | nixxo |
'ext': 'mp4',
'title': 'James Bulger: The New Revelations',
'description': 'md5:7b97922038bad1d0fe8d0470d8a189f2',
'duration': 2640.0,
'age_limit': 0,
'tags': ['Investigation', 'True Crime', 'Justice', 'Europe'],
},
'params': {'skip... | I'd do this but it probably doesn't matter
```suggestion
(('video', 'detail'), ('series', 'currentEpisode')), {dict}), get_all=False)
``` | 'ext': 'mp4',
'title': 'James Bulger: The New Revelations',
'description': 'md5:7b97922038bad1d0fe8d0470d8a189f2',
'duration': 2640.0,
'age_limit': 0,
'tags': ['Investigation', 'True Crime', 'Justice', 'Europe'],
},
'params': {'skip... | @@ -28,12 +28,24 @@ class MagellanTVIE(InfoExtractor):
'tags': ['Investigation', 'True Crime', 'Justice', 'Europe'],
},
'params': {'skip_download': 'm3u8'},
+ }, {
+ 'url': 'https://www.magellantv.com/watch/celebration-nation',
+ 'info_dict': {
+ 'id': 'celebra... | yt_dlp/extractor/magellantv.py | 26 | Python | 0.714 | suggestion | 152 | 41 | 41 | false | [ie/MagellanTV] Add episode support | 9,199 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'preference': thumb_prefs(key),
**parse_resolution(url, lenient=True),
} for key, url in (get_video_info('thumbnail') or {}).items() if url],
'description': clean_html(get_video_info('description')),
'uploader': traverse_obj(api_data, ('owner', 'nickna... | We could inline the `_extract_new_comments` code in this method. Seems like an unnecessary abstraction now. Could also remove references to "new" | 'preference': thumb_prefs(key),
**parse_resolution(url, lenient=True),
} for key, url in (get_video_info('thumbnail') or {}).items() if url],
'description': clean_html(get_video_info('description')),
'uploader': traverse_obj(api_data, ('owner', 'nickna... | @@ -470,87 +467,26 @@ def get_video_info(*items, get_first=True, **kwargs):
parse_duration(self._html_search_meta('video:duration', webpage, 'video duration', default=None))
or get_video_info('duration')),
'webpage_url': url_or_none(url) or f'https://www.nicovideo.jp/watch... | yt_dlp/extractor/niconico.py | 26 | Python | 0.571 | refactor | 145 | 51 | 51 | false | [ie/niconico] remove unusable legacy danmaku (comments, subtitle) extraction | 9,209 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'id': key,
'url': url,
'ext': 'jpg',
'preference': thumb_prefs(key),
**parse_resolution(url, lenient=True),
} for key, url in (get_video_info('thumbnail') or {}).items() if url],
'description': clean_html(get_video_i... | so that the `.get()`s below are non-fatal
```suggestion
comments_info = traverse_obj(api_data, ('comment', 'nvComment', {dict})) or {}
``` | 'id': key,
'url': url,
'ext': 'jpg',
'preference': thumb_prefs(key),
**parse_resolution(url, lenient=True),
} for key, url in (get_video_info('thumbnail') or {}).items() if url],
'description': clean_html(get_video_i... | @@ -470,93 +467,16 @@ def get_video_info(*items, get_first=True, **kwargs):
parse_duration(self._html_search_meta('video:duration', webpage, 'video duration', default=None))
or get_video_info('duration')),
'webpage_url': url_or_none(url) or f'https://www.nicovideo.jp/watch... | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | suggestion | 149 | 51 | 51 | false | [ie/niconico] remove unusable legacy danmaku (comments, subtitle) extraction | 9,209 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
}, {
'url': 'https://onefootball.com/en/video/klopp-fumes-at-var-decisions-in-west-ham-defeat-34041020',
'info_dict': {
'id': 'leVJrMho',
'ext': 'mp4',
'title': 'Klopp fumes at VAR decisions in West Ham defeat',
'description': 'md5:9c50371095a01ad3f633... | this is simpler IMO
```suggestion
data_json = self._search_json_ld(webpage, video_id, fatal=False)
data_json.pop('url', None)
m3u8_url = self._html_search_regex(r'(https://cdn\.jwplayer\.com/manifests/\w+\.m3u8)', webpage, 'm3u8_url')
return self.url_result(
m3u8_url,... | }, {
'url': 'https://onefootball.com/en/video/klopp-fumes-at-var-decisions-in-west-ham-defeat-34041020',
'info_dict': {
'id': 'leVJrMho',
'ext': 'mp4',
'title': 'Klopp fumes at VAR decisions in West Ham defeat',
'description': 'md5:9c50371095a01ad3f633... | @@ -7,41 +9,42 @@ class OneFootballIE(InfoExtractor):
_TESTS = [{
'url': 'https://onefootball.com/en/video/highlights-fc-zuerich-3-3-fc-basel-34012334',
'info_dict': {
- 'id': '34012334',
+ 'id': 'Y2VtcWAT',
'ext': 'mp4',
'title': 'Highlights: FC Zü... | yt_dlp/extractor/onefootball.py | 26 | Python | 0.786 | suggestion | 449 | 27 | 28 | false | [ie/OneFootball] Fix extractor | 9,222 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
from .common import InfoExtractor
from .jwplatform import JWPlatformIE
from ..utils import filter_dict, make_archive_id
class OneFootballIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?onefootball\.com/[a-z]{2}/video/[^/&?#]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://onefootball.com/en/video/high... | ```suggestion
from ..utils import make_archive_id
``` | from .common import InfoExtractor
from .jwplatform import JWPlatformIE
from ..utils import make_archive_id
class OneFootballIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?onefootball\.com/[a-z]{2}/video/[^/&?#]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://onefootball.com/en/video/highlights-fc-zue... | @@ -1,4 +1,6 @@
from .common import InfoExtractor
+from .jwplatform import JWPlatformIE
+from ..utils import filter_dict, make_archive_id | yt_dlp/extractor/onefootball.py | 3 | Python | 0.571 | suggestion | 55 | 28 | 28 | false | [ie/OneFootball] Fix extractor | 9,222 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
_TESTS = [{
'url': 'https://watch.screencastify.com/v/sYVkZip3quLKhHw4Ybk8',
'info_dict': {
'id': 'sYVkZip3quLKhHw4Ybk8',
'ext': 'mp4',
'title': 'Inserting and Aligning the Case Top and Bottom',
'description': '',
'uploader': 'Paul Gunn',
... | ```suggestion
},
}, {
'url': 'https://app.screencastify.com/v2/watch/BQ26VbUdfbQLhKzkktOk',
'only_matching': True,
}]
``` | _TESTS = [{
'url': 'https://watch.screencastify.com/v/sYVkZip3quLKhHw4Ybk8',
'info_dict': {
'id': 'sYVkZip3quLKhHw4Ybk8',
'ext': 'mp4',
'title': 'Inserting and Aligning the Case Top and Bottom',
'description': '',
'uploader': 'Paul Gunn',
... | @@ -19,6 +22,18 @@ class ScreencastifyIE(InfoExtractor):
'params': {
'skip_download': 'm3u8',
},
+ }, {
+ 'url': 'https://app.screencastify.com/v3/watch/J5N7H11wofDN1jZUCr3t',
+ 'info_dict': {
+ 'id': 'J5N7H11wofDN1jZUCr3t',
+ 'ext': 'mp4',
+ ... | yt_dlp/extractor/screencastify.py | 26 | Python | 0.857 | suggestion | 159 | 51 | 51 | false | [ie/Screencastify] Add new URL format | 9,232 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'channel_id': 'MS4wLjABAAAAEKnfa654JAJ_N5lgZDQluwsxmY0lhfmEYNQBBkwGG98',
'creator': '杨超越',
'duration': 15115,
'timestamp': 1621261163,
'upload_date': '20210517',
'track': '@杨超越创作的原声',
'view_count': int,
'like_count': int,
... | ```suggestion
detail = traverse_obj(self._download_json(
'https://www.douyin.com/aweme/v1/web/aweme/detail/', video_id,
'Downloading web detail JSON', 'Failed to download web detail JSON',
query={'aweme_id': video_id}, fatal=False), ('aweme_detail', {dict}))
``` | 'thumbnail': r're:https?://.+\.jpe?g',
},
}]
_UPLOADER_URL_FORMAT = 'https://www.douyin.com/user/%s'
_WEBPAGE_HOST = 'https://www.douyin.com/'
def _real_extract(self, url):
video_id = self._match_id(url)
detail = traverse_obj(self._download_json(
'https:... | @@ -1035,24 +1060,17 @@ class DouyinIE(TikTokBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
- try:
- return self._extract_aweme_app(video_id)
- except ExtractorError as e:
- e.expected = True
- self.to_screen(f'{e}; trying with webpag... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.786 | bug | 311 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
'view_count': int,
'like_count': int,
'repost_count': int,
'comment_count': int,
'thumbnail': r're:https?://.+\.jpe?g',
},
}]
_APP_VERSIONS = [('23.3.0', '230300')]
_APP_NAME = 'aweme'
_AID = 1128
_API_HOSTNAME = 'aweme.snssdk.com'
... | ```suggestion
if not detail:
# TODO: Run verification challenge code to generate signature cookies
raise ExtractorError(
'Fresh cookies (not necessarily logged in) are needed',
expected=not self._get_cookies(self._WEBPAGE_HOST).get('s_v_web_id'))
``` | def _real_extract(self, url):
video_id = self._match_id(url)
detail = traverse_obj(self._download_json(
'https://www.douyin.com/aweme/v1/web/aweme/detail/', video_id,
'Downloading web detail JSON', 'Failed to download web detail JSON',
query={'aweme_id': video_id... | @@ -1035,24 +1060,17 @@ class DouyinIE(TikTokBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
- try:
- return self._extract_aweme_app(video_id)
- except ExtractorError as e:
- e.expected = True
- self.to_screen(f'{e}; trying with webpag... | yt_dlp/extractor/tiktok.py | 26 | Python | 1 | refactor | 320 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
'repost_count': int,
'comment_count': int,
'thumbnail': r're:https?://.+\.jpe?g',
},
}]
_APP_VERSIONS = [('23.3.0', '230300')]
_APP_NAME = 'aweme'
_AID = 1128
_API_HOSTNAME = 'aweme.snssdk.com'
_UPLOADER_URL_FORMAT = 'https://www.douyin.com/user/%s'
... | wrong method
```suggestion
return self._parse_aweme_video_app(detail)
``` |
detail = traverse_obj(self._download_json(
'https://www.douyin.com/aweme/v1/web/aweme/detail/', video_id,
'Downloading web detail JSON', 'Failed to download web detail JSON',
query={'aweme_id': video_id}, fatal=False), ('aweme_detail', {dict}))
if not detail:
... | @@ -1035,24 +1060,17 @@ class DouyinIE(TikTokBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
- try:
- return self._extract_aweme_app(video_id)
- except ExtractorError as e:
- e.expected = True
- self.to_screen(f'{e}; trying with webpag... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.571 | bug | 84 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
def _real_extract(self, url):
uploader, room_id = self._match_valid_url(url).group('uploader', 'id')
webpage = self._download_webpage(
url, uploader or room_id, headers={'User-Agent': 'Mozilla/5.0'}, fatal=not room_id)
if webpage:
data = try_call(lambda: self._get_si... | revert unnecessary/unrelated formatting change
```suggestion
'stream_url', 'live_core_sdk_data', 'pull_data', 'stream_data',
``` | if not room_id:
raise UserNotLive(video_id=uploader)
formats = []
live_info = self._call_api(
'https://webcast.tiktok.com/webcast/room/info', 'room_id', room_id, uploader, key='data')
get_quality = qualities(('SD1', 'ld', 'SD2', 'sd', 'HD1', 'hd', 'FULL_HD1', 'u... | @@ -1200,7 +1218,7 @@ def _real_extract(self, url):
parse_inner = lambda x: self._parse_json(x, None)
for quality, stream in traverse_obj(live_info, (
- 'stream_url', 'live_core_sdk_data', 'pull_data', 'stream_data',
+ 'stream_url', 'live_core_sdk_data', 'pull_data', 'strea... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.786 | suggestion | 147 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
except ExtractorError as e:
if isinstance(e.cause, json.JSONDecodeError) and e.cause.pos == 0:
retry.error = e
continue
raise
yield from post_list.get('aweme_list', [])
if not post_list.get('h... | revert unnecessary/unrelated formatting change
```suggestion
user_id = self._html_search_regex(r'snssdk\d*://user/profile/(\d+)', webpage, 'user ID', default=None) or user_name
``` | webpage = self._download_webpage(url, user_name, headers={
'User-Agent': 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
})
user_id = self._html_search_regex(r'snssdk\d*://user/profile/(\d+)', webpage, 'user ID', default=None) or user_name
videos ... | @@ -800,7 +824,8 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, user_name, headers={
'User-Agent': 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
})
- user_id = self._html_search_regex(r'snssdk\d*://user/profile/(\d+)', webpage, ... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.786 | suggestion | 191 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
secuid = self._search_regex(r'\"secUid\":\"(?P<secUid>[^\"]+)', webpage, username)
verifyfp_cookie = self._get_cookies('https://www.tiktok.com').get('s_v_web_id')
if not verifyfp_cookie:
raise ExtractorError('Improper cookies (missing s_v_web_id).', expected=True)
api_url = f... | revert unnecessary/unrelated formatting change
```suggestion
'device_id': ''.join(random.choices(string.digits, k=19)), # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
``` | 'count': 21,
'max_cursor': 0,
'min_cursor': 0,
'retry_type': 'no_retry',
'device_id': ''.join(random.choices(string.digits, k=19)), # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
}
for page in itertoo... | @@ -767,7 +790,8 @@ def _video_entries_api(self, webpage, user_id, username):
'max_cursor': 0,
'min_cursor': 0,
'retry_type': 'no_retry',
- 'device_id': ''.join(random.choices(string.digits, k=19)), # Some endpoints don't like randomized device_id, so it isn't directly... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.857 | suggestion | 227 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
import itertools
import json
import random
import re
import string
import time
from .common import InfoExtractor
from ..networking import HEADRequest
from ..compat import compat_urllib_parse_urlparse
from ..utils import (
ExtractorError,
LazyList,
UnsupportedError,
UserNotLive,
determine_ext,
f... | revert unnecessary/unrelated formatting change
```suggestion
from ..compat import compat_urllib_parse_urlparse
from ..networking import HEADRequest
``` | import itertools
import json
import random
import re
import string
import time
from .common import InfoExtractor
from ..compat import compat_urllib_parse_urlparse
from ..networking import HEADRequest
from ..utils import (
ExtractorError,
LazyList,
UnsupportedError,
UserNotLive,
determine_ext,
f... | @@ -6,16 +6,15 @@
import time
from .common import InfoExtractor
-from ..compat import compat_urllib_parse_unquote, compat_urllib_parse_urlparse
from ..networking import HEADRequest
+from ..compat import compat_urllib_parse_urlparse | yt_dlp/extractor/tiktok.py | 10 | Python | 0.786 | suggestion | 155 | 35 | 35 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
'app_name': self._APP_NAME,
'app_language': 'en',
'language': 'en',
'timezone_name': 'America/New_York',
'timezone_offset': '-14400',
'channel': 'googleplay',
'ac': 'wifi',
'mcc_mnc': '310260',
'is_my_cn': 0,
... | revert unnecessary/unrelated formatting change
```suggestion
self.report_warning('Only one of the two required version params are passed as extractor arguments', only_once=True)
``` | 'app_name': self._APP_NAME,
'app_language': 'en',
'language': 'en',
'timezone_name': 'America/New_York',
'timezone_offset': '-14400',
'channel': 'googleplay',
'ac': 'wifi',
'mcc_mnc': '310260',
'is_my_cn': 0,
... | @@ -112,7 +111,8 @@ def _call_api(self, ep, query, video_id, fatal=True,
self._WORKING_APP_VERSION = (app_version, manifest_app_version)
self.write_debug('Imported app version combo from extractor arguments')
elif app_version or manifest_app_version:
- self.... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.857 | refactor | 200 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
self.write_debug('Imported app version combo from extractor arguments')
elif app_version or manifest_app_version:
self.report_warning('Only one of the two required version params are passed as extractor arguments',
only_once=True)
... | revert unnecessary/unrelated formatting change
```suggestion
self.report_warning('%s. Retrying... (attempt %s of %s)' % (str(e.cause or e.msg), count, len(self._APP_VERSIONS)))
``` | self.write_debug('Imported app version combo from extractor arguments')
elif app_version or manifest_app_version:
self.report_warning('Only one of the two required version params are passed as extractor arguments', only_once=True)
if self._WORKING_APP_VERSION:
... | @@ -133,7 +133,8 @@ def _call_api(self, ep, query, video_id, fatal=True,
else:
self.report_warning(str(e.cause or e.msg))
return
- self.report_warning('%s. Retrying... (attempt %s of %s)' % (str(e.cause or e.msg), coun... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.857 | suggestion | 203 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
if fatal:
raise e
else:
self.report_warning(str(e.cause or e.msg))
return
self.report_warning(
'%s. Retrying... (attempt %s of %s)' % (str(e.cau... | revert unnecessary/unrelated formatting change
```suggestion
aweme_detail, ('interaction_stickers', ..., 'auto_video_caption_info', 'auto_captions', ...), expected_type=dict)
``` | raise e
else:
self.report_warning(str(e.cause or e.msg))
return
self.report_warning('%s. Retrying... (attempt %s of %s)' % (str(e.cause or e.msg), count, len(self._APP_VERSIONS)))
... | @@ -151,7 +152,8 @@ def _get_subtitles(self, aweme_detail, aweme_id):
subtitles = {}
# aweme/detail endpoint subs
captions_info = traverse_obj(
- aweme_detail, ('interaction_stickers', ..., 'auto_video_caption_info', 'auto_captions', ...), expected_type=dict)
+ aweme_det... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.929 | suggestion | 193 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
if res:
known_resolutions.setdefault(res, {}).setdefault('height', add_meta.get('height') or addr.get('height'))
known_resolutions[res].setdefault('width', add_meta.get('width') or addr.get('width'))
parsed_meta.update(known_resolutions.get(res, {}))
... | revert unnecessary/unrelated formatting change
```suggestion
video_info, 'is_bytevc1', 'is_h265') else 'h264', # TODO: Check for "direct iOS" videos, like https://www.tiktok.com/@cookierun_dev/video/7039716639834656002
``` | parsed_meta.update(known_resolutions.get(res, {}))
add_meta.setdefault('height', int_or_none(res[:-1]))
return [{
'url': url,
'filesize': int_or_none(addr.get('data_size')),
'ext': 'mp4',
'acodec': 'aac',
... | @@ -242,7 +244,8 @@ def extract_addr(addr, add_meta={}):
'format_id': 'play_addr',
'format_note': 'Direct video',
'vcodec': 'h265' if traverse_obj(
- video_info, 'is_bytevc1', 'is_h265') else 'h264', # TODO: Check for "direct iOS" videos, like https... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.857 | suggestion | 245 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
self._set_cookie(compat_urllib_parse_urlparse(f['url']).hostname, 'sid_tt', auth_cookie.value)
thumbnails = []
for cover_id in ('cover', 'ai_dynamic_cover', 'animated_cover', 'ai_dynamic_cover_bak',
'origin_cover', 'dynamic_cover'):
for cover_url in ... | revert unnecessary/unrelated formatting change
```suggestion
is_generic_og_trackname = music_info.get('is_original_sound') and music_info.get('title') == 'original sound - %s' % music_info.get('owner_handle')
``` | self._set_cookie(compat_urllib_parse_urlparse(f['url']).hostname, 'sid_tt', auth_cookie.value)
thumbnails = []
for cover_id in ('cover', 'ai_dynamic_cover', 'animated_cover', 'ai_dynamic_cover_bak',
'origin_cover', 'dynamic_cover'):
for cover_url in ... | @@ -307,7 +310,8 @@ def extract_addr(addr, add_meta={}):
contained_music_author = traverse_obj(
music_info, ('matched_song', 'author'), ('matched_pgc_sound', 'author'), 'author', expected_type=str)
- is_generic_og_trackname = music_info.get('is_original_sound') and music_info.get('title')... | yt_dlp/extractor/tiktok.py | 26 | Python | 1 | suggestion | 223 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
is_private='Private' in labels,
needs_subscription='Friends only' in labels,
is_unlisted='Followers only' in labels),
'_format_sort_fields': ('quality', 'codec', 'size', 'br'),
}
def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id... | revert
```suggestion
for play_url in traverse_obj(video_info, ('playAddr', ((..., 'src'), None), {url_or_none})):
formats.append({
'url': self._proto_relative_url(play_url),
'ext': 'mp4',
'width': width,
'height': height,
... | needs_subscription='Friends only' in labels,
is_unlisted='Followers only' in labels),
'_format_sort_fields': ('quality', 'codec', 'size', 'br'),
}
def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id):
video_info = aweme_detail['video']
... | @@ -362,22 +366,41 @@ def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id):
width = int_or_none(video_info.get('width'))
height = int_or_none(video_info.get('height'))
- for play_url in traverse_obj(video_info, ('playAddr', ((..., 'src'), None), {url_or_none})):
- ... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.786 | suggestion | 333 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
for download_url in traverse_obj(video_info, (('downloadAddr', ('download', 'url')), {url_or_none})):
formats.append({
'format_id': 'download',
'url': self._proto_relative_url(download_url),
'ext': 'mp4',
'width'... | revert
```suggestion
for download_url in traverse_obj(video_info, (('downloadAddr', ('download', 'url')), {url_or_none})):
formats.append({
'format_id': 'download',
'url': self._proto_relative_url(download_url),
'ext': 'mp4',
'wi... | 'format_id': 'download',
'url': self._proto_relative_url(download_url),
'ext': 'mp4',
'width': width,
'height': height,
})
self._remove_duplicate_formats(formats)
thumbnails = []
for thumb_url in traver... | @@ -362,22 +366,41 @@ def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id):
width = int_or_none(video_info.get('width'))
height = int_or_none(video_info.get('height'))
- for play_url in traverse_obj(video_info, ('playAddr', ((..., 'src'), None), {url_or_none})):
- ... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.786 | suggestion | 388 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
parsed_meta, res = parse_url_key(addr.get('url_key', ''))
if res:
known_resolutions.setdefault(res, {}).setdefault('height', add_meta.get('height') or addr.get('height'))
known_resolutions[res].setdefault('width', add_meta.get('width') or addr.get('width'))
... | ```suggestion
video_info, 'is_bytevc1', 'is_h265') else 'h264', # TODO: Check for "direct iOS" videos, like https://www.tiktok.com/@cookierun_dev/video/7039716639834656002
``` | parsed_meta, res = parse_url_key(addr.get('url_key', ''))
if res:
known_resolutions.setdefault(res, {}).setdefault('height', int_or_none(addr.get('height')))
known_resolutions[res].setdefault('width', int_or_none(addr.get('width')))
parsed_meta.upd... | @@ -242,7 +241,7 @@ def extract_addr(addr, add_meta={}):
'format_id': 'play_addr',
'format_note': 'Direct video',
'vcodec': 'h265' if traverse_obj(
- video_info, 'is_bytevc1', 'is_h265') else 'h264', # TODO: Check for "direct iOS" videos, like https... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.714 | suggestion | 198 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
def _entries(self, webpage, user_id, username):
secuid = self._search_regex(r'\"secUid\":\"(?P<secUid>[^\"]+)', webpage, username)
verifyfp_cookie = self._get_cookies('https://www.tiktok.com').get('s_v_web_id')
if not verifyfp_cookie:
raise ExtractorError('Improper cookies (missi... | ```suggestion
'device_id': ''.join(random.choices(string.digits, k=19)), # Some endpoints don't like randomized device_id, so it isn't directly set in _call_api.
``` | 'expected_warnings': ['Retrying']
}]
r''' # TODO: Fix by adding _signature to api_url
def _entries(self, webpage, user_id, username):
secuid = self._search_regex(r'\"secUid\":\"(?P<secUid>[^\"]+)', webpage, username)
verifyfp_cookie = self._get_cookies('https://www.tiktok.com').get... | @@ -767,7 +766,7 @@ def _video_entries_api(self, webpage, user_id, username):
'max_cursor': 0,
'min_cursor': 0,
'retry_type': 'no_retry',
- 'device_id': ''.join(random.choices(string.digits, k=19)), # Some endpoints don't like randomized device_id, so it isn't directly... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.714 | suggestion | 180 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
'ext': 'mp4',
'acodec': 'aac',
'source_preference': -2 if 'aweme/v1' in url else -1, # Downloads from API might get blocked
**add_meta, **parsed_meta,
'format_note': join_nonempty(
add_meta.get('format_note'), '(API)' i... | ```suggestion
download_height = self.RESOLUTION_MAP.get(download_width) # download_addr['height'] is inaccurate
``` | } for url in addr.get('url_list') or []]
# Hack: Add direct video links first to prioritize them when removing duplicate formats
formats = []
width = int_or_none(video_info.get('width'))
height = int_or_none(video_info.get('height'))
if video_info.get('play_addr'):
... | @@ -237,22 +243,27 @@ def extract_addr(addr, add_meta={}):
# Hack: Add direct video links first to prioritize them when removing duplicate formats
formats = []
+ width = int_or_none(video_info.get('width'))
+ height = int_or_none(video_info.get('height'))
if video_info.get('pl... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.714 | suggestion | 130 | 51 | 51 | false | [extractor/Douyin] fix Douyin | 9,239 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 114514ns |
"thumbnail": "https://storage.murrtube.net/murrtube-production/ekbs3zcfvuynnqfx72nn2tkokvsd"
},
},
{
"url": "https://murrtube.net/v/0J2Q",
"md5": "31262f6ac56f0ca75e5a54a0f3fefcb6",
"info_dict": {
"id": "8442998c52134968d9ca... | move to `_real_initialize` so it only runs once | 'info_dict': {
'id': 'ca885d8456b95de529b6723b158032e11115d',
'ext': 'mp4',
'title': 'Inferno X Skyler',
'description': 'Humping a very good slutty sheppy (roomate)',
'uploader': 'Inferno Wolf',
'age_limit': 18,
'thumbnail': 'ht... | @@ -1,164 +1,78 @@
-import functools
-import json
-
+import re
from .common import InfoExtractor
from ..utils import (
- ExtractorError,
- OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKIN... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.286 | suggestion | 47 | 50 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DrakoCpp |
},
},
{
"url": "https://murrtube.net/v/0J2Q",
"md5": "31262f6ac56f0ca75e5a54a0f3fefcb6",
"info_dict": {
"id": "8442998c52134968d9caa36e473e1a6bac6ca",
"ext": "mp4",
"uploader": "Hayel",
"title... | ```suggestion
video_page = self._download_webpage(url, video_id)
```
It's for display on terminal and dont need to be final ID | 'id': 'ca885d8456b95de529b6723b158032e11115d',
'ext': 'mp4',
'title': 'Inferno X Skyler',
'description': 'Humping a very good slutty sheppy (roomate)',
'uploader': 'Inferno Wolf',
'age_limit': 18,
'thumbnail': 'https://storage.murrtube.... | @@ -1,164 +1,78 @@
-import functools
-import json
-
+import re
from .common import InfoExtractor
from ..utils import (
- ExtractorError,
- OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKIN... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.714 | suggestion | 137 | 49 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DrakoCpp |
import re
from .common import InfoExtractor
from ..utils import (
urlencode_postdata,
extract_attributes
)
class MurrtubeIE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
murrtube:|
https?://murrtube\.net/v/|
... | Why delete? Better to leave it marked `_WORKING = False` |
return {
'id': video_id,
'title': remove_end(self._og_search_title(video_page), ' - Murrtube'),
'age_limit': 18,
'formats': self._extract_m3u8_formats(playlist, video_id, 'mp4'),
'description': self._og_search_description(video_page),
'thu... | @@ -1,164 +1,78 @@
-import functools
-import json
-
+import re
from .common import InfoExtractor
from ..utils import (
- ExtractorError,
- OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKIN... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.429 | question | 56 | 79 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DrakoCpp |
"age_limit": 18,
"thumbnail": "https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hxu5vfqi5s"
}
}
]
def _real_extract(self, url):
video_id = self._match_valid_url(url)
# TODO: This part could be smarter (Set and store age cooki... | Use `self._og_search_title`, `self._og_search_thumbnail`, `self._og_search_description`. And it should not be `fatal` | }, {
'url': 'https://murrtube.net/v/0J2Q',
'md5': '31262f6ac56f0ca75e5a54a0f3fefcb6',
'info_dict': {
'id': '8442998c52134968d9caa36e473e1a6bac6ca',
'ext': 'mp4',
'uploader': 'Hayel',
'title': 'Who\'s in charge now?',
'description': ... | @@ -1,164 +1,78 @@
-import functools
-import json
-
+import re
from .common import InfoExtractor
from ..utils import (
- ExtractorError,
- OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKIN... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.571 | suggestion | 117 | 38 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DrakoCpp |
}
}
]
def _real_extract(self, url):
video_id = self._match_valid_url(url)
# TODO: This part could be smarter (Set and store age cookie?)
video_page = self._download_webpage(
'https://murrtube.net', None, note='Getting session token')
data = self._... | Inline in the return. No need for variable | 'md5': '31262f6ac56f0ca75e5a54a0f3fefcb6',
'info_dict': {
'id': '8442998c52134968d9caa36e473e1a6bac6ca',
'ext': 'mp4',
'uploader': 'Hayel',
'title': 'Who\'s in charge now?',
'description': 'md5:795791e97e5b0f1805ea84573f02a997',
'ag... | @@ -1,164 +1,78 @@
-import functools
-import json
-
+import re
from .common import InfoExtractor
from ..utils import (
- ExtractorError,
- OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKIN... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.071 | suggestion | 42 | 36 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DrakoCpp |
import re
from .common import InfoExtractor
from ..utils import (
urlencode_postdata,
extract_attributes
)
class MurrtubeIE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
murrtube:|
https?://murrtube\.net/v/|
... | These are no longer available? | raise ExtractorError('Support for murrtube: prefix URLs is broken')
video_page = self._download_webpage(url, video_id)
video_attrs = extract_attributes(get_element_html_by_id('video', video_page))
playlist = update_url(video_attrs['data-url'], query=None)
video_id = self._sea... | @@ -1,164 +1,78 @@
-import functools
-import json
-
+import re
from .common import InfoExtractor
from ..utils import (
- ExtractorError,
- OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKIN... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.071 | question | 30 | 79 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DrakoCpp |
import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
urlencode_postdata,
extract_attributes
)
class MurrtubeIE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
murrtube:|
... | ```suggestion
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
parse_count,
remove_end,
update_url,
urlencode_postdata,
``` | import functools
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
parse_count,
remove_end,
update_url,
urlencode_postdata,
)
class MurrtubeIE(Inf... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes | yt_dlp/extractor/murrtube.py | 8 | Python | 0.786 | refactor | 193 | 33 | 33 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
urlencode_postdata,
extract_attributes
)
class MurrtubeIE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
murrtube:|
... | ```suggestion
https?://murrtube\.net/(?:v/|videos/(?P<slug>[a-z0-9-]+?)-)
``` | import functools
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
parse_count,
remove_end,
update_url,
urlencode_postdata,
)
class MurrtubeIE(Inf... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 17 | Python | 0.714 | suggestion | 107 | 42 | 42 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
urlencode_postdata,
extract_attributes
)
class MurrtubeIE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
murrtube:|
... | ```suggestion
(?P<id>[A-Z0-9]{4}|[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})
``` | import functools
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
parse_count,
remove_end,
update_url,
urlencode_postdata,
)
class MurrtubeIE(Inf... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 19 | Python | 0.714 | suggestion | 124 | 44 | 44 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
},
},
{
'url': 'https://murrtube.net/v/0J2Q',
'md5': '31262f6ac56f0ca75e5a54a0f3fefcb6',
'info_dict': {
'id': '8442998c52134968d9caa36e473e1a6bac6ca',
'ext': 'mp4',
'uploader': 'Hayel',
'title... | ```suggestion
self._request_webpage(
'https://murrtube.net/accept_age_check', None, 'Setting age cookie',
data=urlencode_postdata(self._hidden_inputs(homepage)))
``` | 'thumbnail': 'https://storage.murrtube.net/murrtube-production/ekbs3zcfvuynnqfx72nn2tkokvsd',
'comment_count': int,
'view_count': int,
'like_count': int,
},
}, {
'url': 'https://murrtube.net/v/0J2Q',
'md5': '31262f6ac56f0ca75e5a54a0f3fefcb6',
... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.786 | suggestion | 201 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
data = self._hidden_inputs(homepage)
self._download_webpage(
'https://murrtube.net/accept_age_check', None, 'Set age cookie', data=urlencode_postdata(data))
def _real_extract(self, url):
video_id = self._match_valid_url(url)
video_page = self._download_webpage(url, video... | use `parse_count` from utils instead of doing this
additionally you could write a helper method specifically for these counts, e.g.
```py
def _extract_count(self, name, html):
return parse_count(self._search_regex(
rf'([\d,]+)\s+<span[^>]*>{name}</span>', html, name, default=None))
```... | return parse_count(self._search_regex(
rf'([\d,]+)\s+<span[^>]*>{name}</span>', html, name, default=None))
def _real_initialize(self):
homepage = self._download_webpage(
'https://murrtube.net', None, note='Getting session token')
self._request_webpage(
'h... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.857 | refactor | 587 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
'view_count': int,
'like_count': int,
}
}
]
def _real_initialize(self):
homepage = self._download_webpage(
'https://murrtube.net', None, note='Getting session token')
data = self._hidden_inputs(homepage)
self._download_webp... | use `remove_end` from utils instead of `split`
```suggestion
'title': remove_end(self._og_search_title(video_page), ' - Murrtube'),
``` | 'age_limit': 18,
'thumbnail': 'https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hxu5vfqi5s',
'comment_count': int,
'view_count': int,
'like_count': int,
},
}]
def _extract_count(self, name, html):
return parse_count(s... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.786 | suggestion | 152 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
}
}
]
def _real_initialize(self):
homepage = self._download_webpage(
'https://murrtube.net', None, note='Getting session token')
data = self._hidden_inputs(homepage)
self._download_webpage(
'https://murrtube.net/accept_age_check', None, 'Set a... | inline formats extraction here, and there's no reason for it to be non-fatal
```suggestion
'formats': self._extract_m3u8_formats(playlist, video_id, 'mp4'),
``` | 'comment_count': int,
'view_count': int,
'like_count': int,
},
}]
def _extract_count(self, name, html):
return parse_count(self._search_regex(
rf'([\d,]+)\s+<span[^>]*>{name}</span>', html, name, default=None))
def _real_initialize(self):
... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.786 | refactor | 175 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
]
def _real_initialize(self):
homepage = self._download_webpage(
'https://murrtube.net', None, note='Getting session token')
data = self._hidden_inputs(homepage)
self._download_webpage(
'https://murrtube.net/accept_age_check', None, 'Set age cookie', data=urlenco... | need to make this non-fatal
```suggestion
'thumbnail': update_url(self._og_search_thumbnail(video_page, default=''), query=None) or None,
``` | 'like_count': int,
},
}]
def _extract_count(self, name, html):
return parse_count(self._search_regex(
rf'([\d,]+)\s+<span[^>]*>{name}</span>', html, name, default=None))
def _real_initialize(self):
homepage = self._download_webpage(
'https://murr... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.714 | suggestion | 156 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
def _real_initialize(self):
homepage = self._download_webpage(
'https://murrtube.net', None, note='Getting session token')
data = self._hidden_inputs(homepage)
self._download_webpage(
'https://murrtube.net/accept_age_check', None, 'Set age cookie', data=urlencode_post... | use `get_element_by_class` (with `clean_html`) from utils instead IMO
```suggestion
'uploader': clean_html(get_element_by_class('pl-1 is-size-6 has-text-lighter', video_page)),
``` | }]
def _extract_count(self, name, html):
return parse_count(self._search_regex(
rf'([\d,]+)\s+<span[^>]*>{name}</span>', html, name, default=None))
def _real_initialize(self):
homepage = self._download_webpage(
'https://murrtube.net', None, note='Getting session tok... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.786 | suggestion | 197 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
urlencode_postdata,
extract_attributes
)
class MurrtubeIE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
murrtube:|
https?://murrtu... | is there any way to still get the old UUID video id?
do the shortened URLs (e.g. `/v/0J2Q`) have long versions too (`/videos/slug-UUID`)? | import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
parse_count,
remove_end,
update_url,
urlencode_postdata,
)
class MurrtubeIE(InfoExtractor):
... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.5 | question | 140 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
'url': 'https://murrtube.net/v/0J2Q',
'md5': '31262f6ac56f0ca75e5a54a0f3fefcb6',
'info_dict': {
'id': '8442998c52134968d9caa36e473e1a6bac6ca',
'ext': 'mp4',
'uploader': 'Hayel',
'title': 'Who\'s in charge now?',
... | need to do this or else we are passing a `re.Match` object around as the id
```suggestion
video_id = self._match_id(url)
``` | 'like_count': int,
},
}, {
'url': 'https://murrtube.net/v/0J2Q',
'md5': '31262f6ac56f0ca75e5a54a0f3fefcb6',
'info_dict': {
'id': '8442998c52134968d9caa36e473e1a6bac6ca',
'ext': 'mp4',
'uploader': 'Hayel',
'title': 'Who\'s in... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.714 | suggestion | 135 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
'thumbnail': 'https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hxu5vfqi5s',
'comment_count': int,
'view_count': int,
'like_count': int,
}
}
]
def _real_initialize(self):
homepage = self._download_webpa... | the convention is to use `webpage` if there's only 1 page being downloaded. not a big deal though | 'title': 'Who\'s in charge now?',
'description': 'md5:795791e97e5b0f1805ea84573f02a997',
'age_limit': 18,
'thumbnail': 'https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hxu5vfqi5s',
'comment_count': int,
'view_count': int,
... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.429 | style | 97 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
'ext': 'mp4',
'uploader': 'Hayel',
'title': 'Who\'s in charge now?',
'description': 'md5:795791e97e5b0f1805ea84573f02a997',
'age_limit': 18,
'thumbnail': 'https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hx... | import `get_element_html_by_id` from utils
```suggestion
video_attrs = extract_attributes(get_element_html_by_id('video', video_page))
playlist = update_url(video_attrs['data-url'], query=None)
video_id = self._search_regex(r'/([^/?#]+)/index.m3u8', playlist, 'video id')
``` | 'md5': '31262f6ac56f0ca75e5a54a0f3fefcb6',
'info_dict': {
'id': '8442998c52134968d9caa36e473e1a6bac6ca',
'ext': 'mp4',
'uploader': 'Hayel',
'title': 'Who\'s in charge now?',
'description': 'md5:795791e97e5b0f1805ea84573f02a997',
'ag... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.857 | refactor | 304 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
'thumbnail': 'https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hxu5vfqi5s',
'comment_count': int,
'view_count': int,
'like_count': int,
}
}
]
def _real_initialize(self):
homepage = self._download_webpa... | ```suggestion
return {
``` | 'title': 'Who\'s in charge now?',
'description': 'md5:795791e97e5b0f1805ea84573f02a997',
'age_limit': 18,
'thumbnail': 'https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hxu5vfqi5s',
'comment_count': int,
'view_count': int,
... | @@ -1,116 +1,104 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ urlencode_postdata,
+ extract_attributes
)
class MurrtubeIE(InfoExtractor):
- _WORKING = False
... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.429 | suggestion | 38 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
'age_limit': 18,
'thumbnail': 'https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hxu5vfqi5s',
'comment_count': int,
'view_count': int,
'like_count': int,
},
},
]
def _extract_count(self, name, h... | ```suggestion
video_id = self._search_regex(r'/([\da-f]+)/index.m3u8', playlist, 'video id')
``` | 'comment_count': int,
'view_count': int,
'like_count': int,
},
}]
def _extract_count(self, name, html):
return parse_count(self._search_regex(
rf'([\d,]+)\s+<span[^>]*>{name}</span>', html, name, default=None))
def _real_initialize(self):
... | @@ -1,116 +1,109 @@
import functools
-import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
- determine_ext,
- int_or_none,
- try_get,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_id,
+ parse_cou... | yt_dlp/extractor/murrtube.py | 26 | Python | 0.714 | suggestion | 106 | 51 | 51 | false | [ie/murrtube] Fix extractor | 9,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DrakoCpp |
except Exception:
traceback.print_exc()
ydl._download_retcode = 100
if not actual_use:
if pre_process:
return ydl._download_retcode
args = sys.argv[1:] if argv is None else argv
ydl.warn_if_short_id(args)
# Show a... | typo
```suggestion
'Do not double click the executable, instead call it from a shell.\n'
```
though since this patch is aimed at not-so-technically-proficient users, I'd argue "the command line" would be more helpful than "a shell" | except Exception:
traceback.print_exc()
ydl._download_retcode = 100
if not actual_use:
if pre_process:
return ydl._download_retcode
args = sys.argv[1:] if argv is None else argv
ydl.warn_if_short_id(args)
# Show a... | @@ -984,7 +984,28 @@ def _real_main(argv=None):
if pre_process:
return ydl._download_retcode
- ydl.warn_if_short_id(sys.argv[1:] if argv is None else argv)
+ args = sys.argv[1:] if argv is None else argv
+ ydl.warn_if_short_id(args)
+
+ # Show ... | yt_dlp/__init__.py | 26 | Python | 0.857 | suggestion | 259 | 51 | 51 | false | [core] Warn user when directly launching `yt-dlp.exe` | 9,250 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class NerdCubedFeedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nerdcubed\.co\.uk/?(?:$|[#?])'
_TEST = {
'url': 'http://www.nerdcubed.co.uk... | Personally, I'd remove one indentation like:
```suggestion
def _extract_video(self, feed_entry):
return self.url_result(
```
```py
return self.playlist_result(
map(self._extract_video, traverse_obj(feed, ('videos', lambda _, v: v['id']))),
video_id, 'nerdcubed.co.uk f... | from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class NerdCubedFeedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nerdcubed\.co\.uk/?(?:$|[#?])'
_TEST = {
'url': 'http://www.nerdcubed.co.uk... | @@ -1,33 +1,37 @@
-import datetime
-
from .common import InfoExtractor
+from .youtube import YoutubeIE
+from ..utils import parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
class NerdCubedFeedIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?nerdcubed\.co\.uk/feed\.json'
+ _VALID_... | yt_dlp/extractor/nerdcubed.py | 20 | Python | 0.857 | refactor | 332 | 38 | 39 | false | [ie/NerdCubedFeed] Rework extractor | 9,269 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | seproDev |
} for key, url in (get_video_info('thumbnail') or {}).items() if url],
'description': clean_html(get_video_info('description')),
'uploader': traverse_obj(api_data, ('owner', 'nickname'), ('channel', 'name'), ('community', 'name')),
'uploader_id': str_or_none(traverse_obj(... | could do this
```suggestion
if not comments_info.get('server'):
return
danmaku = traverse_obj(self._download_json(
f'{comments_info["server"]}/v1/threads', video_id, data=json.dumps({
``` | danmaku = traverse_obj(self._download_json(
f'{comments_info["server"]}/v1/threads', video_id, data=json.dumps({
'additionals': {},
'params': comments_info.get('params'),
'threadKey': comments_info.get('threadKey'),
}).encode(), fatal=False... | @@ -472,6 +565,9 @@ def get_video_info(*items, get_first=True, **kwargs):
def _get_subtitles(self, video_id, api_data):
comments_info = traverse_obj(api_data, ('comment', 'nvComment', {dict})) or {}
+ if not comments_info:
+ return
+
danmaku = traverse_obj(self._download_json(... | yt_dlp/extractor/niconico.py | 26 | Python | 1 | suggestion | 235 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
if video_id.startswith('so'):
video_id = self._match_id(handle.url)
api_data = self._parse_json(self._html_search_regex(
'data-api-data="([^"]+)"', webpage,
'API data', default='{}'), video_id)
except ExtractorError as e:
try:
... | are we able to do this?
```suggestion
r'<p[^>]+\bclass="fail-message"[^>]*>(?P<msg>[^<]+)</p>',
``` | if fmt := self._extract_format_for_quality(video_id, audio_quality, video_quality, protocol):
yield fmt
def _yield_dms_formats(self, api_data, video_id):
fmt_filter = lambda _, v: v['isAvailable'] and v['id']
videos = traverse_obj(api_data, ('media', 'domand', 'videos', ... | @@ -411,17 +424,97 @@ def _real_extract(self, url):
raise
raise ExtractorError(re.sub(r'\s+', ' ', error_msg), expected=True)
+ club_joined = traverse_obj(api_data, ('channel', 'viewer', 'follow', 'isFollowed', {bool}))
+ if club_joined is None:
+ fail_ms... | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | bug | 118 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
api_data = self._parse_json(self._html_search_regex(
'data-api-data="([^"]+)"', webpage,
'API data', default='{}'), video_id)
except ExtractorError as e:
try:
api_data = self._download_json(
'https://www.nicovideo.jp/api... | ```suggestion
self.raise_login_required(clean_html(fail_msg), metadata_available=True)
``` | def _yield_dms_formats(self, api_data, video_id):
fmt_filter = lambda _, v: v['isAvailable'] and v['id']
videos = traverse_obj(api_data, ('media', 'domand', 'videos', fmt_filter))
audios = traverse_obj(api_data, ('media', 'domand', 'audios', fmt_filter))
access_key = traverse_obj(api... | @@ -411,17 +424,97 @@ def _real_extract(self, url):
raise
raise ExtractorError(re.sub(r'\s+', ' ', error_msg), expected=True)
+ club_joined = traverse_obj(api_data, ('channel', 'viewer', 'follow', 'isFollowed', {bool}))
+ if club_joined is None:
+ fail_ms... | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | bug | 108 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
raise
raise ExtractorError(re.sub(r'\s+', ' ', error_msg), expected=True)
club_joined = traverse_obj(api_data, ('channel', 'viewer', 'follow', 'isFollowed', {bool}))
if club_joined is None:
fail_msg = self._html_search_regex(
r'<p[^>]+\bcl... | are `videos`/`audios` supposed to be a list of dicts and `protocols` supposed to be list of strings? we could do this, and simplify the key checking:
```suggestion
dmc_data = traverse_obj(api_data, ('media', 'delivery', 'movie', {
'audios': ('audios', ..., {dict}),
'videos': ('videos... | 'x-frontend-version': 0,
'x-request-with': 'https://www.nicovideo.jp',
})['data']['contentUrl']
# Getting all audio formats results in duplicate video formats which we filter out later
dms_fmts = self._extract_m3u8_formats(dms_m3u8_url, video_id)
# m3... | @@ -411,17 +424,97 @@ def _real_extract(self, url):
raise
raise ExtractorError(re.sub(r'\s+', ' ', error_msg), expected=True)
+ club_joined = traverse_obj(api_data, ('channel', 'viewer', 'follow', 'isFollowed', {bool}))
+ if club_joined is None:
+ fail_ms... | yt_dlp/extractor/niconico.py | 26 | Python | 0.857 | refactor | 450 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
elif not club_joined:
self.raise_login_required('This video is for members only', metadata_available=True)
formats = []
def get_video_info(*items, get_first=True, **kwargs):
return traverse_obj(api_data, ('video', *items), get_all=not get_first, **kwargs)
dmc_d... | would be more appropriate to filter rather than transform here, e.g.
```suggestion
'videos': ('media', 'domand', 'videos', lambda _, v: v['isAvailable'], 'id', {str}),
``` | **traverse_obj(audios, (lambda _, v: audio_fmt['format_id'].startswith(v['id']), {
'format_id': ('id', {str}),
'abr': ('bitRate', {functools.partial(float_or_none, scale=1000)}),
'asr': ('samplingRate', {int_or_none}),
}), get_a... | @@ -411,17 +424,97 @@ def _real_extract(self, url):
raise
raise ExtractorError(re.sub(r'\s+', ' ', error_msg), expected=True)
+ club_joined = traverse_obj(api_data, ('channel', 'viewer', 'follow', 'isFollowed', {bool}))
+ if club_joined is None:
+ fail_ms... | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | suggestion | 186 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
dmc_data = traverse_obj(api_data, (
'media', 'delivery', 'movie', {
'audios': 'audios',
'videos': 'videos',
'protocols': ('session', 'protocols'),
}, {lambda data: data if all(key in data for key in ['audios', 'videos', 'protocols']) else N... | I think once you have to use a transformation to construct an entire format_dict then it's time to break this up and use separate variables/traversals.
Can you show an example of what the POST data that we send with the API request should look like? Maybe I'm misreading the code, but it looks like we are sending a t... |
# Sort before removing dupes to keep the format dicts with the lowest tbr
video_fmts = sorted((fmt for fmt in dms_fmts if fmt['vcodec'] != 'none'), key=lambda f: f['tbr'])
self._remove_duplicate_formats(video_fmts)
# Calculate the true vbr/tbr by subtracting the lowest abr
min_a... | @@ -411,17 +424,97 @@ def _real_extract(self, url):
raise
raise ExtractorError(re.sub(r'\s+', ' ', error_msg), expected=True)
+ club_joined = traverse_obj(api_data, ('channel', 'viewer', 'follow', 'isFollowed', {bool}))
+ if club_joined is None:
+ fail_ms... | yt_dlp/extractor/niconico.py | 26 | Python | 0.786 | bug | 750 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
}
return info_dict, heartbeat_info_dict
def _extract_format_for_quality(self, video_id, audio_quality, video_quality, dmc_protocol):
if not audio_quality.get('isAvailable') or not video_quality.get('isAvailable'):
return None
format_id = '-'.join(
[remove_... | ```suggestion
**traverse_obj(audio_quality, ('metadata', {
'abr': ('bitrate', {functools.partial(float_or_none, scale=1000)}),
'asr': ('samplingRate', {int_or_none}),
}),
**traverse_obj(video_quality, ('metadata', {
'vbr': ('bitra... | return info_dict, heartbeat_info_dict
def _extract_format_for_quality(self, video_id, audio_quality, video_quality, dmc_protocol):
if not audio_quality.get('isAvailable') or not video_quality.get('isAvailable'):
return None
format_id = '-'.join(
[remove_start(s['id... | @@ -370,8 +377,9 @@ def extract_video_quality(video_quality):
'ext': 'mp4', # Session API are used in HTML5, which always serves mp4
'acodec': 'aac',
'vcodec': 'h264',
- 'abr': float_or_none(traverse_obj(audio_quality, ('metadata', 'bitrate')), 1000),
- 'vbr... | yt_dlp/extractor/niconico.py | 26 | Python | 0.786 | suggestion | 529 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
if len(dmc_data) == 3:
for (audio_quality, video_quality, protocol) in itertools.product(
dmc_data['audios'], dmc_data['videos'], dmc_data['protocols']):
fmt = self._extract_format_for_quality(video_id, audio_quality, video_quality, protocol)
if fm... | if the API call is fatal and the following m3u8 extraction is fatal, then we don't need traversal here IMO
```suggestion
dms_m3u8_url = self._download_json(
f'https://nvapi.nicovideo.jp/v1/watch/{video_id}/access-rights/hls', video_id,
data=json.dumps({
... |
# Sort before removing dupes to keep the format dicts with the lowest tbr
video_fmts = sorted((fmt for fmt in dms_fmts if fmt['vcodec'] != 'none'), key=lambda f: f['tbr'])
self._remove_duplicate_formats(video_fmts)
# Calculate the true vbr/tbr by subtracting the lowest abr
min_a... | @@ -409,19 +417,91 @@ def _real_extract(self, url):
webpage, 'error reason', default=None)
if not error_msg:
raise
- raise ExtractorError(re.sub(r'\s+', ' ', error_msg), expected=True)
+ raise ExtractorError(clean_html(error_msg), ... | yt_dlp/extractor/niconico.py | 26 | Python | 0.857 | refactor | 762 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
webpage, 'fail message', default=None, group='msg')
if fail_msg:
self.raise_login_required(clean_html(fail_msg), metadata_available=True)
elif not club_joined:
self.raise_login_required('This video is for members only', metadata_available=True)
fo... | I think we should move the DMC and DMS formats extraction into methods; we don't have to indent everything under if statements and can keep the code cleaner/more readable IMO | })['data']['contentUrl']
# Getting all audio formats results in duplicate video formats which we filter out later
dms_fmts = self._extract_m3u8_formats(dms_m3u8_url, video_id)
# m3u8 extraction does not provide audio bitrates, so extract from the API data and fix
for audio_f... | @@ -409,19 +417,91 @@ def _real_extract(self, url):
webpage, 'error reason', default=None)
if not error_msg:
raise
- raise ExtractorError(re.sub(r'\s+', ' ', error_msg), expected=True)
+ raise ExtractorError(clean_html(error_msg), ... | yt_dlp/extractor/niconico.py | 26 | Python | 0.429 | refactor | 174 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
if fmt := self._extract_format_for_quality(video_id, audio_quality, video_quality, protocol):
yield fmt
def _yield_dms_formats(self, api_data, video_id):
fmt_filter = lambda _, v: v['isAvailable'] and v['id']
videos = traverse_obj(api_data, ('media', 'domand', 'videos', ... | ```suggestion
# m3u8 extraction does not provide audio bitrates, so extract from the API data and fix
for audio_fmt in traverse_obj(dms_fmts, lambda _, v: v['vcodec'] == 'none'):
``` | def _yield_dms_formats(self, api_data, video_id):
fmt_filter = lambda _, v: v['isAvailable'] and v['id']
videos = traverse_obj(api_data, ('media', 'domand', 'videos', fmt_filter))
audios = traverse_obj(api_data, ('media', 'domand', 'audios', fmt_filter))
access_key = traverse_obj(api... | @@ -383,6 +394,70 @@ def extract_video_quality(video_quality):
}
}
+ def _yield_dmc_formats(self, api_data, video_id):
+ dmc_data = traverse_obj(api_data, ('media', 'delivery', 'movie', {
+ 'audios': ('audios', ..., {dict}),
+ 'videos': ('videos', ..., {dict}),
+ ... | yt_dlp/extractor/niconico.py | 26 | Python | 0.857 | refactor | 203 | 51 | 51 | false | [ie/niconico] Add support for DMS server; use robust info extraction logic; allow empty danmaku | 9,282 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
webpage, 'login token', group='xsrft')
vuid = self._search_regex(
r'["\']vuid["\']\s*:\s*(["\'])(?P<vuid>.+?)\1',
webpage, 'vuid', group='vuid')
return xsrft, vuid
def _extract_vimeo_config(self, webpage, video_id, *args, **kwargs):
vimeo_config = self._s... | ```suggestion
live_status = {
'pending': 'is_upcoming',
'active': 'is_live', # TODO: is live or not?
'started': 'is_live',
'ended': 'post_live',
}.get(live_event.get('status'))
```
unnecessarily complex | webpage, 'login token', group='xsrft')
vuid = self._search_regex(
r'["\']vuid["\']\s*:\s*(["\'])(?P<vuid>.+?)\1',
webpage, 'vuid', group='vuid')
return xsrft, vuid
def _extract_vimeo_config(self, webpage, video_id, *args, **kwargs):
vimeo_config = self._s... | @@ -121,7 +122,13 @@ def _parse_config(self, config, video_id):
video_data = config['video']
video_title = video_data.get('title')
live_event = video_data.get('live_event') or {}
- is_live = live_event.get('status') == 'started'
+ live_status = traverse_obj(live_event, ('status'... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.786 | suggestion | 275 | 51 | 51 | false | [ie/vimeo] Extract "live_status" and "release_timestamp" for live events | 9,290 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pzhlkj6612 |
# to properly set audio-only and video-only formats
fmts = self._extract_m3u8_formats(
media_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
for idx, f in enumerate(fmts):
man_url = f.get('url')
if re.search(r'chunklist(_b\d+)*_ao(_|\.)', man_url): # audi... | could we simplify this a bit like so?
```suggestion
fmts = self._extract_m3u8_formats(
media_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
for f in fmts:
if not f.get('acodec'):
f['acodec'] = 'mp4a'
if not f.get('vcodec'):
... |
# Fix malformed m3u8 manifests by setting audio-only/video-only formats
for f in fmts:
if not f.get('acodec'):
f['acodec'] = 'mp4a'
if not f.get('vcodec'):
f['vcodec'] = 'avc1'
man_url = f['url']
if re.search(r'chunklist(?:... | @@ -28,6 +28,36 @@ class RaiBaseIE(InfoExtractor):
_GEO_COUNTRIES = ['IT']
_GEO_BYPASS = False
+ def _fix_m3u8_formats(self, media_url, video_id):
+ # fixes the formats list because the website
+ # uses some malformed m3u8 manifest that needs manual fixing
+ # to properly set audio-o... | yt_dlp/extractor/rai.py | 26 | Python | 0.857 | refactor | 845 | 51 | 51 | false | [extractor/rai] fix #9154 and #887 | 9,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | nixxo |
urljoin,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube-k0srjLSkga8',
... | this is wrong and the cause of it should be fixed in a separate PR/commit
```suggestion
'categories': ['News & Politics'], # FIXME
``` | urljoin,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube-k0srjLSkga8',
... | @@ -32,7 +32,7 @@ class AltCensoredIE(InfoExtractor):
'duration': 926.09,
'thumbnail': 'https://archive.org/download/youtube-k0srjLSkga8/youtube-k0srjLSkga8.thumbs/k0srjLSkga8_000925.jpg',
'view_count': int,
- 'categories': ['News & Politics'],
+ 'categories'... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.786 | bug | 150 | 51 | 51 | false | [AltCensoredChannelIE] Fix page_count regular expression | 9,297 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | marcdumais |
urlh = self._request_webpage(
'https://piapro.jp/login/exe', None,
note='Logging in', errnote='Unable to log in',
data=urlencode_postdata(login_form_strs))
if urlh is False:
login_ok = False
else:
parts = compat_urlparse.urlparse(urlh.u... | I would slightly adjust the regex and make them all non-fatal
```suggestion
str_duration = self._search_regex(r'長さ:\s*([\d:]+)\s*</p>', webpage, 'duration', fatal=False)
str_filesize = self._search_regex(r'サイズ:\s*([\d.]+[KMG]?B)\s*</p>', webpage, 'size', fatal=False)
str_viewcount = self._se... | }
self._request_webpage('https://piapro.jp/login/', None)
urlh = self._request_webpage(
'https://piapro.jp/login/exe', None,
note='Logging in', errnote='Unable to log in',
data=urlencode_postdata(login_form_strs))
if urlh is False:
login_ok... | @@ -88,25 +88,19 @@ def _real_extract(self, url):
if category_id not in ('1', '2', '21', '22', '23', '24', '25'):
raise ExtractorError('The URL does not contain audio.', expected=True)
- str_duration, str_filesize = self._search_regex(
- r'サイズ:</span>(.+?)/\(([0-9,]+?[KMG]?B))'... | yt_dlp/extractor/piapro.py | 26 | Python | 0.786 | suggestion | 505 | 49 | 45 | false | [ie/Piapro] Fix extractor | 9,311 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | FinnRG |
data=urlencode_postdata(login_form_strs))
if urlh is False:
login_ok = False
else:
parts = compat_urlparse.urlparse(urlh.url)
if parts.path != '/':
login_ok = False
if not login_ok:
self.report_warning(
'... | Maybe like so?
```suggestion
uploader_id = self._search_regex(
r'<a\s+href="/([^"]+)"', get_element_by_class('contents_creator', webpage), 'uploader id', fatal=False)
``` | 'https://piapro.jp/login/exe', None,
note='Logging in', errnote='Unable to log in',
data=urlencode_postdata(login_form_strs))
if urlh is False:
login_ok = False
else:
parts = compat_urlparse.urlparse(urlh.url)
if parts.path != '/':
... | @@ -88,25 +88,19 @@ def _real_extract(self, url):
if category_id not in ('1', '2', '21', '22', '23', '24', '25'):
raise ExtractorError('The URL does not contain audio.', expected=True)
- str_duration, str_filesize = self._search_regex(
- r'サイズ:</span>(.+?)/\(([0-9,]+?[KMG]?B))'... | yt_dlp/extractor/piapro.py | 26 | Python | 0.714 | suggestion | 194 | 46 | 42 | false | [ie/Piapro] Fix extractor | 9,311 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | FinnRG |
login_ok = False
else:
parts = compat_urlparse.urlparse(urlh.url)
if parts.path != '/':
login_ok = False
if not login_ok:
self.report_warning(
'unable to log in: bad username or password')
self._login_status = login_... | Inline below
```suggestion
``` | data=urlencode_postdata(login_form_strs))
if urlh is False:
login_ok = False
else:
parts = compat_urlparse.urlparse(urlh.url)
if parts.path != '/':
login_ok = False
if not login_ok:
self.report_warning(
'... | @@ -88,25 +88,19 @@ def _real_extract(self, url):
if category_id not in ('1', '2', '21', '22', '23', '24', '25'):
raise ExtractorError('The URL does not contain audio.', expected=True)
- str_duration, str_filesize = self._search_regex(
- r'サイズ:</span>(.+?)/\(([0-9,]+?[KMG]?B))'... | yt_dlp/extractor/piapro.py | 26 | Python | 0.429 | suggestion | 32 | 44 | 40 | false | [ie/Piapro] Fix extractor | 9,311 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | FinnRG |
self.report_warning(
'unable to log in: bad username or password')
self._login_status = login_ok
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
category_id = self._search_regex(r'categoryId=(.... | ```suggestion
'title': get_element_by_class('contents_title', webpage),
'description': clean_html(get_element_by_class('contents_description', webpage)),
'uploader': get_element_by_class('contents_creator_txt', webpage),
```
Also import `clean_html` and `get_element_by_class` ... | login_ok = False
if not login_ok:
self.report_warning(
'unable to log in: bad username or password')
self._login_status = login_ok
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)... | @@ -88,25 +88,19 @@ def _real_extract(self, url):
if category_id not in ('1', '2', '21', '22', '23', '24', '25'):
raise ExtractorError('The URL does not contain audio.', expected=True)
- str_duration, str_filesize = self._search_regex(
- r'サイズ:</span>(.+?)/\(([0-9,]+?[KMG]?B))'... | yt_dlp/extractor/piapro.py | 26 | Python | 0.786 | suggestion | 334 | 38 | 34 | false | [ie/Piapro] Fix extractor | 9,311 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | FinnRG |
'expected_warnings': ['Failed to download m3u8 information'],
}, {
'url': 'http://ent.cntv.cn/2016/01/18/ARTIjprSSJH8DryTVr5Bx8Wb160118.shtml',
'only_matching': True,
}, {
'url': 'http://tv.cntv.cn/video/C39296/e0210d949f113ddfb38d31f00a4e5c44',
'only_matching': True,
... | we could do this
```suggestion
r'videoCenterId(?:["\']\s*,|:)\s*["\']([\da-fA-F]+)',
``` | 'expected_warnings': ['Failed to download m3u8 information'],
}, {
'url': 'http://ent.cntv.cn/2016/01/18/ARTIjprSSJH8DryTVr5Bx8Wb160118.shtml',
'only_matching': True,
}, {
'url': 'http://tv.cntv.cn/video/C39296/e0210d949f113ddfb38d31f00a4e5c44',
'only_matching': True,
... | @@ -129,6 +143,7 @@ def _real_extract(self, url):
video_id = self._search_regex(
[r'var\s+guid\s*=\s*["\']([\da-fA-F]+)',
r'videoCenterId["\']\s*,\s*["\']([\da-fA-F]+)',
+ r'videoCenterId:\s*["\']([\da-fA-F]+)', | yt_dlp/extractor/cctv.py | 26 | Python | 0.786 | suggestion | 104 | 51 | 51 | false | [ie/CCTV] Fix video id Regex | 9,325 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | src-tinkerer |
_VALID_URL = r'https?://play\.afreeca(?:tv)?\.com/(?P<id>[^/]+)(?:/(?P<bno>\d+))?'
_TESTS = [{
'url': 'https://play.afreecatv.com/pyh3646/237852185',
'info_dict': {
'id': '237852185',
'ext': 'mp4',
'title': '【 우루과이 오늘은 무슨일이? 】',
'uploader': '박진우[JI... | move this down to where it is being used, see below suggestion
```suggestion
``` |
class AfreecaTVLiveIE(AfreecaTVBaseIE):
IE_NAME = 'afreecatv:live'
IE_DESC = 'afreecatv.com livestreams'
_VALID_URL = r'https?://play\.afreeca(?:tv)?\.com/(?P<id>[^/]+)(?:/(?P<bno>\d+))?'
_TESTS = [{
'url': 'https://play.afreecatv.com/pyh3646/237852185',
'info_dict': {
'id':... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.643 | refactor | 82 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
'url': 'https://play.afreecatv.com/pyh3646/237852185',
'info_dict': {
'id': '237852185',
'ext': 'mp4',
'title': '【 우루과이 오늘은 무슨일이? 】',
'uploader': '박진우[JINU]',
'uploader_id': 'pyh3646',
'timestamp': 1640661495,
'is_live':... | ```suggestion
channel_info = traverse_obj(self._download_json(
self._LIVE_API_URL, broadcaster_id, data=urlencode_postdata({'bid': broadcaster_id}))
('CHANNEL', {dict})) or {}
``` | IE_NAME = 'afreecatv:live'
IE_DESC = 'afreecatv.com livestreams'
_VALID_URL = r'https?://play\.afreeca(?:tv)?\.com/(?P<id>[^/]+)(?:/(?P<bno>\d+))?'
_TESTS = [{
'url': 'https://play.afreecatv.com/pyh3646/237852185',
'info_dict': {
'id': '237852185',
'ext': 'mp4',
... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.929 | suggestion | 215 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
'ext': 'mp4',
'title': '【 우루과이 오늘은 무슨일이? 】',
'uploader': '박진우[JINU]',
'uploader_id': 'pyh3646',
'timestamp': 1640661495,
'is_live': True,
},
'skip': 'Livestream has ended',
}, {
'url': 'https://play.afreecatv.com/pyh3646... | I know this is old code, but let's move it below as well
```suggestion
``` | _TESTS = [{
'url': 'https://play.afreecatv.com/pyh3646/237852185',
'info_dict': {
'id': '237852185',
'ext': 'mp4',
'title': '【 우루과이 오늘은 무슨일이? 】',
'uploader': '박진우[JINU]',
'uploader_id': 'pyh3646',
'timestamp': 1640661495,
... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.643 | suggestion | 76 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
'timestamp': 1640661495,
'is_live': True,
},
'skip': 'Livestream has ended',
}, {
'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
}, {
'url': 'https://play.afreecatv.com/pyh3646',
'only_matching': True,
}]
... | as suggested above
```suggestion
password = self.get_param('videopassword')
if channel_info.get('BPWD') == 'Y' and password is None:
``` | 'ext': 'mp4',
'title': '【 우루과이 오늘은 무슨일이? 】',
'uploader': '박진우[JINU]',
'uploader_id': 'pyh3646',
'timestamp': 1640661495,
'is_live': True,
},
'skip': 'Livestream has ended',
}, {
'url': 'https://play.afreecatv.com/pyh3646... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.714 | suggestion | 156 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
_LIVE_API_URL = 'https://live.afreecatv.com/afreeca/player_live_api.php'
def _real_extract(self, url):
broadcaster_id, broadcast_no = self._match_valid_url(url).group('id', 'bno')
password = self.get_param('videopassword')
info = self._download_json(self._LIVE_API_URL, broadcaster_id, d... | import `filter_dict` from utils
```suggestion
aid = self._download_json(
self._LIVE_API_URL, broadcast_no, 'Downloading access token for stream',
'Unable to download access token for stream', data=urlencode_postdata(filter_dict({
'bno': broadcast_no,
... | 'url': 'https://play.afreecatv.com/pyh3646',
'only_matching': True,
}]
_LIVE_API_URL = 'https://live.afreecatv.com/afreeca/player_live_api.php'
def _real_extract(self, url):
broadcaster_id, broadcast_no = self._match_valid_url(url).group('id', 'bno')
channel_info = traverse... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.929 | suggestion | 490 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
raise ExtractorError(
'This livestream is protected by a password, use the --video-password option',
expected=True)
params = {'bno': broadcast_no, 'stream_type': 'common', 'type': 'aid', 'quality': 'master', 'pwd': password}
aid_response = self._download_jso... | let's flip-flop these two requests, since `formats` is fatal and `station_info` shouldn't be (it's metadata-only)
```suggestion
formats = self._extract_m3u8_formats(
stream_info['view_url'], broadcast_no, 'mp4', m3u8_id='hls',
query={'aid': aid}, headers={'Referer': url})
... | if not broadcast_no:
raise UserNotLive(video_id=broadcaster_id)
password = self.get_param('videopassword')
if channel_info.get('BPWD') == 'Y' and password is None:
raise ExtractorError(
'This livestream is protected by a password, use the --video-password... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 1 | refactor | 614 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
params = {'bno': broadcast_no, 'stream_type': 'common', 'type': 'aid', 'quality': 'master', 'pwd': password}
aid_response = self._download_json(self._LIVE_API_URL, broadcast_no, data=urlencode_postdata(params),
note='Downloading access token for stream',
... | let's inline this in the return
```suggestion
``` | password = self.get_param('videopassword')
if channel_info.get('BPWD') == 'Y' and password is None:
raise ExtractorError(
'This livestream is protected by a password, use the --video-password option',
expected=True)
aid = self._download_json(
... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.571 | suggestion | 51 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
raise ExtractorError(f'Unable to extract AID from {aid_response}', expected=False)
stream_base_url = channel_info.get('RMD') or 'https://livestream-manager.afreecatv.com'
stream_info = self._download_json(f'{stream_base_url}/broad_stream_assign.html', broadcast_no, query={
# wor... | ```py
return {
'id': broadcast_no,
'title': channel_info.get('TITLE') or station_info.get('station_title'),
'uploader': channel_info.get('BJNICK') or station_info.get('station_name'),
'uploader_id': broadcaster_id,
'timestamp': unified_timestamp(... | 'Unable to download access token for stream', data=urlencode_postdata(filter_dict({
'bno': broadcast_no,
'stream_type': 'common',
'type': 'aid',
'quality': 'master',
'pwd': password,
})))['CHANNEL']['AID']
s... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.929 | style | 479 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
'url': 'https://play.afreecatv.com/pyh3646/237852185',
'info_dict': {
'id': '237852185',
'ext': 'mp4',
'title': '【 우루과이 오늘은 무슨일이? 】',
'uploader': '박진우[JINU]',
'uploader_id': 'pyh3646',
'timestamp': 1640661495,
'is_live':... | ```suggestion
('CHANNEL', {dict}) or {}
``` | IE_NAME = 'afreecatv:live'
IE_DESC = 'afreecatv.com livestreams'
_VALID_URL = r'https?://play\.afreeca(?:tv)?\.com/(?P<id>[^/]+)(?:/(?P<bno>\d+))?'
_TESTS = [{
'url': 'https://play.afreecatv.com/pyh3646/237852185',
'info_dict': {
'id': '237852185',
'ext': 'mp4',
... | @@ -347,77 +347,56 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE
},
'skip': 'Livestream has ended',
}, {
- 'url': 'http://play.afreeca.com/pyh3646/237852185',
+ 'url': 'https://play.afreecatv.com/pyh3646/237852185',
'only_matching': True,
... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.571 | suggestion | 57 | 51 | 51 | false | [ie/AfreecaTVLive] Fix extractor in Korea | 9,348 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hui1601 |
'url': 'http://funhaus.roosterteeth.com/episode/funhaus-shorts-2016-austin-sucks-funhaus-shorts',
'only_matching': True,
}, {
'url': 'http://screwattack.roosterteeth.com/episode/death-battle-season-3-mewtwo-vs-shadow',
'only_matching': True,
}, {
'url': 'http://theknow.ro... | EDIT: ignore this suggestion
and move this down below the try/except block
```suggestion
m3u8_url = traverse_obj(video_data, (
(('links', 'download'), ('attributes', 'url')), {url_or_none}), get_all=False)
``` | 'url': 'http://funhaus.roosterteeth.com/episode/funhaus-shorts-2016-austin-sucks-funhaus-shorts',
'only_matching': True,
}, {
'url': 'http://screwattack.roosterteeth.com/episode/death-battle-season-3-mewtwo-vs-shadow',
'only_matching': True,
}, {
'url': 'http://theknow.ro... | @@ -133,10 +151,9 @@ def _real_extract(self, url):
try:
video_data = self._download_json(
- api_episode_url + '/videos', display_id,
- 'Downloading video JSON metadata')['data'][0]
- m3u8_url = video_data['attributes']['url']
- # XXX: additiona... | yt_dlp/extractor/roosterteeth.py | 26 | Python | 0.857 | refactor | 244 | 51 | 51 | false | [roosterteeth] Download ad-free streams | 9,355 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | jkmartindale |
'url': 'http://funhaus.roosterteeth.com/episode/funhaus-shorts-2016-austin-sucks-funhaus-shorts',
'only_matching': True,
}, {
'url': 'http://screwattack.roosterteeth.com/episode/death-battle-season-3-mewtwo-vs-shadow',
'only_matching': True,
}, {
'url': 'http://theknow.ro... | `video_data['links']['download']` URLs were giving 403 errors
```suggestion
headers={'Client-Type': 'web'})['data'][0] # web client-type yields ad-free streams
m3u8_url = video_data['attributes']['url']
# XXX: additional ad-free URL at video_data['links']['download'] but oft... | 'url': 'http://funhaus.roosterteeth.com/episode/funhaus-shorts-2016-austin-sucks-funhaus-shorts',
'only_matching': True,
}, {
'url': 'http://screwattack.roosterteeth.com/episode/death-battle-season-3-mewtwo-vs-shadow',
'only_matching': True,
}, {
'url': 'http://theknow.ro... | @@ -133,10 +151,9 @@ def _real_extract(self, url):
try:
video_data = self._download_json(
- api_episode_url + '/videos', display_id,
- 'Downloading video JSON metadata')['data'][0]
- m3u8_url = video_data['attributes']['url']
- # XXX: additiona... | yt_dlp/extractor/roosterteeth.py | 26 | Python | 0.929 | suggestion | 344 | 51 | 51 | false | [roosterteeth] Download ad-free streams | 9,355 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | jkmartindale |
'title': '21st Century Communities: Public Transportation Infrastructure Investment and FAST Act Reauthorization',
'description': 'The Official website of The United States Committee on Banking, Housing, and Urban Affairs',
'ext': 'mp4',
},
'params': {'skip_download':... | ```suggestion
for video_url in urls_alternatives:
formats = self._extract_m3u8_formats(video_url, display_id, ext='mp4', fatal=False)
if formats:
break
``` | '_old_archive_ids': ['senategov appropsA051518'],
},
'params': {'skip_download': 'm3u8'},
'expected_warnings': ['Failed to download m3u8 information'],
}, {
'url': 'https://www.banking.senate.gov/hearings/21st-century-communities-public-transportation-infrastructure-inves... | @@ -177,14 +177,21 @@ def _real_extract(self, url):
display_id = self._generic_id(url)
webpage = self._download_webpage(url, display_id)
parse_info = parse_qs(self._search_regex(
- r'<iframe class="[^>"]*streaminghearing[^>"]*"\s[^>]*\bsrc="([^">]*)', webpage, 'hearing URL'))
-
- ... | yt_dlp/extractor/senategov.py | 26 | Python | 0.857 | refactor | 208 | 40 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
'url': 'https://www.banking.senate.gov/hearings/21st-century-communities-public-transportation-infrastructure-investment-and-fast-act-reauthorization',
'info_dict': {
'id': 'banking041521',
'display_id': '21st-century-communities-public-transportation-infrastructure-investment-an... | Is there a reasoning for this order? or just random? | 'title': 'Review of the FY2019 Budget Request for the U.S. Army',
'ext': 'mp4',
'age_limit': 0,
'thumbnail': 'https://www.appropriations.senate.gov/themes/appropriations/images/video-poster-flash-fit.png',
'_old_archive_ids': ['senategov appropsA051518'],
... | @@ -177,14 +177,21 @@ def _real_extract(self, url):
display_id = self._generic_id(url)
webpage = self._download_webpage(url, display_id)
parse_info = parse_qs(self._search_regex(
- r'<iframe class="[^>"]*streaminghearing[^>"]*"\s[^>]*\bsrc="([^">]*)', webpage, 'hearing URL'))
-
- ... | yt_dlp/extractor/senategov.py | 26 | Python | 0.214 | question | 52 | 44 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
'url': 'https://www.appropriations.senate.gov/hearings/watch?hearingid=B8A25434-5056-A066-6020-1F68CB75F0CD',
'info_dict': {
'id': 'appropsA051518',
'display_id': 'watch?hearingid=B8A25434-5056-A066-6020-1F68CB75F0CD',
'title': 'Review of the FY2019 Budget Request for... | ```suggestion
(r'<iframe class="[^>"]*streaminghearing[^>"]*"\s[^>]*\bsrc="([^>"]+)',
r'<iframe title="[^>"]*"\s[^>]*\bsrc="([^">]+)'),
``` | 'description': 'The U.S. Senate Committee on Health, Education, Labor & Pensions',
'ext': 'mp4',
'age_limit': 0,
'thumbnail': 'https://www.help.senate.gov/assets/images/sharelogo.jpg',
'_old_archive_ids': ['senategov help090920'],
},
'params': ... | @@ -173,15 +173,23 @@ class SenateGovIE(InfoExtractor):
def _real_extract(self, url):
display_id = self._generic_id(url)
webpage = self._download_webpage(url, display_id)
- parse_info = parse_qs(self._search_regex(
- r'<iframe class="[^>"]*streaminghearing[^>"]*"\s[^>]*\bsrc="([... | yt_dlp/extractor/senategov.py | 26 | Python | 0.714 | suggestion | 167 | 51 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
},
'params': {
# m3u8 download
'skip_download': True,
},
'skip': 'This video is not available.',
}, {
'url': 'http://www.senate.gov/isvp/?type=arch&comm=intel&filename=intel090613&hc_location=ufi',
# checksum differs each time
'info_dic... | Suggestion #`2` to remove `qs.get('type')`. `type` is not used anywhere in the function and fails isvp urls such as `https://www.senate.gov/isvp/?auto_play=false&comm=help&filename=help090920&poster=https://www.help.senate.gov/assets/images/video-poster.png&stt=950`. | 'finance': ('76450', 'https://finance-f.akamaihd.net', '2036795', 'finance_finance'),
'foreign': ('76451', 'https://foreign-f.akamaihd.net', '2036794', 'foreignrelations'),
'govtaff': ('76453', 'https://govtaff-f.akamaihd.net', '2036792', 'hsgac'),
'help': ('76452', 'https://help-f.akama... | @@ -91,8 +111,8 @@ def _real_extract(self, url):
qs = urllib.parse.parse_qs(self._match_valid_url(url).group('qs'))
if not qs.get('filename') or not qs.get('type') or not qs.get('comm'): | yt_dlp/extractor/senategov.py | 26 | Python | 0.786 | bug | 267 | 51 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | jameszp | Grabien |
'commerce': ('80177', 'https://commerce1-f.akamaihd.net', '2036779', 'commerce'),
'csce': ('75229', 'https://srs-f.akamaihd.net', '2036777', 'srs_srs'),
'dpc': ('76590', 'https://dpc-f.akamaihd.net', '', 'dpc'),
'energy': ('76448', 'https://energy-f.akamaihd.net', '2036797', 'energy'),
... | Typo in `commitee` --> `committee`. | 'id': 'judiciary031715',
'ext': 'mp4',
'title': 'ISVP',
'thumbnail': r're:^https?://.*\.(?:jpg|png)$',
'_old_archive_ids': ['senategov judiciary031715'],
},
'params': {
# m3u8 download
'skip_download': True,
},
... | @@ -5,45 +5,62 @@
from ..utils import (
ExtractorError,
parse_qs,
+ remove_end,
unsmuggle_url,
)
-_COMMITTEES = {
- 'ag': ('76440', 'http://ag-f.akamaihd.net'),
- 'aging': ('76442', 'http://aging-f.akamaihd.net'),
- 'approps': ('76441', 'http://approps-f.akamaihd.net'),
- 'arch': ('', ... | yt_dlp/extractor/senategov.py | 26 | Python | 0.214 | nitpick | 35 | 51 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | jameszp | Grabien |
stream_num, stream_domain, stream_id, msl3 = self._COMMITTEES[committee]
urls_alternatives = [f'https://www-senate-gov-media-srs.akamaized.net/hls/live/{stream_id}/{committee}/{filename}/master.m3u8',
f'https://www-senate-gov-msl3archive.akamaized.net/{msl3}/{filename}_1/ma... | Maybe `_VALID_URL` should be more restrictive to distinguish between the list of hearings and the hearing page.
Ex. `https://www.energy.senate.gov/hearings` is a list of hearings whereas `https://www.energy.senate.gov/hearings/2025/1/hearing-to-consider-the-nomination-of-the-honorable-doug-burgum-to-be-secretary-of... | formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_url, video_id, ext='mp4', fatal=False)
if formats:
break
return {
'id': video_id,
'title': self._html_extract_title(webpage),
'formats': formats,
'subtitle... | @@ -134,20 +122,32 @@ def _real_extract(self, url):
committee = qs['comm'][0]
- formats, subtitles = self._extract_formats_and_subtitles(committee, filename, video_id)
+ stream_num, stream_domain, stream_id, msl3 = self._COMMITTEES[committee]
+
+ urls_alternatives = [f'https://www-sena... | yt_dlp/extractor/senategov.py | 26 | Python | 0.643 | security | 529 | 51 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | jameszp | Grabien |
'id': 'intel090613',
'ext': 'mp4',
'title': 'ISVP',
'_old_archive_ids': ['senategov intel090613'],
},
'expected_warnings': ['Failed to download m3u8 information'],
}, {
'url': 'https://www.senate.gov/isvp/?auto_play=false&comm=help&filename=hel... | ```suggestion
'arch': ('', 'https://ussenate-f.akamaihd.net', '', 'arch'),
``` | 'id': 'intel090613',
'ext': 'mp4',
'title': 'ISVP',
'_old_archive_ids': ['senategov intel090613'],
},
'expected_warnings': ['Failed to download m3u8 information'],
}, {
'url': 'https://www.senate.gov/isvp/?auto_play=false&comm=help&filename=hel... | @@ -53,92 +22,123 @@ class SenateISVPIE(InfoExtractor):
'info_dict': {
'id': 'judiciary031715',
'ext': 'mp4',
- 'title': 'Integrated Senate Video Player',
+ 'title': 'ISVP',
'thumbnail': r're:^https?://.*\.(?:jpg|png)$',
+ '_old_archive_id... | yt_dlp/extractor/senategov.py | 26 | Python | 0.571 | suggestion | 88 | 51 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grabien |
'judiciary': ('76459', 'https://judiciary-f.akamaihd.net', '2036788', 'judiciary'),
'rpc': ('76591', 'https://rpc-f.akamaihd.net', '', 'rpc'),
'rules': ('76460', 'https://rules-f.akamaihd.net', '2036787', 'rules'),
'saa': ('76489', 'https://srs-f.akamaihd.net', '2036780', 'srs_saa'),
... | can we inline this in the for loop? if you think it's more readable like this i'm fine w/ it | 'judiciary': ('76459', 'https://judiciary-f.akamaihd.net', '2036788', 'judiciary'),
'rpc': ('76591', 'https://rpc-f.akamaihd.net', '', 'rpc'),
'rules': ('76460', 'https://rules-f.akamaihd.net', '2036787', 'rules'),
'saa': ('76489', 'https://srs-f.akamaihd.net', '2036780', 'srs_saa'),
... | @@ -53,92 +22,123 @@ class SenateISVPIE(InfoExtractor):
'info_dict': {
'id': 'judiciary031715',
'ext': 'mp4',
- 'title': 'Integrated Senate Video Player',
+ 'title': 'ISVP',
'thumbnail': r're:^https?://.*\.(?:jpg|png)$',
+ '_old_archive_id... | yt_dlp/extractor/senategov.py | 26 | Python | 0.214 | question | 92 | 51 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grabien |
filename = qs['filename'][0]
video_id = remove_end(filename, '.mp4')
webpage = self._download_webpage(url, video_id)
committee = qs['comm'][0]
stream_num, stream_domain, stream_id, msl3 = self._COMMITTEES[committee]
urls_alternatives = [f'https://www-senate-gov-media-s... | ```suggestion
'_old_archive_ids': [make_archive_id(SenateGovIE, video_id)],
``` | filename = qs['filename'][0]
video_id = remove_end(filename, '.mp4')
webpage = self._download_webpage(url, video_id)
committee = qs['comm'][0]
stream_num, stream_domain, stream_id, msl3 = self._COMMITTEES[committee]
urls_alternatives = [f'https://www-senate-gov-media-s... | @@ -53,92 +22,123 @@ class SenateISVPIE(InfoExtractor):
'info_dict': {
'id': 'judiciary031715',
'ext': 'mp4',
- 'title': 'Integrated Senate Video Player',
+ 'title': 'ISVP',
'thumbnail': r're:^https?://.*\.(?:jpg|png)$',
+ '_old_archive_id... | yt_dlp/extractor/senategov.py | 26 | Python | 0.571 | suggestion | 93 | 51 | 51 | false | [ie/senategov] Fix extractors | 9,361 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grabien |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.