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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
webpage = self._download_webpage(url, album_id or c_id, fatal=False) or ''
title = (self._html_search_meta('title', webpage, fatal=False)
or self._html_extract_title(webpage))
if album_id:
mode = 'album'
mode_id = '4'
content_id = album_id
... | ```suggestion
url_part = (f'aid/{album_id}' if album_id
else f'category/{c_name}/category_id/{c_id}' if c_mode == 'category'
else f'title/{c_name}/channel/{c_id}')
c_mode = c_mode or 'album'
data = {
'vars[mode]': c_mode,
f'v... | query={'page': page, 'page_only': 1}, data=urlencode_postdata(data))
urls = re.findall(r'"([^"]+/video/[^"]+)"', webpage)
for url in urls:
yield self.url_result(host + url, VideocampusSachsenIE)
def _real_extract(self, url):
host, album_id, mode, name, id = self._ma... | @@ -162,7 +181,86 @@ def _real_extract(self, url):
'id': video_id,
'title': title,
'description': description,
+ 'thumbnail': thumbnail,
'display_id': display_id,
'formats': formats,
- 'subtitles': subtitles
+ 'subtitles':... | yt_dlp/extractor/videocampus_sachsen.py | 26 | Python | 0.786 | suggestion | 591 | 45 | 33 | false | [ViMP] Support playlists, add more instances | 4,147 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | FestplattenSchnitzel |
f'https://{host}/media/hlsMedium/key/{video_id}/format/auto/ext/mp4/learning/0/path/m3u8',
video_id, 'mp4', m3u8_id='hls', fatal=True)
except ExtractorError as e:
if not isinstance(e.cause, compat_HTTPError) or e.cause.code not in (404, 500):
raise
... | ```suggestion
)''' % '|'.join(map(re.escape, VideocampusSachsenIE._INSTANCES))
``` | f'https://{host}/media/hlsMedium/key/{video_id}/format/auto/ext/mp4/learning/0/path/m3u8',
video_id, 'mp4', m3u8_id='hls', fatal=True)
except ExtractorError as e:
if not isinstance(e.cause, compat_HTTPError) or e.cause.code not in (404, 500):
raise
... | @@ -183,3 +184,72 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class ViMPPlaylistIE(InfoExtractor):
+ IE_NAME = 'ViMP:Playlist'
+ _VALID_URL = r'''(?x)(?P<host>https?://(?:%s))/(?:
+ album/view/aid/(?P<album_id>[0-9]+)|
+ (?P<... | yt_dlp/extractor/videocampus_sachsen.py | 26 | Python | 0.571 | security | 88 | 51 | 51 | false | [ViMP] Support playlists, add more instances | 4,147 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | FestplattenSchnitzel |
from .common import InfoExtractor
from ..utils import traverse_obj
class FuyinTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)fuyin\.(?:tv)/(?:html)/(?P<mov_id>\w+)/(?P<url_id>\d+)(?:\.html)'
_TESTS = [{
'url': 'https://www.fuyin.tv/html/2733/44129.html',
'info_dict': {
'id':... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?fuyin\.tv/html/(?P<mov_id>\w+)/(?P<url_id>\d+)\.html'
```
Why the unnecessary groups? | from .common import InfoExtractor
from ..utils import traverse_obj
class FuyinTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?fuyin\.tv/html/(?:\d+)/(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.fuyin.tv/html/2733/44129.html',
'info_dict': {
'id': '44129',
'... | @@ -0,0 +1,27 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class FuyinTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)fuyin\.(?:tv)/(?:html)/(?P<mov_id>\w+)/(?P<url_id>\d+)(?:\.html)' | yt_dlp/extractor/fuyintv.py | 6 | Python | 0.714 | question | 140 | 28 | 31 | false | [extractor/fuyin.tv] Add extractor | 4,151 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
from .common import InfoExtractor
from ..utils import traverse_obj
class FuyinTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?fuyin\.tv/html/(?:\d+)/(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.fuyin.tv/html/2733/44129.html',
'info_dict': {
'id': '44129',
'... | ```suggestion
webpage = self._download_webpage(url, video_id, fatal=False)
``` | from .common import InfoExtractor
from ..utils import traverse_obj
class FuyinTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?fuyin\.tv/html/(?:\d+)/(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.fuyin.tv/html/2733/44129.html',
'info_dict': {
'id': '44129',
'... | @@ -0,0 +1,30 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class FuyinTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?fuyin\.tv/html/(?:\d+)/(?P<id>\d+)\.html'
+ _TESTS = [{
+ 'url': 'https://www.fuyin.tv/html/2733/44129.html',
+ 'info_dict': {
+ '... | yt_dlp/extractor/fuyintv.py | 22 | Python | 0.571 | suggestion | 88 | 31 | 31 | false | [extractor/fuyin.tv] Add extractor | 4,151 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
def _real_extract(self, url):
display_id = self._match_id(url)
if display_id.startswith('$/'):
display_id = display_id.split('/', 2)[-1].replace('/', ':')
else:
display_id = display_id.replace(':', '#')
display_id = compat_urllib_parse_unquote(display_id)
... | the headers issue is fixed already | 'only_matching': True,
}, {
'url': 'https://lbry.tv/@LBRYFoundation/Episode-1',
'only_matching': True,
}, {
'url': 'https://lbry.tv/$/download/Episode-1/e7d93d772bd87e2b62d5ab993c1c3ced86ebb396',
'only_matching': True,
}, {
'url': 'https://lbry.tv/@lacajadepan... | @@ -183,11 +184,12 @@ def _real_extract(self, url):
uri = 'lbry://' + display_id
result = self._resolve_url(uri, display_id, 'stream')
if result['value'].get('stream_type') in self._SUPPORTED_STREAM_TYPES:
- claim_id, is_live, headers = result['claim_id'], False, None
+ ... | yt_dlp/extractor/lbry.py | 26 | Python | 0.071 | suggestion | 34 | 51 | 51 | false | [lbry] use head request to determine m3u8 file for streaming url | 4,181 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
})
thumbnails = []
for thumbnail in video_data.get('thumbnails', {}).get('thumbnail', []):
thumbnail_url = thumbnail.get('value')
if not thumbnail_url:
continue
thumbnails.append({
'url': thumbnail_url,
'wid... | ```suggestion
'timestamp': unified_timestamp(traverse_obj(video_data, ('airdates', 'airdate', 0))),
``` | formats.append(f)
self._sort_formats(formats)
for cc in video_data.get('closedcaption', {}).get('src', []):
cc_url = cc.get('value')
if not cc_url:
continue
ext = determine_ext(cc_url)
if ext == 'xml':
ext =... | @@ -316,4 +317,5 @@ def _real_extract(self, url):
'thumbnails': thumbnails,
'formats': formats,
'subtitles': subtitles,
+ 'timestamp': timeconvert(video_data.get('airdates', {}).get('airdate', [None])[0]), | yt_dlp/extractor/go.py | 26 | Python | 0.714 | suggestion | 117 | 28 | 41 | false | [Go] Extract original airdate | 4,186 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
from yt_dlp.utils import int_or_none
from .common import InfoExtractor
class StarTrekIE(InfoExtractor):
_VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md5': '... | How about something like this
```
video_id, urlbase = self._match_valid_url(url).group('id', 'base')
``` | from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class StarTrekIE(InfoExtractor):
_VALID_URL = r'(?P<base>https?://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md... | @@ -0,0 +1,59 @@
+from yt_dlp.utils import int_or_none
+from .common import InfoExtractor
+
+
+class StarTrekIE(InfoExtractor):
+ _VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-read... | yt_dlp/extractor/startrek.py | 26 | Python | 0.714 | suggestion | 111 | 51 | 51 | false | [StarTrek] Add extractor for startrek.com videos | 4,191 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | scy |
'upload_date': '20220616',
'description': 'md5:1ffee884e3920afbdd6dd04e926a1221',
# Thumbnail seems to have some tracking parameters added, ignore those.
'thumbnail': r're:https://intl\.startrek\.com/sites/default/files/styles/video_1920x1080/public/images/2022-06/pp_1479... | avoid use of `.+?`. It can generally be replaced by `[^"]+` or `[^<]+` | 'upload_date': '20220616',
'description': 'md5:1ffee884e3920afbdd6dd04e926a1221',
'thumbnail': r're:https://(?:intl|www)\.startrek\.com/sites/default/files/styles/video_1920x1080/public/images/2022-06/pp_14794_rr_thumb_107_yt_16x9\.jpg(?:\?.+)?',
'subtitles': {'en-US': [{... | @@ -0,0 +1,59 @@
+from yt_dlp.utils import int_or_none
+from .common import InfoExtractor
+
+
+class StarTrekIE(InfoExtractor):
+ _VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-read... | yt_dlp/extractor/startrek.py | 26 | Python | 0.429 | suggestion | 70 | 45 | 51 | false | [StarTrek] Add extractor for startrek.com videos | 4,191 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | scy |
_VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md5': '491df5035c9d4dc7f63c79caaf9c839e',
'info_dict': {
'id': 'watch-welcoming-jess-bush-to-... | `ld` gets easily confused as `id`. Maybe `ld_json`? | _VALID_URL = r'(?P<base>https?://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md5': '491df5035c9d4dc7f63c79caaf9c839e',
'info_dict': {
'id': 'watch-welcoming-jess-bush-to... | @@ -0,0 +1,59 @@
+from yt_dlp.utils import int_or_none
+from .common import InfoExtractor
+
+
+class StarTrekIE(InfoExtractor):
+ _VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-read... | yt_dlp/extractor/startrek.py | 26 | Python | 0.429 | question | 51 | 51 | 51 | false | [StarTrek] Add extractor for startrek.com videos | 4,191 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | scy |
from yt_dlp.utils import int_or_none
from .common import InfoExtractor
class StarTrekIE(InfoExtractor):
_VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md5': '... | ```suggestion
from .common import InfoExtractor
from ..utils import int_or_none
``` | from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class StarTrekIE(InfoExtractor):
_VALID_URL = r'(?P<base>https?://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md... | @@ -0,0 +1,59 @@
+from yt_dlp.utils import int_or_none
+from .common import InfoExtractor | yt_dlp/extractor/startrek.py | 2 | Python | 0.643 | refactor | 86 | 27 | 27 | false | [StarTrek] Add extractor for startrek.com videos | 4,191 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | scy |
# Extract the player element so that the rest of the matching will be done only there.
player = self._search_regex(r'(<div id="cvp-player-.+?></div>)', webpage, 'player')
hls = self._html_search_regex(r' data-hls="(.+?)" ', player, 'HLS URL')
title = self._html_search_regex(r' data-tit... | You are throwing away all other metadata from json/ld? | 'timestamp': 1654221600,
'upload_date': '20220603',
'description': 'md5:b3aa0edacfe119386567362dec8ed51b',
'thumbnail': r're:https://www\.startrek\.com/sites/default/files/styles/video_1920x1080/public/images/2022-06/pp_14792_rr_thumb_105_yt_16x9_1.jpg(?:\?.+)?',
... | @@ -0,0 +1,59 @@
+from yt_dlp.utils import int_or_none
+from .common import InfoExtractor
+
+
+class StarTrekIE(InfoExtractor):
+ _VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-read... | yt_dlp/extractor/startrek.py | 26 | Python | 0.214 | question | 54 | 28 | 45 | false | [StarTrek] Add extractor for startrek.com videos | 4,191 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | scy |
from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class StarTrekIE(InfoExtractor):
_VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md5... | this will fail for links without https (won't even work for http) | from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class StarTrekIE(InfoExtractor):
_VALID_URL = r'(?P<base>https?://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md... | @@ -0,0 +1,51 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, urljoin
+
+
+class StarTrekIE(InfoExtractor):
+ _VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)' | yt_dlp/extractor/startrek.py | 6 | Python | 0.214 | bug | 65 | 31 | 31 | false | [StarTrek] Add extractor for startrek.com videos | 4,191 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | scy |
from .common import InfoExtractor
from ..utils import int_or_none, urljoin
class StarTrekIE(InfoExtractor):
_VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-ready-room',
'md5... | not really a burning issue but these are ugly af, I would rather not have these...but upto u if u want to keep them or not | webpage = self._download_webpage(url, video_id)
player = self._search_regex(
r'(<\s*div\s+id\s*=\s*"cvp-player-[^<]+<\s*/div\s*>)', webpage, 'player')
hls = self._html_search_regex(r'\bdata-hls\s*=\s*"([^"]+)"', player, 'HLS URL')
formats, subtitles = self._extract_m3u8_for... | @@ -0,0 +1,51 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, urljoin
+
+
+class StarTrekIE(InfoExtractor):
+ _VALID_URL = r'(?P<base>https://(?:intl|www)\.startrek\.com)/videos/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://intl.startrek.com/videos/watch-welcoming-jess-bush-to-the-... | yt_dlp/extractor/startrek.py | 26 | Python | 0.357 | suggestion | 123 | 52 | 33 | false | [StarTrek] Add extractor for startrek.com videos | 4,191 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | scy |
)
from .limelight import (
LimelightMediaIE,
LimelightChannelIE,
LimelightChannelListIE,
)
from .line import (
LineLiveIE,
LineLiveChannelIE,
)
from .linkedin import (
LinkedInIE,
LinkedInLearningIE,
LinkedInLearningCourseIE,
)
from .linuxacademy import LinuxAcademyIE
from .litv import L... | ```suggestion
from .livestreamfails import LivestreamfailsIE
``` | )
from .limelight import (
LimelightMediaIE,
LimelightChannelIE,
LimelightChannelListIE,
)
from .line import (
LineLiveIE,
LineLiveChannelIE,
)
from .linkedin import (
LinkedInIE,
LinkedInLearningIE,
LinkedInLearningCourseIE,
)
from .linuxacademy import LinuxAcademyIE
from .litv import L... | @@ -837,6 +837,9 @@
LivestreamOriginalIE,
LivestreamShortenerIE,
)
+from .livestreamfails import (
+ LivestreamfailsIE,
+) | yt_dlp/extractor/_extractors.py | 26 | Python | 0.571 | bug | 66 | 51 | 51 | false | [livestreamfails] Add new extractor | 4,204 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nomevi |
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_timestamp,
)
class LivestreamfailsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?livestreamfails\.com/clip/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://livestreamfails.com/clip/139200',
'md5': '8a03aea1a... | ```suggestion
from ..utils import traverse_obj, unified_timestamp
``` | from .common import InfoExtractor
from ..utils import format_field, traverse_obj, unified_timestamp
class LivestreamfailsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?livestreamfails\.com/clip/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://livestreamfails.com/clip/139200',
'md5': '8a03aea1... | @@ -0,0 +1,37 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+) | yt_dlp/extractor/livestreamfails.py | 5 | Python | 0.571 | suggestion | 71 | 30 | 30 | false | [livestreamfails] Add new extractor | 4,204 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nomevi |
'url': 'https://livestreamfails.com/clip/139200',
'md5': '8a03aea1a46e94a05af6410337463102',
'info_dict': {
'id': '139200',
'ext': 'mp4',
'display_id': 'ConcernedLitigiousSalmonPeteZaroll-O8yo9W2L8OZEKhV2',
'title': 'Streamer jumps off a trampoline... | ```suggestion
'thumbnail': format_field(api_response, 'imageId', 'https://livestreamfails-image-prod.b-cdn.net/image/%s')
``` | 'url': 'https://livestreamfails.com/clip/139200',
'md5': '8a03aea1a46e94a05af6410337463102',
'info_dict': {
'id': '139200',
'ext': 'mp4',
'display_id': 'ConcernedLitigiousSalmonPeteZaroll-O8yo9W2L8OZEKhV2',
'title': 'Streamer jumps off a trampoline... | @@ -0,0 +1,34 @@
+from .common import InfoExtractor
+from ..utils import format_field, traverse_obj, unified_timestamp
+
+
+class LivestreamfailsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?livestreamfails\.com/clip/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://livestreamfails.com/clip/139200',... | yt_dlp/extractor/livestreamfails.py | 26 | Python | 0.714 | bug | 139 | 28 | 28 | false | [livestreamfails] Add new extractor | 4,204 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nomevi |
def _call_api(self, video_id, data):
if 'persistedQuery' in data.get('extensions', {}):
url = 'https://gql.trovo.live'
else:
url = 'https://api-web.trovo.live/graphql'
resp = self._download_json(
url, video_id, data=json.dumps([data]).encode(), headers={'... | is it possible to add tests for this?
| def _call_api(self, video_id, data):
if 'persistedQuery' in data.get('extensions', {}):
url = 'https://gql.trovo.live'
else:
url = 'https://api-web.trovo.live/graphql'
resp = self._download_json(
url, video_id, data=json.dumps([data]).encode(), headers={'... | @@ -43,7 +43,7 @@ def _extract_streamer_info(self, data):
class TrovoIE(TrovoBaseIE): | yt_dlp/extractor/trovo.py | 26 | Python | 0.071 | question | 40 | 51 | 51 | false | [Trovo] Fix extractor | 4,208 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | u-spec-png |
query={
'qid': ''.join(random.choices(string.ascii_uppercase + string.digits, k=10)),
})[0]
if 'errors' in resp:
raise ExtractorError(f'Trovo said: {resp["errors"][0]["message"]}')
return resp['data'][data['operationName']]
def _extract_streamer_i... | Could you add a proper test that currently works (for self-documentation) and then add a `'skip': 'May not be live'` | query={
'qid': ''.join(random.choices(string.ascii_uppercase + string.digits, k=10)),
})[0]
if 'errors' in resp:
raise ExtractorError(f'Trovo said: {resp["errors"][0]["message"]}')
return resp['data'][data['operationName']]
def _extract_streamer_i... | @@ -43,7 +43,14 @@ def _extract_streamer_info(self, data):
class TrovoIE(TrovoBaseIE):
- _VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?!(?:clip|video)/)(?P<id>[^/?&#]+)'
+ _VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?:s/)?(?!(?:clip|video)/)(?P<id>(?!s/)[^/?&#]+(?![^?]+\?vid))'
+ _TESTS = [{
+ '... | yt_dlp/extractor/trovo.py | 26 | Python | 0.571 | suggestion | 116 | 51 | 51 | false | [Trovo] Fix extractor | 4,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
if 'persistedQuery' in data.get('extensions', {}):
url = 'https://gql.trovo.live'
else:
url = 'https://api-web.trovo.live/graphql'
resp = self._download_json(
url, video_id, data=json.dumps([data]).encode(), headers={'Accept': 'application/json'},
... | This doesn't handle `?foo=bar&vid=...`. You can fix the regex, but better to override `suitable` imo | if 'persistedQuery' in data.get('extensions', {}):
url = 'https://gql.trovo.live'
else:
url = 'https://api-web.trovo.live/graphql'
resp = self._download_json(
url, video_id, data=json.dumps([data]).encode(), headers={'Accept': 'application/json'},
... | @@ -43,7 +43,14 @@ def _extract_streamer_info(self, data):
class TrovoIE(TrovoBaseIE):
- _VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?!(?:clip|video)/)(?P<id>[^/?&#]+)'
+ _VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?:s/)?(?!(?:clip|video)/)(?P<id>(?!s/)[^/?&#]+(?![^?]+\?vid))' | yt_dlp/extractor/trovo.py | 26 | Python | 0.714 | bug | 100 | 51 | 51 | false | [Trovo] Fix extractor | 4,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
play_url = stream_info.get('playUrl')
if not play_url:
continue
format_id = stream_info.get('desc')
formats.append({
'format_id': format_id,
'height': int_or_none(format_id[:-1]) if format_id else None,
'url'... | ```suggestion
_VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?:clip|video|s)/(?:[^/]+/\d+[^#]*[?&]vid=)?(?P<id>(?<!/s/)[^/?&#]+)'
``` | play_url = stream_info.get('playUrl')
if not play_url:
continue
format_id = stream_info.get('desc')
formats.append({
'format_id': format_id,
'height': int_or_none(format_id[:-1]) if format_id else None,
'url'... | @@ -87,7 +108,7 @@ def _real_extract(self, url):
class TrovoVodIE(TrovoBaseIE):
- _VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?:clip|video)/(?P<id>[^/?&#]+)'
+ _VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?:clip|video|s)/(?:[^/]+/\d+[^&]*[?&]vid=)?(?P<id>(?<!/s/)[^/?&#]+)' | yt_dlp/extractor/trovo.py | 26 | Python | 0.714 | suggestion | 138 | 51 | 51 | false | [Trovo] Fix extractor | 4,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
if 'persistedQuery' in data.get('extensions', {}):
url = 'https://gql.trovo.live'
else:
url = 'https://api-web.trovo.live/graphql'
resp = self._download_json(
url, video_id, data=json.dumps([data]).encode(), headers={'Accept': 'application/json'},
... | ```suggestion
_VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?:s/)?(?!(?:clip|video)/)(?P<id>(?!s/)[^/?&#]+(?![^#]+[?&]vid=))'
``` | if 'persistedQuery' in data.get('extensions', {}):
url = 'https://gql.trovo.live'
else:
url = 'https://api-web.trovo.live/graphql'
resp = self._download_json(
url, video_id, data=json.dumps([data]).encode(), headers={'Accept': 'application/json'},
... | @@ -43,7 +43,27 @@ def _extract_streamer_info(self, data):
class TrovoIE(TrovoBaseIE):
- _VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?!(?:clip|video)/)(?P<id>[^/?&#]+)'
+ _VALID_URL = TrovoBaseIE._VALID_URL_BASE + r'(?:s/)?(?!(?:clip|video)/)(?P<id>(?!s/)[^/?&#]+(?![^&]+[?&]vid=))' | yt_dlp/extractor/trovo.py | 26 | Python | 0.714 | suggestion | 135 | 51 | 51 | false | [Trovo] Fix extractor | 4,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'info_dict': {
'id': '18694039',
'title': 'Chuyện mèo giả sư tử | Thông điệp cuộc sống',
'ext': 'mp4',
'view_count': int,
'like_count': int,
'dislike_count': int,
'display_id': 'chuyen-meo-gia-su-tu-thong-diep-cuoc-song',
... | ```suggestion
video_url = traverse_obj(json_data, (
'data', 'videoDetail', ('list_resolution', 'original_path')), get_all=False)
```
Also, maybe it should extract both? | 'info_dict': {
'id': '18694039',
'title': 'Chuyện mèo giả sư tử | Thông điệp cuộc sống',
'ext': 'mp4',
'view_count': int,
'like_count': int,
'dislike_count': int,
'display_id': 'chuyen-meo-gia-su-tu-thong-diep-cuoc-song',
... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.786 | refactor | 192 | 51 | 51 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'like_count': int,
'dislike_count': int,
'display_id': 'chuyen-meo-gia-su-tu-thong-diep-cuoc-song',
'thumbnail': 'http://mcvideomd1fr.keeng.net/playnow/images/20220505/ad0a055d-2f69-42ca-b888-4790041fe6bc_640x480.jpg',
'description': '',
'duration'... | ```suggestion
formats = [{'url': video_url, 'ext': 'mp4'}]
``` | 'like_count': int,
'dislike_count': int,
'display_id': 'chuyen-meo-gia-su-tu-thong-diep-cuoc-song',
'thumbnail': 'http://mcvideomd1fr.keeng.net/playnow/images/20220505/ad0a055d-2f69-42ca-b888-4790041fe6bc_640x480.jpg',
'description': '',
'duration'... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.571 | suggestion | 76 | 51 | 51 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'description': '',
'duration': 70,
'timestamp': 1652254203,
'upload_date': '20220511',
'comment_count': int,
'categories': ['Kids']
}
}]
def _real_extract(self, url):
video_slug = self._match_valid_url(url).group('video_slu... | ```suggestion
vid_url, subs = self._extract_m3u8_formats_and_subtitles(video['video_path'], video_slug, ext='mp4')
``` | 'description': '',
'duration': 70,
'timestamp': 1652254203,
'upload_date': '20220511',
'comment_count': int,
'categories': ['Kids']
}
}]
def _real_extract(self, url):
video_slug = self._match_valid_url(url).group('video_slu... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.786 | refactor | 136 | 51 | 50 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
else:
for video in video_url:
vid_url, subs = self._extract_m3u8_formats_and_subtitles(video['video_path'], video_slug)
vid_url = [{**vid, 'ext': 'mp4'} for vid in vid_url]
formats.extend(vid_url)
self._merge_subtitles(subs, target=subt... | Did you mean `channel_follower_count`? | fmts, subs = self._extract_m3u8_formats_and_subtitles(
video.get('video_path'), video_id, ext='mp4')
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
self._sort_formats(formats)
return {
'id': video_id,
... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.214 | question | 38 | 30 | 28 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'dislike_count': int,
'display_id': 'chuyen-meo-gia-su-tu-thong-diep-cuoc-song',
'thumbnail': 'http://mcvideomd1fr.keeng.net/playnow/images/20220505/ad0a055d-2f69-42ca-b888-4790041fe6bc_640x480.jpg',
'description': '',
'duration': 70,
'timestamp': ... | Is it fine to set `[0]` at this ? | 'dislike_count': int,
'display_id': 'chuyen-meo-gia-su-tu-thong-diep-cuoc-song',
'thumbnail': 'http://mcvideomd1fr.keeng.net/playnow/images/20220505/ad0a055d-2f69-42ca-b888-4790041fe6bc_640x480.jpg',
'description': '',
'duration': 70,
'timestamp': ... | @@ -30,15 +30,14 @@ def _real_extract(self, url):
'http://apivideo.mocha.com.vn:8081/onMediaBackendBiz/mochavideo/getVideoDetail',
video_slug, query={'url': f'{url}', 'token': ''})
- video_url = traverse_obj(json_data, ('data', 'videoDetail', 'list_resolution'))
- video_url.app... | yt_dlp/extractor/mocha.py | 26 | Python | 0.214 | question | 33 | 51 | 51 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | HobbyistDev |
_VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
_TESTS = [{
'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v18694039',
'info_dict': {
'id': '18694039',
'title': 'Chuyện mèo giả sư tử | Thông điệp cuộc sống',
'ext... | ```suggestion
video_slug, query={'url': url, 'token': ''})
```
Isn't this enough?
Also how stable is this url given it has port number in it -_-? | _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
_TESTS = [{
'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v18694039',
'info_dict': {
'id': '18694039',
'title': 'Chuyện mèo giả sư tử | Thông điệp cuộc sống',
'ext... | @@ -0,0 +1,65 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.714 | question | 163 | 51 | 51 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v18694039',
'info_dict': {
'id': '18694039',
'title': 'Chuyện mèo giả sư tử | Thông điệp cuộc sống',
'ext': 'mp4',
'view_count': int,
'like_count': int,
'di... | ```suggestion
video_urls = traverse_obj(json_data, ('data', 'videoDetail', ('list_resolution', 'original_path'))) or []
``` | 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v18694039',
'info_dict': {
'id': '18694039',
'title': 'Chuyện mèo giả sư tử | Thông điệp cuộc sống',
'ext': 'mp4',
'view_count': int,
'like_count': int,
'di... | @@ -0,0 +1,65 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.714 | suggestion | 133 | 51 | 51 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
'thumbnail': 'http://mcvideomd1fr.keeng.net/playnow/images/20220505/ad0a055d-2f69-42ca-b888-4790041fe6bc_640x480.jpg',
'description': '',
'duration': 70,
'timestamp': 1652254203,
'upload_date': '20220511',
'comment_count': int,
'categor... | ```suggestion
self._merge_subtitles(subs, target=subtitles)
```
this should be inside the else block, no? | 'thumbnail': 'http://mcvideomd1fr.keeng.net/playnow/images/20220505/ad0a055d-2f69-42ca-b888-4790041fe6bc_640x480.jpg',
'description': '',
'duration': 70,
'timestamp': 1652254203,
'upload_date': '20220511',
'comment_count': int,
'categor... | @@ -0,0 +1,65 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.786 | question | 125 | 50 | 51 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
'dislike_count': int,
'display_id': 'chuyen-meo-gia-su-tu-thong-diep-cuoc-song',
'thumbnail': 'http://mcvideomd1fr.keeng.net/playnow/images/20220505/ad0a055d-2f69-42ca-b888-4790041fe6bc_640x480.jpg',
'description': '',
'duration': 70,
'timestamp': ... | ```suggestion
fmts, subs = self._extract_m3u8_formats_and_subtitles(video[0]['video_path'], video_slug, ext='mp4')
``` | 'dislike_count': int,
'display_id': 'chuyen-meo-gia-su-tu-thong-diep-cuoc-song',
'thumbnail': 'http://mcvideomd1fr.keeng.net/playnow/images/20220505/ad0a055d-2f69-42ca-b888-4790041fe6bc_640x480.jpg',
'description': '',
'duration': 70,
'timestamp': ... | @@ -0,0 +1,65 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.786 | refactor | 136 | 51 | 51 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
'comment_count': int,
'categories': ['Kids']
}
}]
def _real_extract(self, url):
video_slug = self._match_valid_url(url).group('video_slug')
json_data = self._download_json(
'http://apivideo.mocha.com.vn:8081/onMediaBackendBiz/mochavideo/getVideoDetail... | move this right after json_data is fetched...no point in doing other tasks only to fail while returning -_-
Also use this id only everywhere | 'comment_count': int,
'categories': ['Kids']
}
}]
def _real_extract(self, url):
video_slug = self._match_valid_url(url).group('video_slug')
json_data = self._download_json(
'http://apivideo.mocha.com.vn:8081/onMediaBackendBiz/mochavideo/getVideoDetail... | @@ -0,0 +1,65 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.429 | bug | 143 | 45 | 46 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
'categories': ['Kids']
}
}]
def _real_extract(self, url):
video_slug = self._match_valid_url(url).group('video_slug')
json_data = self._download_json(
'http://apivideo.mocha.com.vn:8081/onMediaBackendBiz/mochavideo/getVideoDetail',
video_slug, query={... | i see u are using this `[data][videoDetail]` everywhere, better to have this as fatal and make json_data point to this dict | 'categories': ['Kids']
}
}]
def _real_extract(self, url):
video_slug = self._match_valid_url(url).group('video_slug')
json_data = self._download_json(
'http://apivideo.mocha.com.vn:8081/onMediaBackendBiz/mochavideo/getVideoDetail',
video_slug, query={... | @@ -0,0 +1,65 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj
+
+
+class MochaVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://video.mocha.com.vn/(?P<video_slug>[\w-]+)'
+ _TESTS = [{
+ 'url': 'http://video.mocha.com.vn/chuyen-meo-gia-su-tu-thong-diep-cuoc-song-v186940... | yt_dlp/extractor/mocha.py | 26 | Python | 0.571 | suggestion | 123 | 44 | 45 | false | [extractor/mocha] Add extractor | 4,213 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
return {
'id': uuid,
'title': title,
'formats': formats,
'timestamp': material['original_date'],
'description': description,
'duration': parse_duration(material.get('duration')),
'thumbnails': thumbnails,
}
class RTLL... | rename to `get_formats_and_subtitles` |
return {
'id': uuid,
'title': title,
'formats': formats,
'timestamp': material['original_date'],
'description': description,
'duration': parse_duration(material.get('duration')),
'thumbnails': thumbnails,
}
class RTLL... | @@ -141,3 +141,176 @@ def _real_extract(self, url):
'duration': parse_duration(material.get('duration')),
'thumbnails': thumbnails,
}
+
+
+class RTLLuBaseIE(InfoExtractor):
+ _MEDIA_REGEX = {
+ 'video': r'<rtl-player\s*poster\s*=\s*\"(?:[\"\w\.://-]+)\"\s*(title\s*=\s*(?:[\"... | yt_dlp/extractor/rtlnl.py | 26 | Python | 0.286 | style | 37 | 51 | 51 | false | [extractor/rtl.nl] Add rtl.lu extractor | 4,222 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
'title': 'Esch2022: Suessem ass déi nei "Gemeng vum Mount"',
'thumbnail': 'https://static.rtl.lu/rtl2008.lu/nt/p/2022/06/22/16/7f9d5141c40733ffd0054d1a4d01819e.jpeg',
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpa... | this is incorrect imo.
U are calling the group id here and it is `?`.
Either u should rename it to slug (which again i do not prefer)
Or you should make the whole group capture compulsory and then u can call it id.(which i prefer)
`r'https?://www\.rtl\.lu/tele/(?P<id>live(?:-\d+)?)'` | 'ext': 'mp4',
'description': 'md5:ac031da0740e997a5cf4633173634fee',
'title': 'md5:87e17722ed21af0f24be3243f4ec0c46',
'thumbnail': 'https://replay-assets.rtl.lu/2022/01/26/screenshot_20220126104933_3274749_12b249833469b0d6e4440a1dec83cdfa.jpg',
}
}, {
... | @@ -141,3 +141,176 @@ def _real_extract(self, url):
'duration': parse_duration(material.get('duration')),
'thumbnails': thumbnails,
}
+
+
+class RTLLuBaseIE(InfoExtractor):
+ _MEDIA_REGEX = {
+ 'video': r'<rtl-player\s*poster\s*=\s*\"(?:[\"\w\.://-]+)\"\s*(title\s*=\s*(?:[\"... | yt_dlp/extractor/rtlnl.py | 26 | Python | 0.643 | bug | 294 | 51 | 51 | false | [extractor/rtl.nl] Add rtl.lu extractor | 4,222 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
class RTLLuTeleLiveIE(RTLLuBaseIE):
_VALID_URL = r'https?://www\.rtl\.lu/tele/live(?P<id>-\d+)?'
_TESTS = [{
'url': 'https://www.rtl.lu/tele/live',
'info_dict': {
'id': 'Tele:live',
'ext': 'mp4',
'live_status': 'is_live',
'title': r're:RTL - Télé... | not a good idea to set id manually imo.
Just apply above suggestion and do video_id = self._match_id(url) | 'url': 'https://www.rtl.lu/tele/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'live_status': 'is_live',
'title': r're:RTL - Télé LIVE \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
'thumbnail': 'https://static.rtl.lu/livestream/channel1.jpg',
}
... | @@ -141,3 +141,176 @@ def _real_extract(self, url):
'duration': parse_duration(material.get('duration')),
'thumbnails': thumbnails,
}
+
+
+class RTLLuBaseIE(InfoExtractor):
+ _MEDIA_REGEX = {
+ 'video': r'<rtl-player\s*poster\s*=\s*\"(?:[\"\w\.://-]+)\"\s*(title\s*=\s*(?:[\"... | yt_dlp/extractor/rtlnl.py | 26 | Python | 0.357 | suggestion | 106 | 51 | 44 | false | [extractor/rtl.nl] Add rtl.lu extractor | 4,222 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | HobbyistDev |
r'/sz=[0-9]+x([0-9]+)',
meta[p], 'thumbnail height', fatal=False))
})
return {
'id': uuid,
'title': title,
'formats': formats,
'timestamp': material['original_date'],
'description': description,
... | ```suggestion
_MEDIA_REGEX = {
'video': r'<rtl-player\s[^>]*\bhls\s*=\s*"([^"]+)',
'audio': r'<rtl-audioplayer\s[^>]*\bsrc\s*=\s*"([^"]+)',
'thumbnail': r'<rtl-player\s[^>]*\bposter\s*=\s*"([^"]+)',
}
def get_media_url(self, webpage, video_id, media_type):
return sel... | r'/sz=[0-9]+x([0-9]+)',
meta[p], 'thumbnail height', fatal=False))
})
return {
'id': uuid,
'title': title,
'formats': formats,
'timestamp': material['original_date'],
'description': description,
... | @@ -141,3 +141,157 @@ def _real_extract(self, url):
'duration': parse_duration(material.get('duration')),
'thumbnails': thumbnails,
}
+
+
+class RTLLuBaseIE(InfoExtractor):
+ _MEDIA_REGEX = {
+ 'video': r'<rtl-player\s*[^>]*\bhls\s*=\s*\"(?P<media_url>[^"]+)\"',
+ 'au... | yt_dlp/extractor/rtlnl.py | 26 | Python | 0.929 | suggestion | 415 | 51 | 51 | false | [extractor/rtl.nl] Add rtl.lu extractor | 4,222 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
# flake8: noqa: F401
from .abc import (
ABCIE,
ABCIViewIE,
ABCIViewShowSeriesIE,
)
from .abcnews import (
AbcNewsIE,
AbcNewsVideoIE,
)
from .abcotvs import (
ABCOTVSIE,
ABCOTVSClipsIE,
)
from .abematv import (
AbemaTVIE,
AbemaTVTitleIE,
)
from .academicearth import AcademicEarthCour... | It didn't need `(` or `)` (sorry, i forgot the symbol name in english) | # flake8: noqa: F401
from .abc import (
ABCIE,
ABCIViewIE,
ABCIViewShowSeriesIE,
)
from .abcnews import (
AbcNewsIE,
AbcNewsVideoIE,
)
from .abcotvs import (
ABCOTVSIE,
ABCOTVSClipsIE,
)
from .abematv import (
AbemaTVIE,
AbemaTVTitleIE,
)
from .academicearth import AcademicEarthCour... | @@ -22,6 +22,7 @@
ACastIE,
ACastChannelIE,
)
+from .acfun import (AcFunVideoIE, AcFunBangumiIE) | yt_dlp/extractor/_extractors.py | 25 | Python | 0.357 | suggestion | 70 | 50 | 50 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | lockmatrix |
'only_matching': True,
}]
@staticmethod
def parse_format(info):
vcodec, acodec = None, None
codec_str = info.get('codecs') or ''
m = re.match('(?P<vc>[^,]+),(?P<ac>[^,]+)', codec_str)
if m:
vcodec = m.group("vc")
acodec = m.group("ac")
... | i think the `mobj` is unnecessary as the url will be get checked first, you can group `video_id` directly here | return {
'id': video_id,
'formats': formats,
'subtitles': subtitles,
'duration': float_or_none(video_info.get('durationMillis'), 1000),
'timestamp': int_or_none(video_info.get('uploadTime'), 1000),
'http_headers': {'Referer': 'https://www.a... | @@ -0,0 +1,162 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ IE_NAME = 'AcFunVideoIE'
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _T... | yt_dlp/extractor/acfun.py | 26 | Python | 0.5 | suggestion | 110 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | lockmatrix |
(?:\?ac=(?P<ac_idx>\d+))?
'''
_TESTS = [{
'url': 'https://www.acfun.cn/bangumi/aa6002917',
'info_dict': {
'id': 'aa6002917',
'title': '租借女友 第1话 租借女友',
'duration': 1467,
'timestamp': 1594432800,
},
... | same as https://github.com/yt-dlp/yt-dlp/pull/4228/files#r914718187. You can also group `ac_idx` from here, regex will return `None` if it's not found | 'title': title,
'thumbnail': json_all.get('coverUrl'),
'description': json_all.get('description'),
'uploader': traverse_obj(json_all, ('user', 'name')),
'uploader_id': traverse_obj(json_all, ('user', 'href')),
'tags': traverse_obj(json_all, ('tagLi... | @@ -0,0 +1,162 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ IE_NAME = 'AcFunVideoIE'
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _T... | yt_dlp/extractor/acfun.py | 26 | Python | 0.5 | suggestion | 150 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | lockmatrix |
class AcFunBangumiIE(InfoExtractor):
IE_NAME = 'AcFunBangumiIE'
_VALID_URL = r'''(?x)
https?://(?:www\.acfun\.cn/bangumi/)
(?P<id>aa[_\d]+)
(?:\?ac=(?P<ac_idx>\d+))?
'''
_TESTS = [{
'url': 'https://www.acfun.c... | Actually this not a problem for me but why you test same link twice ? | part_idx, part_video_info = next(
(idx + 1, v) for (idx, v) in enumerate(video_list)
if v['id'] == video_internal_id)
title = f'{title} P{part_idx:02d} {part_video_info["title"]}'
return {
**self._extract_metadata(video_id, json_all['currentVi... | @@ -0,0 +1,162 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ IE_NAME = 'AcFunVideoIE'
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _T... | yt_dlp/extractor/acfun.py | 26 | Python | 0.214 | question | 69 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | lockmatrix |
'url': info.get('url'),
'fps': int_or_none(info.get('frameRate')),
'width': int_or_none(info.get('width')),
'height': int_or_none(info.get('height')),
'vcodec': vcodec,
'acodec': acodec,
'tbr': float_or_none(info.get('avgBitrate'))
... | This lines seems can generalized | 'url': 'https://www.acfun.cn/v/ac35457073',
'info_dict': {
'id': '35457073',
'ext': 'mp4',
'duration': 174.208,
'timestamp': 1656403967,
'title': '1 8 岁 现 状',
'description': '“赶紧回去!班主任查班了!”',
'uploader': '锤子game',
... | @@ -0,0 +1,162 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ IE_NAME = 'AcFunVideoIE'
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _T... | yt_dlp/extractor/acfun.py | 26 | Python | 0.071 | suggestion | 32 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | lockmatrix |
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id)
json_bangumi_data = self._search_json(r'window.bangumiData\s*=\s*', webpage, 'bangumiData', video_id)
if not mobj.group('ac_idx'):
... | same as https://github.com/yt-dlp/yt-dlp/pull/4228/files#r914721156 | },
}, {
'url': 'https://www.acfun.cn/bangumi/aa5023171_36188_1750645',
'info_dict': {
'id': 'aa5023171_36188_1750645',
'ext': 'mp4',
'title': '红孩儿之趴趴蛙寻石记 第5话 ',
'duration': 760.0,
'season': '红孩儿之趴趴蛙寻石记',
'season_id': 502... | @@ -0,0 +1,162 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ IE_NAME = 'AcFunVideoIE'
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _T... | yt_dlp/extractor/acfun.py | 26 | Python | 0.214 | suggestion | 67 | 40 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | lockmatrix |
if m:
vcodec = m.group("vc")
acodec = m.group("ac")
return {
'url': info.get('url'),
'fps': int_or_none(info.get('frameRate')),
'width': int_or_none(info.get('width')),
'height': int_or_none(info.get('height')),
'vcodec... | Is this possible to generate `m3u8` ? if yes, i think it's better to hardcoding the ext imo |
class AcFunVideoIE(AcFunVideoBaseIE):
_VALID_URL = r'https?://www\.acfun\.cn/v/ac(?P<id>[_\d]+)'
_TESTS = [{
'url': 'https://www.acfun.cn/v/ac35457073',
'info_dict': {
'id': '35457073',
'ext': 'mp4',
'duration': 174.208,
'timestamp': 1656403967,
... | @@ -0,0 +1,162 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ IE_NAME = 'AcFunVideoIE'
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _T... | yt_dlp/extractor/acfun.py | 26 | Python | 0.429 | question | 91 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | lockmatrix |
self._sort_formats(formats)
video_list = json_all['videoList']
p_idx, video_info = [(idx + 1, v) for (idx, v) in enumerate(video_list)
if v['id'] == video_inner_id
][0]
title = json_all['title']
if len(video_list) > 1:
... | I don't think this is necessary, the extractor will use class name as default ie name | 'uploader_id': '37259967',
'upload_date': '20220629',
'timestamp': 1656479962,
'tags': list,
'like_count': int,
'view_count': int,
'comment_count': int,
'thumbnail': r're:^https?://.*\.(jpg|jpeg)',
'description':... | @@ -0,0 +1,162 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ IE_NAME = 'AcFunVideoIE'
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _T... | yt_dlp/extractor/acfun.py | 26 | Python | 0.286 | refactor | 85 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | lockmatrix |
import re
from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
traverse_obj,
)
class AcFunVideoIE(InfoExtractor):
_VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
_TESTS = [{
'url': 'https://www.acfun.cn/v/ac35457073',
'info_dict':... | ```suggestion
'skip_download': 'm3u8',
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
format_field,
int_or_none,
traverse_obj,
parse_codecs,
parse_qs,
)
class AcFunVideoBaseIE(InfoExtractor):
def _extract_metadata(self, video_id, video_info):
playjson = self._parse_json(video_info['ksPlayJson'], ... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 24 | Python | 0.571 | suggestion | 56 | 49 | 49 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
import re
from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
traverse_obj,
)
class AcFunVideoIE(InfoExtractor):
_VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
_TESTS = [{
'url': 'https://www.acfun.cn/v/ac35457073',
'info_dict':... | Is the whole site geo-restricted? If possible, add a non-restricted test | from .common import InfoExtractor
from ..utils import (
float_or_none,
format_field,
int_or_none,
traverse_obj,
parse_codecs,
parse_qs,
)
class AcFunVideoBaseIE(InfoExtractor):
def _extract_metadata(self, video_id, video_info):
playjson = self._parse_json(video_info['ksPlayJson'], ... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.214 | suggestion | 72 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'duration': 455.21,
'timestamp': 1655289827,
},
'params': {
# m3u8 download
'skip_download': True,
},
'skip': 'Geo-restricted to China',
}]
def parse_format(self, info, video_id):
vcodec, acodec = None, None
codec_... | Why are other formats discarded? | formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
for f in fmts:
f.update({
'fps': float_or_none(video.get('frameRate')),
'width': int_or_none(video.get('width')),
'height': int_or_none(video... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.071 | question | 32 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
self._sort_formats(formats)
return formats
def gen_other_video_info_map(self, video_info):
return {
'duration': float_or_none(video_info.get('durationMillis'), 1000),
'timestamp': int_or_none(video_info.get('uploadTime'), 1000),
}
def _real_extract(self... | ```suggestion
p_idx, video_info = next(
(idx + 1, v) for (idx, v) in enumerate(json_all['videoList'])
if v['id'] == video_internal_id)
``` | 'tags': list,
},
}, {
# example for len(video_list) > 1
'url': 'https://www.acfun.cn/v/ac35468952_2',
'info_dict': {
'id': '35468952_2',
'ext': 'mp4',
'title': '【动画剧集】Rocket & Groot Season 1(2022)/火箭浣熊与格鲁特第1季 P02 S01E02 十拿九穩',
... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.714 | suggestion | 174 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
json_all = self._search_json(r'window.videoInfo\s*=\s*', webpage, 'videoInfo', video_id)
video_info = json_all['currentVideoInfo']
playjson = self._parse_json(video_info['ksPlayJson'], video_id)
video_internal_id = traverse_obj(json_all, ('currentVideoInfo', 'id'))
formats = se... | ```suggestion
'tags': traverse_obj(json_all, ('tag_list', ..., 'name')),
``` | 'tags': list,
'like_count': int,
'view_count': int,
'comment_count': int,
'thumbnail': r're:^https?://.*\.(jpg|jpeg)',
'description': 'md5:67583aaf3a0f933bd606bc8a2d3ebb17',
}
}]
def _real_extract(self, url):
video_id = sel... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.571 | suggestion | 90 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
def gen_other_video_info_map(self, video_info):
return {
'duration': float_or_none(video_info.get('durationMillis'), 1000),
'timestamp': int_or_none(video_info.get('uploadTime'), 1000),
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpa... | use single quotes outside and double inside | 'url': 'https://www.acfun.cn/v/ac35468952_2',
'info_dict': {
'id': '35468952_2',
'ext': 'mp4',
'title': '【动画剧集】Rocket & Groot Season 1(2022)/火箭浣熊与格鲁特第1季 P02 S01E02 十拿九穩',
'duration': 90.459,
'uploader': '比令',
'uploader_id': '3725996... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.143 | suggestion | 43 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
_TESTS = [{
'url': 'https://www.acfun.cn/bangumi/aa6002917',
'info_dict': {
'id': 'aa6002917',
'title': '租借女友 第1话 租借女友',
'duration': 1467,
'timestamp': 1594432800,
},
'params': {
# m3u8 download
'skip_download': ... | ```suggestion
video_id = f"{mobj.group('id')}_{mobj.group('ac_idx')}"
```
is better imo | _VALID_URL = r'https?://www\.acfun\.cn/bangumi/(?P<id>aa[_\d]+)'
_TESTS = [{
'url': 'https://www.acfun.cn/bangumi/aa6002917_36188_1745457?ac=2',
'info_dict': {
'id': 'aa6002917_36188_1745457__2',
'ext': 'mp4',
'title': '【7月】租借女友 水原千鹤角色曲『DATE』特别PV',
... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.786 | suggestion | 102 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'params': {
# m3u8 download
'skip_download': True,
},
'skip': 'Geo-restricted to China',
}, {
'url': 'https://www.acfun.cn/bangumi/aa6002917_36188_1745457?ac=2',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._... | title should be non-fatal. Same everywhere | 'upload_date': '20200916',
'timestamp': 1600243813,
'duration': 92.091,
},
}, {
'url': 'https://www.acfun.cn/bangumi/aa5023171_36188_1750645',
'info_dict': {
'id': 'aa5023171_36188_1750645',
'ext': 'mp4',
'title': '红孩儿之趴... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.143 | suggestion | 42 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'timestamp': 1594432800,
},
'params': {
# m3u8 download
'skip_download': True,
},
'skip': 'Geo-restricted to China',
}, {
'url': 'https://www.acfun.cn/bangumi/aa6002917_36188_1745457?ac=2',
'only_matching': True,
}]
def _re... | can be simplified to:
```py
webpage = ...
json_bangumi_data = ...
ac_id, ac_idx = self._search_regex(...) or (None, None)
if ac_idx:
...
else:
...
``` | 'ext': 'mp4',
'title': '【7月】租借女友 水原千鹤角色曲『DATE』特别PV',
'upload_date': '20200916',
'timestamp': 1600243813,
'duration': 92.091,
},
}, {
'url': 'https://www.acfun.cn/bangumi/aa5023171_36188_1750645',
'info_dict': {
'id': 'aa... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.714 | suggestion | 167 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
webpage = self._download_webpage(url, video_id)
json_bangumi_data = self._search_json(r'window.bangumiData\s*=\s*', webpage, 'bangumiData', video_id)
other_info = {}
if not has_ac_idx:
video_info = json_bangumi_data['currentVideoInfo']
title = json_bangumi_data['... | Why is this called `other_info`? | 'comment_count': int,
},
}, {
'url': 'https://www.acfun.cn/bangumi/aa6065485_36188_1885061',
'info_dict': {
'id': 'aa6065485_36188_1885061',
'ext': 'mp4',
'title': '叽歪老表(第二季) 第5话 坚不可摧',
'season': '叽歪老表(第二季)',
'season_num... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.214 | question | 32 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
][0]
title = json_all['title']
if len(video_list) > 1:
title = f"{title} P{p_idx:02d} {video_info['title']}"
return {
'id': video_id,
'title': title,
'formats': formats,
'thumbnail': json_all.get('coverUrl... | Do not inherit from a concrete IE. Instead, create a BaseIE from which both inherits |
webpage = self._download_webpage(url, video_id)
json_all = self._search_json(r'window.videoInfo\s*=\s*', webpage, 'videoInfo', video_id)
title = json_all.get('title')
video_list = json_all.get('videoList') or []
video_internal_id = traverse_obj(json_all, ('currentVideoInfo', 'i... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.286 | suggestion | 84 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
return {
**formats[0],
'fps': int_or_none(info.get('frameRate')),
'width': int_or_none(info.get('width')),
'height': int_or_none(info.get('height')),
'vcodec': vcodec,
'acodec': acodec,
'tbr': float_or_none(info.get('avgBitrate'... | It looks to me like all these three should be merged into a single function |
_TESTS = [{
'url': 'https://www.acfun.cn/v/ac35457073',
'info_dict': {
'id': '35457073',
'ext': 'mp4',
'duration': 174.208,
'timestamp': 1656403967,
'title': '1 8 岁 现 状',
'description': '“赶紧回去!班主任查班了!”',
'uploader':... | @@ -0,0 +1,192 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ traverse_obj,
+)
+
+
+class AcFunVideoIE(InfoExtractor):
+ _VALID_URL = r'(?x)https?://(?:www\.acfun\.cn/v/)ac(?P<id>[_\d]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.acfun.cn/v/... | yt_dlp/extractor/acfun.py | 26 | Python | 0.286 | suggestion | 75 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
from .common import InfoExtractor
from ..utils import (
bug_reports_message,
ExtractorError,
float_or_none,
format_field,
int_or_none,
traverse_obj,
parse_codecs,
)
class AcFunVideoBaseIE(InfoExtractor):
def parse_format_and_subtitle(self, video_id, video_info):
if 'ksPlayJson... | No idea what `fmt_jobj` is supposed to mean. Use a better name | from .common import InfoExtractor
from ..utils import (
float_or_none,
format_field,
int_or_none,
traverse_obj,
parse_codecs,
parse_qs,
)
class AcFunVideoBaseIE(InfoExtractor):
def _extract_metadata(self, video_id, video_info):
playjson = self._parse_json(video_info['ksPlayJson'], ... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 20 | Python | 0.429 | suggestion | 62 | 45 | 45 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
class AcFunVideoBaseIE(InfoExtractor):
def parse_format_and_subtitle(self, video_id, video_info):
if 'ksPlayJson' not in video_info:
raise ExtractorError(f'Unknown webpage json schema{bug_reports_message()}')
playjson = self._parse_json(video_info['ksPlayJson'], video_id)
fmt_... | ```suggestion
formats, subtitles = [], {}
for video in fmt_jobj:
fmts, subs = self._extract_m3u8_formats_and_subtitles(video['url'], video_id, 'mp4', fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
for f in fmts:
... | class AcFunVideoBaseIE(InfoExtractor):
def _extract_metadata(self, video_id, video_info):
playjson = self._parse_json(video_info['ksPlayJson'], video_id)
formats, subtitles = [], {}
for video in traverse_obj(playjson, ('adaptationSet', 0, 'representation')):
fmts, subs = self._e... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.857 | refactor | 692 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
self._sort_formats(formats)
return {
'formats': formats,
'subtitles': subtitles,
'duration': float_or_none(video_info.get('durationMillis'), 1000),
'timestamp': int_or_none(video_info.get('uploadTime'), 1000),
}
class AcFunVideoIE(AcFunVideoBase... | these will easily break!
```suggestion
'view_count': int,
'like_count': int,
'comment_count': int,
``` |
class AcFunVideoIE(AcFunVideoBaseIE):
_VALID_URL = r'https?://www\.acfun\.cn/v/ac(?P<id>[_\d]+)'
_TESTS = [{
'url': 'https://www.acfun.cn/v/ac35457073',
'info_dict': {
'id': '35457073',
'ext': 'mp4',
'duration': 174.208,
'timestamp': 1656403967,... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.714 | suggestion | 143 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'ext': 'mp4',
'subtitles': subtitle_list, # it seems AcFun do not have subtitles
**parse_codecs(video.get('codecs', ''))
} for fmt in format_list]
subtitles += subtitle_list
self._sort_formats(formats)
return {
'form... | Does this URL not change? If it can, use regex
```suggestion
'thumbnail': r're:https?://tx-free-imgs\.acfun\.cn/newUpload/\w+.jpeg',
``` | 'id': video_id,
'formats': formats,
'subtitles': subtitles,
'duration': float_or_none(video_info.get('durationMillis'), 1000),
'timestamp': int_or_none(video_info.get('uploadTime'), 1000),
'http_headers': {'Referer': 'https://www.acfun.cn/'},
... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.786 | question | 151 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'description': '“赶紧回去!班主任查班了!”',
'uploader': '锤子game',
'uploader_id': '51246077',
'tags': ['电子竞技', 'LOL', 'CF', '搞笑', '真人'],
'view_count': 31917,
'like_count': 1850,
'comment_count': 288,
'duration': 174.208,
'ti... | ```suggestion
title = json_all.get('title')
``` | 'view_count': int,
'comment_count': int,
'tags': list,
},
}, {
# example for len(video_list) > 1
'url': 'https://www.acfun.cn/v/ac35468952_2',
'info_dict': {
'id': '35468952_2',
'ext': 'mp4',
'title': '【动画剧集】Rock... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.571 | suggestion | 57 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'id': '35457073',
'title': '1 8 岁 现 状',
'thumbnail': 'https://tx-free-imgs.acfun.cn/newUpload/51246077_82bcf86c32c54c4d80cbd624ba4cc38c.jpeg?imageslim',
'description': '“赶紧回去!班主任查班了!”',
'uploader': '锤子game',
'uploader_id': '51246077',
'... | Imo, this error isnt even needed. The below line will raise a good enough error for this situation. But if u want to keep it, do:
```suggestion
raise ExtractorError('Unknown webpage json schema')
```
bug_report_message is automatically added | 'thumbnail': r're:^https?://.*\.(jpg|jpeg)',
'upload_date': '20220628',
'like_count': int,
'view_count': int,
'comment_count': int,
'tags': list,
},
}, {
# example for len(video_list) > 1
'url': 'https://www.acfun.cn/v/a... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 1 | bug | 257 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
},
'params': {
'skip_download': 'm3u8',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
json_all = self._search_json(r'window.videoInfo\s*=\s*', webpage, 'videoInfo', video_id)
... | ```suggestion
video_list = json_all.get('videoList') or []
if len(video_list) > 1:
p_idx, p_video_info = next(
(idx + 1, v) for (idx, v) in enumerate(video_list)
if v['id'] == video_internal_id)
title = f'{title} Part {p_idx:02d} {p_video_inf... | 'ext': 'mp4',
'title': '【动画剧集】Rocket & Groot Season 1(2022)/火箭浣熊与格鲁特第1季 P02 S01E02 十拿九穩',
'duration': 90.459,
'uploader': '比令',
'uploader_id': '37259967',
'upload_date': '20220629',
'timestamp': 1656479962,
'tags': list,
... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.786 | suggestion | 353 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'view_count': 31917,
'like_count': 1850,
'comment_count': 288,
'duration': 174.208,
'timestamp': 1656403967
},
'params': {
'skip_download': 'm3u8',
},
}]
def _real_extract(self, url):
video_id = self._match_... | What is "p_"? Use better var names | }, {
# example for len(video_list) > 1
'url': 'https://www.acfun.cn/v/ac35468952_2',
'info_dict': {
'id': '35468952_2',
'ext': 'mp4',
'title': '【动画剧集】Rocket & Groot Season 1(2022)/火箭浣熊与格鲁特第1季 P02 S01E02 十拿九穩',
'duration': 90.459,
'u... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.143 | question | 34 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
_TESTS = [{
'url': 'https://www.acfun.cn/bangumi/aa6002917',
'info_dict': {
'id': 'aa6002917',
'title': '租借女友 第1话 租借女友',
'duration': 1467,
'timestamp': 1594432800,
},
'params': {
# m3u8 download
'skip_download':... | ```suggestion
video_id = f'{base_id}{format_field(ac_idx, None, "_%s")}'
```
is the convention |
_TESTS = [{
'url': 'https://www.acfun.cn/bangumi/aa6002917_36188_1745457?ac=2',
'info_dict': {
'id': 'aa6002917_36188_1745457__2',
'ext': 'mp4',
'title': '【7月】租借女友 水原千鹤角色曲『DATE』特别PV',
'upload_date': '20200916',
'timestamp': 1600243813,
... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.714 | suggestion | 109 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
base_id, ac_idx = self._search_regex(r'(?P<id>aa[_\d]+)(?:\?ac=(?P<ac_idx>\d+))?', video_id,
'ac_idx_parse', group=['id', 'ac_idx']) or (None, None)
... | ```suggestion
idx + 1 for (idx, v) in enumerate(json_bangumi_data.get('relatedBangumis') or [])
``` | 'title': '红孩儿之趴趴蛙寻石记 第5话 ',
'duration': 760.0,
'season': '红孩儿之趴趴蛙寻石记',
'season_id': 5023171,
'season_number': 1, # series has only 1 season
'episode': 'Episode 5',
'episode_number': 5,
'upload_date': '20181223',
... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.714 | suggestion | 121 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
base_id, ac_idx = self._search_regex(r'(?P<id>aa[_\d]+)(?:\?ac=(?P<ac_idx>\d+))?', video_id,
'ac_idx_parse', group=['id', 'ac_idx']) or (None, None)
if base_id is not None:
... | You sure the default should be 1 and not `None`? | 'duration': 760.0,
'season': '红孩儿之趴趴蛙寻石记',
'season_id': 5023171,
'season_number': 1, # series has only 1 season
'episode': 'Episode 5',
'episode_number': 5,
'upload_date': '20181223',
'timestamp': 1545552185,
't... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.286 | question | 48 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
base_id, ac_idx = self._search_regex(r'(?P<id>aa[_\d]+)(?:\?ac=(?P<ac_idx>\d+))?', video_id,
'ac_idx_parse', group=['id', 'ac_idx']) or (None, None)
if base_id is not None:
... | ```py
season_number = season_id and next((...))
```
same below | 'duration': 760.0,
'season': '红孩儿之趴趴蛙寻石记',
'season_id': 5023171,
'season_number': 1, # series has only 1 season
'episode': 'Episode 5',
'episode_number': 5,
'upload_date': '20181223',
'timestamp': 1545552185,
't... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
if v.get('videoId') == video_internal_id)
info.update({
'thumbnail': json_bangumi_data.get('image'),
'comment_count': int_or_none(json_bangumi_data.get('commentCount')),
'season': json_bangumi_data.get('bangumiTitle'),
'sea... | ```suggestion
**info,
``` | video_id = f'{video_id}{format_field(ac_idx, template="__%s")}'
webpage = self._download_webpage(url, video_id)
json_bangumi_data = self._search_json(r'window.bangumiData\s*=\s*', webpage, 'bangumiData', video_id)
if ac_idx:
video_info = json_bangumi_data['hlVideoInfo']
... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.429 | suggestion | 39 | 29 | 38 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
season_number = None
if season_id:
season_number = next((
idx + 1 for (idx, v) in enumerate(json_bangumi_data.get('relatedBangumis', []))
if v.get('id') == season_id), 1)
json_bangumi_list = self._search_json(r'window.bangumiLi... | > the normal video_id is not in json
what does this mean? | 'episode_number': 5,
'upload_date': '20220324',
'timestamp': 1648082786,
'duration': 105.002,
'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)',
'comment_count': int,
},
}]
def _real_extract(self, url):
video_id = self._match... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 0.214 | question | 60 | 41 | 50 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
(idx + 1, v) for (idx, v) in enumerate(video_list)
if v['id'] == video_internal_id)
if len(video_list) > 1:
title = f'{title} P{p_idx:02d} {p_video_info["title"]}'
return {
'id': video_id,
'title': title,
'thumbnai... | 1. This doesnt handle URLs like `...?foo=bar&ac=1234`
2. Unncessary groups
3. You are matching everything into id but the parsing it again later
```suggestion
_VALID_URL = r'https?://www\.acfun\.cn/bangumi/(?P<id>aa[_\d]+)/?(?:\?([^#]+&)?ac=(?<ac_id>\d+))?'
```
Then in real_extract, you can just do
```py
... |
title = json_all.get('title')
video_list = json_all.get('videoList') or []
video_internal_id = traverse_obj(json_all, ('currentVideoInfo', 'id'))
if video_internal_id and len(video_list) > 1:
part_idx, part_video_info = next(
(idx + 1, v) for (idx, v) in enum... | @@ -0,0 +1,191 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError,
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def parse_format_and_subtitle(self, video_id, vi... | yt_dlp/extractor/acfun.py | 26 | Python | 1 | refactor | 615 | 51 | 51 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
from .common import InfoExtractor
from ..utils import (
bug_reports_message,
ExtractorError,
float_or_none,
format_field,
int_or_none,
traverse_obj,
parse_codecs,
parse_qs,
)
class AcFunVideoBaseIE(InfoExtractor):
def parse_format_and_subtitle(self, video_id, video_info):
... | ```suggestion
from .common import InfoExtractor
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
format_field,
int_or_none,
traverse_obj,
parse_codecs,
parse_qs,
)
class AcFunVideoBaseIE(InfoExtractor):
def _extract_metadata(self, video_id, video_info):
playjson = self._parse_json(video_info['ksPlayJson'], ... | @@ -0,0 +1,175 @@
+
+from .common import InfoExtractor | yt_dlp/extractor/acfun.py | 2 | Python | 0.643 | refactor | 53 | 27 | 27 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
from .common import InfoExtractor
from ..utils import (
bug_reports_message,
ExtractorError,
float_or_none,
format_field,
int_or_none,
traverse_obj,
parse_codecs,
parse_qs,
)
class AcFunVideoBaseIE(InfoExtractor):
def parse_format_and_subtitle(self, video_id, video_info):
... | ```suggestion
ExtractorError,
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
format_field,
int_or_none,
traverse_obj,
parse_codecs,
parse_qs,
)
class AcFunVideoBaseIE(InfoExtractor):
def _extract_metadata(self, video_id, video_info):
playjson = self._parse_json(video_info['ksPlayJson'], ... | @@ -0,0 +1,175 @@
+
+from .common import InfoExtractor
+from ..utils import (
+ bug_reports_message,
+ ExtractorError, | yt_dlp/extractor/acfun.py | 5 | Python | 0.643 | refactor | 39 | 30 | 30 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
ac_idx = parse_qs(url).get('ac', [None])[-1]
video_id = f'{video_id}{format_field(ac_idx, template="__%s")}'
webpage = self._download_webpage(url, video_id)
json_bangumi_data = self._search_json(r'window.ba... | ```suggestion
r'window\.bangumiList\s*=\s*', webpage, 'bangumiList', video_id, fatal=False)
``` | }]
def _real_extract(self, url):
video_id = self._match_id(url)
ac_idx = parse_qs(url).get('ac', [None])[-1]
video_id = f'{video_id}{format_field(ac_idx, template="__%s")}'
webpage = self._download_webpage(url, video_id)
json_bangumi_data = self._search_json(r'window.ba... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ format_field,
+ int_or_none,
+ traverse_obj,
+ parse_codecs,
+ parse_qs,
+)
+
+
+class AcFunVideoBaseIE(InfoExtractor):
+ def _extract_metadata(self, video_id, video_info):
+ playjson = self._parse... | yt_dlp/extractor/acfun.py | 26 | Python | 0.714 | suggestion | 109 | 43 | 43 | false | [extractor/acfun] add video, bangumi | 4,228 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
from .common import InfoExtractor
import json
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a569558089',
... | use `self._search_nextjs_data()` | from .common import InfoExtractor
from ..utils import traverse_obj
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a5... | @@ -0,0 +1,39 @@
+from .common import InfoExtractor
+import json
+
+
+class SYVDKIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
+
+ _TESTS = [{
+ 'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
+ 'md5': '429ce5a423d... | yt_dlp/extractor/syvdk.py | 25 | Python | 0.286 | suggestion | 32 | 40 | 34 | false | [syvdk] Add extractor | 4,250 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | misaelaguayo |
'title': 'Isabella Arendt stiller op for De Konservative',
'description': 'Tidligere formand for Kristendemokraterne Isabella Arendt stiller op til folketingsvalget for Det Konservative Folkeparti. Men hvorfor netop de konservative? og hvordan harmonisere det med hendes ønske om en mere human ud... | ```suggestion
info_data = self._search_nextjs_data(webpage, video_id)["props"]["pageProps"]["episodeDetails"][0]
return {
'id': str(info['id']),
'display_id': video_id,
'title': try_get(info, lambda x: x['title']['rendered']),
'description': try_ge... | from .common import InfoExtractor
from ..utils import traverse_obj
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a5... | @@ -0,0 +1,39 @@
+from .common import InfoExtractor
+import json
+
+
+class SYVDKIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
+
+ _TESTS = [{
+ 'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
+ 'md5': '429ce5a423d... | yt_dlp/extractor/syvdk.py | 26 | Python | 0.786 | suggestion | 489 | 27 | 34 | false | [syvdk] Add extractor | 4,250 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | misaelaguayo |
from .common import InfoExtractor
from ..utils import try_get
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3... | I think this line too long. Please use md5 instead | from .common import InfoExtractor
from ..utils import traverse_obj
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a5... | @@ -10,9 +10,10 @@ class SYVDKIE(InfoExtractor):
'md5': '429ce5a423dd4b1e1d0bf3a569558089',
'info_dict': {
'id': '12215',
+ 'display_id': 'isabella-arendt-stiller-op-for-de-konservative-2',
'ext': 'mp3',
'title': 'Isabella Arendt stiller op for De Kons... | yt_dlp/extractor/syvdk.py | 16 | Python | 0.286 | refactor | 50 | 34 | 34 | false | [syvdk] Add extractor | 4,250 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | misaelaguayo |
from .common import InfoExtractor
from ..utils import try_get
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3... | ```suggestion
info_data = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['episodeDetails'][0]
``` | from .common import InfoExtractor
from ..utils import traverse_obj
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a5... | @@ -0,0 +1,33 @@
+from .common import InfoExtractor
+from ..utils import try_get
+
+
+class SYVDKIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
+
+ _TESTS = [{
+ 'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
+ 'md... | yt_dlp/extractor/syvdk.py | 23 | Python | 0.714 | suggestion | 126 | 34 | 34 | false | [syvdk] Add extractor | 4,250 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | misaelaguayo |
from .common import InfoExtractor
from ..utils import try_get
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[\w-]+)'
``` | from .common import InfoExtractor
from ..utils import traverse_obj
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a5... | @@ -0,0 +1,33 @@
+from .common import InfoExtractor
+from ..utils import try_get
+
+
+class SYVDKIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)' | yt_dlp/extractor/syvdk.py | 6 | Python | 0.571 | suggestion | 91 | 31 | 31 | false | [syvdk] Add extractor | 4,250 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | misaelaguayo |
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a569558089',
'info_dict': {
'id': '12215',
'display_id': 'isabella-arendt-stiller-op-for-de-konservative-2',
'ext': 'mp3',
... | ```suggestion
return {
'id': str(info_data['id']),
'vcodec': 'none',
'ext': 'mp3',
'url': info_data['details']['enclosure'],
'display_id': video_id,
'title': traverse_obj(info_data, ('title', 'rendered')),
'description':... | _TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a569558089',
'info_dict': {
'id': '12215',
'display_id': 'isabella-arendt-stiller-op-for-de-konservative-2',
'ext': 'mp3',
... | @@ -0,0 +1,33 @@
+from .common import InfoExtractor
+from ..utils import try_get
+
+
+class SYVDKIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
+
+ _TESTS = [{
+ 'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
+ 'md... | yt_dlp/extractor/syvdk.py | 26 | Python | 0.786 | suggestion | 388 | 27 | 27 | false | [syvdk] Add extractor | 4,250 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | misaelaguayo |
from .common import InfoExtractor
from ..utils import try_get
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[a-zA-Z0-9-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3... | ```suggestion
from ..utils import traverse_obj
``` | from .common import InfoExtractor
from ..utils import traverse_obj
class SYVDKIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?24syv\.dk/episode/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://24syv.dk/episode/isabella-arendt-stiller-op-for-de-konservative-2',
'md5': '429ce5a423dd4b1e1d0bf3a5... | @@ -0,0 +1,33 @@
+from .common import InfoExtractor
+from ..utils import try_get | yt_dlp/extractor/syvdk.py | 2 | Python | 0.571 | suggestion | 52 | 27 | 27 | false | [syvdk] Add extractor | 4,250 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | misaelaguayo |
'duration': 3255,
'season': 'Season 1',
'title': 'Isabel - Episódio 1',
'thumbnail': 'https://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/62beac200cf2f9a86eab856b/',
'season_number': 1,
}
}, {
'url': 'https://tviplayer.iol.pt/video/62... | Shouldn't this be in _real_initialize? | 'duration': 3255,
'season': 'Season 1',
'title': 'Isabel - Episódio 1',
'thumbnail': 'https://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/62beac200cf2f9a86eab856b/',
'season_number': 1,
}
}, {
'url': 'https://tviplayer.iol.pt/video/62... | @@ -0,0 +1,64 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class TVIPlayerIE(InfoExtractor):
+ _VALID_URL = r'https?://tviplayer\.iol\.pt(/programa/[\w-]+/[a-f0-9]+)?/video/(?P<id>[a-f0-9]+)'
+ _TESTS = [{
+ 'url': 'https://tviplayer.iol.pt/programa/jornal-das-8/53c6b3903004... | yt_dlp/extractor/tviplayer.py | 26 | Python | 0.143 | question | 38 | 43 | 44 | false | [extractor/tviplayer] Add extractor | 4,281 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'timestamp': 1654279105,
'title': 'Merasakan Bus Imut Tanpa Pengemudi, Muter-muter di Kawasan BSD City',
'tags': ['viral', 'autonomous vehicle', 'electric', 'shuttle bus'],
'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/06/03/VIRAL_BUS_NO_SUPIR-20220604004... | I think this is not safe, if `json_ld_data.get('keywords') or self._html_search_meta(['keywords', 'keyword', 'dtk:keywords'], webpage)` return `None` then it would give error to `.split` right?. Should i set `''` on `str_or_none` or do you have better solution about this ? | from .common import InfoExtractor
from ..utils import merge_dicts, str_or_none
class Detik20IE(InfoExtractor):
IE_NAME = '20.detik.com'
_VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
_TESTS = [{
# detikflash
'url': 'https://20.detik.com/detikflash/2022070... | @@ -0,0 +1,127 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none
+
+
+class Detik20IE(InfoExtractor):
+ IE_NAME = '20.detik.com'
+ _VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
+ _TESTS = [{
+ # detikflash
+ 'url': 'https://20.... | yt_dlp/extractor/detik.py | 26 | Python | 0.786 | question | 273 | 30 | 123 | false | [extractor/detik] Add extractor | 4,284 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | HobbyistDev |
'timestamp': 1654279105,
'title': 'Merasakan Bus Imut Tanpa Pengemudi, Muter-muter di Kawasan BSD City',
'tags': ['viral', 'autonomous vehicle', 'electric', 'shuttle bus'],
'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/06/03/VIRAL_BUS_NO_SUPIR-20220604004... | ```suggestion
'tags': try_get(None, lambda x: json_ld_data.get('keywords') or self._html_search_meta(['keywords', 'keyword', 'dtk:keywords'], webpage).split(',')),
``` | from .common import InfoExtractor
from ..utils import merge_dicts, str_or_none
class Detik20IE(InfoExtractor):
IE_NAME = '20.detik.com'
_VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
_TESTS = [{
# detikflash
'url': 'https://20.detik.com/detikflash/2022070... | @@ -0,0 +1,127 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none
+
+
+class Detik20IE(InfoExtractor):
+ IE_NAME = '20.detik.com'
+ _VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
+ _TESTS = [{
+ # detikflash
+ 'url': 'https://20.... | yt_dlp/extractor/detik.py | 26 | Python | 0.714 | suggestion | 181 | 30 | 123 | false | [extractor/detik] Add extractor | 4,284 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | HobbyistDev |
'title': 'Resa Boenard Si \'Princess Bantar Gebang\'',
'description': 'md5:84ea66306a0285330de6a13fc6218b78',
'tags': ['sosok', 'sosok20d', 'bantar gebang', 'bgbj', 'resa boenard', 'bantar gebang bgbj', 'bgbj bantar gebang', 'sosok bantar gebang', 'sosok bgbj', 'bgbj resa boenard'],
... | Any reason for not using _search_json_ld directly? | 'title': 'Resa Boenard Si \'Princess Bantar Gebang\'',
'description': 'md5:84ea66306a0285330de6a13fc6218b78',
'tags': ['sosok', 'sosok20d', 'bantar gebang', 'bgbj', 'resa boenard', 'bantar gebang bgbj', 'bgbj bantar gebang', 'sosok bantar gebang', 'sosok bgbj', 'bgbj resa boenard'],
... | @@ -0,0 +1,127 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none
+
+
+class Detik20IE(InfoExtractor):
+ IE_NAME = '20.detik.com'
+ _VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
+ _TESTS = [{
+ # detikflash
+ 'url': 'https://20.... | yt_dlp/extractor/detik.py | 26 | Python | 0.214 | question | 50 | 43 | 38 | false | [extractor/detik] Add extractor | 4,284 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'upload_date': '20220702',
'duration': 650,
}
}, {
# viral
'url': 'https://20.detik.com/viral/20220603-220603135/merasakan-bus-imut-tanpa-pengemudi-muter-muter-di-kawasan-bsd-city',
'info_dict': {
'id': '220603135',
'ext': 'mp4',
... | ```suggestion
r'videoUrl\s*:\s*"(?P<video_url>[^"]+)', webpage, 'videoUrl')
``` | 'upload_date': '20220703',
'duration': 650,
}
}, {
# viral
'url': 'https://20.detik.com/viral/20220603-220603135/merasakan-bus-imut-tanpa-pengemudi-muter-muter-di-kawasan-bsd-city',
'info_dict': {
'id': '220603135',
'ext': 'mp4',
... | @@ -0,0 +1,127 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none
+
+
+class Detik20IE(InfoExtractor):
+ IE_NAME = '20.detik.com'
+ _VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
+ _TESTS = [{
+ # detikflash
+ 'url': 'https://20.... | yt_dlp/extractor/detik.py | 26 | Python | 0.571 | suggestion | 93 | 40 | 35 | false | [extractor/detik] Add extractor | 4,284 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/06/03/VIRAL_BUS_NO_SUPIR-20220604004707-custom.jpg?w=650&q=80',
'duration': 593,
'upload_date': '20220603'
}
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = sel... | Is there any field in json_ld you are trying to avoid? if not, just do
```py
return merge_dicts(json_ld_data, {
...
})
```
rather than cherry picking fields | from .common import InfoExtractor
from ..utils import merge_dicts, str_or_none
class Detik20IE(InfoExtractor):
IE_NAME = '20.detik.com'
_VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
_TESTS = [{
# detikflash
'url': 'https://20.detik.com/detikflash/2022070... | @@ -0,0 +1,127 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none
+
+
+class Detik20IE(InfoExtractor):
+ IE_NAME = '20.detik.com'
+ _VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
+ _TESTS = [{
+ # detikflash
+ 'url': 'https://20.... | yt_dlp/extractor/detik.py | 26 | Python | 0.786 | suggestion | 166 | 27 | 123 | false | [extractor/detik] Add extractor | 4,284 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'id': '220603135',
'ext': 'mp4',
'description': 'md5:4771fe101aa303edb829c59c26f9e7c6',
'timestamp': 1654304305,
'title': 'Merasakan Bus Imut Tanpa Pengemudi, Muter-muter di Kawasan BSD City',
'tags': ['viral', 'autonomous vehicle', 'electric', 'sh... | ```suggestion
'tags': self._html_search_meta(['keywords', 'keyword', 'dtk:keywords'], webpage), '').split(','),
```
did u forget to remove this? | 'id': '220603135',
'ext': 'mp4',
'description': 'md5:4771fe101aa303edb829c59c26f9e7c6',
'timestamp': 1654304305,
'title': 'Merasakan Bus Imut Tanpa Pengemudi, Muter-muter di Kawasan BSD City',
'tags': ['viral', 'autonomous vehicle', 'electric', 'sh... | @@ -0,0 +1,122 @@
+from .common import InfoExtractor
+from ..utils import merge_dicts, str_or_none
+
+
+class Detik20IE(InfoExtractor):
+ IE_NAME = '20.detik.com'
+ _VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-]+)'
+ _TESTS = [{
+ # detikflash
+ 'url': 'https://20.... | yt_dlp/extractor/detik.py | 26 | Python | 0.786 | refactor | 159 | 28 | 28 | false | [extractor/detik] Add extractor | 4,284 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
class AudiodraftIE(InfoExtractor):
def _audiodraft_extract_from_id(self, player_entry_id):
data_json = self._download_json(
'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', player_entry_id,
headers={
'Content-type': 'application/x-www-form-url... | ```suggestion
_VALID_URL = r'https?://(?:[-\w]+)\.audiodraft\.com/entry/(?P<id>\d+)'
``` | class AudiodraftBaseIE(InfoExtractor):
def _audiodraft_extract_from_id(self, player_entry_id):
data_json = self._download_json(
'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', player_entry_id,
headers={
'Content-type': 'application/x-www-form... | @@ -0,0 +1,93 @@
+from .common import InfoExtractor
+from ..utils import int_or_none
+
+
+class AudiodraftIE(InfoExtractor):
+ def _audiodraft_extract_from_id(self, player_entry_id):
+ data_json = self._download_json(
+ 'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', playe... | yt_dlp/extractor/audiodraft.py | 26 | Python | 0.571 | suggestion | 94 | 51 | 51 | false | Audiodraft | 4,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | fstirlitz |
'average_rating': 5,
'like_count': int,
},
}, {
'url': 'http://timferriss.audiodraft.com/entry/765',
'info_dict': {
'id': '19710',
'ext': 'mp3',
'title': 'ferris03',
'uploader': 'malex',
'uploader_id': '17335... | ```suggestion
_VALID_URL = r'https?://www\.audiodraft\.com/contests/[^/#]+#entries&eid=(?P<id>\d+)'
``` | 'average_rating': 5,
'like_count': int,
},
}, {
'url': 'http://timferriss.audiodraft.com/entry/765',
'info_dict': {
'id': '19710',
'ext': 'mp3',
'title': 'ferris03',
'uploader': 'malex',
'uploader_id': '17335... | @@ -0,0 +1,93 @@
+from .common import InfoExtractor
+from ..utils import int_or_none
+
+
+class AudiodraftIE(InfoExtractor):
+ def _audiodraft_extract_from_id(self, player_entry_id):
+ data_json = self._download_json(
+ 'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', playe... | yt_dlp/extractor/audiodraft.py | 26 | Python | 0.714 | suggestion | 109 | 44 | 44 | false | Audiodraft | 4,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | fstirlitz |
from .common import InfoExtractor
from ..utils import int_or_none
class AudiodraftIE(InfoExtractor):
def _audiodraft_extract_from_id(self, player_entry_id):
data_json = self._download_json(
'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', player_entry_id,
h... | The convention is for the same to end in `BaseIE`
```suggestion
class AudiodraftBaseIE(InfoExtractor):
``` | from .common import InfoExtractor
from ..utils import int_or_none
class AudiodraftBaseIE(InfoExtractor):
def _audiodraft_extract_from_id(self, player_entry_id):
data_json = self._download_json(
'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', player_entry_id,
... | @@ -0,0 +1,93 @@
+from .common import InfoExtractor
+from ..utils import int_or_none
+
+
+class AudiodraftIE(InfoExtractor): | yt_dlp/extractor/audiodraft.py | 5 | Python | 0.786 | refactor | 109 | 30 | 30 | false | Audiodraft | 4,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | fstirlitz |
_TESTS = [{
'url': 'https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video',
'playlist_mincount': 5,
'info_dict': {
'id': 'youtube-dl test video',
'title': 'youtube-dl test video',
}
}, {
'url': 'https:/... | This isnt needed afaik. If test fails without this, it's a bug in the test runner | 'url': 'https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video',
'playlist_mincount': 5,
'info_dict': {
'id': 'youtube-dl test video',
'title': 'youtube-dl test video',
}
}, {
'url': 'https://www.youtube.com... | @@ -5781,6 +5793,9 @@ class YoutubeSearchURLIE(YoutubeTabBaseInfoExtractor):
'entries': [{
'url': r're:https://(www\.)?youtube\.com/hashtag/cats',
'title': '#cats',
+ 'ie_key': 'YoutubeTab',
+ '_type': 'url',
+ '__x_forwarded_fo... | yt_dlp/extractor/youtube.py | 26 | Python | 0.357 | bug | 81 | 51 | 51 | false | [extractor/youtube] Fix some youtube tests | 4,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sheerluck |
self.assertTrue(
match_rex.match(got),
f'field {field} (value: {got!r}) should match {match_str!r}')
elif isinstance(expected, str) and expected.startswith('startswith:'):
start_str = expected[len('startswith:'):]
self.assertTrue(
isinstance(got, str),
... | Which test is failing without this? | self.assertTrue(
match_rex.match(got),
f'field {field} (value: {got!r}) should match {match_str!r}')
elif isinstance(expected, str) and expected.startswith('startswith:'):
start_str = expected[len('startswith:'):]
self.assertTrue(
isinstance(got, str),
... | @@ -128,7 +128,7 @@ def expect_value(self, got, expected, field):
f'Expected type {expected!r} for field {field}, but got value {got!r} of type {type(got)!r}')
elif isinstance(expected, dict) and isinstance(got, dict):
expect_dict(self, got, expected)
- elif isinstance(expected, list) and ... | test/helper.py | 26 | Python | 0.071 | bug | 35 | 51 | 51 | false | [extractor/youtube] Fix some youtube tests | 4,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sheerluck |
# Story. Requires specific player params to work.
# Note: stories get removed after some period of time
'url': 'https://www.youtube.com/watch?v=vv8qTUWmulI',
'info_dict': {
'id': 'vv8qTUWmulI',
'ext': 'mp4',
'availability': ... | In my opinion this test should be replaced (with a new youtube story), rather than being disabled, although I don't know how to find youtube stories. | # Story. Requires specific player params to work.
'url': 'https://www.youtube.com/watch?v=vv8qTUWmulI',
'info_dict': {
'id': 'vv8qTUWmulI',
'ext': 'mp4',
'availability': 'unlisted',
'view_count': int,
'ch... | @@ -2227,7 +2235,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'thumbnail': 'https://i.ytimg.com/vi_webp/vv8qTUWmulI/maxresdefault.webp',
'uploader_url': 'http://www.youtube.com/user/BlastfromthePast',
'channel_url': 'https://www.youtube.com/channel/UCzIZ8HrzDgc-pNQD... | yt_dlp/extractor/youtube.py | 26 | Python | 0.429 | suggestion | 149 | 51 | 51 | false | [extractor/youtube] Fix some youtube tests | 4,293 | yt-dlp/yt-dlp | 132,642 | Python | gamer191 | sheerluck |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
import re
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
urljoin,
parse_qs as compat_parse_qs,
ExtractorError)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
... | don't do `parse_qs as compat_parse_qs` | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
get_element_by_class,
parse_qs,
remove_start,
unescapeHTML,
urljoin,
)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+import re
+
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ urljoin,
+ parse_qs as compat_parse_qs, | yt_dlp/extractor/wikimedia.py | 13 | Python | 0.214 | suggestion | 38 | 38 | 38 | false | Add support for wikimedia.org | 4,314 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | EhtishamSabir |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
import re
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
urljoin,
parse_qs as compat_parse_qs,
ExtractorError)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
... | sort imports (you can sort manually, or use isort) | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
get_element_by_class,
parse_qs,
remove_start,
unescapeHTML,
urljoin,
)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+import re
+
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ urljoin,
+ parse_qs as compat_parse_qs,
+ ExtractorError) | yt_dlp/extractor/wikimedia.py | 14 | Python | 0.286 | suggestion | 50 | 39 | 39 | false | Add support for wikimedia.org | 4,314 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | EhtishamSabir |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
import re
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
urljoin,
parse_qs as compat_parse_qs,
ExtractorError)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
... | _NETRC_MACHINE must only be set of the extractor has login support | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
get_element_by_class,
parse_qs,
remove_start,
unescapeHTML,
urljoin,
)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+import re
+
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ urljoin,
+ parse_qs as compat_parse_qs,
+ ExtractorError)
+
+
+class WikimediaIE(InfoExtractor)... | yt_dlp/extractor/wikimedia.py | 19 | Python | 0.286 | refactor | 66 | 44 | 44 | false | Add support for wikimedia.org | 4,314 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | EhtishamSabir |
parse_qs as compat_parse_qs,
ExtractorError)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_NETRC_MACHINE = 'wikimediaorg'
_API_BASE_URL = 'https://commons.wikimedia.org/'
_VALID_URL = 'https://commons.wikimedia.org/wiki/File:(?P<id>[^/]+)'
_TEST = {
'url': 'https://... | This formatting is terrible... Read https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#trailing-parentheses |
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\w+'
_TESTS = [{
'url': 'https://commons.wikimedia.org/wiki/File:Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS.webm',
'info_dict': {
... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+import re
+
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ urljoin,
+ parse_qs as compat_parse_qs,
+ ExtractorError)
+
+
+class WikimediaIE(InfoExtractor)... | yt_dlp/extractor/wikimedia.py | 26 | Python | 0.357 | style | 117 | 51 | 44 | false | Add support for wikimedia.org | 4,314 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | EhtishamSabir |
import re
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
urljoin,
parse_qs as compat_parse_qs,
ExtractorError)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_NETRC_MACHINE = 'wikimediaorg'
_API_BASE_URL = 'https://commons.wikimedia.org/'
... | 1. author is not a valid field
2. Fields that return None shouldn't be in tests | clean_html,
get_element_by_class,
parse_qs,
remove_start,
unescapeHTML,
urljoin,
)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\w+'
_TESTS = [{
'url': 'https://commons.wikimedia.org/w... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+import re
+
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ urljoin,
+ parse_qs as compat_parse_qs,
+ ExtractorError)
+
+
+class WikimediaIE(InfoExtractor)... | yt_dlp/extractor/wikimedia.py | 26 | Python | 0.286 | security | 80 | 51 | 51 | false | Add support for wikimedia.org | 4,314 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | EhtishamSabir |
from .common import InfoExtractor
import re
from ..utils import (
clean_html,
determine_ext,
get_element_by_class,
urljoin,
parse_qs as compat_parse_qs,
ExtractorError)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_NETRC_MACHINE = 'wikimediaorg'
_API_BASE_URL = 'ht... | Dont think it makes sense to use md5 for license | from ..utils import (
clean_html,
get_element_by_class,
parse_qs,
remove_start,
unescapeHTML,
urljoin,
)
class WikimediaIE(InfoExtractor):
IE_NAME = 'wikimedia.org'
_VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\w+'
_TESTS = [{
'url': 'https://c... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+import re
+
+from ..utils import (
+ clean_html,
+ determine_ext,
+ get_element_by_class,
+ urljoin,
+ parse_qs as compat_parse_qs,
+ ExtractorError)
+
+
+class WikimediaIE(InfoExtractor)... | yt_dlp/extractor/wikimedia.py | 26 | Python | 0.143 | suggestion | 48 | 51 | 51 | false | Add support for wikimedia.org | 4,314 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | EhtishamSabir |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.