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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
import re
from .common import InfoExtractor
from .archiveorg import ArchiveOrgIE
from ..utils import (
int_or_none,
str_to_int,
orderedSet,
urljoin,
InAdvancePagedList,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watc... | ```suggestion
InAdvancePagedList,
int_or_none,
orderedSet,
str_to_int,
urljoin,
``` | import re
from .archiveorg import ArchiveOrgIE
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
orderedSet,
str_to_int,
urljoin,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watc... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ str_to_int,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList, | yt_dlp/extractor/altcensored.py | 10 | Python | 0.714 | suggestion | 109 | 35 | 35 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube-k0srjLSkga8',
'ext': 'webm',
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
'release_da... | we can inline these. also note that currently `categories` could be returned as `[None]`
```suggestion
``` | 'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube-k0srjLSkga8',
'ext': 'webm',
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
'release_da... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ str_to_int,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.786 | suggestion | 108 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
'ext': 'webm',
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
'release_date': '20180403',
'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
... | I would write it like this
```suggestion
return {
'_type': 'url_transparent',
'url': f'https://archive.org/details/youtube-{video_id}',
'ie_key': ArchiveOrgIE.ie_key(),
'view_count': str_to_int(self._html_search_regex(
r'YouTube Views:(?:\s|... | 'ext': 'webm',
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
'release_date': '20180403',
'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ str_to_int,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.929 | suggestion | 576 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
'uploader': 'admin@altcensored.com',
'description': 'md5:0b38a8fc04103579d5c1db10a247dc30',
'timestamp': 1679161343,
'track': 'k0srjLSkga8',
'durat... | could keep the `IE_NAME` scheme consistent
```suggestion
class AltCensoredChannelIE(InfoExtractor):
IE_NAME = 'altcensored:channel'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/channel/(?!page|table)(?P<id>[^/?#]+)'
``` | 'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
'uploader': 'admin@altcensored.com',
'description': 'md5:0b38a8fc04103579d5c1db10a247dc30',
'timestamp': 1679161343,
'track': 'k0srjLSkga8',
'durat... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ str_to_int,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.857 | refactor | 238 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/channel/(?!page|table)(?P<id>[^/?#]+)'
_PAGE_SIZE = 24
_TESTS = [{
'url': 'https://www.altcensored.com/channel/UCFPTO55xxHqFqkzRZHu4kcw',
'info_dict': {
'title': 'Virginie Vota',
'id': 'UCFPTO55xxHqFqkzRZHu4kcw',
... | just formatting nitpicks
```suggestion
channel_id = self._match_id(url)
webpage = self._download_webpage(
url, channel_id, 'Download channel webpage', 'Unable to get channel webpage')
title = self._html_search_meta('altcen_title', webpage, 'title', fatal=False)
page_cou... | r'<a href="/category/\d+">\s*\n?\s*([^<]+)</a>',
webpage, 'category', default='').split() or None,
}
class AltCensoredChannelIE(InfoExtractor):
IE_NAME = 'altcensored:channel'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/channel/(?!page|table)(?P<id>[^/?#]+)'
... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ str_to_int,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.786 | suggestion | 482 | 41 | 48 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
import re
from .common import InfoExtractor
from .archiveorg import ArchiveOrgIE
from ..utils import (
int_or_none,
str_to_int,
orderedSet,
urljoin,
InAdvancePagedList,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watc... | ```suggestion
from .archiveorg import ArchiveOrgIE
from .common import InfoExtractor
``` | import re
from .archiveorg import ArchiveOrgIE
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
orderedSet,
str_to_int,
urljoin,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watc... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE | yt_dlp/extractor/altcensored.py | 4 | Python | 0.643 | refactor | 91 | 29 | 29 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
'release_year': 2018,
'upload_date': '20230318',
'uploader': 'admin@altcensored.com',
'description': 'md5:0b38a8fc04103579d5c1db10a247dc30',
'timestamp': 1679161343,
'track': 'k0srjLSkga8',
'duration': 926.09,
'thumbnail': '... | fixing my typo
```suggestion
'view_count': str_to_int(self._html_search_regex(
r'YouTube Views:(?:\s| )*([\d,]+)', webpage, 'view count', default=None)),
'categories': self._html_search_regex(
r'<a href="/category/\d+">\s*\n?\s*([^<]+)</a>',
... | 'release_year': 2018,
'upload_date': '20230318',
'uploader': 'admin@altcensored.com',
'description': 'md5:0b38a8fc04103579d5c1db10a247dc30',
'timestamp': 1679161343,
'track': 'k0srjLSkga8',
'duration': 926.09,
'thumbnail': '... | @@ -0,0 +1,96 @@
+import re
+
+from .archiveorg import ArchiveOrgIE
+from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ orderedSet,
+ str_to_int,
+ urljoin,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.786 | suggestion | 379 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
str_to_int,
urljoin,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube... | ```suggestion
'view_count': int,
``` | str_to_int,
urljoin,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube... | @@ -0,0 +1,96 @@
+import re
+
+from .archiveorg import ArchiveOrgIE
+from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ orderedSet,
+ str_to_int,
+ urljoin,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
username, password = self._get_login_info()
if username:
data.update({
'grant_type': 'password',
'password': password,
'username': username,
})
else:
data['grant_type'] = 'clie... | ```suggestion
self._HEADERS['Authorization'] = f'Bearer {self._get_token(xid)}'
``` | 'client_secret': 'eea605b96e01c796ff369935357eca920c5da4c5',
}
username, password = self._get_login_info()
if username:
data.update({
'grant_type': 'password',
'password': password,
'username': username,
})
... | @@ -44,35 +45,39 @@ def _real_initialize(self):
self._FAMILY_FILTER = ff == 'on' if ff else age_restricted(18, self.get_param('age_limit'))
self._set_dailymotion_cookie('ff', 'on' if self._FAMILY_FILTER else 'off')
+ def _get_token(self, xid):
+ cookies = self._get_dailymotion_cookies()
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.571 | security | 97 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
raise ExtractorError(self._parse_json(
e.cause.response.read().decode(), xid)['error_description'], expected=True)
raise
self._set_dailymotion_cookie('access_token' if use... | Move in to `DailymotionSearchIE` | data=urlencode_postdata(data))['access_token']
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
raise ExtractorError(self._parse_json(
e.cause.response.read().decode(), xid)['error_description'], expected=Tru... | @@ -88,6 +93,310 @@ def _call_api(self, object_type, xid, object_fields, note, filter_extra=None):
raise ExtractorError(resp['errors'][0]['message'], expected=True)
return obj
+ def _call_search_api(self, term, page, note): | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.286 | suggestion | 32 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
raise ExtractorError(self._parse_json(
e.cause.response.read().decode(), xid)['error_description'], expected=True)
raise
self._set_dailymotion_cookie('access_token' if username else 'client_token', token)
return token
def _call_api(sel... | Yeah, this kind of sucks. I think it's probably best to use a slightly minified version on a single line:
```suggestion
search_query = 'fragment VIDEO_BASE_FRAGMENT on Video { id xid title createdAt stats { id views { id total __typename } __typename } channel { id xid name displayName accountType __typename ... | except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
raise ExtractorError(self._parse_json(
e.cause.response.read().decode(), xid)['error_description'], expected=True)
raise
self._set_dailymotion_cookie('acce... | @@ -88,6 +93,310 @@ def _call_api(self, object_type, xid, object_fields, note, filter_extra=None):
raise ExtractorError(resp['errors'][0]['message'], expected=True)
return obj
+ def _call_search_api(self, term, page, note):
+ payload_living_horror = ''' | yt_dlp/extractor/dailymotion.py | 26 | Python | 1 | suggestion | 3,868 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
__typename
}
pageInfo {
hasNextPage
nextPage
__typename
}
totalCount
edges {
node {
id
...TOPIC_BASE_FRAG
__typename
}
__typename
}
__typename
}
__typename
}
}
'''
if not se... | ```suggestion
self._HEADERS['Authorization'] = f'Bearer {self._get_token(term)}'
``` | def _fetch_page(self, playlist_id, page):
page += 1
videos = self._call_api(
self._OBJECT_TYPE, playlist_id,
'''videos(allowExplicit: %s, first: %d, page: %d) {
edges {
node {
xid
url
}
}
}''' % ('false' if self._FAMILY_FILT... | @@ -88,6 +93,310 @@ def _call_api(self, object_type, xid, object_fields, note, filter_extra=None):
raise ExtractorError(resp['errors'][0]['message'], expected=True)
return obj
+ def _call_search_api(self, term, page, note):
+ payload_living_horror = '''
+fragment VIDEO_BASE_FRAGMENT on... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.571 | security | 98 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
__typename
}
}
'''
if not self._HEADERS.get('Authorization'):
token = self._get_token(term)
self._HEADERS['Authorization'] = 'Bearer ' + token
resp = self._download_json(
'https://graphql.api.dailymotion.com/', None, note, data=json.dumps({
'ope... | Should be non-fatal:
```suggestion
obj = traverse_obj(resp, ('data', 'search', {dict}))
if not obj:
raise ExtractorError(traverse_obj(resp, ('errors', 0, 'message'))
or 'Could not fetch search data', expected=True)
``` | def _real_extract(self, url):
playlist_id = self._match_id(url)
entries = OnDemandPagedList(functools.partial(
self._fetch_page, playlist_id), self._PAGE_SIZE)
return self.playlist_result(
entries, playlist_id)
class DailymotionPlaylistIE(DailymotionPlaylistBaseIE):... | @@ -88,6 +93,310 @@ def _call_api(self, object_type, xid, object_fields, note, filter_extra=None):
raise ExtractorError(resp['errors'][0]['message'], expected=True)
return obj
+ def _call_search_api(self, term, page, note):
+ payload_living_horror = '''
+fragment VIDEO_BASE_FRAGMENT on... | yt_dlp/extractor/dailymotion.py | 26 | Python | 1 | refactor | 285 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
'title': 'Dailymotion search of king of turtles',
},
'playlist_mincount': 90,
}]
def _fetch_page(self, term, page):
page += 1
videos = self._call_search_api(term, page, 'Searching "%s", page %d' % (term, page))['videos']
for edge in videos['edges']:
... | The search URLs need to be excluded from `DailymotionUserIE`
```suggestion
_VALID_URL = r'https?://(?:www\.)?dailymotion\.[a-z]{2,3}/(?!(?:embed|swf|#|video|playlist|search)/)(?:(?:old/)?user/)?(?P<id>[^/]+)'
``` | import functools
import json
import re
import urllib.parse
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
OnDemandPagedList,
age_restricted,
clean_html,
int_or_none,
traverse_obj,
try_get,
unescapeHTML,
unsmuggle... | @@ -383,6 +692,37 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.857 | suggestion | 219 | 51 | 475 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
_PAGE_SIZE = 20
_TESTS = [{
'url': 'http://www.dailymotion.com/search/king of turtles/videos',
'info_dict': {
'id': 'king of turtles',
'title': 'Dailymotion search of king of turtles',
},
'playlist_mincount': 90,
}]
def _fetch_page(self, term, pag... | ```suggestion
return self.playlist_result(
OnDemandPagedList(functools.partial(self._fetch_page, term), self._PAGE_SIZE), term, term)
``` | import functools
import json
import re
import urllib.parse
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
OnDemandPagedList,
age_restricted,
clean_html,
int_or_none,
traverse_obj,
try_get,
unescapeHTML,
unsmuggle... | @@ -383,6 +692,37 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.714 | suggestion | 160 | 51 | 475 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
yield '//dailymotion.com/playlist/%s' % p
class DailymotionSearchIE(DailymotionPlaylistBaseIE):
IE_NAME = 'dailymotion:search'
_VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
_PAGE_SIZE = 20
_TESTS = [{
'url': 'http://www.dailymotion.... | Should be non-fatal:
```suggestion
response = self._call_search_api(term, page, f'Searching "{term}" page {page}')
for edge in traverse_obj(response, ('videos', 'edges', lambda _, x: x['node']['xid'])) or []:
xid = edge['node']['xid']
yield self.url_result(f'https://www.dail... | import functools
import json
import re
import urllib.parse
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
OnDemandPagedList,
age_restricted,
clean_html,
int_or_none,
traverse_obj,
try_get,
unescapeHTML,
unsmuggle... | @@ -383,6 +692,37 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.857 | suggestion | 370 | 51 | 475 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
@classmethod
def _extract_embed_urls(cls, url, webpage):
# Look for embedded Dailymotion playlist player (#3822)
for mobj in re.finditer(
r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.[a-z]{2,3}/widget/jukebox\?.+?)\1',
webpage):
... | Does the request still succeed if we remove any of this? We are only extracting the IDs, we don't need thumbnail etc |
class DailymotionPlaylistIE(DailymotionPlaylistBaseIE):
IE_NAME = 'dailymotion:playlist'
_VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/playlist/(?P<id>x[0-9a-z]+)'
_TESTS = [{
'url': 'http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q',
'info_dict': {
... | @@ -383,9 +387,61 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.429 | refactor | 116 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
}]
def _call_search_api(self, term, page, note):
search_query = 'fragment VIDEO_BASE_FRAGMENT on Video { id xid title createdAt stats { id views { id total __typename } __typename } channel { id xid name displayName accountType __typename } duration thumbnailx60: thumbnailURL(size: "x60") thumbnailx120... | ```suggestion
raise ExtractorError(
traverse_obj(resp, ('errors', 0, 'message', {str})) or 'Could not fetch search data', expected=True)
```
Why is this expected, though? (I'm just asking a question, not necessarily suggesting anything other than the formatting be changed) |
class DailymotionSearchIE(DailymotionPlaylistBaseIE):
IE_NAME = 'dailymotion:search'
_VALID_URL = r'https?://(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/?#]+)/videos'
_PAGE_SIZE = 20
_TESTS = [{
'url': 'http://www.dailymotion.com/search/king of turtles/videos',
'info_dict': {
... | @@ -383,9 +387,61 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 1 | refactor | 305 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
resp = self._download_json(
'https://graphql.api.dailymotion.com/', None, note, data=json.dumps({
'operationName': 'SEARCH_QUERY',
'query': search_query,
'variables': {
'limit': 20,
'page': page,
... | ```suggestion
for xid in traverse_obj(response, ('videos', 'edges', ..., 'node', 'xid')):
``` | 'info_dict': {
'id': 'king of turtles',
'title': 'king of turtles',
},
'playlist_mincount': 90,
}]
_SEARCH_QUERY = 'query SEARCH_QUERY( $query: String! $page: Int $limit: Int ) { search { videos( query: $query first: $limit page: $page ) { edges { node { xid } } }... | @@ -383,9 +387,61 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
class DailymotionPlaylistIE(DailymotionPlaylistBaseIE):
IE_NAME = 'dailymotion:playlist'
_VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/playlist/(?P<id>x[0-9a-z]+)'
_TESTS = [{
'url': 'http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q',
'info_dict': {
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/?#]+)/videos'
``` | entries, playlist_id)
class DailymotionPlaylistIE(DailymotionPlaylistBaseIE):
IE_NAME = 'dailymotion:playlist'
_VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/playlist/(?P<id>x[0-9a-z]+)'
_TESTS = [{
'url': 'http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl... | @@ -393,9 +397,56 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos' | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.714 | suggestion | 112 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
for p in re.findall(r'list\[\]=/playlist/([^/]+)/', unescapeHTML(mobj.group('url'))):
yield '//dailymotion.com/playlist/%s' % p
class DailymotionSearchIE(DailymotionPlaylistBaseIE):
IE_NAME = 'dailymotion:search'
_VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search... | ```suggestion
_SEARCH_QUERY = 'query SEARCH_QUERY( $query: String! $page: Int $limit: Int ) { search { videos( query: $query first: $limit page: $page ) { edges { node { xid } } } } } '
def _call_search_api(self, term, page, note):
if not self._HEADERS.get('Authorization'):
self._HEADERS['... | r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.[a-z]{2,3}/widget/jukebox\?.+?)\1',
webpage):
for p in re.findall(r'list\[\]=/playlist/([^/]+)/', unescapeHTML(mobj.group('url'))):
yield '//dailymotion.com/playlist/%s' % p
class Dailymo... | @@ -393,9 +397,56 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.786 | security | 592 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
'Origin': 'https://www.dailymotion.com',
}
_NETRC_MACHINE = 'dailymotion'
def _get_dailymotion_cookies(self):
return self._get_cookies('https://www.dailymotion.com/')
@staticmethod
def _get_cookie_value(cookies, name):
cookie = cookies.get(name)
if cookie:
... | I would do this and then un-indent the rest
```suggestion
if token:
return token
``` | 'Origin': 'https://www.dailymotion.com',
}
_NETRC_MACHINE = 'dailymotion'
def _get_dailymotion_cookies(self):
return self._get_cookies('https://www.dailymotion.com/')
@staticmethod
def _get_cookie_value(cookies, name):
cookie = cookies.get(name)
if cookie:
... | @@ -44,36 +45,39 @@ def _real_initialize(self):
self._FAMILY_FILTER = ff == 'on' if ff else age_restricted(18, self.get_param('age_limit'))
self._set_dailymotion_cookie('ff', 'on' if self._FAMILY_FILTER else 'off')
+ def _get_token(self, xid):
+ cookies = self._get_dailymotion_cookies()
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.714 | suggestion | 108 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
'page': page,
'query': term,
}
}).encode(), headers=self._HEADERS)
obj = traverse_obj(resp, ('data', 'search', {dict}))
if not obj:
raise ExtractorError(
traverse_obj(resp, ('errors', 0, 'message', {str})) or... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?dailymotion\.[a-z]{2,3}/(?!(?:embed|swf|#|video|playlist|search)/)(?:(?:old/)?user/)?(?P<id>[^/?#]+)'
``` | 'limit': 20,
'page': page,
'query': term,
}
}).encode(), headers=self._HEADERS)
obj = traverse_obj(resp, ('data', 'search', {dict}))
if not obj:
raise ExtractorError(
traverse_obj(resp, ('... | @@ -393,9 +397,56 @@ def _extract_embed_urls(cls, url, webpage):
yield '//dailymotion.com/playlist/%s' % p
+class DailymotionSearchIE(DailymotionPlaylistBaseIE):
+ IE_NAME = 'dailymotion:search'
+ _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/search/(?P<id>[^/]+)/videos'
+ ... | yt_dlp/extractor/dailymotion.py | 26 | Python | 0.786 | suggestion | 159 | 51 | 51 | false | [ie/dailymotion] search support, fix #6126 | 8,292 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_response = self._download_webpage(check_r... | I think this should be equivalent.
```suggestion
captions = get_first(snippet, 'video_available_captions_locales', 'captions_url')
``` | 'fb_dtsg': fb_dtsg,
'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_respo... | @@ -420,6 +420,30 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.786 | suggestion | 149 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | kclauhk |
check_response = self._download_webpage(check_req, None,
note='Confirming login')
if re.search(r'id="checkpointSubmitButton"', check_response) is not None:
self.report_warning('Unable to confirm login, you have to login in your ... | ```suggestion
subtitles[locale] = [{'ext': determine_ext(captions, default_ext='srt'), 'url': captions}]
``` | check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_response = self._download_webpage(check_req, None,
note='Confirming login')
if re.search(r'id="checkpointSubmitButton"', check_response) is not None:
... | @@ -420,6 +420,30 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.714 | suggestion | 126 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | kclauhk |
return
def _extract_from_url(self, url, video_id):
webpage = self._download_webpage(
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
def extract_metadata(webpage):
post_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
... | ```suggestion
'ext': determine_ext(c['captions_url'], default_ext='srt'),
``` | self.report_warning('unable to log in: %s' % error_to_compat_str(err))
return
def _extract_from_url(self, url, video_id):
webpage = self._download_webpage(
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
def extract_metadata(webpage):
... | @@ -420,6 +420,30 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | kclauhk |
check_form = {
'fb_dtsg': fb_dtsg,
'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlencod... | Remove `expected_type=dict` because filtering by key/value already expects dicts
Remove `or {}` because `snippet` is going to be a list due to branching in traversal
```suggestion
snippet = traverse_obj(post, (..., 'video', ..., 'attachments', ..., lambda k, v: (
k == 'media' and str(v['... |
check_form = {
'fb_dtsg': fb_dtsg,
'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlenco... | @@ -420,6 +420,30 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 1 | suggestion | 376 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_response = self._download_webpage(check_req, None,
... | snake_case
```suggestion
is_video_broadcast = get_first(snippet, 'is_video_broadcast', expected_type=bool)
``` | 'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_response = self._download_webpage(check_r... | @@ -420,6 +420,30 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.857 | suggestion | 125 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
check_response = self._download_webpage(check_req, None,
note='Confirming login')
if re.search(r'id="checkpointSubmitButton"', check_response) is not None:
self.report_warning('Unable to confirm login, you have to login in your ... | I don't see the point in manually determining the ext, since it's always `srt` and it's always in the url (core code will call `determine_ext` on the url)
```suggestion
if url_or_none(captions): # snippet only had 'captions_url'
subtitles[locale] = [{'url': captions}]
``` | check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_response = self._download_webpage(check_req, None,
note='Confirming login')
if re.search(r'id="checkpointSubmitButton"', check_response) is not None:
... | @@ -420,6 +420,30 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.786 | suggestion | 305 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
snippet = traverse_obj(post, (..., 'video', ..., 'attachments', ..., lambda k, v: (
k == 'media' and str(v['i... | We need to make everything here non-fatal
Sorting is not necessary
I'd prefer to simplify the `name` -- are the parentheses necessary? `join_nonempty` would clean this up nicely if you're ok with a `-` delimiter (or you can change it by passing a `delim` kwarg)
Instead of instance checking we can just try to t... | r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
automatic_captions, subtitles = {}, {}
... | @@ -420,6 +420,30 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 1 | refactor | 1,109 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
f = [f]
if not f or not isinstance(f, list):
continue
for quality in ('sd', 'hd'):
for src_type in ('src', 'src_no_ratelimit'):
src = f[0].get('%s_%s' % (quality, src_type))
if src:
# ... | This code down here doesn't need to be removed unless you are certain that no subs will ever be found in the `subtitles_src` field. We update the info_dict with the `extract_metadata` result anyways | if f and isinstance(f, dict):
f = [f]
if not f or not isinstance(f, list):
continue
for quality in ('sd', 'hd'):
for src_type in ('src', 'src_no_ratelimit'):
src = f[0].get('%s_%s' % (quality, src_type))
... | @@ -731,14 +756,10 @@ def parse_attachment(attachment, key='media'):
'height': 720 if quality == 'hd' else None
})
extract_dash_manifest(f[0], formats)
- subtitles_src = f[0].get('subtitles_src')
- if subtitles_src:
- ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.571 | refactor | 198 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_response = self._download_webpage(check_r... | imo this line (L426) makes more sense moved further down, right above when we start to use the `captions` var | 'fb_dtsg': fb_dtsg,
'h': h,
'name_action_selected': 'dont_save',
}
check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
check_respo... | @@ -420,6 +420,30 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.571 | suggestion | 109 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
self.report_warning('Unable to confirm login, you have to login in your browser and authorize the login.')
except network_exceptions as err:
self.report_warning('unable to log in: %s' % error_to_compat_str(err))
return
def _extract_from_url(self, url, video_id):
... | gotta make this non-fatal though
```suggestion
for caption in traverse_obj(captions, (
{lambda x: sorted(x, key=lambda c: c['locale'])}, lambda _, v: v['captions_url'])
):
``` | self.report_warning('Unable to confirm login, you have to login in your browser and authorize the login.')
except network_exceptions as err:
self.report_warning('unable to log in: %s' % error_to_compat_str(err))
return
def _extract_from_url(self, url, video_id):
... | @@ -420,6 +421,26 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.786 | suggestion | 220 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
def _extract_from_url(self, url, video_id):
webpage = self._download_webpage(
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
def extract_metadata(webpage):
post_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
r'da... | ```suggestion
lang = caption.get('localized_language') or ''
subs = {
'url': caption['captions_url'],
'name': format_field(caption, 'localized_country', f'{lang} (%s)', default=lang),
}
``` | def _extract_from_url(self, url, video_id):
webpage = self._download_webpage(
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
def extract_metadata(webpage):
post_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
r'da... | @@ -420,6 +421,28 @@ def extract_metadata(webpage):
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
post = traverse_obj(post_data, (
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
+
+ ... | yt_dlp/extractor/facebook.py | 26 | Python | 0.786 | suggestion | 283 | 51 | 51 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
import json
import re
import urllib.parse
from .common import InfoExtractor
from ..compat import (
compat_etree_fromstring,
compat_str,
compat_urllib_parse_unquote,
)
from ..networking import Request
from ..networking.exceptions import network_exceptions
from ..utils import (
ExtractorError,
clean_... | ```suggestion
format_field,
get_element_by_id,
``` | import json
import re
import urllib.parse
from .common import InfoExtractor
from ..compat import (
compat_etree_fromstring,
compat_str,
compat_urllib_parse_unquote,
)
from ..networking import Request
from ..networking.exceptions import network_exceptions
from ..utils import (
ExtractorError,
clean_... | @@ -19,6 +19,7 @@
get_element_by_id, | yt_dlp/extractor/facebook.py | 20 | Python | 0.571 | suggestion | 61 | 45 | 45 | false | [Facebook] Fix captions not included as subtitles | 8,296 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'playerOverlays', 'playerOverlayRenderer', 'decoratedPlayerBarRenderer',
'decoratedPlayerBarRenderer', 'playerBar', 'chapteredPlayerBarRenderer', 'chapters'
), expected_type=list)
return self._extract_chapters_helper(
chapter_list,
start_funct... | This should be adjusted to something like `_extract_heatmap` now | 'playerOverlays', 'playerOverlayRenderer', 'decoratedPlayerBarRenderer',
'decoratedPlayerBarRenderer', 'playerBar', 'chapteredPlayerBarRenderer', 'chapters'
), expected_type=list)
return self._extract_chapters_helper(
chapter_list,
start_funct... | @@ -3281,15 +3281,13 @@ def _extract_chapters_from_engagement_panel(self, data, duration):
for contents in content_list)), [])
def _extract_heatmap_from_player_overlay(self, data): | yt_dlp/extractor/youtube.py | 26 | Python | 0.429 | refactor | 64 | 51 | 51 | false | [ie/youtube] Fix `heatmap` extraction | 8,299 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | bashonly |
return self._extract_chapters_helper(
chapter_list,
start_function=lambda chapter: float_or_none(
traverse_obj(chapter, ('chapterRenderer', 'timeRangeStartMillis')), scale=1000),
title_function=lambda chapter: traverse_obj(
chapter, ('chapterR... | Maybe we should explicitly filter for `MARKER_TYPE_HEATMAP`?
```suggestion
'frameworkUpdates', 'entityBatchUpdate', 'mutations',
lambda _, v: v['payload']['macroMarkersListEntity']['markersList']['markerType'] == 'MARKER_TYPE_HEATMAP',
'payload', 'macroMarkersListEntity', 'marker... |
return self._extract_chapters_helper(
chapter_list,
start_function=lambda chapter: float_or_none(
traverse_obj(chapter, ('chapterRenderer', 'timeRangeStartMillis')), scale=1000),
title_function=lambda chapter: traverse_obj(
chapter, ('chapterR... | @@ -3281,15 +3281,13 @@ def _extract_chapters_from_engagement_panel(self, data, duration):
for contents in content_list)), [])
def _extract_heatmap_from_player_overlay(self, data):
- content_list = traverse_obj(data, (
- 'playerOverlays', 'playerOverlayRenderer', 'decoratedPlayerBa... | yt_dlp/extractor/youtube.py | 26 | Python | 1 | performance | 350 | 51 | 51 | false | [ie/youtube] Fix `heatmap` extraction | 8,299 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | bashonly |
'PF', 'PM', 'RE', 'WF', 'YT',
),
# with both of the below 'BE' sometimes works, sometimes doesn't
'EUR_DE_FR': (
'AT', 'BL', 'CH', 'DE', 'FR', 'GF', 'GP', 'LI',
'MC', 'MF', 'MQ', 'NC', 'PF', 'PM', 'RE', 'WF',
'YT',
),
'SAT': (
... | Single quotes
And core code fixes this, but all header values should be strings
```suggestion
'x-validated-age': '18'
``` | 'BL', 'DE', 'FR', 'GF', 'GP', 'MF', 'MQ', 'NC',
'PF', 'PM', 'RE', 'WF', 'YT',
),
# with both of the below 'BE' sometimes works, sometimes doesn't
'EUR_DE_FR': (
'AT', 'BL', 'CH', 'DE', 'FR', 'GF', 'GP', 'LI',
'MC', 'MF', 'MQ', 'NC', 'PF', 'PM', 'RE... | @@ -136,7 +126,9 @@ def _real_extract(self, url):
lang = mobj.group('lang') or mobj.group('lang_2')
langauge_code = self._LANG_MAP.get(lang)
- config = self._download_json(f'{self._API_BASE}/config/{lang}/{video_id}', video_id)
+ config = self._download_json(f'{self._API_BASE}/config/{... | yt_dlp/extractor/arte.py | 26 | Python | 0.786 | suggestion | 137 | 51 | 51 | false | [arte] Allow downloading age restricted content | 8,301 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | StefanLobbenmeier |
'id': '100103-000-A',
'title': 'USA: Dyskryminacja na porodówce',
'description': 'md5:242017b7cce59ffae340a54baefcafb1',
'alt_title': 'ARTE Reportage',
'upload_date': '20201103',
'duration': 554,
'thumbnail': r're:https://api-cdn\.arte\... | ```suggestion
}, {
'note': 'age-restricted',
'url': 'https://www.arte.tv/de/videos/006785-000-A/the-element-of-crime/',
``` | 'id': '100103-000-A',
'title': 'USA: Dyskryminacja na porodówce',
'description': 'md5:242017b7cce59ffae340a54baefcafb1',
'alt_title': 'ARTE Reportage',
'upload_date': '20201103',
'duration': 554,
'thumbnail': r're:https://api-cdn\.arte\... | @@ -67,19 +57,19 @@ class ArteTVIE(ArteTVBaseIE):
'only_matching': True,
}, {
'url': 'https://www.arte.tv/de/videos/110203-006-A/zaz/',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://www.arte.tv/de/videos/006785-000-A/the-element-of-crime/', | yt_dlp/extractor/arte.py | 26 | Python | 0.714 | suggestion | 147 | 51 | 51 | false | [arte] Allow downloading age restricted content | 8,301 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | StefanLobbenmeier |
from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
)
class JioSaavnBaseInfoExtractor(InfoExtractor):
def extract_initial_data_as_json(self, url, id):
webpage = self._download_webpage(url, id)
init_data_re = r'window.__INITIAL_DATA__\s*=\s*(?P<json>.+?);... | ```suggestion
return self._search_json(
r'window\.__INITIAL_DATA__\s*=', webpage,
'init json', audio_id, transform_source=js_to_json)
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id):
+ webpage = self._download_webpage(url, id)
+ init_data_re = r'window.__INITIAL... | yt_dlp/extractor/jiosaavn.py | 16 | Python | 0.714 | suggestion | 173 | 41 | 41 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | awalgarg |
data = urlencode_postdata({'__call': 'song.generateAuthToken',
'_format': 'json',
'bitrate': '128',
'url': song_data['encrypted_media_url'],
})
def clean_api_json(... | I got returned a mp4 file with AAC audio, so hard-coding mp3 doesn't make sense. We can also make title extraction non-fatal.
I am a bit unsure regarding the `transform_source=clean_api_json`. Is that really needed? The two test cases seem to work without. I have removed it in the suggestion.
```suggestion
m... | return {
'id': audio_id,
'url': media_data['auth_url'],
'ext': media_data.get('type'),
'vcodec': 'none',
**traverse_obj(song_data, {
'title': ('title', 'text'),
'album': ('album', 'text'),
'thumbnail': ('... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id):
+ webpage = self._download_webpage(url, id)
+ init_data_re = r'window.__INITIAL... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 1 | security | 1,199 | 51 | 34 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | awalgarg |
}
class JioSaavnAlbumIE(JioSaavnBaseInfoExtractor):
_VALID_URL = r'''(?x)
https?://(?:www\.)?
(?:(?:jio)?saavn\.com/album/[^/]+/)
(?P<id>[^/]+)
'''
_TESTS = [{
'url': 'https://www.jiosaavn.com/album/96/buIOj... | ```suggestion
self.playlist_from_matches(
traverse_obj(album_view, (
'modules', lambda _, x: x['key'] == 'list', 'data', ..., 'title', 'action', {str})),
album_id, traverse_obj(album_view, ('album', 'title', 'text', {str})), ie=JioSaavnSongIE,
getter=lamb... | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id):
+ webpage = self._download_webpage(url, id)
+ init_data_re = r'window.__INITIAL... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.786 | suggestion | 371 | 27 | 80 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | awalgarg |
from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
)
class JioSaavnBaseInfoExtractor(InfoExtractor):
def extract_initial_data_as_json(self, url, id):
webpage = self._download_webpage(url, id)
init_data_re = r'window.__INITIAL_DATA__\s*=\s*(?P<json>.+?);... | ```suggestion
def _extract_initial_data(self, url, audio_id):
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id): | yt_dlp/extractor/jiosaavn.py | 9 | Python | 0.643 | refactor | 71 | 34 | 34 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
from ..utils import (
js_to_json,
urlencode_postdata,
)
class JioSaavnBaseInfoExtractor(InfoExtractor):
def extract_initial_data_as_json(self, url, id):
webpage = self._download_webpage(url, id)
init_data_re = r'window.__INITIAL_DATA__\s*=\s*(?P<json>.+?);*\s*\</script>'
init_data... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
``` | from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
return self._search_json(
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id):
+ webpage = self._download_webpage(url, id)
+ init_data_re = r'window.__INITIAL... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.714 | suggestion | 139 | 51 | 51 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
_VALID_URL = r'''(?x)
https?://(?:www\.)?
(?:
jiosaavn\.com/song/[^/]+/|
saavn.com/s/song/(?:[^/]+/){3}
)
(?P<id>[^/]+)
'''
_TESTS = [{
'... | ```suggestion
song_data = self._extract_initial_data(url, audio_id)['song']['song']
``` | _VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.jiosaavn.com/song/leja-re/OQsEfQFVUXk',
'md5': '7b1f70de088ede3a152ea34aece4df42',
'info_dict': {
'id': 'OQsEfQFVUXk',
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id):
+ webpage = self._download_webpage(url, id)
+ init_data_re = r'window.__INITIAL... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.643 | refactor | 97 | 51 | 51 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
'''
_TESTS = [{
'url': 'https://www.jiosaavn.com/song/leja-re/OQsEfQFVUXk',
'md5': '7b1f70de088ede3a152ea34aece4df42',
'info_dict': {
'id': 'OQsEfQFVUXk',
'ext': 'mp3',
'title': 'Leja Re',
'album': 'Leja Re',
'thu... | inline this in the api call
```suggestion
``` | 'title': 'Leja Re',
'album': 'Leja Re',
'thumbnail': 'https://c.saavncdn.com/258/Leja-Re-Hindi-2018-20181124024539-500x500.jpg',
},
}, {
'url': 'https://www.saavn.com/s/song/hindi/Saathiya/O-Humdum-Suniyo-Re/KAMiazoCblU',
'only_matching': True,
}]
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id):
+ webpage = self._download_webpage(url, id)
+ init_data_re = r'window.__INITIAL... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.429 | suggestion | 47 | 51 | 51 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
audio_id, data=data,
transform_source=clean_api_json,
)['auth_url']
return {
'id': audio_id,
'title': song_data['title']['text'],
'formats': [{
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?(?:jio)?saavn\.com/album/[^/?#]+/(?P<id>[^/?#]+)'
_TESTS = [{
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id):
+ webpage = self._download_webpage(url, id)
+ init_data_re = r'window.__INITIAL... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.714 | suggestion | 124 | 43 | 80 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
'format_id': '128',
'vcodec': 'none',
}],
'album': song_data.get('album', {}).get('text'),
'thumbnail': song_data.get('image', [None])[0],
}
class JioSaavnAlbumIE(JioSaavnBaseInfoExtractor):
_VALID_URL = r'''(?x)
https... | ```suggestion
album_id = self._match_id(url)
album_view = self._extract_initial_data(url, album_id)['album_view']
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def extract_initial_data_as_json(self, url, id):
+ webpage = self._download_webpage(url, id)
+ init_data_re = r'window.__INITIAL... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.786 | refactor | 136 | 32 | 80 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
)
class JioSaavnBaseInfoExtractor(InfoExtractor):
def extract_initial_data_as_json(self, url, id):
webpage = self._download_webpage(url, id)
init_data_re = r'window.__INITIAL_DATA__\s*=\s*(?P<json>.+?);... | ```suggestion
urlencode_postdata,
urljoin,
)
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,98 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+) | yt_dlp/extractor/jiosaavn.py | 5 | Python | 0.571 | suggestion | 60 | 30 | 30 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
urljoin,
)
class JioSaavnBaseInfoExtractor(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, id)
return self._search_json(
r'window\._... | ```suggestion
webpage = self._download_webpage(url, audio_id)
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,79 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+ urljoin,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def _extract_initial_data(self, url, audio_id):
+ webpage = self._download_webpage(url, id) | yt_dlp/extractor/jiosaavn.py | 11 | Python | 0.571 | suggestion | 75 | 36 | 36 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
urljoin,
)
class JioSaavnBaseInfoExtractor(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
return self._search_json(
r'win... | ```suggestion
class JioSaavnBaseIE(InfoExtractor):
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,79 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+ urljoin,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor): | yt_dlp/extractor/jiosaavn.py | 9 | Python | 0.643 | refactor | 56 | 34 | 34 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
urljoin,
)
class JioSaavnBaseInfoExtractor(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
return self._search_json(
r'win... | ```suggestion
class JioSaavnSongIE(JioSaavnBaseIE):
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,79 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+ urljoin,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def _extract_initial_data(self, url, audio_id):
+ webpage = self._download_webpage(url, audio_id)
+ return self._s... | yt_dlp/extractor/jiosaavn.py | 17 | Python | 0.571 | suggestion | 57 | 42 | 42 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
song_data = self._extract_initial_data(url, audio_id)['song']['song']
media_data = self._download_json(
'https://www.jiosaavn.com/api.php', audio_id, data=urlencode_postdata({
'__call': 'song.generateAuthToken',
'_format': 'json',
'bitrate': '... | ```suggestion
class JioSaavnAlbumIE(JioSaavnBaseIE):
``` | def _real_extract(self, url):
audio_id = self._match_id(url)
song_data = self._extract_initial_data(url, audio_id)['song']['song']
media_data = self._download_json(
'https://www.jiosaavn.com/api.php', audio_id, data=urlencode_postdata({
'__call': 'song.generateAut... | @@ -0,0 +1,79 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+ urljoin,
+)
+
+
+class JioSaavnBaseInfoExtractor(InfoExtractor):
+ def _extract_initial_data(self, url, audio_id):
+ webpage = self._download_webpage(url, audio_id)
+ return self._s... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.571 | suggestion | 58 | 45 | 45 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
urljoin,
)
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
return self._search_json(
r'window\.__INIT... | ```suggestion
)
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,79 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata,
+ urljoin,
+)
+ | yt_dlp/extractor/jiosaavn.py | 7 | Python | 0.571 | suggestion | 67 | 32 | 32 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
return self... | ```suggestion
js_to_json,
url_or_none,
urlencode_postdata,
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.traversal import traverse_obj
class JioSaavnBaseIE(InfoExtractor):
def _extract_initial_data(self, url, audio_id):
webpage = self._download_webpage(url, audio_id)
... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ urlencode_postdata, | yt_dlp/extractor/jiosaavn.py | 4 | Python | 0.571 | suggestion | 78 | 29 | 29 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
'album': 'Leja Re',
'thumbnail': 'https://c.saavncdn.com/258/Leja-Re-Hindi-2018-20181124024539-500x500.jpg',
},
}, {
'url': 'https://www.saavn.com/s/song/hindi/Saathiya/O-Humdum-Suniyo-Re/KAMiazoCblU',
'only_matching': True,
}]
def _real_extract(self, url):
... | ```suggestion
'url': media_data['auth_url'],
'ext': media_data.get('type'),
'vcodec': 'none',
``` | 'album': 'Leja Re',
'thumbnail': 'https://c.saavncdn.com/258/Leja-Re-Hindi-2018-20181124024539-500x500.jpg',
},
}, {
'url': 'https://www.saavn.com/s/song/hindi/Saathiya/O-Humdum-Suniyo-Re/KAMiazoCblU',
'only_matching': True,
}]
def _real_extract(self, url):
... | @@ -0,0 +1,81 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ url_or_none,
+ urlencode_postdata,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class JioSaavnBaseIE(InfoExtractor):
+ def _extract_initial_data(self, url, audio_id):
+ webpage = self._down... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.857 | security | 137 | 51 | 51 | false | [JioSaavn] Add extractor | 8,307 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | awalgarg |
'formats': formats,
'subtitles': subs,
})
else:
if fetch_episode:
audio_path = episode['audio']['audio']
info['formats'] = self._extract_m3u8_formats(
'https://nhkworld-vh.akamaihd.net/i%s/master.m3u8' %... | IMO let's take this opportunity to convert these to f-strings
and protect against matching a query or fragment
```suggestion
_VALID_URL = [rf'{NhkBaseIE._BASE_URL_REGEX}/(?P<type>video)/(?P<id>[0-9a-z]+)',
rf'{NhkBaseIE._BASE_URL_REGEX}/(?P<type>audio)/(?P<id>[^/?#]+?-\d{{8}}-[0-9a-z]+)']
```... | 'formats': formats,
'subtitles': subs,
})
else:
if fetch_episode:
audio_path = episode['audio']['audio']
info['formats'] = self._extract_m3u8_formats(
'https://nhkworld-vh.akamaihd.net/i%s/master.m3u8' %... | @@ -133,45 +134,45 @@ def get_clean_field(key):
class NhkVodIE(NhkBaseIE):
# the 7-character IDs can have alphabetic chars too: assume [a-z] rather than just [a-f], eg
- _VALID_URL = r'%s%s(?P<id>[0-9a-z]{7}|[^/]+?-\d{8}-[0-9a-z]+)' % (NhkBaseIE._BASE_URL_REGEX, NhkBaseIE._TYPE_REGEX)
+ _VALID_URL = [r'%s... | yt_dlp/extractor/nhk.py | 26 | Python | 0.929 | suggestion | 679 | 51 | 51 | false | NHK World regex fixes 2 | 8,309 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
}, {
# video clip
'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999011/',
'md5': '153c3016dfd252ba09726588149cf0e7',
'info_dict': {
'id': 'lpZXIwaDE6_Z-976CPsFdxyICyWUzlT5',
'ext': 'mp4',
'title': "Dining with the Chef - Chef Saito's F... | What's going on with this test? Old url, new info, still `'skip': '404'`?
Single quotes for the title | }, {
# video clip
'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999011/',
'md5': '153c3016dfd252ba09726588149cf0e7',
'info_dict': {
'id': 'lpZXIwaDE6_Z-976CPsFdxyICyWUzlT5',
'ext': 'mp4',
'title': 'Dining with the Chef - Chef Saito\'s ... | @@ -133,45 +134,45 @@ def get_clean_field(key):
class NhkVodIE(NhkBaseIE):
# the 7-character IDs can have alphabetic chars too: assume [a-z] rather than just [a-f], eg
- _VALID_URL = r'%s%s(?P<id>[0-9a-z]{7}|[^/]+?-\d{8}-[0-9a-z]+)' % (NhkBaseIE._BASE_URL_REGEX, NhkBaseIE._TYPE_REGEX)
+ _VALID_URL = [r'%s... | yt_dlp/extractor/nhk.py | 26 | Python | 0.5 | question | 102 | 51 | 51 | false | NHK World regex fixes 2 | 8,309 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'url': 'https://www3.nhk.or.jp/nhkworld/fr/ondemand/audio/plugin-20190404-1/',
'only_matching': True,
}, {
'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/audio/j_art-20150903-1/',
'only_matching': True,
}, {
# video, alphabetic character in ID #29670
'url': '... | f-string conversion again
```suggestion
_VALID_URL = rf'{NhkBaseIE._BASE_URL_REGEX}/program{NhkBaseIE._TYPE_REGEX}(?P<id>[0-9a-z_]+)(?:.+?\btype=(?P<episode_type>clip|(?:radio|tv)Episode))?'
```
or could we shorten it like this? only difference would be uppercase letters allowed
```suggestion
_VAL... | 'only_matching': True,
}, {
'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/audio/j_art-20150903-1/',
'only_matching': True,
}, {
# video, alphabetic character in ID #29670
'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a34/',
'info_dict': {
... | @@ -206,7 +207,7 @@ def _real_extract(self, url):
class NhkVodProgramIE(NhkBaseIE):
- _VALID_URL = r'%s/program%s(?P<id>[0-9a-z]+)(?:.+?\btype=(?P<episode_type>clip|(?:radio|tv)Episode))?' % (NhkBaseIE._BASE_URL_REGEX, NhkBaseIE._TYPE_REGEX)
+ _VALID_URL = r'%s/program%s(?P<id>[0-9a-z_]+)(?:.+?\btype=(?P<epi... | yt_dlp/extractor/nhk.py | 26 | Python | 1 | suggestion | 464 | 51 | 51 | false | NHK World regex fixes 2 | 8,309 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
return api_info
def _extract_formats_and_subtitles(self, vod_id):
for refresh in (False, True):
api_info = self._get_api_info(refresh)
if not api_info:
continue
api_url = api_info.pop('url')
stream_url = traverse_obj(
... | I know this is old code, but if we're doing regex maintenance we should do this imo:
```suggestion
lang, m_type, episode_id = NhkVodIE._match_valid_url(url).group('lang', 'type', 'id')
```
could do it in `NhkVodProgramIE._real_extract()` as well, but I'm unable to suggest down there | return api_info
def _extract_formats_and_subtitles(self, vod_id):
for refresh in (False, True):
api_info = self._get_api_info(refresh)
if not api_info:
continue
api_url = api_info.pop('url')
stream_url = traverse_obj(
... | @@ -69,10 +69,11 @@ def _extract_formats_and_subtitles(self, vod_id):
def _extract_episode_info(self, url, episode=None):
fetch_episode = episode is None
lang, m_type, episode_id = NhkVodIE._match_valid_url(url).groups() | yt_dlp/extractor/nhk.py | 26 | Python | 1 | refactor | 295 | 51 | 51 | false | NHK World regex fixes 2 | 8,309 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
unified_strdate,
)
class MBNIE(InfoExtractor):
IE_DESC = 'mbn.co.kr (매일방송)'
_VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+)'
_TESTS = [{
'u... | we can shorten this a bit
```suggestion
_VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/preview(?:list)?/\d+/\d+/(?P<id>\d+)'
``` | import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
unified_strdate,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MBNIE(InfoExtractor):
IE_DESC = 'mbn.co.kr (매일방송)'
_VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/preview(?:list)?/\d+... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ unified_strdate,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+... | yt_dlp/extractor/mbn.py | 12 | Python | 0.714 | suggestion | 154 | 37 | 37 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'ext': 'mp4',
'title': '김정은♥최원영, 제자리를 찾은 위험한 부부! "결혼은 투쟁이면서, 어려운 방식이야.."',
'duration': 93,
'release_date': '20201124',
'thumbnail': 'http://img.vod.mbn.co.kr/mbnvod2img/835/2020/11/25/20201125000221_21_835_1084744_360_7_0.jpg',
'series': '나의 위험한 아내... | just a line too long nitpick
```suggestion
content_cls_cd = self._search_regex(
r'"\?content_cls_cd=(\d+)&', webpage, 'content cls cd', default='20')
```
though, is falling back to `'20'` worthy of a warning?
```suggestion
content_cls_cd = self._search_regex(
r'"\... | 'info_dict': {
'id': '1084744',
'ext': 'mp4',
'title': '김정은♥최원영, 제자리를 찾은 위험한 부부! "결혼은 투쟁이면서, 어려운 방식이야.."',
'duration': 93,
'release_date': '20201124',
'thumbnail': 'http://img.vod.mbn.co.kr/mbnvod2img/835/2020/11/25/20201125000221_21_835_10... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ unified_strdate,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+... | yt_dlp/extractor/mbn.py | 26 | Python | 0.786 | refactor | 397 | 51 | 51 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'release_date': '20201124',
'thumbnail': 'http://img.vod.mbn.co.kr/mbnvod2img/835/2020/11/25/20201125000221_21_835_1084744_360_7_0.jpg',
'series': '나의 위험한 아내',
},
}, {
'url': 'https://www.mbn.co.kr/vod/programContents/preview/952/6088/1054797?next=1',
'md5... | use `query` param to make this more readable
```suggestion
media_info = self._download_json(
'https://www.mbn.co.kr/player/mbnVodPlayer_2020.mbn', content_id,
note='Fetching playback data', query={
'content_cls_cd': content_cls_cd,
'content_id': cont... | 'title': '김정은♥최원영, 제자리를 찾은 위험한 부부! "결혼은 투쟁이면서, 어려운 방식이야.."',
'duration': 93,
'release_date': '20201124',
'thumbnail': 'http://img.vod.mbn.co.kr/mbnvod2img/835/2020/11/25/20201125000221_21_835_1084744_360_7_0.jpg',
'series': '나의 위험한 아내',
},
}, {
... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ unified_strdate,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+... | yt_dlp/extractor/mbn.py | 26 | Python | 1 | suggestion | 384 | 49 | 51 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'url': 'https://www.mbn.co.kr/vod/programContents/preview/952/6088/1054797?next=1',
'md5': 'c711103c72aeac8323a5cf1751f10097',
'info_dict': {
'id': '1054797',
'ext': 'mp4',
'title': '[2차 티저] MBN 주말 미니시리즈 <완벽한 결혼의 정석> l 그녀에게 주어진 두 번째 인생',
'duration'... | import `traverse_obj` and filter here
```suggestion
for stream in traverse_obj(media_info, ('movie_list', lambda _, v: v['url'])):
``` | },
}, {
'url': 'https://www.mbn.co.kr/vod/programContents/preview/952/6088/1054797?next=1',
'md5': 'c711103c72aeac8323a5cf1751f10097',
'info_dict': {
'id': '1054797',
'ext': 'mp4',
'title': '[2차 티저] MBN 주말 미니시리즈 <완벽한 결혼의 정석> l 그녀에게 주어진 두 번째 인생',
... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ unified_strdate,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+... | yt_dlp/extractor/mbn.py | 26 | Python | 0.714 | suggestion | 145 | 44 | 51 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'md5': 'c711103c72aeac8323a5cf1751f10097',
'info_dict': {
'id': '1054797',
'ext': 'mp4',
'title': '[2차 티저] MBN 주말 미니시리즈 <완벽한 결혼의 정석> l 그녀에게 주어진 두 번째 인생',
'duration': 65,
'release_date': '20231028',
'thumbnail': 'http://img.vod.mbn.c... | I assume we want to match/sub any numeric value there, yeah?
```suggestion
location = re.sub(r'/(?:chunk|play)list(?:_pd\d+)?\.m3u8', '/manifest.m3u8', stream['url'])
``` | }, {
'url': 'https://www.mbn.co.kr/vod/programContents/preview/952/6088/1054797?next=1',
'md5': 'c711103c72aeac8323a5cf1751f10097',
'info_dict': {
'id': '1054797',
'ext': 'mp4',
'title': '[2차 티저] MBN 주말 미니시리즈 <완벽한 결혼의 정석> l 그녀에게 주어진 두 번째 인생',
'... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ unified_strdate,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+... | yt_dlp/extractor/mbn.py | 26 | Python | 0.714 | suggestion | 185 | 43 | 50 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'ext': 'mp4',
'title': '[2차 티저] MBN 주말 미니시리즈 <완벽한 결혼의 정석> l 그녀에게 주어진 두 번째 인생',
'duration': 65,
'release_date': '20231028',
'thumbnail': 'http://img.vod.mbn.co.kr/vod2/952/2023/09/11/20230911130223_22_952_1054797_1080_7.jpg',
'series': '완벽한 결혼의 정석',... | import `url_or_none`
Let's use that to make sure we're not passing unexpected data to `extract_m3u8_formats`
also, IMO it's more accurate to say we are "fetching" since a potentially fatal web request is being made
```suggestion
m3u8_url = url_or_none(self._download_webpage(
f'https:/... | 'info_dict': {
'id': '1054797',
'ext': 'mp4',
'title': '[2차 티저] MBN 주말 미니시리즈 <완벽한 결혼의 정석> l 그녀에게 주어진 두 번째 인생',
'duration': 65,
'release_date': '20231028',
'thumbnail': 'http://img.vod.mbn.co.kr/vod2/952/2023/09/11/20230911130223_22_952_1054... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ unified_strdate,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+... | yt_dlp/extractor/mbn.py | 26 | Python | 0.857 | security | 463 | 40 | 47 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'duration': 65,
'release_date': '20231028',
'thumbnail': 'http://img.vod.mbn.co.kr/vod2/952/2023/09/11/20230911130223_22_952_1054797_1080_7.jpg',
'series': '완벽한 결혼의 정석',
},
}]
def _real_extract(self, url):
content_id = self._match_id(url)
... | since we are potentially extracting multiple m3u8s, I think this should be non-fatal
```suggestion
formats.extend(self._extract_m3u8_formats(m3u8_url, content_id, fatal=False))
``` | 'ext': 'mp4',
'title': '[2차 티저] MBN 주말 미니시리즈 <완벽한 결혼의 정석> l 그녀에게 주어진 두 번째 인생',
'duration': 65,
'release_date': '20231028',
'thumbnail': 'http://img.vod.mbn.co.kr/vod2/952/2023/09/11/20230911130223_22_952_1054797_1080_7.jpg',
'series': '완벽한 결혼의 정석',... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ unified_strdate,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+... | yt_dlp/extractor/mbn.py | 26 | Python | 0.786 | refactor | 195 | 38 | 45 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
webpage = self._download_webpage(url, content_id)
content_cls_cd = self._search_regex(r'"\?content_cls_cd=(\d+)&', webpage, 'content_cls_cd', default='20')
media_info = self._download_json(
f'https://www.mbn.co.kr/player/mbnVodPlayer_2020.mbn?content_cls_cd={content_cls_cd}&content_... | traversal can make metadata extraction easier and safer (`release_date` was fatal before)
```suggestion
**traverse_obj(media_info, {
'title': ('movie_title', {str}),
'duration': ('play_sec', {int_or_none}),
'release_date': ('bcast_date', {lambda x: x.repl... | def _real_extract(self, url):
content_id = self._match_id(url)
webpage = self._download_webpage(url, content_id)
content_cls_cd = self._search_regex(
r'"\?content_cls_cd=(\d+)&', webpage, 'content cls cd', fatal=False) or '20'
media_info = self._download_json(
... | @@ -0,0 +1,82 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ unified_strdate,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/(?:previewlist|preview)/[0-9]+/[0-9]+/(?P<id>[0-9]+... | yt_dlp/extractor/mbn.py | 26 | Python | 1 | refactor | 561 | 29 | 36 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'series': '완벽한 결혼의 정석',
},
}]
def _real_extract(self, url):
content_id = self._match_id(url)
webpage = self._download_webpage(url, content_id)
content_cls_cd = self._search_regex(
r'"\?content_cls_cd=(\d+)&', webpage, 'content cls cd', fatal=False) or '2... | ```suggestion
formats = []
for stream_url in traverse_obj(media_info, ('movie_list', ..., 'url', {url_or_none})):
stream_url = re.sub(r'/(?:chunk|play)list(?:_pd\d+)?\.m3u8', '/manifest.m3u8', stream_url)
final_url = url_or_none(self._download_webpage(
f'http... | 'series': '완벽한 결혼의 정석',
},
}]
def _real_extract(self, url):
content_id = self._match_id(url)
webpage = self._download_webpage(url, content_id)
content_cls_cd = self._search_regex(
r'"\?content_cls_cd=(\d+)&', webpage, 'content cls cd', fatal=False) or '2... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class MBNIE(InfoExtractor):
+ IE_DESC = 'mbn.co.kr (매일방송)'
+ _VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/preview(?:list... | yt_dlp/extractor/mbn.py | 26 | Python | 0.857 | security | 562 | 40 | 40 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
unified_strdate,
url_or_none,
)
class MBNIE(InfoExtractor):
IE_DESC = 'mbn.co.kr (매일방송)'
_VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/preview(?:list)?/\d+/\d+/(?P<id>\d+)'
_TE... | Same as the other review, probably better to use `from ..utils.traversal import traverse_obj` | import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
unified_strdate,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MBNIE(InfoExtractor):
IE_DESC = 'mbn.co.kr (매일방송)'
_VALID_URL = r'https?://(?:www\.)?mbn\.co\.kr/vod/programContents/preview(?:list)?/\d+... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ traverse_obj, | yt_dlp/extractor/mbn.py | 6 | Python | 0.429 | suggestion | 93 | 31 | 31 | false | Add mbn.co.kr extractor | 8,312 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
traverse_obj,
)
class JTBCIE(InfoExtractor):
IE_DESC = 'jtbc.co.kr'
_VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm[0-9]+)/(?P<id>(?:ep|vo)[0-9]+... | ```suggestion
_VALID_URL = r'''(?x)
https?://(?:
vod\.jtbc\.co\.kr/player/(?:program|clip)
|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr\d+/pm\d+
)/(?P<id>(?:ep|vo)\d+)'''
``` | import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
url_or_none,
)
from ..utils.traversal import traverse_obj
class JTBCIE(InfoExtractor):
IE_DESC = 'jtbc.co.kr'
_VALID_URL = r'''(?x)
https?://(?:
vod\.jtbc\.co\.kr/player/(?:program|c... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 12 | Python | 0.786 | suggestion | 224 | 37 | 37 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
subtitles.setdefault(sub.get('label', 'und'), []).append({'url': sub.get('file')})
formats = []
for format_id, stream in traverse_obj(playback_data, ('sources', 'HLS'), default={}).items():
m3u8_url = re.sub(r'/playlist(?:_pd180000)?\.m3u8', '/index.m3u8', stream.get('file'))
... | allow trailing slash/query/fragment
```suggestion
_VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/program|tv\.jtbc\.co\.kr/replay)/(?P<id>pr\d+)/(?:replay|pm\d+)/?(?:$|[?#])'
``` | else:
webpage = self._download_webpage(url, display_id)
video_id = self._search_regex(r'data-vod="(VO\d+)"', webpage, 'vod id')
playback_data = self._download_json(
f'https://api.jtbc.co.kr/vod/{video_id}', video_id, note='Downloading VOD playback data')
sub... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.714 | suggestion | 182 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'release_date': '20231015',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/20231008_210957_775_1.jpg',
'series': '뭉쳐야 찬다3',
},
}, {
'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/... | nitpick: `name` arg is intended to be human readable / not just var name / avoid underscores etc
```suggestion
file_id = self._search_regex(r'data-vod="(VO\d+)"', webpage, 'vod id')
``` | 'url': 'https://vod.jtbc.co.kr/player/clip/vo10721270',
'md5': '05782e2dc22a9c548aebefe62ae4328a',
'info_dict': {
'id': 'VO10721270',
'display_id': 'vo10721270',
'ext': 'mp4',
'title': '뭉쳐야 찬다3 2회 예고편 - A매치로 향하는 마지막 관문💥',
'description'... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.786 | suggestion | 196 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'title': '아는 형님 404회 예고편 | 10월 14일(토) 저녁 8시 50분 방송!',
'description': 'md5:2743bb1079ceb85bb00060f2ad8f0280',
'duration': 148.0,
'release_date': '20231014',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros... | filter traversal
```suggestion
for sub in traverse_obj(playback_data, ('tracks', lambda _, v: v['file'])):
subtitles.setdefault(sub.get('label', 'und'), []).append({'url': sub['file']})
``` | 'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/20231008_210957_775_1.jpg',
'series': '뭉쳐야 찬다3',
},
}, {
'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/view',
'md5': '367d480eb3ef54a9cd7a4b4d69c4b32d',
'in... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.786 | suggestion | 213 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'release_date': '20231014',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
'series': '아는 형님',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
... | can do this more safely w/ filtering and transformation in the path
```suggestion
for format_id, stream in traverse_obj(playback_data, ('sources', 'HLS', lambda _, v: v['file'], {dict.items}, ...)):
``` | }, {
'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/view',
'md5': '367d480eb3ef54a9cd7a4b4d69c4b32d',
'info_dict': {
'id': 'VO10720912',
'display_id': 'vo10720912',
'ext': 'mp4',
'title': '아는 형님 404회 예고편 | 10월 14일(토) 저녁 ... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.786 | suggestion | 213 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
'series': '아는 형님',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, vi... | ```suggestion
m3u8_url = re.sub(r'/playlist(?:_pd\d+)?\.m3u8', '/index.m3u8', stream['file'])
``` | 'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/view',
'md5': '367d480eb3ef54a9cd7a4b4d69c4b32d',
'info_dict': {
'id': 'VO10720912',
'display_id': 'vo10720912',
'ext': 'mp4',
'title': '아는 형님 404회 예고편 | 10월 14일(토) 저녁 8시 50분 방송... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.714 | suggestion | 111 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
'series': '아는 형님',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
file_id = se... | ```suggestion
formats.extend(self._extract_m3u8_formats(
m3u8_url, video_id, m3u8_id=format_id, fatal=False))
``` | 'md5': '367d480eb3ef54a9cd7a4b4d69c4b32d',
'info_dict': {
'id': 'VO10720912',
'display_id': 'vo10720912',
'ext': 'mp4',
'title': '아는 형님 404회 예고편 | 10월 14일(토) 저녁 8시 50분 방송!',
'description': 'md5:2743bb1079ceb85bb00060f2ad8f0280',
'du... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.786 | refactor | 144 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
webpage = self._download_webpage(url, video_id)
file_id = self._search_regex(r'data-vod="(VO[0-9]+)"', webpage, 'vod_id')
metadata = self._download_json(
f'https://now-api.jtbc.co.kr/v1/vod/detail?vodFileId={file_id}',
video_id, note='Downloading mobile details', fatal=... | ```suggestion
'age_limit': ('watchAge', {int_or_none}),
``` | 'duration': 148.0,
'release_date': '20231014',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
'series': '아는 형님',
},
}]
def _real_extract(self, url):
display_... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
metadata = self._download_json(
f'https://now-api.jtbc.co.kr/v1/vod/detail?vodFileId={file_id}',
video_id, note='Downloading mobile details', fatal=False)
playback_data = self._download_json(
f'https://api.jtbc.co.kr/vod/{file_id}', video_id, note='Downloading VOD p... | ```suggestion
'thumbnail': ('imgFileUrl', {url_or_none}),
``` | 'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
'series': '아는 형님',
},
}]
def _real_extract(self, url):
display_id = self._match_id(url)
if display_id.startswith('vo'):
video_id = display_id.... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.571 | suggestion | 79 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
class JTBCProgramIE(InfoExtractor):
IE_NAME = 'JTBC:program'
_VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/program|tv\.jtbc\.co\.kr/replay)/(?P<id>pr[0-9]+)/(?:replay|pm[0-9]+)$'
_TESTS = [{
'url': 'https://tv.jtbc.co.kr/replay/pr10010392/pm10032710',
'info_dict': {
'_type': 'pla... | ```suggestion
vod_list = self._download_json(
'https://now-api.jtbc.co.kr/v1/vodClip/programHome/programReplayVodList', program_id,
note='Downloading program replay list', query={
'programId': program_id,
'rowCount': '10000',
})
``` | 'title': 'vodTitleView',
'series': 'programTitle',
'age_limit': ('watchAge', {int_or_none}),
'release_date': ('broadcastDate', {lambda x: re.match(r'\d{8}', x.replace('.', ''))}, 0),
'description': 'episodeContents',
'thumbn... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.786 | suggestion | 315 | 33 | 47 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
_TESTS = [{
'url': 'https://tv.jtbc.co.kr/replay/pr10010392/pm10032710',
'info_dict': {
'_type': 'playlist',
'id': 'pr10010392',
},
'playlist_count': 398,
}, {
'url': 'https://vod.jtbc.co.kr/program/pr10011491/replay',
'info_dict': {
... | ```suggestion
entries = [self.url_result(f'https://vod.jtbc.co.kr/player/program/{video_id}', JTBCIE, video_id)
for video_id in traverse_obj(vod_list, ('programReplayVodList', ... 'episodeId'))]
``` | 'description': 'episodeContents',
'thumbnail': ('imgFileUrl', {url_or_none}),
})),
'duration': parse_duration(playback_data.get('playTime')),
'formats': formats,
'subtitles': subtitles,
}
class JTBCProgramIE(InfoExtractor):
IE... | @@ -0,0 +1,142 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/player/(?:program|clip)|tv\.jtbc\.co\.kr/(?:replay|trailer|clip)/pr[0-9]+/pm... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.786 | suggestion | 228 | 29 | 43 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'info_dict': {
'_type': 'playlist',
'id': 'pr10010392',
},
'playlist_count': 398,
}, {
'url': 'https://vod.jtbc.co.kr/program/pr10011491/replay',
'info_dict': {
'_type': 'playlist',
'id': 'pr10011491',
},
'playli... | oops, I think this was my typo
```suggestion
for video_id in traverse_obj(vod_list, ('programReplayVodList', ..., 'episodeId'))]
``` |
class JTBCProgramIE(InfoExtractor):
IE_NAME = 'JTBC:program'
_VALID_URL = r'https?://(?:vod\.jtbc\.co\.kr/program|tv\.jtbc\.co\.kr/replay)/(?P<id>pr\d+)/(?:replay|pm\d+)/?(?:$|[?#])'
_TESTS = [{
'url': 'https://tv.jtbc.co.kr/replay/pr10010392/pm10032710',
'info_dict': {
'_type... | @@ -0,0 +1,149 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ traverse_obj,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'''(?x)
+ https?://(?:
+ vod\.jtbc\.co\.kr/player/(?:program|clip)
+ |tv\.jtbc... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.714 | suggestion | 154 | 29 | 36 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
'series': '아는 형님',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
file_id = se... | ```suggestion
formats = []
for stream_url in traverse_obj(playback_data, ('sources', 'HLS', ..., 'file', {url_or_none})):
stream_url = re.sub(r'/playlist(?:_pd\d+)?\.m3u8', '/index.m3u8', stream_url)
formats.extend(self._extract_m3u8_formats(stream_url, video_id, fatal=False)... | 'description': 'md5:2743bb1079ceb85bb00060f2ad8f0280',
'duration': 148.0,
'release_date': '20231014',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/jtbcbros/img/20231006_230023_802_1.jpg',
'series': '아는 형님',
... | @@ -0,0 +1,150 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'''(?x)
+ https?://(?:
+ vod\.jtbc\.co\.kr/player/(?:... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.857 | refactor | 326 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'release_date': '20231015',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/20231008_210957_775_1.jpg',
'series': '뭉쳐야 찬다3',
},
}, {
'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/... | We can skip the webpage download when the id starts with `vo`. We have to uppercase it though | 'title': '뭉쳐야 찬다3 2회 예고편 - A매치로 향하는 마지막 관문💥',
'description': 'md5:d48b51a8655c84843b4ed8d0c39aae68',
'duration': 46.0,
'release_date': '20231015',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/2023... | @@ -0,0 +1,150 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'''(?x)
+ https?://(?:
+ vod\.jtbc\.co\.kr/player/(?:... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.357 | suggestion | 93 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
'title': '뭉쳐야 찬다3 2회 예고편 - A매치로 향하는 마지막 관문💥',
'description': 'md5:d48b51a8655c84843b4ed8d0c39aae68',
'duration': 46.0,
'release_date': '20231015',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/2023... | I think this should be the `display_id` instead of the `id`. The `VO...` should be the id instead. | 'id': 'VO10721270',
'display_id': 'vo10721270',
'ext': 'mp4',
'title': '뭉쳐야 찬다3 2회 예고편 - A매치로 향하는 마지막 관문💥',
'description': 'md5:d48b51a8655c84843b4ed8d0c39aae68',
'duration': 46.0,
'release_date': '20231015',
'age_limit': 1... | @@ -0,0 +1,150 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'''(?x)
+ https?://(?:
+ vod\.jtbc\.co\.kr/player/(?:... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.429 | suggestion | 98 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
},
}, {
'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/view',
'md5': '217a6d190f115a75e4bda0ceaa4cd7f4',
'info_dict': {
'id': 'vo10720912',
'ext': 'mp4',
'title': '아는 형님 404회 예고편 | 10월 14일(토) 저녁 8시 50분 방송!',
'des... | I think this should be moved down before the return or even inlined into the traversal, so its not so disconnected. | 'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/20231008_210957_775_1.jpg',
'series': '뭉쳐야 찬다3',
},
}, {
'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/view',
'md5': '367d480eb3ef54a9c... | @@ -0,0 +1,150 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'''(?x)
+ https?://(?:
+ vod\.jtbc\.co\.kr/player/(?:... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.429 | suggestion | 115 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
'series': '뭉쳐야 찬다3',
},
}, {
'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/view',
'md5': '217a6d190f115a75e4bda0ceaa4cd7f4',
'info_dict': {
'id': 'vo10720912',
'ext': 'mp4',
'title': '아는 형님 404회 예고편 | 10월 14일(토)... | This could be `query={...}` instead, but im not sure. If you like it better this way keep it | 'release_date': '20231015',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/enter/soccer3/img/20231008_210957_775_1.jpg',
'series': '뭉쳐야 찬다3',
},
}, {
'url': 'https://tv.jtbc.co.kr/trailer/pr10010392/pm10032526/vo10720912/... | @@ -0,0 +1,150 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'''(?x)
+ https?://(?:
+ vod\.jtbc\.co\.kr/player/(?:... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.429 | suggestion | 92 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
traverse_obj,
url_or_none,
)
class JTBCIE(InfoExtractor):
IE_DESC = 'jtbc.co.kr'
_VALID_URL = r'''(?x)
https?://(?:
vod\.jtbc\.co\.kr/player/(?:program|clip)
|tv\.jtb... | Same as above, remove the empty line below or just inline into the return | 'info_dict': {
'_type': 'playlist',
'id': 'pr10010392',
},
'playlist_count': 398,
}, {
'url': 'https://vod.jtbc.co.kr/program/pr10011491/replay',
'info_dict': {
'_type': 'playlist',
'id': 'pr10011491',
},
'playli... | @@ -0,0 +1,150 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'''(?x)
+ https?://(?:
+ vod\.jtbc\.co\.kr/player/(?:... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.286 | suggestion | 73 | 151 | 28 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
'ext': 'mp4',
'title': '헬로 마이 닥터 친절한 진료실 149회 다시보기',
'description': 'md5:1d70788a982dd5de26874a92fcffddb8',
'duration': 2720.0,
'release_date': '20231009',
'age_limit': 15,
'thumbnail': 'https://fs.jtbc.co.kr//joydata/CP00000001/prog/cu... | md5 seems to have changed, may want to add `'params': {'skip_download': 'm3u8'}` to these tests | 'id': 'VO10721429',
'display_id': 'ep20216733',
'ext': 'mp4',
'title': '헬로 마이 닥터 친절한 진료실 149회 다시보기',
'description': 'md5:1d70788a982dd5de26874a92fcffddb8',
'duration': 2720.0,
'release_date': '20231009',
'age_limit': 15,
... | @@ -0,0 +1,150 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class JTBCIE(InfoExtractor):
+ IE_DESC = 'jtbc.co.kr'
+ _VALID_URL = r'''(?x)
+ https?://(?:
+ vod\.jtbc\.co\.kr/player/(?:... | yt_dlp/extractor/jtbc.py | 26 | Python | 0.429 | suggestion | 95 | 51 | 51 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
traverse_obj,
url_or_none,
)
class JTBCIE(InfoExtractor):
IE_DESC = 'jtbc.co.kr'
_VALID_URL = r'''(?x)
https?://(?:
vod\.jtbc\.co\.kr/player/(?:program|clip)
|tv\.jtb... | also this should probably be `from ..utils.traversal imoprt traverse_obj` instead | import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
url_or_none,
)
from ..utils.traversal import traverse_obj
class JTBCIE(InfoExtractor):
IE_DESC = 'jtbc.co.kr'
_VALID_URL = r'''(?x)
https?://(?:
vod\.jtbc\.co\.kr/player/(?:program|c... | @@ -0,0 +1,150 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ traverse_obj, | yt_dlp/extractor/jtbc.py | 7 | Python | 0.429 | suggestion | 81 | 32 | 32 | false | Add jtbc.co.kr extractor | 8,314 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
if not cc_url:
continue
captions = self._download_xml(
cc_url, programme_id, 'Downloading captions', fatal=False)
if not isinstance(captions, xml.etree.ElementTree.Element):
continue
subtitles['en'] = [
{
... | `sttls` is less obvious imo
```suggestion
fmts, subs = self._download_media_selector_url(
``` | if not cc_url:
continue
captions = self._download_xml(
cc_url, programme_id, 'Downloading captions', fatal=False)
if not isinstance(captions, xml.etree.ElementTree.Element):
continue
subtitles['en'] = [
{
... | @@ -317,16 +317,26 @@ def _raise_extractor_error(self, media_selection_error):
def _download_media_selector(self, programme_id):
last_exception = None
+ formats, subtitles = [], {}
for media_set in self._MEDIA_SETS:
try:
- return self._download_media_selector_... | yt_dlp/extractor/bbc.py | 26 | Python | 0.714 | suggestion | 112 | 51 | 51 | false | [ie/bbc] extract more formats | 8,321 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | barsnick |
if not isinstance(captions, xml.etree.ElementTree.Element):
continue
subtitles['en'] = [
{
'url': connection.get('href'),
'ext': 'ttml',
},
]
break
return subtitles
def _r... | ```suggestion
self._merge_subtitles(subs, target=subtitles)
``` | if not isinstance(captions, xml.etree.ElementTree.Element):
continue
subtitles['en'] = [
{
'url': connection.get('href'),
'ext': 'ttml',
},
]
break
return subtitles
def _r... | @@ -317,16 +317,26 @@ def _raise_extractor_error(self, media_selection_error):
def _download_media_selector(self, programme_id):
last_exception = None
+ formats, subtitles = [], {}
for media_set in self._MEDIA_SETS:
try:
- return self._download_media_selector_... | yt_dlp/extractor/bbc.py | 26 | Python | 0.571 | suggestion | 81 | 51 | 51 | false | [ie/bbc] extract more formats | 8,321 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | barsnick |
return subtitles
def _raise_extractor_error(self, media_selection_error):
raise ExtractorError(
'%s returned error: %s' % (self.IE_NAME, media_selection_error.id),
expected=True)
def _download_media_selector(self, programme_id):
last_exception = None
for... | f-string
```suggestion
self.report_warning(f'{self.IE_NAME} returned error: {last_exception.id}')
``` | return subtitles
def _raise_extractor_error(self, media_selection_error):
raise ExtractorError(
'%s returned error: %s' % (self.IE_NAME, media_selection_error.id),
expected=True)
def _download_media_selector(self, programme_id):
last_exception = None
for... | @@ -317,16 +317,26 @@ def _raise_extractor_error(self, media_selection_error):
def _download_media_selector(self, programme_id):
last_exception = None
+ formats, subtitles = [], {}
for media_set in self._MEDIA_SETS:
try:
- return self._download_media_selector_... | yt_dlp/extractor/bbc.py | 26 | Python | 0.857 | suggestion | 120 | 51 | 51 | false | [ie/bbc] extract more formats | 8,321 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | barsnick |
'series': '트롤리',
'episode': '이거 다 거짓말이야',
'episode_number': 15,
},
}, {
'url': 'https://programs.sbs.co.kr/enter/fourman/vod/69625/22000508948',
'md5': '41e8ae4cc6c8424f4e4d76661a4becbf',
'info_dict': {
'id': '22000508948',
... | `_call_api` is the convention
```suggestion
def _call_api(self, video_id, rscuse=''):
``` | 'series': '트롤리',
'episode': '이거 다 거짓말이야',
'episode_number': 15,
},
}, {
'url': 'https://programs.sbs.co.kr/enter/fourman/vod/69625/22000508948',
'md5': '41e8ae4cc6c8424f4e4d76661a4becbf',
'info_dict': {
'id': '22000508948',
... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.643 | suggestion | 96 | 51 | 51 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'like_count': int,
'duration': 7036,
'age_limit': 15,
'series': '신발 벗고 돌싱포맨',
'episode': '돌싱포맨 저격수들 등장!',
'episode_number': 104,
},
}]
def request_details(self, video_id, rscuse=''):
return self._download_json(
... | ```suggestion
details = self._call_api(video_id)
``` | 'like_count': int,
'duration': 7036,
'age_limit': 15,
'series': '신발 벗고 돌싱포맨',
'episode': '돌싱포맨 저격수들 등장!',
'episode_number': 104,
},
}]
def _call_api(self, video_id, rscuse=''):
return self._download_json(
f'http... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.571 | suggestion | 62 | 51 | 51 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'duration': 7036,
'age_limit': 15,
'series': '신발 벗고 돌싱포맨',
'episode': '돌싱포맨 저격수들 등장!',
'episode_number': 104,
},
}]
def request_details(self, video_id, rscuse=''):
return self._download_json(
f'https://api.play.sbs.co.kr/1.... | just in case so that the `source.get('mediarscuse')` below is not fatal
```suggestion
source = traverse_obj(details, ('vod', 'source', 'mediasource', {dict})) or {}
``` | 'duration': 7036,
'age_limit': 15,
'series': '신발 벗고 돌싱포맨',
'episode': '돌싱포맨 저격수들 등장!',
'episode_number': 104,
},
}]
def _call_api(self, video_id, rscuse=''):
return self._download_json(
f'https://api.play.sbs.co.kr/1.0/sbs_... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.786 | suggestion | 179 | 51 | 51 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'episode': '돌싱포맨 저격수들 등장!',
'episode_number': 104,
},
}]
def request_details(self, video_id, rscuse=''):
return self._download_json(
f'https://api.play.sbs.co.kr/1.0/sbs_vodall/{video_id}', video_id,
note=f'Downloading m3u8 information {rscuse}',
... | could filter here to ensure that we always get a list, and that we always fallback to `[source]` if `mediasourcelist` doesn't have what we need
```suggestion
for stream in traverse_obj(details, (
'vod', 'source', 'mediasourcelist', lambda _, v: v['mediaurl'] or v['mediarscuse']
), defaul... | 'episode': '돌싱포맨 저격수들 등장!',
'episode_number': 104,
},
}]
def _call_api(self, video_id, rscuse=''):
return self._download_json(
f'https://api.play.sbs.co.kr/1.0/sbs_vodall/{video_id}', video_id,
note=f'Downloading m3u8 information {rscuse}',
... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.857 | suggestion | 337 | 51 | 51 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
}]
def request_details(self, video_id, rscuse=''):
return self._download_json(
f'https://api.play.sbs.co.kr/1.0/sbs_vodall/{video_id}', video_id,
note=f'Downloading m3u8 information {rscuse}',
query={
'platform': 'pcweb',
'protocol': '... | ```suggestion
new_source = traverse_obj(
self._call_api(video_id, rscuse=stream['mediarscuse']),
('vod', 'source', 'mediasource', {dict})) or {}
``` | }]
def _call_api(self, video_id, rscuse=''):
return self._download_json(
f'https://api.play.sbs.co.kr/1.0/sbs_vodall/{video_id}', video_id,
note=f'Downloading m3u8 information {rscuse}',
query={
'platform': 'pcweb',
'protocol': 'downlo... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.857 | suggestion | 208 | 51 | 51 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
note=f'Downloading m3u8 information {rscuse}',
query={
'platform': 'pcweb',
'protocol': 'download',
'absolute_show': 'Y',
'service': 'program',
'ssl': 'Y',
'rscuse': rscuse,
})
def _r... | shouldn't need `.get()` anymore if other suggestions applied
```suggestion
'url': stream['mediaurl'],
``` | note=f'Downloading m3u8 information {rscuse}',
query={
'platform': 'pcweb',
'protocol': 'download',
'absolute_show': 'Y',
'service': 'program',
'ssl': 'Y',
'rscuse': rscuse,
})
def _r... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.786 | suggestion | 124 | 51 | 51 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
caption_url = traverse_obj(details, ('vod', 'source', 'subtitle', {url_or_none}))
subtitles = {'ko': [{'url': caption_url}]} if caption_url else None
return {
'id': video_id,
**traverse_obj(details, ('vod', {
'title': ('info', 'title'),
'd... | ```suggestion
_VALID_URL = r'https?://allvod\.sbs\.co\.kr/allvod/vod(?:Free)?ProgramDetail\.do\?(?:[^#]+&)?pgmId=(?P<id>P?\d+)'
``` | 'preference': int_or_none(stream.get('mediarscuse'))
})
caption_url = traverse_obj(details, ('vod', 'source', 'subtitle', {url_or_none}))
return {
'id': video_id,
**traverse_obj(details, ('vod', {
'title': ('info', 'title'),
... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.714 | suggestion | 137 | 51 | 51 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.