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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
},
'skip': 'The video is no longer available',
},
]
def _extract_vars(self, variable, html):
return self._search_regex(
rf'(?:var|const|let)\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1',
html, f'variable {variable}', group='value')
de... | Should be identical to
```suggestion
if date and time:
``` | }]
def _extract_var(self, variable, html):
return self._search_regex(
rf'(?:var|const|let)\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1',
html, f'variable {variable}', group='value')
def _real_extract(self, url):
video_key = self._match_id(url)
webpag... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.643 | suggestion | 73 | 51 | 51 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ChocoLZS |
'live_status': 'not_live',
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://ulizaportal.jp/pages/005e1b23-fe93-5780-19a0-98e917cc4b7d?expires=4102412400&signature=f422a993b683e1068f946caf406d211c17d1ef1... | ```suggestion
raise ExtractorError('The link is expired', video_id=video_id, expected=True)
``` | '_old_archive_ids': ['piaulizaportal ae350126-5e22-4a7f-a8ac-8d0fd448b800'],
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://ulizaportal.jp/pages/005e1b23-fe93-5780-19a0-98e917cc4b7d?expires=4102412400... | @@ -0,0 +1,112 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ make_archive_id,
+ parse_qs,
+ time_seconds,
+)
+from ..utils.traversal import traverse_obj
+
+
+class UlizaPlayerIE(InfoExtractor):
+ _VALID_URL = r'https://player-api\.p\.uliza\.jp/v1/playe... | yt_dlp/extractor/uliza.py | 26 | Python | 0.929 | refactor | 109 | 36 | 37 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_class,
multipart_encode,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class PiaLiveIE(InfoExtractor):
PL... | ```suggestion
_VALID_URL = r'https?://player\.pia-live\.jp/stream/(?P<id>[\w-]+)'
_PLAYER_ROOT_URL = 'https://player.pia-live.jp/'
_PIA_LIVE_API_URL = 'https://api.pia-live.jp'
_API_KEY = 'kfds)FKFps-dms9e'
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_class,
multipart_encode,
str_or_none,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class PiaLiveIE(InfoE... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 19 | Python | 0.786 | suggestion | 231 | 44 | 44 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
'params': {
'getcomments': True,
'skip_download': True,
'ignore_no_formats_error': True,
},
'skip': 'The video is no longer available',
},
{
'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F... | `_extract_vars` is a misnomer if it only extracts one at a time
```suggestion
def _extract_var(self, variable, html):
``` | 'getcomments': True,
'skip_download': True,
'ignore_no_formats_error': True,
},
'skip': 'The video is no longer available',
}, {
'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krJdu0GVBVbVy01IwpJ6J3qBEm3d9TCTt1d0eWpsZGj7... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.786 | refactor | 128 | 51 | 51 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
'id': '9ce8b8ba-f6d1-4d1f-83a0-18c3148ded93',
'display_id': '2431867_002',
'title': 'こながめでたい日2024の視聴ページ | PIA LIVE STREAM(ぴあライブストリーム)',
'live_status': 'was_live',
'comment_count': int,
},
'params': {
... | ```suggestion
program_code = self._extract_var('programCode', webpage)
article_code = self._extract_var('articleCode', webpage)
``` | 'title': 'こながめでたい日2024の視聴ページ | PIA LIVE STREAM(ぴあライブストリーム)',
'live_status': 'was_live',
'comment_count': int,
},
'params': {
'getcomments': True,
'skip_download': True,
'ignore_no_formats_error': True,
},
'skip': 'Th... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.786 | refactor | 150 | 51 | 51 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
program_code = self._extract_vars('programCode', webpage)
article_code = self._extract_vars('articleCode', webpage)
title = self._html_extract_title(webpage)
if get_element_html_by_class('play-end', webpage):
raise ExtractorError('The video is no longer available', expected... | ```suggestion
'api_key': self._API_KEY,
``` | title = self._html_extract_title(webpage)
if get_element_html_by_class('play-end', webpage):
raise ExtractorError('The video is no longer available', expected=True, video_id=program_code)
if start_info := clean_html(get_element_by_class('play-waiting__date', webpage)):
... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.571 | suggestion | 57 | 51 | 51 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
if get_element_html_by_class('play-end', webpage):
raise ExtractorError('The video is no longer available', expected=True, video_id=program_code)
if start_info := clean_html(get_element_by_class('play-waiting__date', webpage)):
date, time = self._search_regex(
r'... | ```suggestion
'headers': {'Content-Type': content_type, 'Referer': self._PLAYER_ROOT_URL},
``` | if start_info := clean_html(get_element_by_class('play-waiting__date', webpage)):
date, time = self._search_regex(
r'(?P<date>\d{4}/\d{1,2}/\d{1,2})\([月火水木金土日]\)(?P<time>\d{2}:\d{2})',
start_info, 'start_info', fatal=False, group=('date', 'time'))
if date ... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.857 | suggestion | 108 | 51 | 51 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
date, time = self._search_regex(
r'(?P<date>\d{4}/\d{1,2}/\d{1,2})\([月火水木金土日]\)(?P<time>\d{2}:\d{2})',
start_info, 'start_info', fatal=False, group=('date', 'time'))
if date and time:
release_timestamp_str = f'{date} {time} +09:00'
... | ```suggestion
f'{self._PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', **api_kwargs,
``` | if date and time:
release_timestamp_str = f'{date} {time} +09:00'
release_timestamp = unified_timestamp(release_timestamp_str)
self.raise_no_formats(f'The video will be available after {release_timestamp_str}', expected=True)
return {
... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.714 | suggestion | 110 | 51 | 51 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
release_timestamp = unified_timestamp(release_timestamp_str)
self.raise_no_formats(f'The video will be available after {release_timestamp_str}', expected=True)
return {
'id': program_code,
'title': title,
'live_s... | ```suggestion
f'{self._PIA_LIVE_API_URL}/perf/chat-tag-list/{program_code}/{article_code}', **api_kwargs,
``` | 'id': program_code,
'title': title,
'live_status': 'is_upcoming',
'release_timestamp': release_timestamp,
}
payload, content_type = multipart_encode({
'play_url': video_key,
'api_key': self._... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.714 | suggestion | 127 | 50 | 46 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
api_kwargs = {
'video_id': program_code,
'data': payload,
'headers': {'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL},
}
player_tag_list = self._download_json(
f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', **api_kw... | ```suggestion
chat_room_url, video_id, headers={'Referer': self._PLAYER_ROOT_URL},
``` | }
player_tag_list = self._download_json(
f'{self._PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', program_code,
'Fetching player tag list', 'Unable to fetch player tag list', **api_data_and_headers)
return self.url_result(
extract_attributes(player_t... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.714 | suggestion | 104 | 37 | 33 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
})
api_kwargs = {
'video_id': program_code,
'data': payload,
'headers': {'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL},
}
player_tag_list = self._download_json(
f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}... | instead of indenting this all under an `if` assignment expression, let's just early exit `if not comment_page` | 'headers': {'Content-Type': content_type, 'Referer': self._PLAYER_ROOT_URL},
}
player_tag_list = self._download_json(
f'{self._PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', program_code,
'Fetching player tag list', 'Unable to fetch player tag list', **api_d... | @@ -0,0 +1,126 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ get_element_by_class,
+ get_element_html_by_class,
+ multipart_encode,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class... | yt_dlp/extractor/pialive.py | 26 | Python | 0.571 | suggestion | 110 | 38 | 34 | false | [ie/PiaLive] Add extractor | 10,811 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ChocoLZS |
'params': {
'skip_download': True,
},
}, {
'url': 'https://event.drtalks.com/mitochondrial-summit/encore-access-day-6',
'only_matching': True,
}, {
'url': 'https://event.drtalks.com/medicine-of-mindset-summit/free-access-day-1/',
'only_matching': True,... | Question:
The `video_id` is always ignored, no matter if I set the `url_transparent` to True or False. Is it because of the "playlist" result? | from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import url_or_none
from ..utils.traversal import traverse_obj
class DrTalksIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?drtalks\.com/videos/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://drtalks.com/videos/six-... | @@ -0,0 +1,56 @@
+import functools
+import urllib.parse
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import extract_attributes
+
+
+class DrTalksIE(InfoExtractor):
+ _VALID_URL = r'https?://event\.drtalks\.com/(?P<id>.+/[^/]+)/?'
+
+ _TESTS = [{
+ 'url': 'http... | yt_dlp/extractor/drtalks.py | 26 | Python | 0.571 | question | 145 | 27 | 52 | false | [ie/DrTalks] Add extractor | 10,831 | yt-dlp/yt-dlp | 132,642 | Python | pzhlkj6612 | pzhlkj6612 |
'name': 'cover_url',
'url': r're:^https?://.*\.jpg',
},
{
'name': 'cover_url_142',
'url': r're:^https?://.*\.jpg',
'width': 180,
'height... | These values are mandatory, right? I would make this whole thing fatal then
```suggestion
seed = float(audio_info['seed'])
``` | 'ext': 'm4a',
'uploader': '小彬彬爱听书',
'uploader_id': '61425525',
'uploader_url': 'http://www.ximalaya.com/zhubo/61425525/',
'title': '261.唐诗三百首.卷八.送孟浩然之广陵.李白',
'description': 'contains:《送孟浩然之广陵》\n作者:李白\n故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.714 | suggestion | 137 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
'width': 180,
'height': 180,
},
],
'categories': ['人文'],
'duration': 93,
'view_count': int,
'like_count': int,
},
},
{
# VIP-restric... | ```suggestion
seed = float(int(211 * seed + 30031) % 65536)
``` | 'thumbnail': r're:^https?://.*\.jpg',
'thumbnails': [
{
'name': 'cover_url',
'url': r're:^https?://.*\.jpg',
},
{
'name': 'cover_url_142',
... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
},
],
'categories': ['人文'],
'duration': 93,
'view_count': int,
'like_count': int,
},
},
{
# VIP-restricted audio
'url': 'https://www.ximalaya.com/sound/562111701',
... | Should be identical to this, no?
```suggestion
r = int(seed / 65536 * len(key))
``` | {
'name': 'cover_url',
'url': r're:^https?://.*\.jpg',
},
{
'name': 'cover_url_142',
'url': r're:^https?://.*\.jpg',
'width': 180,
... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.643 | suggestion | 98 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
{
# VIP-restricted audio
'url': 'https://www.ximalaya.com/sound/562111701',
'only_matching': True,
},
]
@staticmethod
def _decrypt_filename(audio_info):
seed = float_or_none(audio_info['seed'])
file_id = audio_info['fileId']
cgstr ... | ```suggestion
parts = file_id.split('*')
filename = ''.join(cgstr[int(part)] for part in parts if part.isdigit())
``` | 'height': 180,
},
],
'categories': ['人文'],
'duration': 93,
'view_count': int,
'like_count': int,
},
},
{
# VIP-restricted audio
'url': 'https://... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
# VIP-restricted audio
'url': 'https://www.ximalaya.com/sound/562111701',
'only_matching': True,
},
]
@staticmethod
def _decrypt_filename(audio_info):
seed = float_or_none(audio_info['seed'])
file_id = audio_info['fileId']
cgstr = ''
... | ```suggestion
if not filename.startswith('/'):
``` | },
],
'categories': ['人文'],
'duration': 93,
'view_count': int,
'like_count': int,
},
},
{
# VIP-restricted audio
'url': 'https://www.ximalaya.com/sound/562111701',
... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.571 | suggestion | 60 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
file_id = audio_info['fileId']
cgstr = ''
key = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890'
for _ in range(len(key)):
j = 211 * seed + 30031
seed = float_or_none(int_or_none(j) % 65536)
ran = seed / float_or_none(65536)
... | This is just rc4, right?
Maybe we can use some more commonly used names here. | # VIP-restricted audio
'url': 'https://www.ximalaya.com/sound/562111701',
'only_matching': True,
},
]
@staticmethod
def _decrypt_filename(file_id, seed):
cgstr = ''
key = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890'
... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.286 | suggestion | 78 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
@staticmethod
def _decrypt_url_params(audio_info):
def char_code_at(s: str, n: int) -> int:
return ord(s[n]) if n < len(s) else 0
def decrypt(e: str, t: list) -> str:
r = list(range(256))
a = 0
s = ''
for o in range(256):
... | Can't we just iterate over the chars?
```suggestion
for char in key:
``` |
@staticmethod
def _decrypt_url_params(encrypted_params):
params = VideaIE.rc4(
base64.b64decode(encrypted_params), 'xkt3a41psizxrh9l').split('-')
# sign, token, timestamp
return params[1], params[2], params[3]
def _real_extract(self, url):
scheme = 'https' if ur... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.571 | suggestion | 87 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
def char_code_at(s: str, n: int) -> int:
return ord(s[n]) if n < len(s) else 0
def decrypt(e: str, t: list) -> str:
r = list(range(256))
a = 0
s = ''
for o in range(256):
a = (a + r[o] + int_or_none(char_code_at(e, o % len(e))... | How about just this:
```suggestion
if 'a' <= char <= 'z':
``` | def _decrypt_url_params(encrypted_params):
params = VideaIE.rc4(
base64.b64decode(encrypted_params), 'xkt3a41psizxrh9l').split('-')
# sign, token, timestamp
return params[1], params[2], params[3]
def _real_extract(self, url):
scheme = 'https' if url.startswith('https... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.571 | suggestion | 80 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
return filename
@staticmethod
def _decrypt_url_params(audio_info):
def char_code_at(s: str, n: int) -> int:
return ord(s[n]) if n < len(s) else 0
def decrypt(e: str, t: list) -> str:
r = list(range(256))
a = 0
s = ''
for o in... | This looks like a base36 substitution cipher to me | filename = '/' + filename
return filename
@staticmethod
def _decrypt_url_params(encrypted_params):
params = VideaIE.rc4(
base64.b64decode(encrypted_params), 'xkt3a41psizxrh9l').split('-')
# sign, token, timestamp
return params[1], params[2], params[3]
... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.214 | suggestion | 50 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
for o in range(256):
a = (a + r[o] + int_or_none(char_code_at(e, o % len(e)))) % 256
r[o], r[a] = r[a], r[o]
a, o = 0, 0
for u in range(len(t)):
o = (o + 1) % 256
a = (a + r[o]) % 256
r[o], r[a] = r[a], ... | I'd probably use a different variable name and just do:
```suggestion
i = key2.index(a)
``` |
audio_id = self._match_id(url)
audio_info = self._download_json(
f'{scheme}://m.ximalaya.com/tracks/{audio_id}.json', audio_id,
'Downloading info json', 'Unable to download info file')
formats = []
# NOTE: VIP-restricted audio
if audio_info.get('is_paid'... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.786 | suggestion | 110 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
s += chr(t[u] ^ r[(r[o] + r[a]) % 256])
return s
def decrypt2(key: str, key2: list) -> str:
n = []
for r in range(len(key)):
a = ord('a')
if ord('a') <= ord(key[r]) <= ord('z'):
a = ord(key[r]) - 97
... | Maybe I am missing something, but isn't this just base64?
```python
return list(base64.b64decode(s))
``` | ts = int(time.time())
vip_info = self._download_json(
f'{scheme}://mpay.ximalaya.com/mobile/track/pay/{audio_id}/{ts}',
audio_id, 'Downloading VIP info json', 'Unable to download VIP info file',
query={'device': 'pc', 'isBackend': 'true', '_': ts})... | @@ -71,8 +72,157 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.714 | suggestion | 107 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
i.append(((t & 3) << 6) | n)
return i
o = 'g3utf1k6yxdwi0'
u = [19, 1, 4, 7, 30, 14, 28, 8, 24, 17, 6, 35, 34, 16, 9, 10, 13, 22,
32, 29, 31, 21, 18, 3, 2, 23, 25, 27, 11, 20, 5, 15, 12, 0, 33, 26]
s1 = decrypt3(audio_info['ep'])
s2 = decrypt(de... | The default value of get is `None` which is also falsy
```suggestion
if audio_info.get('is_paid'):
``` | },
'playlist_mincount': 323,
}, {
'url': 'https://www.ximalaya.com/album/6912905',
'info_dict': {
'title': '埃克哈特《修炼当下的力量》',
'id': '6912905',
},
'playlist_mincount': 41,
}]
def _real_extract(self, url):
playlist_id = self._match... | @@ -82,6 +232,24 @@ def _real_extract(self, url):
audio_info_file, audio_id,
f'Downloading info json {audio_info_file}', 'Unable to download info file')
+ # NOTE(xcsong): VIP-restricted audio
+ if audio_info.get('is_paid', False): | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.714 | suggestion | 113 | 51 | 37 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
for _ in range(len(key)):
seed = float(int(211 * seed + 30031) % 65536)
r = int(seed / 65536 * len(key))
cgstr += key[r]
key = key.replace(key[r], '')
parts = file_id.split('*')
filename = ''.join(cgstr[int(part)] for part in parts if part.isdigit(... | I know this was here before, but can you please simplify this using:
```suggestion
f'{scheme}://m.ximalaya.com/tracks/{audio_id}.json', audio_id,
'Downloading info json', 'Unable to download info file')
``` |
@staticmethod
def _decrypt_filename(file_id, seed):
cgstr = ''
key = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890'
for _ in key:
seed = float(int(211 * seed + 30031) % 65536)
r = int(seed / 65536 * len(key))
cgstr += key[r]
... | @@ -82,6 +114,24 @@ def _real_extract(self, url):
audio_info_file, audio_id,
f'Downloading info json {audio_info_file}', 'Unable to download info file') | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.857 | refactor | 234 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
filename = '/' + filename
return filename
@staticmethod
def _decrypt_url_params(audio_info):
params = VideaIE.rc4(base64.b64decode(audio_info['ep']),
'xkt3a41psizxrh9l').split('-')
sign, token, timestamp = params[1], params[2], params[3]
... | Same thing here:
```suggestion
audio_info = self._download_json(
f'{scheme}://mpay.ximalaya.com/mobile/track/pay/{audio_id}/{ts}',
audio_id, 'Downloading VIP info json', 'Unable to download VIP info file',
query={'device': 'pc', 'isBackend': 'true', '_': ... | cgstr += key[r]
key = key.replace(key[r], '')
parts = file_id.split('*')
filename = ''.join(cgstr[int(part)] for part in parts if part.isdecimal())
if not filename.startswith('/'):
filename = '/' + filename
return filename
@staticmethod
def _d... | @@ -82,6 +114,24 @@ def _real_extract(self, url):
audio_info_file, audio_id,
f'Downloading info json {audio_info_file}', 'Unable to download info file')
+ # NOTE(xcsong): VIP-restricted audio
+ if audio_info.get('is_paid'):
+ ts = int(time.time())
+ audio_... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.857 | security | 733 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
return sign, token, timestamp
def _real_extract(self, url):
scheme = 'https' if url.startswith('https') else 'http'
audio_id = self._match_id(url)
audio_info_file = f'{scheme}://m.ximalaya.com/tracks/{audio_id}.json'
audio_info = self._download_json(
audio_info_... | I would write this like so:
```suggestion
audio_info['play_path_64'] = update_url_query(
f'{audio_info['domain']}/download/{audio_info['apiVersion']}{filename}', {
'sign': sign,
'token': token,
'timestamp': timestamp,
... | @staticmethod
def _decrypt_url_params(encrypted_params):
params = VideaIE.rc4(
base64.b64decode(encrypted_params), 'xkt3a41psizxrh9l').split('-')
# sign, token, timestamp
return params[1], params[2], params[3]
def _real_extract(self, url):
scheme = 'https' if url... | @@ -82,6 +114,24 @@ def _real_extract(self, url):
audio_info_file, audio_id,
f'Downloading info json {audio_info_file}', 'Unable to download info file')
+ # NOTE(xcsong): VIP-restricted audio
+ if audio_info.get('is_paid'):
+ ts = int(time.time())
+ audio_... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.857 | refactor | 689 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | xingchensong |
},
],
'categories': ['人文'],
'duration': 93,
'view_count': int,
'like_count': int,
},
},
{
# VIP-restricted audio
'url': 'https://www.ximalaya.com/sound/562111701',
... | I think `isdecimal` is what we want here
```suggestion
filename = ''.join(cgstr[int(part)] for part in parts if part.isdecimal())
``` | },
],
'categories': ['人文'],
'duration': 93,
'view_count': int,
'like_count': int,
},
},
{
# VIP-restricted audio
'url': 'https://www.ximalaya.com/sound/562111701',
... | @@ -71,23 +81,92 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.714 | suggestion | 144 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | xingchensong |
},
{
'name': 'cover_url_142',
'url': r're:^https?://.*\.jpg',
'width': 180,
'height': 180,
},
],
'categories': ['人文'],
... | i meant do this
```suggestion
for _ in key:
``` | },
{
'name': 'cover_url_142',
'url': r're:^https?://.*\.jpg',
'width': 180,
'height': 180,
},
],
'categories': ['人文'],
... | @@ -71,23 +81,92 @@ class XimalayaIE(XimalayaBaseIE):
'like_count': int,
},
},
+ {
+ # VIP-restricted audio
+ 'url': 'https://www.ximalaya.com/sound/562111701',
+ 'only_matching': True,
+ },
]
+ @staticmethod
+ def _decry... | yt_dlp/extractor/ximalaya.py | 26 | Python | 0.571 | suggestion | 58 | 51 | 51 | false | [ximalaya.com] Add VIP support | 10,832 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | xingchensong |
}, {
'url': 'https://www.dailymotion.com/video/x3z49k?playlist=xv4bw',
'only_matching': True,
}, {
'url': 'https://geo.dailymotion.com/player/x86gw.html?video=k46oCapRs4iikoz9DWy',
'only_matching': True,
}, {
'url': 'https://geo.dailymotion.com/player/xakln.html?video... | ```suggestion
r'(?s)<script [^>]*\bsrc=(["\'])(?:https?:)?//[\w-]+\.dailymotion\.com/player/(?:(?!\1).)+\1[^>]*>', webpage):
``` | }, {
'url': 'https://www.lequipe.fr/video/x791mem',
'only_matching': True,
}, {
'url': 'https://www.lequipe.fr/video/k7MtHciueyTcrFtFKA2',
'only_matching': True,
}, {
'url': 'https://www.dailymotion.com/video/x3z49k?playlist=xv4bw',
'only_matching': True,
... | @@ -232,6 +234,13 @@ def _extract_embed_urls(cls, url, webpage):
for mobj in re.finditer(
r'(?s)DM\.player\([^,]+,\s*{.*?video[\'"]?\s*:\s*["\']?(?P<id>[0-9a-zA-Z]+).+?}\s*\);', webpage):
yield from 'https://www.dailymotion.com/embed/video/' + mobj.group('id')
+ for mobj in... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.714 | suggestion | 146 | 51 | 51 | false | [ie/Dailymotion] Improve embed extraction | 10,843 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'only_matching': True,
}, {
'url': 'https://geo.dailymotion.com/player/xakln.html?video=x8mjju4&customConfig%5BcustomParams%5D=%2Ffr-fr%2Ftennis%2Fwimbledon-mens-singles%2Farticles-video',
'only_matching': True,
}]
_GEO_BYPASS = False
_COMMON_MEDIA_FIELDS = '''description
g... | ```suggestion
player_url = url_or_none(attrs.get('src'))
if not player_url:
continue
player_url = player_url.replace('.js', '.html')
if player_url.startswith('//'):
player_url = f'https:{player_url}'
if video_id := attrs.... | 'only_matching': True,
}, {
'url': 'https://www.dailymotion.com/video/x3z49k?playlist=xv4bw',
'only_matching': True,
}, {
'url': 'https://geo.dailymotion.com/player/x86gw.html?video=k46oCapRs4iikoz9DWy',
'only_matching': True,
}, {
'url': 'https://geo.dailymot... | @@ -232,6 +234,13 @@ def _extract_embed_urls(cls, url, webpage):
for mobj in re.finditer(
r'(?s)DM\.player\([^,]+,\s*{.*?video[\'"]?\s*:\s*["\']?(?P<id>[0-9a-zA-Z]+).+?}\s*\);', webpage):
yield from 'https://www.dailymotion.com/embed/video/' + mobj.group('id')
+ for mobj in... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.857 | suggestion | 621 | 51 | 51 | false | [ie/Dailymotion] Improve embed extraction | 10,843 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
import functools
import json
import re
import urllib.parse
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
OnDemandPagedList,
age_restricted,
clean_html,
extract_attributes,
int_or_none,
traverse_obj,
try_get,
une... | ```suggestion
update_url,
url_or_none,
``` | import functools
import json
import re
import urllib.parse
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
OnDemandPagedList,
age_restricted,
clean_html,
extract_attributes,
int_or_none,
traverse_obj,
try_get,
une... | @@ -10,11 +10,13 @@
OnDemandPagedList,
age_restricted,
clean_html,
+ extract_attributes,
int_or_none,
traverse_obj,
try_get,
unescapeHTML,
unsmuggle_url,
+ url_or_none, | yt_dlp/extractor/dailymotion.py | 20 | Python | 0.571 | suggestion | 53 | 45 | 45 | false | [ie/Dailymotion] Improve embed extraction | 10,843 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'only_matching': True,
}, {
'url': 'https://geo.dailymotion.com/player/xakln.html?video=x8mjju4&customConfig%5BcustomParams%5D=%2Ffr-fr%2Ftennis%2Fwimbledon-mens-singles%2Farticles-video',
'only_matching': True,
}]
_GEO_BYPASS = False
_COMMON_MEDIA_FIELDS = '''description
g... | There appear to be two types of embeds video and playlist embeds. Could you extend this PR to also match `data-playlist` embeds?
Also, please add `_WEBPAGE_TESTS`. Here two sample URLs:
- Video: https://www.financialounge.com/video/2024/08/01/borse-europee-in-rosso-dopo-la-fed-a-milano-volano-mediobanca-e-tim-edizion... | 'only_matching': True,
}, {
'url': 'https://www.dailymotion.com/video/x3z49k?playlist=xv4bw',
'only_matching': True,
}, {
'url': 'https://geo.dailymotion.com/player/x86gw.html?video=k46oCapRs4iikoz9DWy',
'only_matching': True,
}, {
'url': 'https://geo.dailymot... | @@ -232,6 +234,13 @@ def _extract_embed_urls(cls, url, webpage):
for mobj in re.finditer(
r'(?s)DM\.player\([^,]+,\s*{.*?video[\'"]?\s*:\s*["\']?(?P<id>[0-9a-zA-Z]+).+?}\s*\);', webpage):
yield from 'https://www.dailymotion.com/embed/video/' + mobj.group('id')
+ for mobj in... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.786 | suggestion | 427 | 51 | 51 | false | [ie/Dailymotion] Improve embed extraction | 10,843 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
'id': 'x93blhi',
'ext': 'mp4',
'title': 'OnAir - 01/08/24',
'description': '',
'duration': 217,
'timestamp': 1722505658,
'upload_date': '20240801',
'uploader': 'Financialounge',
'uploader_id': 'x2vtgmm',
... | ```suggestion
# https://www.dailymotion.com/crawler/video/x8u4owg
'url': 'https://www.leparisien.fr/environnement/video-le-veloto-la-voiture-a-pedales-qui-aimerait-se-faire-une-place-sur-les-routes-09-03-2024-KCYMCPM4WFHJXMSKBUI66UNFPU.php',
``` | 'url': 'https://www.financialounge.com/video/2024/08/01/borse-europee-in-rosso-dopo-la-fed-a-milano-volano-mediobanca-e-tim-edizione-del-1-agosto/',
'info_dict': {
'id': 'x93blhi',
'ext': 'mp4',
'title': 'OnAir - 01/08/24',
'description': '',
'... | @@ -217,6 +232,53 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
}, {
'url': 'https://geo.dailymotion.com/player/xakln.html?video=x8mjju4&customConfig%5BcustomParams%5D=%2Ffr-fr%2Ftennis%2Fwimbledon-mens-singles%2Farticles-video',
'only_matching': True,
+ }, {
+ 'url': 'https://g... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.786 | suggestion | 264 | 51 | 51 | false | [ie/Dailymotion] Improve embed extraction | 10,843 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
title = error.get('title') or error['raw_message']
# See https://developer.dailymotion.com/api#access-error
if error.get('code') == 'DM007':
allowed_countries = try_get(media, lambda x: x['geoblockedCountries']['allowed'], list)
self.raise_geo_restrict... | It's unlikely that this was meant to yield `'h'`, `'t'`, `'t'`, etc:
```suggestion
yield 'https://www.dailymotion.com/embed/video/' + mobj.group('id')
``` | 'thumbnail': 'https://www.leparisien.fr/resizer/ho_GwveeYftNkLwg_cEta--5Bv4=/1200x675/cloudfront-eu-central-1.images.arcpublishing.com/leparisien/BFXJNEBN75EUNHGYJLORUC3TX4.jpg',
'upload_date': '20240309',
'view_count': int,
'timestamp': 1709997866,
'age_limit... | @@ -232,16 +297,35 @@ def _extract_embed_urls(cls, url, webpage):
for mobj in re.finditer(
r'(?s)DM\.player\([^,]+,\s*{.*?video[\'"]?\s*:\s*["\']?(?P<id>[0-9a-zA-Z]+).+?}\s*\);', webpage):
yield from 'https://www.dailymotion.com/embed/video/' + mobj.group('id') | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.714 | suggestion | 171 | 51 | 51 | false | [ie/Dailymotion] Improve embed extraction | 10,843 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | pzhlkj6612 |
for format_id, format_url in options['video_balancer'].items():
ext = determine_ext(format_url)
if ext == 'm3u8':
formats.extend(self._extract_m3u8_formats(
format_url, video_id, 'mp4', m3u8_id=format_id, fatal=False))
elif ext == 'f4m':
... | As `https://rutube.ru/live/video/private/c58f502c7bb34a8fcdd976b221fca292/` is also valid, I would do:
```suggestion
_VALID_URL = r'https?://rutube\.ru/(?:(?:live/)?video(?:/private)?|(?:play/)?embed)/(?P<id>[\da-z]{32})'
``` | for format_id, format_url in options['video_balancer'].items():
ext = determine_ext(format_url)
if ext == 'm3u8':
formats.extend(self._extract_m3u8_formats(
format_url, video_id, 'mp4', m3u8_id=format_id, fatal=False))
elif ext == 'f4m':
... | @@ -90,7 +93,7 @@ def _download_and_extract_formats(self, video_id, query=None):
class RutubeIE(RutubeBaseIE):
IE_NAME = 'rutube'
IE_DESC = 'Rutube videos'
- _VALID_URL = r'https?://rutube\.ru/(?:video(?:/private)?|(?:play/)?embed)/(?P<id>[\da-z]{32})'
+ _VALID_URL = r'https?://rutube\.ru/(?:video(?:/p... | yt_dlp/extractor/rutube.py | 26 | Python | 0.786 | suggestion | 232 | 51 | 51 | false | [ie/Rutube] Support livestreams | 10,844 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
if not query:
query = {}
query['format'] = 'json'
return self._download_json(
f'http://rutube.ru/api/play/options/{video_id}/',
video_id, 'Downloading options JSON',
'Unable to download options JSON',
headers=self.geo_verification_heade... | ```suggestion
formats.extend(self._extract_m3u8_formats(hls_url, video_id, ext='mp4', fatal=False))
``` | if not query:
query = {}
query['format'] = 'json'
return self._download_json(
f'http://rutube.ru/api/play/options/{video_id}/',
video_id, 'Downloading options JSON',
'Unable to download options JSON',
headers=self.geo_verification_heade... | @@ -80,6 +81,8 @@ def _extract_formats(self, options, video_id):
'url': format_url,
'format_id': format_id,
})
+ for hls_url in traverse_obj(options, ('live_streams', 'hls', ..., 'url', {url_or_none})):
+ formats += self._extract_m3u8_formats(... | yt_dlp/extractor/rutube.py | 26 | Python | 0.786 | refactor | 117 | 51 | 51 | false | [ie/Rutube] Support livestreams | 10,844 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
(r'ownerName\s*:\s*"([^"]+)"', *self._og_regexes('title')), webpage, 'uploader', fatal=False))
timestamp = int_or_none(self._search_regex(
r'<abbr[^>]+data-utime=["\'](\d+)', webpage,
'timestamp', default=None))
thumbnail = self._html_search_me... | Those are not valid info dicts values. Please have a look for what values are allowed to be returned here: https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/extractor/common.py#L104
I'm not sure what `unified_reactors_count` means, are those effectively the likes? Then `like_count` could be used.
`total_comment_c... | r'<abbr[^>]+data-utime=["\'](\d+)', webpage,
'timestamp', default=None))
thumbnail = self._html_search_meta(
['og:image', 'twitter:image'], webpage, 'thumbnail', default=None)
# some webpages contain unretrievable thumbnail urls
# like ... | @@ -524,6 +530,10 @@ def extract_metadata(webpage):
webpage, 'view count', default=None)),
'concurrent_view_count': get_first(post, (
('video', (..., ..., 'attachments', ..., 'media')), 'liveViewerCount', {int_or_none})),
+ 'unified_reactors_coun... | yt_dlp/extractor/facebook.py | 26 | Python | 0.643 | bug | 567 | 51 | 51 | false | [extractor/facebook] Add extract total_comment_count, unified_reactors_count and share_count of the video. (yt-dlp#10824) | 10,858 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lengzuo |
if not redirect_url:
raise ExtractorError('Invalid facebook redirect URL', expected=True)
return self.url_result(redirect_url)
class FacebookReelIE(InfoExtractor):
_VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/reel/(?P<id>\d+)'
IE_NAME = 'facebook:reel'
_TESTS = [{
... | Don't hardcode the values; otherwise the test would fail if someone shares or comments on this video. Just match that they are of type int. | raise ExtractorError('Invalid facebook redirect URL', expected=True)
return self.url_result(redirect_url)
class FacebookReelIE(InfoExtractor):
_VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/reel/(?P<id>\d+)'
IE_NAME = 'facebook:reel'
_TESTS = [{
'url': 'https://www.faceboo... | @@ -944,6 +954,10 @@ class FacebookReelIE(InfoExtractor):
'timestamp': 1637502609,
'upload_date': '20211121',
'thumbnail': r're:^https?://.*',
+ 'total_comment_count': 21,
+ 'unified_reactors_count': 356,
+ 'share_count': 81, | yt_dlp/extractor/facebook.py | 26 | Python | 0.5 | bug | 139 | 51 | 51 | false | [extractor/facebook] Add extract total_comment_count, unified_reactors_count and share_count of the video. (yt-dlp#10824) | 10,858 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lengzuo |
or self._search_regex(
(r'ownerName\s*:\s*"([^"]+)"', *self._og_regexes('title')), webpage, 'uploader', fatal=False))
timestamp = int_or_none(self._search_regex(
r'<abbr[^>]+data-utime=["\'](\d+)', webpage,
'timestamp', default=None))
... | Looking at the data the page returns, maybe `likers` seems like the better choice for `like_count`. Not sure if we really have a field that `unified_reactors` could map to.
We can also simplify and ensure the correct type is returned:
```suggestion
**traverse_obj(post_stats, {
'l... | (r'ownerName\s*:\s*"([^"]+)"', *self._og_regexes('title')), webpage, 'uploader', fatal=False))
timestamp = int_or_none(self._search_regex(
r'<abbr[^>]+data-utime=["\'](\d+)', webpage,
'timestamp', default=None))
thumbnail = self._html_search_me... | @@ -524,6 +529,9 @@ def extract_metadata(webpage):
webpage, 'view count', default=None)),
'concurrent_view_count': get_first(post, (
('video', (..., ..., 'attachments', ..., 'media')), 'liveViewerCount', {int_or_none})),
+ 'like_count': post_stat... | yt_dlp/extractor/facebook.py | 26 | Python | 1 | refactor | 531 | 51 | 51 | false | [extractor/facebook] Add extract total_comment_count, unified_reactors_count and share_count of the video. (yt-dlp#10824) | 10,858 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lengzuo |
'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_response = self._download_webpage(check_r... | These two lines can just be combined to:
```suggestion
post_stats = traverse_obj(post, (
lambda _, v: v['short_form_video_context']['video']['id'] == video_id and v[
'url'] == f'https://www.facebook.com/reel/{video_id}/', 'feedback', {dict}, any)) or {}
```
Though m... |
check_form = {
'fb_dtsg': fb_dtsg,
'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlenco... | @@ -481,6 +481,10 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.786 | suggestion | 388 | 51 | 51 | false | [extractor/facebook] Add extract total_comment_count, unified_reactors_count and share_count of the video. (yt-dlp#10824) | 10,858 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lengzuo |
timestamp = int_or_none(self._search_regex(
r'<abbr[^>]+data-utime=["\'](\d+)', webpage,
'timestamp', default=None))
thumbnail = self._html_search_meta(
['og:image', 'twitter:image'], webpage, 'thumbnail', default=None)
# some webpages ... | Oh, I think I didn't express myself well initially.
yt-dlp has a list of allowed values that can be returned as part of the info dict. https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/extractor/common.py#L104
`reactor_count` is not one of them. As yt-dlp is not intended to be a universal metadata scraper, we won't... | timestamp = int_or_none(self._search_regex(
r'<abbr[^>]+data-utime=["\'](\d+)', webpage,
'timestamp', default=None))
thumbnail = self._html_search_meta(
['og:image', 'twitter:image'], webpage, 'thumbnail', default=None)
# some webpages ... | @@ -524,6 +528,12 @@ def extract_metadata(webpage):
webpage, 'view count', default=None)),
'concurrent_view_count': get_first(post, (
('video', (..., ..., 'attachments', ..., 'media')), 'liveViewerCount', {int_or_none})),
+ **traverse_obj(post_st... | yt_dlp/extractor/facebook.py | 26 | Python | 0.857 | refactor | 637 | 51 | 51 | false | [extractor/facebook] Add extract total_comment_count, unified_reactors_count and share_count of the video. (yt-dlp#10824) | 10,858 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lengzuo |
'id': 'Ve8KNkJ5',
'title': '夏☀️\nムービーへのポイントは本イベントに加算されないので配信にてお願い致します🙇🏻\u200d♀️\n#TGCCAMPUS #ミス東大 #ミス東大2024 ',
'ext': 'mp4',
'uploader': 'ミス東大No.5 松藤百香🍑💫',
'uploader_id': 12299174,
'channel_follower_count': int,
'view_count': int,
... | Since the URL is mandatory:
```suggestion
'formats': [{
'format_id': 'mp4',
'url': data['movie']['file'],
'ext': 'mp4',
}],
``` | 'title': '夏☀️\nムービーへのポイントは本イベントに加算されないので配信にてお願い致します🙇🏻\u200d♀️\n#TGCCAMPUS #ミス東大 #ミス東大2024 ',
'ext': 'mp4',
'uploader': 'ミス東大No.5 松藤百香🍑💫',
'uploader_id': '12299174',
'channel_follower_count': int,
'view_count': int,
'like_count': int... | @@ -116,3 +117,88 @@ def _real_extract(self, url):
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
}
+
+
+class MixchMovieIE(InfoExtractor):
+ IE_NAME = 'mixch:movie'
+ _VALID_URL = ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.786 | suggestion | 206 | 51 | 44 | false | [ie/MixchMovie] Add extractor | 10,897 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Sakura286 |
'ext': 'mp4',
'uploader': 'ミス東大No.5 松藤百香🍑💫',
'uploader_id': 12299174,
'channel_follower_count': int,
'view_count': int,
'like_count': int,
'comment_count': int,
'uploader_url': 'https://mixch.tv/u/12299174',
'l... | Instead of force converting to string, I'd rather check the type. Imagine if they turned the title in to a dict with `short` and `normal` as keys. `{str}` will just return no title, `{str_or_none}` will stringify that returning bad data.
```suggestion
'title': ('movie', 'title', {str}),
``` | 'uploader': 'ミス東大No.5 松藤百香🍑💫',
'uploader_id': '12299174',
'channel_follower_count': int,
'view_count': int,
'like_count': int,
'comment_count': int,
'timestamp': 1724070828,
'uploader_url': 'https://mixch.tv/u/12299174',
... | @@ -116,3 +117,88 @@ def _real_extract(self, url):
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
}
+
+
+class MixchMovieIE(InfoExtractor):
+ IE_NAME = 'mixch:movie'
+ _VALID_URL = ... | yt_dlp/extractor/mixch.py | 26 | Python | 1 | suggestion | 310 | 51 | 42 | false | [ie/MixchMovie] Add extractor | 10,897 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Sakura286 |
'uploader_id': 12299174,
'channel_follower_count': int,
'view_count': int,
'like_count': int,
'comment_count': int,
'uploader_url': 'https://mixch.tv/u/12299174',
'live_status': 'not_live',
},
}, {
'url': 'https://mi... | ```suggestion
'uploader': ('ownerInfo', 'name', {str}),
``` | 'channel_follower_count': int,
'view_count': int,
'like_count': int,
'comment_count': int,
'timestamp': 1724070828,
'uploader_url': 'https://mixch.tv/u/12299174',
'live_status': 'not_live',
'upload_date': '20240819',
... | @@ -116,3 +117,88 @@ def _real_extract(self, url):
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
}
+
+
+class MixchMovieIE(InfoExtractor):
+ IE_NAME = 'mixch:movie'
+ _VALID_URL = ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 40 | false | [ie/MixchMovie] Add extractor | 10,897 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Sakura286 |
},
}, {
'url': 'https://mixch.tv/m/61DzpIKE',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
data = self._download_json(
f'https://mixch.tv/api-web/movies/{video_id}', video_id)
return {
'id': vi... | Let's add the timestamp and inline this
```suggestion
'timestamp': ('movie', 'published', {int_or_none}),
'uploader_url': ('ownerInfo', 'id', {lambda x: x and f'https://mixch.tv/u/{x}'}),
}),
```
Tests will need to be updated. | 'upload_date': '20240819',
},
}, {
'url': 'https://mixch.tv/m/61DzpIKE',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
data = self._download_json(
f'https://mixch.tv/api-web/movies/{video_id}', video_id... | @@ -116,3 +117,88 @@ def _real_extract(self, url):
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
}
+
+
+class MixchMovieIE(InfoExtractor):
+ IE_NAME = 'mixch:movie'
+ _VALID_URL = ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.786 | suggestion | 276 | 51 | 33 | false | [ie/MixchMovie] Add extractor | 10,897 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Sakura286 |
# There are up to 20 comments in one json file.
while has_next:
yield from traverse_obj(data,
('comments', lambda k, v: v['comment'], {
'author': ('user_name', {str_or_none}),
... | I don't think the extractor should have a hard limit on the number of comments that can be extracted. Maybe there can be an extractor arg, but generally, I would say the user is responsible for picking an appropriate sleep interval.
If forbidden messages are common, we could implement some retry logic.
I would also... | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
UserNotLive,
int_or_none,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MixchIE(InfoExtractor):
IE_NAME = 'mixch'
_VALID_URL = r'https?://mix... | @@ -116,3 +117,88 @@ def _real_extract(self, url):
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
}
+
+
+class MixchMovieIE(InfoExtractor):
+ IE_NAME = 'mixch:movie'
+ _VALID_URL = ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.857 | bug | 1,315 | 27 | 172 | false | [ie/MixchMovie] Add extractor | 10,897 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Sakura286 |
base_url = f'https://mixch.tv/api-web/movies/{video_id}/comments'
has_next = True
next_cursor = ''
fragment = 1
while has_next and (comments_left > 0):
data = self._download_json(
base_url, video_id,
note=f'Downloading comments, fragme... | This does not need to be an extractor arg since `--sleep-requests` can just be used. | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
UserNotLive,
int_or_none,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MixchIE(InfoExtractor):
IE_NAME = 'mixch'
_VALID_URL = r'https?://mix... | @@ -116,3 +117,95 @@ def _real_extract(self, url):
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
}
+
+
+class MixchMovieIE(InfoExtractor):
+ IE_NAME = 'mixch:movie'
+ _VALID_URL = ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.429 | refactor | 84 | 30 | 172 | false | [ie/MixchMovie] Add extractor | 10,897 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Sakura286 |
'timestamp': 1724070828,
'uploader_url': 'https://mixch.tv/u/12299174',
'live_status': 'not_live',
'upload_date': '20240819',
},
}, {
'url': 'https://mixch.tv/m/61DzpIKE',
'only_matching': True,
}]
def _real_extract(self, url):
... | shouldn't be int
```suggestion
'uploader_id': ('ownerInfo', 'id', {str}),
```
or
```suggestion
'uploader_id': ('ownerInfo', 'id', {int}, {str_or_none}),
``` | 'timestamp': 1724070828,
'uploader_url': 'https://mixch.tv/u/12299174',
'live_status': 'not_live',
'upload_date': '20240819',
},
}, {
'url': 'https://mixch.tv/m/61DzpIKE',
'only_matching': True,
}]
def _real_extract(self, url):
... | @@ -116,3 +116,56 @@ def _real_extract(self, url):
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
}
+
+
+class MixchMovieIE(InfoExtractor):
+ IE_NAME = 'mixch:movie'
+ _VALID_URL = ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.786 | suggestion | 197 | 36 | 36 | false | [ie/MixchMovie] Add extractor | 10,897 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Sakura286 |
'ext': 'mp3',
'title': '207 - Whitney Webb Returns',
'description': 'md5:75ef4316031df7b41ced4e7b987f79c6',
'upload_date': '20200705',
'timestamp': 1593932400,
'duration': 5369,
'series': 'The Tim Dillon Show',
'thumbnail': ... | This data is mandatory, so we might as well make extraction fatal:
```suggestion
episode_id)[0]['data']
``` | 'id': '1000482637777',
'ext': 'mp3',
'title': '207 - Whitney Webb Returns',
'episode': '207 - Whitney Webb Returns',
'episode_number': 207,
'description': 'md5:75ef4316031df7b41ced4e7b987f79c6',
'upload_date': '20200705',
't... | @@ -39,47 +51,25 @@ class ApplePodcastsIE(InfoExtractor):
def _real_extract(self, url):
episode_id = self._match_id(url)
webpage = self._download_webpage(url, episode_id)
- episode_data = {}
- ember_data = {}
- # new page type 2021-11
- amp_data = self._parse_json(self... | yt_dlp/extractor/applepodcasts.py | 26 | Python | 0.786 | refactor | 122 | 46 | 48 | false | [ie/ApplePodcasts] Fix extractor | 10,903 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | coreywright |
'thumbnail': 're:.+[.](png|jpe?g|webp)',
},
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
'only_matching': True,
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns?i=1000482637777',
... | Instead of parsing the json-ld schema ourselves, we can use the already existing helper functions
```suggestion
``` | 'timestamp': 1593932400,
'duration': 5369,
'series': 'The Tim Dillon Show',
'thumbnail': 're:.+[.](png|jpe?g|webp)',
},
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
'only_matching': Tru... | @@ -39,47 +51,25 @@ class ApplePodcastsIE(InfoExtractor):
def _real_extract(self, url):
episode_id = self._match_id(url)
webpage = self._download_webpage(url, episode_id)
- episode_data = {}
- ember_data = {}
- # new page type 2021-11
- amp_data = self._parse_json(self... | yt_dlp/extractor/applepodcasts.py | 26 | Python | 0.786 | refactor | 117 | 39 | 41 | false | [ie/ApplePodcasts] Fix extractor | 10,903 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | coreywright |
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
'only_matching': True,
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns?i=1000482637777',
'only_matching': True,
}, {
'url': 'https://podcas... | ```suggestion
'id': episode_id,
**self._json_ld(
traverse_obj(server_data, ('seoData', 'schemaContent', {dict}))
or self._yield_json_ld(webpage, episode_id, fatal=False), episode_id, fatal=False),
```
You will need to also modify `_json_ld` in `InfoExtract... | 'series': 'The Tim Dillon Show',
'thumbnail': 're:.+[.](png|jpe?g|webp)',
},
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
'only_matching': True,
}, {
'url': 'https://podcasts.apple.com/podcast/207-... | @@ -39,47 +51,25 @@ class ApplePodcastsIE(InfoExtractor):
def _real_extract(self, url):
episode_id = self._match_id(url)
webpage = self._download_webpage(url, episode_id)
- episode_data = {}
- ember_data = {}
- # new page type 2021-11
- amp_data = self._parse_json(self... | yt_dlp/extractor/applepodcasts.py | 26 | Python | 1 | security | 783 | 37 | 39 | false | [ie/ApplePodcasts] Fix extractor | 10,903 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | coreywright |
'series': 'The Tim Dillon Show',
'thumbnail': 're:.+[.](png|jpe?g|webp)',
},
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
'only_matching': True,
}, {
'url': 'https://podcasts.apple.com/podcast/207-... | Let's simplify this to:
```suggestion
model_data = traverse_obj(server_data, (
'headerButtonItems', lambda _, v: v['$kind'] == 'bookmark' and v['modelType'] == 'EpisodeOffer',
'model', {dict}, any))
```
Also, was there any reason for choosing `bookmark`/`EpisodeOffer`? `download`/`... | 'upload_date': '20200705',
'timestamp': 1593932400,
'duration': 5369,
'series': 'The Tim Dillon Show',
'thumbnail': 're:.+[.](png|jpe?g|webp)',
},
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns/id1135137367?i=10004... | @@ -39,47 +51,25 @@ class ApplePodcastsIE(InfoExtractor):
def _real_extract(self, url):
episode_id = self._match_id(url)
webpage = self._download_webpage(url, episode_id)
- episode_data = {}
- ember_data = {}
- # new page type 2021-11
- amp_data = self._parse_json(self... | yt_dlp/extractor/applepodcasts.py | 26 | Python | 1 | refactor | 386 | 40 | 42 | false | [ie/ApplePodcasts] Fix extractor | 10,903 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | coreywright |
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns?i=1000482637777',
'only_matching': True,
}, {
'url': 'https://podcasts.apple.com/podcast/id1135137367?i=1000482637777',
'only_matching': True,
}]
def _real_extract(self, url):
episode_id = s... | Let's bring this up to date with the modern yt-dlp code style:
```suggestion
**traverse_obj(model_data, {
'title': ('title', {str}),
'url': ('streamUrl', {clean_podcast_url}),
'timestamp': ('releaseDate', {parse_iso8601}),
'duration': ('d... | }, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns?i=1000482637777',
'only_matching': True,
}, {
'url': 'https://podcasts.apple.com/podcast/id1135137367?i=1000482637777',
'only_matching': True,
}]
def _real_extract(self, url):
episode_id = s... | @@ -39,47 +54,21 @@ class ApplePodcastsIE(InfoExtractor):
def _real_extract(self, url):
episode_id = self._match_id(url)
webpage = self._download_webpage(url, episode_id)
- episode_data = {}
- ember_data = {}
- # new page type 2021-11
- amp_data = self._parse_json(self... | yt_dlp/extractor/applepodcasts.py | 26 | Python | 0.929 | suggestion | 367 | 30 | 33 | false | [ie/ApplePodcasts] Fix extractor | 10,903 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | coreywright |
from .common import InfoExtractor
from ..utils import (
clean_podcast_url,
get_element_by_id,
parse_iso8601,
traverse_obj,
)
class ApplePodcastsIE(InfoExtractor):
_VALID_URL = r'https?://podcasts\.apple\.com/(?:[^/]+/)?podcast(?:/[^/]+){1,2}.*?\bi=(?P<id>\d+)'
_TESTS = [{
'url': 'https... | ```suggestion
int_or_none,
``` | from .common import InfoExtractor
from ..utils import (
clean_podcast_url,
int_or_none,
parse_iso8601,
)
from ..utils.traversal import traverse_obj
class ApplePodcastsIE(InfoExtractor):
_VALID_URL = r'https?://podcasts\.apple\.com/(?:[^/]+/)?podcast(?:/[^/]+){1,2}.*?\bi=(?P<id>\d+)'
_TESTS = [{
... | @@ -1,27 +1,42 @@
from .common import InfoExtractor
from ..utils import (
- clean_html,
clean_podcast_url,
- get_element_by_class,
- int_or_none,
+ get_element_by_id, | yt_dlp/extractor/applepodcasts.py | 4 | Python | 0.429 | suggestion | 36 | 29 | 29 | false | [ie/ApplePodcasts] Fix extractor | 10,903 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | coreywright |
from .common import InfoExtractor
from ..utils import (
clean_podcast_url,
get_element_by_id,
parse_iso8601,
traverse_obj,
)
class ApplePodcastsIE(InfoExtractor):
_VALID_URL = r'https?://podcasts\.apple\.com/(?:[^/]+/)?podcast(?:/[^/]+){1,2}.*?\bi=(?P<id>\d+)'
_TESTS = [{
'url': 'https... | ```suggestion
)
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from ..utils import (
clean_podcast_url,
int_or_none,
parse_iso8601,
)
from ..utils.traversal import traverse_obj
class ApplePodcastsIE(InfoExtractor):
_VALID_URL = r'https?://podcasts\.apple\.com/(?:[^/]+/)?podcast(?:/[^/]+){1,2}.*?\bi=(?P<id>\d+)'
_TESTS = [{
... | @@ -1,27 +1,42 @@
from .common import InfoExtractor
from ..utils import (
- clean_html,
clean_podcast_url,
- get_element_by_class,
- int_or_none,
+ get_element_by_id,
parse_iso8601,
- try_get,
+ traverse_obj,
) | yt_dlp/extractor/applepodcasts.py | 7 | Python | 0.571 | suggestion | 65 | 32 | 32 | false | [ie/ApplePodcasts] Fix extractor | 10,903 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | coreywright |
'episode': '207 - Whitney Webb Returns',
'episode_number': 207,
'description': 'md5:75ef4316031df7b41ced4e7b987f79c6',
'upload_date': '20200705',
'timestamp': 1593932400,
'duration': 5369,
'series': 'The Tim Dillon Show',
't... | Avoid using the `get_element` helpers when trying to parse JSON; they call `unescapeHTML` on the result, so any JSON values containing `"` would be unescaped to `"` causing parsing to fail.
Use `_search_json` instead:
```suggestion
server_data = self._search_json(
r'<script [^>]*\bid=["... | 'episode': '207 - Whitney Webb Returns',
'episode_number': 207,
'description': 'md5:75ef4316031df7b41ced4e7b987f79c6',
'upload_date': '20200705',
'timestamp': 1593932400,
'duration': 5369,
'series': 'The Tim Dillon Show',
't... | @@ -39,47 +54,21 @@ class ApplePodcastsIE(InfoExtractor):
def _real_extract(self, url):
episode_id = self._match_id(url)
webpage = self._download_webpage(url, episode_id)
- episode_data = {}
- ember_data = {}
- # new page type 2021-11
- amp_data = self._parse_json(self... | yt_dlp/extractor/applepodcasts.py | 26 | Python | 0.857 | bug | 458 | 42 | 45 | false | [ie/ApplePodcasts] Fix extractor | 10,903 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coreywright |
from .common import InfoExtractor
from .. import traverse_obj
from ..utils import (
determine_ext,
int_or_none,
url_or_none,
)
class ManyVidsIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [
{
# Dead previe... | I saw the reviewer on the prior PR asked for the test to be skipped instead of removed, so I've done that here. | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -1,114 +1,98 @@
-import re
from .common import InfoExtractor
+from .. import traverse_obj
from ..utils import (
determine_ext,
- extract_attributes,
int_or_none,
- str_to_int,
url_or_none,
- urlencode_postdata,
)
class ManyVidsIE(InfoExtractor):
- _WORKING = False
+ _WORKING =... | yt_dlp/extractor/manyvids.py | 12 | Python | 0.429 | suggestion | 111 | 37 | 37 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | pj47x | pj47x |
'release_date': '20181110',
'tags': ['EyeContact', 'Interviews', 'MaskFetish', 'MouthFetish', 'Redhead'],
'release_timestamp': 1541851200,
'duration': 224.0,
},
},
]
def _real_extract(self, url):
video_id = self._match_... | The API does not return int values for the views and like count, but stringified numbers such as "123k". | video_id = self._match_id(url)
video_data = self._download_json(f'{self._API_BASE}/{video_id}/private', video_id)['data']
formats, preview_only = [], True
for format_id, path in [
('preview', ['teaser', 'filepath']),
('transcoded', ['transcodedFilepath']),
... | @@ -1,114 +1,106 @@
-import re
+
from .common import InfoExtractor
-from ..utils import (
- determine_ext,
- extract_attributes,
- int_or_none,
- str_to_int,
- url_or_none,
- urlencode_postdata,
-)
+from .. import traverse_obj
+from ..utils import determine_ext, int_or_none, parse_duration, parse_i... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.357 | suggestion | 104 | 51 | 51 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | pj47x | pj47x |
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
info = traverse_obj(
self._download_json(f'https://www.manyvids.com/bff/store/video/{video_id}', video_id),
('data', {dict})) or {}
video_urls = traverse_obj(
self._download_j... | ```suggestion
thumbnail = url_or_none(info.get('screenshot')) or url_or_none(info.get('thumbnail'))
```
Shouldn't screenshot be preferred over thumbnail? Screenshot is most often higher resolution than thumbnail. | ('preview', ['teaser', 'filepath']),
('transcoded', ['transcodedFilepath']),
('filepath', ['filepath']),
]:
format_url = traverse_obj(video_data, (*path, {url_or_none}))
if not format_url:
continue
if determine_ext(format_ur... | @@ -1,114 +1,99 @@
-import re
+
from .common import InfoExtractor
-from ..utils import (
- determine_ext,
- extract_attributes,
- int_or_none,
- str_to_int,
- url_or_none,
- urlencode_postdata,
-)
+from .. import traverse_obj
+from ..utils import determine_ext, int_or_none, parse_count, parse_durat... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.857 | suggestion | 224 | 51 | 47 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | octopusknives | pj47x |
# If the video formats JSON only contains a teaser object, then it is a preview
if video_urls.get('teaser') and not video_urls.get('filepath'):
title += ' (Preview)'
formats = []
for v_url, fmt in video_urls_and_ids:
v_url = url_or_none(v_url)
if not ... | ```suggestion
if 'preview' in f['format_id']:
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -131,32 +116,20 @@ def mung_title(s):
f['height'] = int_or_none(
self._search_regex(r'_(\d{2,3}[02468])_', f['url'], 'video height', default=None))
if '/preview/' in f['url']: | yt_dlp/extractor/manyvids.py | 26 | Python | 0.571 | suggestion | 63 | 44 | 109 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | octopusknives | pj47x |
'duration': 224.0,
},
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
info = traverse_obj(
self._download_json(f'https://www.manyvids.com/bff/store/video/{video_id}', video_id),
('data', {dict})) or {}
video... | ```suggestion
self.report_warning(
f'Only extracting preview. Video may be paid or subscription only. {self._login_hint()}')
```
Would it be better to report a warning with a login hint if there is only a preview? I am not sure if this would be better suited to put in a separate PR thoug... |
for format_id, path in [
('preview', ['teaser', 'filepath']),
('transcoded', ['transcodedFilepath']),
('filepath', ['filepath']),
]:
format_url = traverse_obj(video_data, (*path, {url_or_none}))
if not format_url:
continue
... | @@ -1,114 +1,99 @@
-import re
+
from .common import InfoExtractor
-from ..utils import (
- determine_ext,
- extract_attributes,
- int_or_none,
- str_to_int,
- url_or_none,
- urlencode_postdata,
-)
+from .. import traverse_obj
+from ..utils import determine_ext, int_or_none, parse_count, parse_durat... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.857 | refactor | 399 | 51 | 49 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | octopusknives | pj47x |
from .common import InfoExtractor
from .. import traverse_obj
from ..utils import determine_ext, int_or_none, parse_count, parse_duration, parse_iso8601, url_or_none
class ManyVidsIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [
... | bring back the parenthesized import group | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -1,113 +1,100 @@
-import re
+
from .common import InfoExtractor
-from ..utils import (
- determine_ext,
- extract_attributes,
- int_or_none,
- str_to_int,
- url_or_none,
- urlencode_postdata,
-)
+from .. import traverse_obj
+from ..utils import determine_ext, int_or_none, parse_count, parse_dura... | yt_dlp/extractor/manyvids.py | 5 | Python | 0.071 | suggestion | 41 | 30 | 30 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
from .common import InfoExtractor
from .. import traverse_obj
from ..utils import determine_ext, int_or_none, parse_count, parse_duration, parse_iso8601, url_or_none
class ManyVidsIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [
... | revert the formatting change here
the download test outputs a dict indented for the `TESTS = [{` style formatting | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -1,113 +1,100 @@
-import re
+
from .common import InfoExtractor
-from ..utils import (
- determine_ext,
- extract_attributes,
- int_or_none,
- str_to_int,
- url_or_none,
- urlencode_postdata,
-)
+from .. import traverse_obj
+from ..utils import determine_ext, int_or_none, parse_count, parse_dura... | yt_dlp/extractor/manyvids.py | 12 | Python | 0.571 | style | 116 | 37 | 37 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
def _real_extract(self, url):
video_id = self._match_id(url)
info = traverse_obj(
self._download_json(f'https://www.manyvids.com/bff/store/video/{video_id}', video_id),
('data', {dict})) or {}
video_urls = traverse_obj(
self._download_json(f'https://www.... | you can inline all(?) of this in the return
use `traverse_obj` | ]:
format_url = traverse_obj(video_data, (*path, {url_or_none}))
if not format_url:
continue
if determine_ext(format_url) == 'm3u8':
formats.extend(self._extract_m3u8_formats(format_url, video_id, 'mp4', m3u8_id=format_id))
else:
... | @@ -1,113 +1,100 @@
-import re
+
from .common import InfoExtractor
-from ..utils import (
- determine_ext,
- extract_attributes,
- int_or_none,
- str_to_int,
- url_or_none,
- urlencode_postdata,
-)
+from .. import traverse_obj
+from ..utils import determine_ext, int_or_none, parse_count, parse_dura... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.429 | suggestion | 65 | 51 | 44 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
'id': '935718',
'ext': 'mp4',
'title': 'MY FACE REVEAL',
'description': 'md5:ec5901d41808b3746fed90face161612',
'thumbnail': 'https://ods.manyvids.com/1001061960/3aa5397f2a723ec4597e344df66ab845/screenshots/thumbs/custom_1_180_5be09c1dcce03... | don't need the traversal here. we have no video if we don't get `'data'`, so it can be fatal
```suggestion
video_urls = self._download_json(
f'https://www.manyvids.com/bff/store/video/{video_id}/private', video_id)['data']
``` | 'tags': ['EyeContact', 'Interviews', 'MaskFetish', 'MouthFetish', 'Redhead'],
'release_timestamp': 1541851200,
'duration': 224.0,
},
}]
_API_BASE = 'https://www.manyvids.com/bff/store/video'
def _real_extract(self, url):
video_id = self._match_id(url)
... | @@ -1,113 +1,100 @@
-import re
+
from .common import InfoExtractor
-from ..utils import (
- determine_ext,
- extract_attributes,
- int_or_none,
- str_to_int,
- url_or_none,
- urlencode_postdata,
-)
+from .. import traverse_obj
+from ..utils import determine_ext, int_or_none, parse_count, parse_dura... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.786 | suggestion | 250 | 51 | 51 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
from .common import InfoExtractor
from .. import traverse_obj
from ..utils import (
determine_ext,
int_or_none,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [{... | move this to the bottom of the imports like this:
```py
from ..utils.traversal import traverse_obj
```
```suggestion
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -1,21 +1,20 @@
-import re
-
from .common import InfoExtractor
+from .. import traverse_obj | yt_dlp/extractor/manyvids.py | 2 | Python | 0.786 | refactor | 125 | 27 | 27 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
from .common import InfoExtractor
from .. import traverse_obj
from ..utils import (
determine_ext,
int_or_none,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [{... | ```suggestion
)
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -1,21 +1,20 @@
-import re
-
from .common import InfoExtractor
+from .. import traverse_obj
from ..utils import (
determine_ext,
- extract_attributes,
int_or_none,
- str_to_int,
+ parse_count,
+ parse_duration,
+ parse_iso8601,
url_or_none,
- urlencode_postdata,
)
| yt_dlp/extractor/manyvids.py | 11 | Python | 0.571 | suggestion | 65 | 36 | 36 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
from .common import InfoExtractor
from .. import traverse_obj
from ..utils import (
determine_ext,
int_or_none,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [{... | you can remove the dead video test | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -1,21 +1,20 @@
-import re
-
from .common import InfoExtractor
+from .. import traverse_obj
from ..utils import (
determine_ext,
- extract_attributes,
int_or_none,
- str_to_int,
+ parse_count,
+ parse_duration,
+ parse_iso8601,
url_or_none,
- urlencode_postdata,
)
class ManyVi... | yt_dlp/extractor/manyvids.py | 20 | Python | 0.143 | suggestion | 34 | 45 | 45 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
parse_iso8601,
url_or_none,
)
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [{
# Dead preview video
'skip': True,
'url': 'https://www.manyvids.com/Video/133957/everthing-about-me/',
'md5': '03f11bb21c52d... | run this test again with the `-preview` suffix change to the `id`
| parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [{
# preview video
'url': 'https://www.manyvids.com/Video/530341/mv-tips-tricks'... | @@ -26,6 +25,24 @@ class ManyVidsIE(InfoExtractor):
'view_count': int,
'like_count': int,
},
+ }, {
+ # preview video
+ 'url': 'https://www.manyvids.com/Video/530341/mv-tips-tricks',
+ 'md5': '738dc723f7735ee9602f7ea352a6d058',
+ 'info_dict': {
+ ... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.429 | suggestion | 69 | 51 | 51 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
url_or_none,
)
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [{
# Dead preview video
'skip': True,
'url': 'https://www.manyvids.com/Video/133957/everthing-about-me/',
'md5': '03f11bb21c52dd12a05be21a5c7dcc97... | ```suggestion
},
'expected_warnings': ['Only extracting preview'],
``` | parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [{
# preview video
'url': 'https://www.manyvids.com/Video/530341/mv-tips-tricks',
'md5': '73... | @@ -26,6 +25,24 @@ class ManyVidsIE(InfoExtractor):
'view_count': int,
'like_count': int,
},
+ }, {
+ # preview video
+ 'url': 'https://www.manyvids.com/Video/530341/mv-tips-tricks',
+ 'md5': '738dc723f7735ee9602f7ea352a6d058',
+ 'info_dict': {
+ ... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.643 | refactor | 89 | 51 | 51 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
}, {
# full video
'url': 'https://www.manyvids.com/Video/935718/MY-FACE-REVEAL/',
'md5': 'bb47bab0e0802c2a60c24ef079dfe60f',
'info_dict': {
'id': '935718',
'ext': 'mp4',
'title': 'MY FACE REVEAL',
'description': 'md5:ec5901d41808b3746fe... | This `_download_json` call can/should be non-fatal, and let's do it after the `video_urls`/formats extraction so that we don't waste time before aborting if something is wrong | 'uploader': 'Sarah Calanthe',
'view_count': int,
'like_count': int,
'release_date': '20181110',
'tags': ['EyeContact', 'Interviews', 'MaskFetish', 'MouthFetish', 'Redhead'],
'release_timestamp': 1541851200,
'duration': 224.0,
},... | @@ -35,79 +52,41 @@ class ManyVidsIE(InfoExtractor):
'ext': 'mp4',
'title': 'MY FACE REVEAL',
'description': 'md5:ec5901d41808b3746fed90face161612',
+ 'thumbnail': 'https://ods.manyvids.com/1001061960/3aa5397f2a723ec4597e344df66ab845/screenshots/thumbs/custom_1_180_5be0... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.571 | bug | 175 | 51 | 51 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
'md5': 'bb47bab0e0802c2a60c24ef079dfe60f',
'info_dict': {
'id': '935718',
'ext': 'mp4',
'title': 'MY FACE REVEAL',
'description': 'md5:ec5901d41808b3746fed90face161612',
'thumbnail': 'https://ods.manyvids.com/1001061960/3aa5397f2a723ec4597e344d... | I would set a class constant like
```py
_API_BASE = 'https://www.manyvids.com/bff/store/video'
```
to reduce duplication and line-length | 'release_date': '20181110',
'tags': ['EyeContact', 'Interviews', 'MaskFetish', 'MouthFetish', 'Redhead'],
'release_timestamp': 1541851200,
'duration': 224.0,
},
}]
_API_BASE = 'https://www.manyvids.com/bff/store/video'
def _real_extract(self, url):
... | @@ -35,79 +52,41 @@ class ManyVidsIE(InfoExtractor):
'ext': 'mp4',
'title': 'MY FACE REVEAL',
'description': 'md5:ec5901d41808b3746fed90face161612',
+ 'thumbnail': 'https://ods.manyvids.com/1001061960/3aa5397f2a723ec4597e344df66ab845/screenshots/thumbs/custom_1_180_5be0... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.714 | suggestion | 144 | 51 | 51 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
self._remove_duplicate_formats(formats)
for f in formats:
if f.get('height') is None:
f['height'] = int_or_none(
self._search_regex(r'_(\d{2,3}[02468])_', f['url'], 'video height', default=None))
if 'preview' in f['format_id']:
... | ```py
return {
'id': video_id,
'title': title,
'formats': formats,
**traverse_obj(metadata, {
'description': ('description', {clean_html}),
'uploader': ('model', 'displayName', {clean_html}),
'thumbnail': (('... | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -130,33 +109,22 @@ def mung_title(s):
if f.get('height') is None:
f['height'] = int_or_none(
self._search_regex(r'_(\d{2,3}[02468])_', f['url'], 'video height', default=None))
- if '/preview/' in f['url']:
- f['format_id'] = '_'.join(filter... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.786 | style | 731 | 27 | 109 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
formats = []
for v_url, fmt in video_urls_and_ids:
v_url = url_or_none(v_url)
if not v_url:
continue
if determine_ext(v_url) == 'm3u8':
formats.extend(self._extract_m3u8_formats(
v_url, video_id, 'mp4', entry_protoc... | All the formats code should be moved together. I don't like most of this old code, either. We should only set `preference` for the `teaser` format, and use `quality` to prioritize `filepath` over `transcoded` | from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
int_or_none,
join_nonempty,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.... | @@ -130,33 +109,22 @@ def mung_title(s):
if f.get('height') is None:
f['height'] = int_or_none(
self._search_regex(r'_(\d{2,3}[02468])_', f['url'], 'video height', default=None))
- if '/preview/' in f['url']:
- f['format_id'] = '_'.join(filter... | yt_dlp/extractor/manyvids.py | 26 | Python | 0.643 | suggestion | 208 | 42 | 109 | false | [ie/manyvids] Fix extractor | 10,907 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pj47x |
if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.urlencode if path == 'token' else json.dumps
return self._download_json(
f'https://espn.api.edge.bamgrid.com/{path}', video_id, headers=headers, data=parse(payload... | Is the "jwt" in the cookie actually a JWT? or is it only the payload of a JWT (without a header or signature)?
If it's a full JWT, you could use `jwt_decode_hs256` from utils:
```suggestion
id_token = self._download_json(
'https://registerdisney.go.com/jgc/v6/client/ESPN-ONESITE.WEB-... | if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.urlencode if path == 'token' else json.dumps
return self._download_json(
f'https://espn.api.edge.bamgrid.com/{path}', video_id, headers=headers, data=parse(payload... | @@ -353,6 +353,14 @@ def _real_extract(self, url):
if not cookie:
self.raise_login_required(method='cookies')
+ jwt = re.search(r'=(.*)\|', cookie.value).group(1)
+ import requests
+ id_token = requests.post('https://registerdisney.go.com/jgc/v6/client/ES... | yt_dlp/extractor/espn.py | 26 | Python | 1 | security | 1,047 | 51 | 51 | false | Better authentication for ESPN+ | 10,910 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ischmidt20 |
},
}]
_API_KEY = 'ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c'
def _call_bamgrid_api(self, path, video_id, payload=None, headers={}):
if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.ur... | use `_search_regex` here
```suggestion
jwt = self._search_regex(r'=([^|]+)\|', cookie.value, 'cookie jwt')
``` | },
}]
_API_KEY = 'ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c'
def _call_bamgrid_api(self, path, video_id, payload=None, headers={}):
if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.ur... | @@ -353,6 +353,14 @@ def _real_extract(self, url):
if not cookie:
self.raise_login_required(method='cookies')
+ jwt = re.search(r'=(.*)\|', cookie.value).group(1) | yt_dlp/extractor/espn.py | 26 | Python | 0.786 | suggestion | 127 | 51 | 51 | false | Better authentication for ESPN+ | 10,910 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ischmidt20 |
_API_KEY = 'ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c'
def _call_bamgrid_api(self, path, video_id, payload=None, headers={}):
if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.urlencode if path == ... | ```suggestion
None, 'Refreshing token', headers={'Content-Type': 'application/json'}, data=json.dumps({
``` | _API_KEY = 'ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c'
def _call_bamgrid_api(self, path, video_id, payload=None, headers={}):
if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.urlencode if path == ... | @@ -353,6 +353,13 @@ def _real_extract(self, url):
if not cookie:
self.raise_login_required(method='cookies')
+ jwt = self._search_regex(r'=([^|]+)\|', cookie.value, 'cookie jwt')
+ id_token = self._download_json(
+ 'https://registerdisney.go.com/jgc/... | yt_dlp/extractor/espn.py | 26 | Python | 0.857 | suggestion | 125 | 51 | 51 | false | Better authentication for ESPN+ | 10,910 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ischmidt20 |
'url': 'https://screenrec.com/share/DasLtbknYo',
'info_dict': {
'id': 'DasLtbknYo',
'ext': 'mp4',
'title': '02.05.2024_03.01.25_REC',
'description': 'Recorded with ScreenRec',
'thumbnail': r're:^https?://.*\.gif$',
},
'params': ... | Imo. we don't need the `url_or_none`
```suggestion
'formats': self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4'),
``` | 'info_dict': {
'id': 'DasLtbknYo',
'ext': 'mp4',
'title': '02.05.2024_03.01.25_REC',
'description': 'Recorded with ScreenRec',
'thumbnail': r're:^https?://.*\.gif$',
},
'params': {
'skip_download': True,
},
}]
... | @@ -0,0 +1,34 @@
+from .common import InfoExtractor
+from ..utils import url_or_none
+
+
+class ScreenRecIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?screenrec\.com/share/(?P<id>[A-Za-z0-9]{10})'
+ _TESTS = [{
+ 'url': 'https://screenrec.com/share/DasLtbknYo',
+ 'info_dict': {
+ ... | yt_dlp/extractor/screenrec.py | 26 | Python | 0.786 | refactor | 139 | 28 | 27 | false | [ie/screenrec] Add extractor | 10,917 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | naglis |
from .common import InfoExtractor
from ..utils import url_or_none
class ScreenRecIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?screenrec\.com/share/(?P<id>[A-Za-z0-9]{10})'
_TESTS = [{
'url': 'https://screenrec.com/share/DasLtbknYo',
'info_dict': {
'id': 'DasLtbknYo',
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?screenrec\.com/share/(?P<id>\w{10})'
``` | from .common import InfoExtractor
class ScreenRecIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?screenrec\.com/share/(?P<id>\w{10})'
_TESTS = [{
'url': 'https://screenrec.com/share/DasLtbknYo',
'info_dict': {
'id': 'DasLtbknYo',
'ext': 'mp4',
'title': ... | @@ -0,0 +1,34 @@
+from .common import InfoExtractor
+from ..utils import url_or_none
+
+
+class ScreenRecIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?screenrec\.com/share/(?P<id>[A-Za-z0-9]{10})' | yt_dlp/extractor/screenrec.py | 6 | Python | 0.571 | suggestion | 94 | 31 | 31 | false | [ie/screenrec] Add extractor | 10,917 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | naglis |
'skip_download': True,
},
}, {
'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
'only_matching': True,
}]
_GEO_BYPASS = False
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
... | The altId is required anyway, so let's just do:
```suggestion
video = self._download_json(
f'https://pubads.g.doubleclick.net/ondemand/hls/content/2489270/vid/{data["altId"]}/streams',
content_id, data=b'')
``` | 'series': 'Neighbours',
'thumbnail': r're:https://.*\.jpg',
'age_limit': 15,
'timestamp': 1725517860,
'upload_date': '20240905',
'uploader': 'Channel 10',
'uploader_id': '2199827728001',
},
'params': {
'skip_... | @@ -66,42 +63,21 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
- def _get_bearer_token(self, video_id):
- username, password = self._get_login_info()
- if username is None or password is None:
- self.raise_login_required('Your 10play account\'s details must be provided with -... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.786 | suggestion | 247 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aarubui |
'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
'only_matching': True,
}]
_GEO_BYPASS = False
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
'MA': 15,
'MA15+': 15,
'R': 18,
... | How about:
```suggestion
formats, subtitles = self._extract_m3u8_formats_and_subtitles(video['stream_manifest'], content_id, 'mp4')
for sub in video.get('subtitles', []):
if ttml_url := sub.get('ttml'):
subtitles.setdefault(sub.get('language') or 'en', []).append({
... | 'timestamp': 1725517860,
'upload_date': '20240905',
'uploader': 'Channel 10',
'uploader_id': '2199827728001',
},
'params': {
'skip_download': True,
},
'skip': 'Only available in Australia',
}, {
'url': 'https://10pla... | @@ -66,42 +63,21 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
- def _get_bearer_token(self, video_id):
- username, password = self._get_login_info()
- if username is None or password is None:
- self.raise_login_required('Your 10play account\'s details must be provided with -... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.857 | refactor | 637 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aarubui |
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
'MA': 15,
'MA15+': 15,
'R': 18,
'X': 18,
}
def _real_extract(self, url):
content_id = self._match_id(url)
data = self._download_json(
'https://10play.com.au/api/v1/videos/' + conten... | ```suggestion
'subtitles': subtitles,
``` | },
'params': {
'skip_download': True,
},
'skip': 'Only available in Australia',
}, {
'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
'only_matching': True,
}]
_GEO_BYPASS = F... | @@ -66,42 +63,21 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
- def _get_bearer_token(self, video_id):
- username, password = self._get_login_info()
- if username is None or password is None:
- self.raise_login_required('Your 10play account\'s details must be provided with -... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.571 | suggestion | 55 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aarubui |
'uploader': 'Channel 10',
'uploader_id': '2199827728001',
},
'params': {
'skip_download': True,
},
}, {
'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
'only_matching... | I assume you removed this due to login being no longer required. Is this the case for all content? | 'episode': 'Episode 9107',
'episode_number': 9107,
'season': 'Season 42',
'season_number': 42,
'series': 'Neighbours',
'thumbnail': r're:https://.*\.jpg',
'age_limit': 15,
'timestamp': 1725517860,
'upload_date': ... | @@ -66,42 +63,21 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
- def _get_bearer_token(self, video_id): | yt_dlp/extractor/tenplay.py | 26 | Python | 0.286 | question | 98 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aarubui |
'only_matching': True,
}]
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
'MA': 15,
'MA15+': 15,
'R': 18,
'X': 18,
}
def _real_extract(self, url):
content_id = self._match_id(url)
data = self._download_json(
'https://... | Imo. we can also add the resolution upgrade code after the geo restriction check:
```py
# Attempt to get a higher quality stream
m3u8_url = m3u8_url.replace(',150,75,55,0000', ',300,150,75,55,0000')
``` | 'only_matching': True,
}]
_GEO_BYPASS = False
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
'MA': 15,
'MA15+': 15,
'R': 18,
'X': 18,
}
def _real_extract(self, url):
content_id = self._match_id(url)
data = self._download_jso... | @@ -66,33 +72,14 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
- def _get_bearer_token(self, video_id):
- username, password = self._get_login_info()
- if username is None or password is None:
- self.raise_login_required('Your 10play account\'s details must be provided with -... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.857 | suggestion | 222 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aarubui |
'skip': 'Only available in Australia',
}, {
'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
'only_matching': True,
}]
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
'MA': 15,
... | I'd write this like so:
```suggestion
video_data = self._download_json(
f'https://vod.ten.com.au/api/videos/bcquery?command=find_videos_by_id&video_id={data["altId"]}',
content_id, 'Downloading video JSON')
m3u8_url = self._request_webpage(
HEADRequest(traverse_... | 'skip': 'Only available in Australia',
}, {
'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
'only_matching': True,
}]
_GEO_BYPASS = False
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
... | @@ -66,33 +72,14 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
- def _get_bearer_token(self, video_id):
- username, password = self._get_login_info()
- if username is None or password is None:
- self.raise_login_required('Your 10play account\'s details must be provided with -... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.786 | suggestion | 433 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aarubui |
'M': 15,
'MA': 15,
'MA15+': 15,
'R': 18,
'X': 18,
}
def _real_extract(self, url):
content_id = self._match_id(url)
data = self._download_json(
'https://10play.com.au/api/v1/videos/' + content_id, content_id)
video_data = self._downloa... | Below info returned was not changed in this PR but could have some more type conditioning, like this:
```py
return {
'id': content_id,
'formats': formats,
'uploader': 'Channel 10',
'uploader_id': '2199827728001',
**traverse_obj(data, {
... | 'PG': 15,
'M': 15,
'MA': 15,
'MA15+': 15,
'R': 18,
'X': 18,
}
def _real_extract(self, url):
content_id = self._match_id(url)
data = self._download_json(
'https://10play.com.au/api/v1/videos/' + content_id, content_id)
video_da... | @@ -66,37 +72,21 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
- def _get_bearer_token(self, video_id):
- username, password = self._get_login_info()
- if username is None or password is None:
- self.raise_login_required('Your 10play account\'s details must be provided with -... | yt_dlp/extractor/tenplay.py | 26 | Python | 1 | style | 1,102 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | aarubui |
'skip': 'Only available in Australia',
}, {
'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
'only_matching': True,
}]
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
'MA': 15,
... | no point in traversal here since the request is fatal
```suggestion
HEADRequest(video_data['items'][0]['HLSURL']),
``` | 'skip': 'Only available in Australia',
}, {
'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
'only_matching': True,
}]
_GEO_BYPASS = False
_AUS_AGES = {
'G': 0,
'PG': 15,
'M': 15,
... | @@ -66,55 +72,42 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
- def _get_bearer_token(self, video_id):
- username, password = self._get_login_info()
- if username is None or password is None:
- self.raise_login_required('Your 10play account\'s details must be provided with -... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.714 | suggestion | 133 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aarubui |
'ext': 'mp4',
'title': 'Neighbours - S42 Ep. 9107',
'alt_title': 'Thu 05 Sep',
'description': 'md5:37a1f4271be34b9ee2b533426a5fbaef',
'duration': 1388,
'episode': 'Episode 9107',
'episode_number': 9107,
'season': 'Season 42'... | `x-forwarded-for` doesn't work with this site, so we want to add this back
```suggestion
_GEO_BYPASS = False
``` | 'ext': 'mp4',
'title': 'Neighbours - S42 Ep. 9107',
'alt_title': 'Thu 05 Sep',
'description': 'md5:37a1f4271be34b9ee2b533426a5fbaef',
'duration': 1388,
'episode': 'Episode 9107',
'episode_number': 9107,
'season': 'Season 42'... | @@ -1,60 +1,66 @@
-import base64
-import datetime as dt
import functools
import itertools
from .common import InfoExtractor
from ..networking import HEADRequest
-from ..utils import int_or_none, traverse_obj, urlencode_postdata, urljoin
+from ..utils import int_or_none, traverse_obj, url_or_none, urljoin
cla... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.714 | suggestion | 121 | 51 | 51 | false | [ie/tenplay] Fix extractor | 10,928 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aarubui |
# Skipping links to another channels, note that checking for
# endpoint.commandMetadata.webCommandMetadata.webPageTypwebPageType == WEB_PAGE_TYPE_CHANNEL
# will not work
if skip_channels and '/channels?' in shelf_url:
return
title = self._get_t... | maybe just to keep the line shorter:
```suggestion
('content', ('videoRenderer', 'reelItemRenderer', 'playlistRenderer', 'shortsLockupViewModel'), any)) or {}
``` | # Skipping links to another channels, note that checking for
# endpoint.commandMetadata.webCommandMetadata.webPageTypwebPageType == WEB_PAGE_TYPE_CHANNEL
# will not work
if skip_channels and '/channels?' in shelf_url:
return
title = self._get_t... | @@ -4987,7 +4987,7 @@ def _playlist_entries(self, video_list_renderer):
def _rich_entries(self, rich_grid_renderer):
renderer = traverse_obj(
rich_grid_renderer,
- ('content', ('videoRenderer', 'reelItemRenderer', 'playlistRenderer')), get_all=False) or {}
+ ('content', ... | yt_dlp/extractor/youtube.py | 26 | Python | 0.714 | suggestion | 177 | 51 | 51 | false | [ie/youtube] Support new shorts tab view model | 10,938 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
continue
renderer = content.get('playlistVideoRenderer') or content.get('playlistPanelVideoRenderer')
if not isinstance(renderer, dict):
continue
video_id = renderer.get('videoId')
if not video_id:
continue
yield... | ```suggestion
# shortsLockupViewModel extraction
entity_id = renderer.get('entityId')
``` | continue
renderer = content.get('playlistVideoRenderer') or content.get('playlistPanelVideoRenderer')
if not isinstance(renderer, dict):
continue
video_id = renderer.get('videoId')
if not video_id:
continue
yield... | @@ -4999,6 +4999,20 @@ def _rich_entries(self, rich_grid_renderer):
ie=YoutubeTabIE.ie_key(), video_id=playlist_id,
video_title=self._get_text(renderer, 'title'))
return
+ entity_id = renderer.get('entityId') | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | refactor | 108 | 51 | 51 | false | [ie/youtube] Support new shorts tab view model | 10,938 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
if mobj:
uploader_id, uploader = mobj.groups()
breadcrumb = get_element_by_attribute('typeof', 'BreadcrumbList', webpage)
categories = []
if breadcrumb:
for _, name in re.findall(r'<span[^>]+property=(["\'])name\1[^>]*>([^<]+)', breadcrumb):
categ... | these could just be in the info dict root instead of a formats dict, but either way works. core code will also determine acodec from ext, but explicitly returning it is fine too | if mobj:
uploader_id, uploader = mobj.groups()
breadcrumb = get_element_by_attribute('typeof', 'BreadcrumbList', webpage)
categories = []
if breadcrumb:
for _, name in re.findall(r'<span[^>]+property=(["\'])name\1[^>]*>([^<]+)', breadcrumb):
categ... | @@ -82,7 +82,15 @@ def extract_count(klass):
return {
'id': sample_id,
'title': title,
- 'url': mp3_url,
+ 'formats': [{
+ 'url': mp3_url,
+ 'ext': 'mp3',
+ 'vcodec': 'none',
+ 'acodec': 'mp3',
+ ... | yt_dlp/extractor/samplefocus.py | 26 | Python | 0.429 | suggestion | 177 | 31 | 39 | false | [ie/SampleFocus] Fix extractor | 10,947 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
if self.access_token is None:
raise ExtractorError('Getting token failed', expected=True)
def _real_initialize(self):
if not self.access_token:
self.raise_login_required('Login is required to access any iPrima content', method='password')
def _raise_access_error(self, e... | ```suggestion
r'let\s+videos\s*=\s*([\'"])(?P<id>p\d+)\1',
``` | f'{self._AUTH_ROOT}/user/profile-select-perform/{profile_id}', None,
query={'continueUrl': '/user/login?redirect_uri=/user/'}, note='Selecting profile')
code = traverse_obj(login_handle.url, ({parse_qs}, 'code', 0))
if not code:
raise ExtractorError('Login fa... | @@ -131,6 +131,7 @@ def _real_extract(self, url):
video_id = self._search_regex((
r'productId\s*=\s*([\'"])(?P<id>p\d+)\1',
r'pproduct_id\s*=\s*([\'"])(?P<id>p\d+)\1',
+ r'let videos\s*=\s*([\'"])(?P<id>p\d+)\1', | yt_dlp/extractor/iprima.py | 26 | Python | 0.571 | suggestion | 76 | 51 | 51 | false | [ie/IPrima] Fix extractor | 10,959 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | otovalek |
headers={'X-OTT-Access-Token': self.access_token},
expected_status=403)
self._raise_access_error(metadata.get('errorCode'))
stream_infos = metadata.get('streamInfos')
formats = []
if stream_infos is None:
self.raise_no_formats('Reading stream infos f... | ```suggestion
'title': final_result.get('title') or title,
``` | headers={'X-OTT-Access-Token': self.access_token},
expected_status=403)
self._raise_access_error(metadata.get('errorCode'))
stream_infos = metadata.get('streamInfos')
formats = []
if stream_infos is None:
self.raise_no_formats('Reading stream infos f... | @@ -176,7 +197,7 @@ def _real_extract(self, url):
final_result = self._search_json_ld(webpage, video_id, default={})
final_result.update({
'id': video_id,
- 'title': title,
+ 'title': final_result.get('title', title), | yt_dlp/extractor/iprima.py | 26 | Python | 0.571 | suggestion | 76 | 51 | 51 | false | [ie/IPrima] Fix extractor | 10,959 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | otovalek |
webpage = self._download_webpage(url, display_id)
redirect_url = self._og_search_property('url', webpage, 'redirect url')
return self.url_result(
redirect_url,
SpreakerPodcastPageIE)
class SpreakerPodcastPageIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?sprea... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?spreaker\.com/show/(?P<id>\d+)/episodes/feed'
``` | import itertools
from .common import InfoExtractor
from ..utils import (
filter_dict,
float_or_none,
int_or_none,
parse_qs,
str_or_none,
try_get,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
def _extract_episode(data, episode_id=None):
title = data[... | @@ -156,17 +159,53 @@ def _real_extract(self, url):
class SpreakerShowPageIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?spreaker\.com/show/(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?spreaker\.com/show/(?P<id>[^/?#&]+)(?!/episodes/feed)'
_TESTS = [{
'url': 'https://www.spreak... | yt_dlp/extractor/spreaker.py | 26 | Python | 0.714 | suggestion | 103 | 40 | 180 | false | [ie/spreaker] Support podcast and feed pages | 10,968 | yt-dlp/yt-dlp | 132,642 | Python | grqz | subrat-lima |
episodes = self._download_json(
f'https://api.spreaker.com/show/{show_id}/episodes',
show_id, note=f'Downloading JSON page {page_num}', query={
'page': page_num,
'max_per_page': 100,
})
pager = try_get(episod... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?spreaker\.com/show/(?P<id>[^/?#&]+)(?:[?#]|$)(?!/episodes/feed)'
``` | 'id': '4652058',
},
'playlist_mincount': 118,
}, {
'url': 'https://www.spreaker.com/podcast/health-wealth--5918323',
'info_dict': {
'id': '5918323',
},
'playlist_mincount': 60,
}, {
'url': 'https://www.spreaker.com/show/5887186/epis... | @@ -156,17 +159,53 @@ def _real_extract(self, url):
class SpreakerShowPageIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?spreaker\.com/show/(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?spreaker\.com/show/(?P<id>[^/?#&]+)(?!/episodes/feed)' | yt_dlp/extractor/spreaker.py | 26 | Python | 0.714 | suggestion | 122 | 51 | 44 | false | [ie/spreaker] Support podcast and feed pages | 10,968 | yt-dlp/yt-dlp | 132,642 | Python | grqz | subrat-lima |
def _perform_login(self, username, password):
sign_in = self._download_json(
f'{self._BASE_URL}/web_api/signin', None, 'Logging in', headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
}, data=json.dumps({
'sessi... | I would just pull this out to a method. Lambdas and nested funcs can end up creating more work later on down the maintenance timeline
also, are we sure this should be `b64encode` and not `urlsafe_b64encode`?
```py
@staticmethod
def _get_encoded_id(program):
return base64.b64encode(str(program['id... |
@staticmethod
def _get_encoded_id(program):
return base64.urlsafe_b64encode(str(program['id']).encode()).decode()
def _perform_login(self, username, password):
sign_in = self._download_json(
f'{self._BASE_URL}/web_api/signin', None, 'Logging in', headers={
'Acce... | @@ -0,0 +1,146 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ strftime_or_none,
+ update_url,
+ url_or_none,
+)
+from ..utils.tra... | yt_dlp/extractor/onsen.py | 26 | Python | 0.857 | suggestion | 347 | 51 | 51 | false | [ie/onsen] Add extractor | 10,971 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
sign_in = self._download_json(
f'{self._BASE_URL}/web_api/signin', None, 'Logging in', headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
}, data=json.dumps({
'session': {
'email': username,
... | I think technically we want the last value in the query. Sorry, this is very pedantic
```suggestion
query = {k: v[-1] for k, v in parse_qs(url).items() if v}
``` | @staticmethod
def _get_encoded_id(program):
return base64.urlsafe_b64encode(str(program['id']).encode()).decode()
def _perform_login(self, username, password):
sign_in = self._download_json(
f'{self._BASE_URL}/web_api/signin', None, 'Logging in', headers={
'Accep... | @@ -0,0 +1,146 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ strftime_or_none,
+ update_url,
+ url_or_none,
+)
+from ..utils.tra... | yt_dlp/extractor/onsen.py | 26 | Python | 0.714 | suggestion | 172 | 51 | 51 | false | [ie/onsen] Add extractor | 10,971 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'password': password,
},
}).encode(), expected_status=401)
if sign_in.get('error'):
raise ExtractorError('Invalid username or password', expected=True)
def _real_extract(self, url):
program_id = self._match_id(url)
try:
... | - Formatting
- I would use `update_url_query` here since the `url` may already have a query with params other than `c`
- playlist title extraction should be non-fatal
```suggestion
entries = [
self.url_result(update_url_query(url, {'c': self._get_encoded_id(program)}), OnsenIE)
... | 'Accept': 'application/json',
'Content-Type': 'application/json',
}, data=json.dumps({
'session': {
'email': username,
'password': password,
},
}).encode(), expected_status=401)
if si... | @@ -0,0 +1,146 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ strftime_or_none,
+ update_url,
+ url_or_none,
+)
+from ..utils.tra... | yt_dlp/extractor/onsen.py | 26 | Python | 0.857 | refactor | 562 | 51 | 51 | false | [ie/onsen] Add extractor | 10,971 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
}).encode(), expected_status=401)
if sign_in.get('error'):
raise ExtractorError('Invalid username or password', expected=True)
def _real_extract(self, url):
program_id = self._match_id(url)
try:
programs = self._download_json(
f'{self._BA... | Extra `=`s are ignored by Python's b64 decoder, so we can simplify this
Also, the same question as above applies here: are we certain this should be `b64decode` over `urlsafe_b64decode`?
```suggestion
raw_id = base64.urlsafe_b64decode(f'{query["c"]}===')).decode()
``` | }, data=json.dumps({
'session': {
'email': username,
'password': password,
},
}).encode(), expected_status=401)
if sign_in.get('error'):
raise ExtractorError('Invalid username or password', expected=True... | @@ -0,0 +1,146 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ strftime_or_none,
+ update_url,
+ url_or_none,
+)
+from ..utils.tra... | yt_dlp/extractor/onsen.py | 26 | Python | 0.857 | refactor | 282 | 51 | 51 | false | [ie/onsen] Add extractor | 10,971 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.