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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
self.cache.store(
self._NETRC_MACHINE, 'token_data', (
self._get_vrt_cookie(self._ACCESS_TOKEN_COOKIE_NAME),
self._get_vrt_cookie(self._VIDEO_TOKEN_COOKIE_NAME)))
self.cache.store(self._NETRC_MACHINE, 'refresh_token', self._get_vrt_cookie(self._REFRESH_TOKEN_... | to go with the above suggestion
```suggestion
}))['data']['page']
``` | 'loginID': username,
'password': password,
}).encode(), headers={
'Content-Type': 'application/json',
'Oidcxsrf': self._get_cookies('https://login.vrt.be')['OIDCXSRF'].value,
}, note='Logging in', errnote='Login failed', expected_st... | @@ -178,154 +179,236 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.571 | suggestion | 84 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
return jwt_decode_hs256(token)['exp'] - time.time() < 300
def _perform_login(self, username, password):
refresh_token = self._get_vrt_cookie(self._REFRESH_TOKEN_COOKIE_NAME)
if refresh_token and not self._is_jwt_token_expired(refresh_token):
self.write_debug('Refresh token alrea... | it's fatal either way, so don't bother with `.get()`
```suggestion
'Oidcxsrf': self._get_cookies('https://login.vrt.be')['OIDCXSRF'].value,
``` |
if has_credentials:
self.cache.store(self._NETRC_MACHINE, 'token_data', (access_token, video_token))
return access_token, video_token
def _get_vrt_cookie(self, cookie_name):
# Refresh token cookie is scoped to /vrtmax/sso, others are scoped to /
return try_call(lambda:... | @@ -178,154 +179,236 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.714 | suggestion | 162 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
self.write_debug('Refresh token already present')
return
refresh_token = self.cache.load(self._NETRC_MACHINE, 'refresh_token', default=None)
if refresh_token and not self._is_jwt_token_expired(refresh_token):
self.write_debug('Restored refresh token from cache')
... | ```suggestion
self._request_webpage(
``` |
def _get_vrt_cookie(self, cookie_name):
# Refresh token cookie is scoped to /vrtmax/sso, others are scoped to /
return try_call(lambda: self._get_cookies('https://www.vrt.be/vrtmax/sso')[cookie_name].value)
@staticmethod
def _is_jwt_token_expired(token):
return jwt_decode_hs256(tok... | @@ -178,154 +179,236 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
note='Refreshing tokens', errnote='Failed to refresh tokens', fatal=False)
access_token = self._get_vrt_cookie(self._ACCESS_TOKEN_COOKIE_NAME)
video_token = self._get_vrt_cookie(self._VIDEO_TOKEN_COOKIE_NAME)
if not access_token or not video_token:
self.cache.store(self... | since this code path will only be hit if the user is passing both cookies and credentials, I'd like to adjust the debug msg
```suggestion
self.write_debug('Using refresh token from logged-in cookies; skipping login with credentials')
``` |
if not self._get_vrt_cookie(self._REFRESH_TOKEN_COOKIE_NAME):
return None, None
self._request_webpage(
'https://www.vrt.be/vrtmax/sso/refresh', None,
note='Refreshing tokens', errnote='Failed to refresh tokens', fatal=False)
access_token = self._get_vrt_coo... | @@ -178,154 +179,236 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 1 | bug | 252 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
titleRaw
}
title
}
ldjson
player {
image {
templateUrl
}
modes {
streamId
}
... | ```suggestion
has_credentials = self._get_login_info()[0]
access_token = self._get_vrt_cookie(self._ACCESS_TOKEN_COOKIE_NAME)
``` | title
}
season {
id
titleRaw
}
title
brand
}
ldjson
player {
image {
... | @@ -178,154 +179,236 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.714 | security | 148 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
}
title
}
ldjson
player {
image {
templateUrl
}
modes {
streamId
}
}
}
... | ```suggestion
if has_credentials:
``` | }
season {
id
titleRaw
}
title
brand
}
ldjson
player {
image {
templateUrl
... | @@ -178,154 +179,236 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.429 | security | 47 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
if self._get_login_info()[0]:
access_token, video_token = self.cache.load(self._NETRC_MACHINE, 'token_data', default=(None, None))
if (access_token and not self._is_jwt_token_expired(access_token)
and video_token and not self._is_jwt_token_expired(video_token)):
... | ```suggestion
if has_credentials:
```
or if using my re-login suggestion above, then:
```suggestion
elif has_credentials:
```
so we don't unnecessarily cache to disk twice | video_token = self._get_vrt_cookie(self._VIDEO_TOKEN_COOKIE_NAME)
if (access_token and not self._is_jwt_token_expired(access_token)
and video_token and not self._is_jwt_token_expired(video_token)):
return access_token, video_token
if has_credentials:
acc... | @@ -178,154 +179,236 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.714 | security | 198 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
return access_token, video_token
if self._get_login_info()[0]:
access_token, video_token = self.cache.load(self._NETRC_MACHINE, 'token_data', default=(None, None))
if (access_token and not self._is_jwt_token_expired(access_token)
and video_token and not ... | I think this should be fatal *at least* if the user has logged in with credentials
```suggestion
msg = 'Refreshing of tokens failed'
if has_credentials:
raise ExtractorError(f'{msg}. Try logging in again', expected=True)
self.report_warning(msg)
retu... | has_credentials = self._get_login_info()[0]
access_token = self._get_vrt_cookie(self._ACCESS_TOKEN_COOKIE_NAME)
video_token = self._get_vrt_cookie(self._VIDEO_TOKEN_COOKIE_NAME)
if (access_token and not self._is_jwt_token_expired(access_token)
and video_token and not sel... | @@ -178,154 +179,236 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 1 | bug | 687 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
self._request_webpage(
'https://www.vrt.be/vrtmax/sso/login', None,
note='Getting session cookies', errnote='Failed to get session cookies')
login_data = self._download_json(
'https://login.vrt.be/perform_login', None, data=json.dumps({
'clientId': '... | ```suggestion
access_token = self._get_vrt_cookie(self._ACCESS_TOKEN_COOKIE_NAME)
video_token = self._get_vrt_cookie(self._VIDEO_TOKEN_COOKIE_NAME)
refresh_token = self._get_vrt_cookie(self._REFRESH_TOKEN_COOKIE_NAME)
if not all((access_token, video_token, refresh_token)):
... | if refresh_token and not self._is_jwt_token_expired(refresh_token):
self.write_debug('Using refresh token from logged-in cookies; skipping login with credentials')
return
refresh_token = self.cache.load(self._NETRC_MACHINE, 'refresh_token', default=None)
if refresh_token... | @@ -178,154 +181,237 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 1 | performance | 606 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
if login_data.get('errorCode'):
raise ExtractorError(f'Login failed: {login_data.get("errorMessage")}', expected=True)
self._request_webpage(
login_data['redirectUrl'], None,
note='Getting access token', errnote='Failed to get access token')
self.cache.store... | oops typo
```suggestion
headers=filter_dict({
``` | login_data = self._download_json(
'https://login.vrt.be/perform_login', None, data=json.dumps({
'clientId': 'vrtnu-site',
'loginID': username,
'password': password,
}).encode(), headers={
'Content-Type': 'application/json',
... | @@ -178,154 +181,237 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.571 | suggestion | 64 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
and video_token and not self._is_jwt_token_expired(video_token)):
self.write_debug('Restored tokens from cache')
self._set_cookie('.vrt.be', self._ACCESS_TOKEN_COOKIE_NAME, access_token)
self._set_cookie('.vrt.be', self._VIDEO_TOKEN_COOKIE_NAME, video_... | `elif` not needed
```suggestion
if has_credentials:
``` | access_token, video_token = self.cache.load(self._NETRC_MACHINE, 'token_data', default=(None, None))
if (access_token and not self._is_jwt_token_expired(access_token)
and video_token and not self._is_jwt_token_expired(video_token)):
self.write_debug('Restored... | @@ -178,154 +181,247 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.571 | security | 66 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
if not self._get_vrt_cookie(self._REFRESH_TOKEN_COOKIE_NAME):
return None, None
self._request_webpage(
'https://www.vrt.be/vrtmax/sso/refresh', None,
note='Refreshing tokens', errnote='Failed to refresh tokens', fatal=False)
access_token = self._get_vrt_cook... | ```suggestion
def _get_vrt_cookie(self, cookie_name):
# Refresh token cookie is scoped to /vrtmax/sso, others are scoped to /
return try_call(lambda: self._get_cookies('https://www.vrt.be/vrtmax/sso')[cookie_name].value)
``` | return access_token, video_token
if not self._get_vrt_cookie(self._REFRESH_TOKEN_COOKIE_NAME):
return None, None
self._request_webpage(
'https://www.vrt.be/vrtmax/sso/refresh', None,
note='Refreshing tokens', errnote='Failed to refresh tokens', fatal... | @@ -178,153 +181,247 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.786 | suggestion | 248 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
return access_token, video_token
if has_credentials:
access_token, video_token = self.cache.load(self._NETRC_MACHINE, 'token_data', default=(None, None))
if (access_token and not self._is_jwt_token_expired(access_token)
and video_token and not self._is_j... | ```suggestion
self.cache.store(self._NETRC_MACHINE, 'refresh_token', None)
self.cookiejar.clear('.www.vrt.be', '/vrtmax/sso', self._REFRESH_TOKEN_COOKIE_NAME)
``` | if (access_token and not self._is_jwt_token_expired(access_token)
and video_token and not self._is_jwt_token_expired(video_token)):
return access_token, video_token
if has_credentials:
access_token, video_token = self.cache.load(self._NETRC_MACHINE, 'token_data',... | @@ -178,153 +181,247 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.714 | performance | 189 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
and video_token and not self._is_jwt_token_expired(video_token)):
return access_token, video_token
if has_credentials:
access_token, video_token = self.cache.load(self._NETRC_MACHINE, 'token_data', default=(None, None))
if (access_token and not self._is_jwt_... | ```suggestion
self.cookiejar.clear(self._TOKEN_COOKIE_DOMAIN, '/vrtmax/sso', self._REFRESH_TOKEN_COOKIE_NAME)
``` | if (access_token and not self._is_jwt_token_expired(access_token)
and video_token and not self._is_jwt_token_expired(video_token)):
return access_token, video_token
if has_credentials:
access_token, video_token = self.cache.load(self._NETRC_MACHINE, 'token_data',... | @@ -178,153 +181,250 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX'
- _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)'
_TESTS = [{
- ... | yt_dlp/extractor/vrt.py | 26 | Python | 0.714 | suggestion | 127 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
formats, subtitles = self._extract_formats_and_subtitles(data, asset_id)
description = self._html_search_meta(
['og:description', 'twitter:description', 'description'], webpage)
if description == '…':
description = None
return {
'id': asset_id,
... | ```suggestion
IE_NAME = 'vrtmax'
IE_DESC = 'VRT MAX (formerly VRT NU)'
``` | formats, subtitles = self._extract_formats_and_subtitles(data, asset_id)
description = self._html_search_meta(
['og:description', 'twitter:description', 'description'], webpage)
if description == '…':
description = None
return {
'id': asset_id,
... | @@ -178,153 +181,250 @@ def _real_extract(self, url):
class VrtNUIE(VRTBaseIE):
IE_DESC = 'VRT MAX' | yt_dlp/extractor/vrt.py | 26 | Python | 0.571 | suggestion | 85 | 51 | 51 | false | [ie/VRTMax] Rework Extractor | 12,479 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | MichaelDeBoey |
import json
from .common import InfoExtractor
from ..networking.common import Request
class CanalsurmasExtractorIE(InfoExtractor):
_VALID_URL = r'https://www.canalsurmas.es/videos/(?P<id>[0-9]*)-.*'
_TESTS = [
{
'url': 'https://www.canalsurmas.es/videos/44006-el-gran-queo-1-lora-del-rio-... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
``` | import json
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsur... | @@ -0,0 +1,143 @@
+import json
+
+from .common import InfoExtractor
+from ..networking.common import Request
+
+
+class CanalsurmasExtractorIE(InfoExtractor):
+ _VALID_URL = r'https://www.canalsurmas.es/videos/(?P<id>[0-9]*)-.*' | yt_dlp/extractor/canalsurmas.py | 8 | Python | 0.571 | suggestion | 93 | 33 | 33 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
from .common import InfoExtractor
from ..networking.common import Request
class CanalsurmasExtractorIE(InfoExtractor):
_VALID_URL = r'https://www.canalsurmas.es/videos/(?P<id>[0-9]*)-.*'
_TESTS = [
{
'url': 'https://www.canalsurmas.es/videos/44006-el-gran-queo-1-lora-del-rio-sevilla-2007... | Why wrap this in a Request object? Just the `_download_json` arguments. | import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/vide... | @@ -0,0 +1,143 @@
+import json
+
+from .common import InfoExtractor
+from ..networking.common import Request
+
+
+class CanalsurmasExtractorIE(InfoExtractor):
+ _VALID_URL = r'https://www.canalsurmas.es/videos/(?P<id>[0-9]*)-.*'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/4400... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 0.357 | question | 71 | 51 | 51 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
access_token = self._download_json(
Request(
url='https://api-rtva.interactvty.com/jwt/token/',
method='POST',
headers={
'Content-Type': 'ap... | No need to document all optional fields. Just request and use the ones that make sense to be included as part of the info dict. https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/extractor/common.py#L120
image, duration, genre, created_at, publish_date, and tags seem like good things to include. | 'md5': '861f86fdc1221175e15523047d0087ef',
'info_dict': {
'id': '44006',
'ext': 'mp4',
'title': 'Lora del Río (Sevilla)',
'description': 'md5:3d9ee40a9b1b26ed8259e6b71ed27b8b',
'thumbnail': 'https://cdn2.rtva.interactvty.com/content_cards/00f3e... | @@ -0,0 +1,143 @@
+import json
+
+from .common import InfoExtractor
+from ..networking.common import Request
+
+
+class CanalsurmasExtractorIE(InfoExtractor):
+ _VALID_URL = r'https://www.canalsurmas.es/videos/(?P<id>[0-9]*)-.*'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/4400... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 0.5 | refactor | 300 | 51 | 51 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
- created_at
- image_medium
- alternative_image
- alternative_image_medium
- image_mobile
- expiration_date
- publish_date
- is_freemium
- tags
'''
video_info = self._download_json(
url_or_request=f'https://api-rtva.inte... | Instead of constructing the URL like this I would call the `content_resources` api
```
https://api-rtva.interactvty.com/api/2.0/contents/content_resources/222388/?optional_fields=type,videotype,media_url,is_initial,assets,drm_token,test,plain,url_app_web,thumbnail_track_url,product,remote_product_id
``` | import json
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsur... | @@ -0,0 +1,143 @@
+import json
+
+from .common import InfoExtractor
+from ..networking.common import Request
+
+
+class CanalsurmasExtractorIE(InfoExtractor):
+ _VALID_URL = r'https://www.canalsurmas.es/videos/(?P<id>[0-9]*)-.*'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/4400... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 1 | suggestion | 307 | 40 | 85 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
url_or_request=f'https://api-rtva.interactvty.com/api/2.0/contents/content/{video_id}/?optional_fields=reference,description,main_category',
video_id=video_id,
headers={
'Authorization': f'jwtok {access_token}',
},
)
video_reference_num: s... | The metadata extraction should be non fatal, and ideally use traverse_obj. Please see the contributing guidelines https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#developer-instructions | import json
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsur... | @@ -0,0 +1,143 @@
+import json
+
+from .common import InfoExtractor
+from ..networking.common import Request
+
+
+class CanalsurmasExtractorIE(InfoExtractor):
+ _VALID_URL = r'https://www.canalsurmas.es/videos/(?P<id>[0-9]*)-.*'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/4400... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 0.429 | refactor | 197 | 29 | 85 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
import json
from .common import InfoExtractor
from ..networking.common import Request
class CanalsurmasExtractorIE(InfoExtractor):
_VALID_URL = r'https://www.canalsurmas.es/videos/(?P<id>[0-9]*)-.*'
_TESTS = [
{
'url': 'https://www.canalsurmas.es/videos/44006-el-gran-queo-1-lora-del-rio-... | ```suggestion
class CanalsurmasIE(InfoExtractor):
``` | import json
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsur... | @@ -0,0 +1,143 @@
+import json
+
+from .common import InfoExtractor
+from ..networking.common import Request
+
+
+class CanalsurmasExtractorIE(InfoExtractor): | yt_dlp/extractor/canalsurmas.py | 7 | Python | 0.643 | refactor | 55 | 32 | 32 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
},
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
access_token: str | None = traverse_obj(
self._download_json(
url_or_request='https://api-rtva.interactvty.com/jwt/token/',
headers={
'Conten... | Since the access token is mandatory we might as well make this fatal
```suggestion
access_token = self._download_json(
'https://api-rtva.interactvty.com/jwt/token/', video_id,
headers={'Content-Type': 'application/json'},
data=json.dumps({
'username': 'c... | 'info_dict': {
'id': '44006',
'ext': 'mp4',
'title': 'Lora del Río (Sevilla)',
'description': 'md5:3d9ee40a9b1b26ed8259e6b71ed27b8b',
'thumbnail': 'https://cdn2.rtva.interactvty.com/content_cards/00f3e8f67b0a4f3b90a4a14618a48b0d.jpg',
'time... | @@ -0,0 +1,116 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class CanalsurmasIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/44... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 1 | suggestion | 416 | 51 | 51 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
'Content-Type': 'application/json',
},
data=json.dumps(
{
'username': 'canalsur_demo',
'password': 'dsUBXUcI',
},
).encode(),
video_id=video_id,
... | Just adjusting the formatting
```suggestion
video_info = self._download_json(
f'https://api-rtva.interactvty.com/api/2.0/contents/content/{video_id}/', video_id,
headers={'Authorization': f'jwtok {access_token}'},
query={
'optional_fields': 'description,... | _access_token = None
@staticmethod
def _is_jwt_expired(token):
return jwt_decode_hs256(token)['exp'] - time.time() < 300
def _call_api(self, endpoint, video_id, fields=None):
if not self._access_token or self._is_jwt_expired(self._access_token):
self._access_token = self._d... | @@ -0,0 +1,116 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class CanalsurmasIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/44... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 0.786 | security | 406 | 51 | 51 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
raise ExtractorError('Failed to retrieve a required access token.')
video_info = self._download_json(
url_or_request=f'https://api-rtva.interactvty.com/api/2.0/contents/content/{video_id}/',
video_id=video_id,
headers={
'Authorization': f'jwtok {a... | ```suggestion
stream_info = self._download_json(
f'https://api-rtva.interactvty.com/api/2.0/contents/content_resources/{video_id}/', video_id,
headers={'Authorization': f'jwtok {access_token}'},
query={
'optional_fields': 'media_url',
})
``` | 'password': 'dsUBXUcI',
}).encode())['access']
return self._download_json(
f'{self._API_BASE}/api/2.0/contents/{endpoint}/{video_id}/', video_id,
f'Downloading {endpoint} API JSON', f'Failed to download {endpoint} API JSON',
headers={'Auth... | @@ -0,0 +1,116 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class CanalsurmasIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/44... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 0.786 | security | 320 | 51 | 40 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
('results'),
)
if type(content_resources_linked_to_video) is not list:
raise ExtractorError('Failed to retrieve proper information about content resources linked to the specified video.')
formats = []
for content_resource_linked_to_video in content_resources_li... | We can simplify and also extract the mp4 format:
```suggestion
formats = []
subtitles = {}
for stream_url in traverse_obj(stream_info, ('results', ..., 'media_url', {url_or_none})):
if determine_ext(stream_url) == 'm3u8':
fmts, subs = self._extract_m3u8_formats_... | import json
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsur... | @@ -0,0 +1,116 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class CanalsurmasIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/44... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 0.857 | refactor | 624 | 48 | 85 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
# Example URL of a M3U8 file for a specific quality (i.e. 480p): https://cdn.rtva.interactvty.com/archivo_ott/el_gran_queo/0000051496/0000051496_480p/0000051496_480p.m3u8
formats = self._extract_m3u8_formats(
media_url,
video_id,
... | The nice thing about traverse_obj is that you can combine multiple calls like so:
```suggestion
return {
'id': video_id,
'formats': formats,
'subtitles': subtitles,
**traverse_obj(video_info, {
'title': ('name', {str.strip}),
... | import json
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsur... | @@ -0,0 +1,116 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class CanalsurmasIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/44... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 0.786 | suggestion | 559 | 27 | 85 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
import json
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://www.canalsurmas.es/videos/44006-el-gran-queo-1-lora-del-ri... | Adjusting the formatting to be in line with other extractors
```suggestion
_TESTS = [{
'url': 'https://www.canalsurmas.es/videos/44006-el-gran-queo-1-lora-del-rio-sevilla-20072014',
'md5': '861f86fdc1221175e15523047d0087ef',
'info_dict': {
'id': '44006',
'ext':... | import json
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsur... | @@ -0,0 +1,116 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class CanalsurmasIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
+
+ _TESTS = [
+ {
+ 'url': 'https://www.canalsurmas.es/videos/44... | yt_dlp/extractor/canalsurmas.py | 23 | Python | 0.857 | refactor | 660 | 48 | 48 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
import json
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://www.canalsurmas.es/videos/44006-el-gran-queo-1-lora-del-ri... | ```suggestion
from ..utils import determine_ext, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
``` | import json
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
jwt_decode_hs256,
parse_iso8601,
url_or_none,
variadic,
)
from ..utils.traversal import traverse_obj
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsur... | @@ -0,0 +1,116 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj | yt_dlp/extractor/canalsurmas.py | 4 | Python | 0.714 | suggestion | 125 | 29 | 29 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Arc8ne |
'id': '44006',
'ext': 'mp4',
'title': 'Lora del Río (Sevilla)',
'description': 'md5:3d9ee40a9b1b26ed8259e6b71ed27b8b',
'thumbnail': 'https://cdn2.rtva.interactvty.com/content_cards/00f3e8f67b0a4f3b90a4a14618a48b0d.jpg',
'timestamp': 1648123182,
... | we're not using `main_category`, `duration`, `genre` or `publish_date`
might be nice to at least extract `duration`. and remove any that we don't use |
class CanalsurmasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.canalsurmas.es/videos/44006-el-gran-queo-1-lora-del-rio-sevilla-20072014',
'md5': '861f86fdc1221175e15523047d0087ef',
'info_dict': {
'id'... | @@ -0,0 +1,74 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import determine_ext, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
+
+
+class CanalsurmasIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?canalsurmas\.es/videos/(?P<id>\d+)'
+
+ _TESTS = [{
+ 'u... | yt_dlp/extractor/canalsurmas.py | 26 | Python | 0.571 | refactor | 152 | 51 | 51 | false | [ie/Canalsurmas] Add extractor | 12,497 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Arc8ne |
'age_limit': 14,
'duration': 2640.0,
'tags': ['True Crime', 'Murder'],
},
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.magellantv.com/watch/celebration-nation?type=s',
'info_dict': {
'id': 'celebration-nation',
... | Is this getting duplicate formats?
I think `subs` only come from `v2` in the Ellipsis: hence it should be enough to use that if present and any other (probably, `v1` which I found to give the same as the `jwp_video_url`) if not. | 'age_limit': 14,
'duration': 2640.0,
'tags': ['True Crime', 'Murder'],
},
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.magellantv.com/watch/celebration-nation?type=s',
'info_dict': {
'id': 'celebration-nation',
... | @@ -46,7 +47,13 @@ def _real_extract(self, url):
data = traverse_obj(self._search_nextjs_data(webpage, video_id), (
'props', 'pageProps', 'reactContext',
(('video', 'detail'), ('series', 'currentEpisode')), {dict}), get_all=False)
- formats, subtitles = self._extract_m3u8_forma... | yt_dlp/extractor/magellantv.py | 26 | Python | 0.643 | refactor | 232 | 44 | 47 | false | [ie/MagellanTV] Fix extractor | 12,505 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | seproDev |
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.magellantv.com/watch/celebration-nation?type=s',
'info_dict': {
'id': 'celebration-nation',
'ext': 'mp4',
'tags': ['Art & Culture', 'Human Interest', 'Anthropology', 'China', 'History'],
... | Maybe add some error handling (eg, 2nd test is geo-blocked in UK), s/t like this:
```suggestion
context = traverse_obj(self._search_nextjs_data(webpage, video_id), (
'props', 'pageProps', 'reactContext'))
data = traverse_obj(context, (
(('video', 'detail'), ('series', 'curre... | 'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.magellantv.com/watch/celebration-nation?type=s',
'info_dict': {
'id': 'celebration-nation',
'ext': 'mp4',
'tags': ['Art & Culture', 'Human Interest', 'Anthropology', 'China', 'History'],
... | @@ -46,7 +47,13 @@ def _real_extract(self, url):
data = traverse_obj(self._search_nextjs_data(webpage, video_id), (
'props', 'pageProps', 'reactContext',
(('video', 'detail'), ('series', 'currentEpisode')), {dict}), get_all=False)
- formats, subtitles = self._extract_m3u8_forma... | yt_dlp/extractor/magellantv.py | 26 | Python | 1 | bug | 1,154 | 40 | 43 | false | [ie/MagellanTV] Fix extractor | 12,505 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | seproDev |
'duration': 2640.0,
'tags': ['True Crime', 'Murder'],
},
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.magellantv.com/watch/celebration-nation?type=s',
'info_dict': {
'id': 'celebration-nation',
'ext': 'mp4',
... | ```suggestion
for m3u8_url in set(traverse_obj(data, ((('manifests', ..., 'hls'), 'jwp_video_url'), {url_or_none}))):
fmts, subs = self._extract_m3u8_formats_and_subtitles(
m3u8_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
``` | 'duration': 2640.0,
'tags': ['True Crime', 'Murder'],
},
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.magellantv.com/watch/celebration-nation?type=s',
'info_dict': {
'id': 'celebration-nation',
'ext': 'mp4',
... | @@ -43,10 +44,19 @@ class MagellanTVIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- data = traverse_obj(self._search_nextjs_data(webpage, video_id), (
- 'props', 'pageProps', 'reactContext',
- ... | yt_dlp/extractor/magellantv.py | 26 | Python | 0.857 | refactor | 271 | 46 | 46 | false | [ie/MagellanTV] Fix extractor | 12,505 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'formats': formats,
}
def _extract_embedded_urls(self, webpage, video_id):
"""Extract URLs of embedded videos (e.g., YouTube, Dailymotion) from the webpage."""
embed_urls = []
# Use re.findall to extract all iframe src attributes
iframe_matches = re.findall(r'<if... | Extractors should never be invoked directly.
```suggestion
``` | 'timestamp': ('createdDateTime', {parse_iso8601}),
'release_timestamp': ('publishedDateTime', {parse_iso8601}),
'modified_timestamp': ('updatedDateTime', {parse_iso8601}),
'thumbnail': ('thumbnail', 'image', 'url', {url_or_none}),
'duration': ('videoMetadata',... | @@ -39,129 +40,137 @@ class MSNIE(InfoExtractor):
'url': 'http://www.msn.com/en-ae/video/watch/obama-a-lot-of-people-will-be-disappointed/vi-AAhxUMH',
'only_matching': True,
}, {
- # geo restricted
'url': 'http://www.msn.com/en-ae/foodanddrink/joinourtable/the-first-fart-makes-you... | yt_dlp/extractor/msn.py | 26 | Python | 0.643 | refactor | 64 | 27 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | thedenv |
}, {
'url': 'http://www.msn.com/en-ae/foodanddrink/joinourtable/the-first-fart-makes-you-laugh-the-last-fart-makes-you-cry/vp-AAhzIBU',
'only_matching': True,
}, {
'url': 'http://www.msn.com/en-ae/entertainment/bollywood/watch-how-salman-khan-reacted-when-asked-if-he-would-apologize-for-... | Why did you remove the helper function `_match_valid_url`? | 'description': 'md5:98c05f7bd9ab4f9c423400f62f2d3da5',
'uploader': 'Sky News',
'uploader_id': 'AA2eki',
'duration': 52,
'thumbnail': 'https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1zo7nU.img',
'timestamp': 1739993965,
'uploa... | @@ -39,129 +40,137 @@ class MSNIE(InfoExtractor):
'url': 'http://www.msn.com/en-ae/video/watch/obama-a-lot-of-people-will-be-disappointed/vi-AAhxUMH',
'only_matching': True,
}, {
- # geo restricted
'url': 'http://www.msn.com/en-ae/foodanddrink/joinourtable/the-first-fart-makes-you... | yt_dlp/extractor/msn.py | 26 | Python | 0.429 | refactor | 58 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | thedenv |
if len(embedded_urls) == 1:
return self.url_result(embedded_urls[0], ie=None, video_id=page_id)
return self.playlist_result(
[self.url_result(u, ie=None) for u in embedded_urls],
page_id,
json_data.get('title... | Inline below and use `traverse_obj`. For the title you should also not create a fallback title yourself, the core code will handle that. | 'tags': ['topthink', 'top think', 'personal growth'],
'timestamp': 1722711620,
'upload_date': '20240803',
'playable_in_embed': True,
'availability': 'public',
'live_status': 'not_live',
},
}, {
# Article with social embed
... | @@ -39,129 +40,137 @@ class MSNIE(InfoExtractor):
'url': 'http://www.msn.com/en-ae/video/watch/obama-a-lot-of-people-will-be-disappointed/vi-AAhxUMH',
'only_matching': True,
}, {
- # geo restricted
'url': 'http://www.msn.com/en-ae/foodanddrink/joinourtable/the-first-fart-makes-you... | yt_dlp/extractor/msn.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | thedenv |
bitrate_str = filename.split('_')[-1].replace('.mp4', '')
bitrate = int_or_none(bitrate_str)
if bitrate:
format_dict['bitrate'] = bitrate * 1000 # kbps to bps
formats.append(format_dict)
# Extract embedded videos (e.g., YouTube, ... | No need to raise here imo., core code will do that. | 'channel_id': 'UCMlGmHokrQRp-RaNO7aq4Uw',
'channel_url': 'https://www.youtube.com/channel/UCMlGmHokrQRp-RaNO7aq4Uw',
'channel_is_verified': True,
'channel_follower_count': int,
'comment_count': int,
'view_count': int,
'like_count': int,... | @@ -39,129 +40,137 @@ class MSNIE(InfoExtractor):
'url': 'http://www.msn.com/en-ae/video/watch/obama-a-lot-of-people-will-be-disappointed/vi-AAhxUMH',
'only_matching': True,
}, {
- # geo restricted
'url': 'http://www.msn.com/en-ae/foodanddrink/joinourtable/the-first-fart-makes-you... | yt_dlp/extractor/msn.py | 26 | Python | 0.214 | suggestion | 51 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | thedenv |
}
# Attempt to parse bitrate from filename
filename = os.path.basename(video_url)
if '_' in filename and filename.endswith('.mp4'):
bitrate_str = filename.split('_')[-1].replace('.mp4', '')
bitrate = int_or_none(bitrate_str)
... | You can not return embed URLs as formats. A format URL is a direct URL to for example a mp4 file, not a youtube link. | 'uploader': 'TopThink',
'uploader_id': '@TopThink',
'uploader_url': 'https://www.youtube.com/@TopThink',
'channel': 'TopThink',
'channel_id': 'UCMlGmHokrQRp-RaNO7aq4Uw',
'channel_url': 'https://www.youtube.com/channel/UCMlGmHokrQRp-RaNO7aq4Uw',
... | @@ -39,129 +40,137 @@ class MSNIE(InfoExtractor):
'url': 'http://www.msn.com/en-ae/video/watch/obama-a-lot-of-people-will-be-disappointed/vi-AAhxUMH',
'only_matching': True,
}, {
- # geo restricted
'url': 'http://www.msn.com/en-ae/foodanddrink/joinourtable/the-first-fart-makes-you... | yt_dlp/extractor/msn.py | 26 | Python | 0.357 | suggestion | 117 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | thedenv |
'url': 'https://www.msn.com/en-in/money/news/meet-vikram-%E2%80%94-chandrayaan-2s-lander/vi-AAGUr0v',
'only_matching': True,
}, {
'url': 'https://www.msn.com/en-us/money/football_nfl/week-13-preview-redskins-vs-panthers/vi-BBXsCDb',
'only_matching': True,
}]
def _real_extrac... | Instead use `fatal=False`, though I am not fully convinced this should be non fatal. | 'url': 'https://www.msn.com/en-us/entertainment/news/rock-frontman-replacements-you-might-not-know-happened/vi-AA1yLVcD',
'info_dict': {
'id': 'AA1yLVcD',
'ext': 'mp4',
'display_id': 'rock-frontman-replacements-you-might-not-know-happened',
'title': 'Rock ... | @@ -39,129 +40,137 @@ class MSNIE(InfoExtractor):
'url': 'http://www.msn.com/en-ae/video/watch/obama-a-lot-of-people-will-be-disappointed/vi-AAhxUMH',
'only_matching': True,
}, {
- # geo restricted
'url': 'http://www.msn.com/en-ae/foodanddrink/joinourtable/the-first-fart-makes-you... | yt_dlp/extractor/msn.py | 26 | Python | 0.429 | suggestion | 84 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | thedenv |
import re
import os
from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
unescapeHTML,
url_or_none,
)
class MSNIE(InfoExtractor):
_WORKING = True # Set to True assuming it works after refinement
_VALID_URL = r'https?://(?:(?:www|preview)\.)?... | Could you please also update the tests. | from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
determine_ext,
int_or_none,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MSNIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|preview)\.)?msn\.com/(?P<locale>[a-z]{2}-[a... | @@ -1,16 +1,18 @@
import re
+import os
from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
unescapeHTML,
+ url_or_none,
)
class MSNIE(InfoExtractor):
- _WORKING = False
+ _WORKING = True # Set to True assuming it works after refine... | yt_dlp/extractor/msn.py | 15 | Python | 0.143 | suggestion | 39 | 40 | 40 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | thedenv |
json_data.get('title') or
self._html_search_meta(('og:title', 'title'), webpage, default=None) or
f'MSN video {page_id}'
)
description = json_data.get('description') or self._html_search_meta('description', webpage, default=None)
duration = int_or_none(video_m... | Are the embeds really loaded as iframes? For the couple examples I found they were provided as the `sourceHref` key. | 'upload_date': '20250225',
'release_timestamp': 1740484875,
'release_date': '20250225',
'modified_timestamp': 1740488561,
'modified_date': '20250225',
},
'playlist_count': 1,
}]
def _real_extract(self, url):
locale, display_id,... | @@ -39,129 +40,137 @@ class MSNIE(InfoExtractor):
'url': 'http://www.msn.com/en-ae/video/watch/obama-a-lot-of-people-will-be-disappointed/vi-AAhxUMH',
'only_matching': True,
}, {
- # geo restricted
'url': 'http://www.msn.com/en-ae/foodanddrink/joinourtable/the-first-fart-makes-you... | yt_dlp/extractor/msn.py | 26 | Python | 0.5 | suggestion | 116 | 45 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | thedenv |
}, {
# Article with social embed
'url': 'https://www.msn.com/en-in/news/techandscience/watch-earth-sets-and-rises-behind-moon-in-breathtaking-blue-ghost-video/ar-AA1zKoAc',
'info_dict': {
'id': 'AA1zKoAc',
'title': 'Watch: Earth sets and rises behind Moon in breathtak... | 'Downloading JSON metadata' is the default note
```suggestion
f'https://assets.msn.com/content/view/v2/Detail/{locale}/{page_id}', page_id)
``` | 'tags': ['topthink', 'top think', 'personal growth'],
'timestamp': 1722711620,
'upload_date': '20240803',
'playable_in_embed': True,
'availability': 'public',
'live_status': 'not_live',
},
}, {
# Article with social embed
... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
... | yt_dlp/extractor/msn.py | 26 | Python | 0.714 | suggestion | 158 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
}))
for caption in traverse_obj(json_data, ('videoMetadata', 'closedCaptions', lambda _, v: url_or_none(v['href']))):
lang = caption.get('locale') or 'en-us'
subtitles.setdefault(lang, []).append({
'url': caption['href'],
... | ```suggestion
raise ExtractorError(f'Unsupported page type: {page_type}')
``` | traverse_obj(file, {
'url': 'url',
'format_id': ('format', {str}),
'filesize': ('fileSize', {int_or_none}),
'height': ('height', {int_or_none}),
'width': ('... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
... | yt_dlp/extractor/msn.py | 26 | Python | 0.786 | refactor | 89 | 27 | 34 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
f'https://assets.msn.com/content/view/v2/Detail/{locale}/{page_id}', page_id,
note='Downloading JSON metadata')
common_metadata = traverse_obj(json_data, {
'title': ('title', {str}),
'description': (('abstract', ('body', {clean_html})), {str}, filter, any),
... | I don't like redefining `url`, doing so hurts maintainability and readability
```suggestion
file_url = file['url']
ext = determine_ext(file_url)
``` | 'playlist_count': 1,
}]
def _real_extract(self, url):
locale, display_id, page_id = self._match_valid_url(url).group('locale', 'display_id', 'id')
json_data = self._download_json(
f'https://assets.msn.com/content/view/v2/Detail/{locale}/{page_id}', page_id)
common_... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
... | yt_dlp/extractor/msn.py | 26 | Python | 0.714 | suggestion | 184 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
common_metadata = traverse_obj(json_data, {
'title': ('title', {str}),
'description': (('abstract', ('body', {clean_html})), {str}, filter, any),
'timestamp': ('createdDateTime', {parse_iso8601}),
'release_timestamp': ('publishedDateTime', {parse_iso8601}),
... | ```suggestion
file_url, page_id, 'mp4', m3u8_id='hls', fatal=False)
``` | def _real_extract(self, url):
locale, display_id, page_id = self._match_valid_url(url).group('locale', 'display_id', 'id')
json_data = self._download_json(
f'https://assets.msn.com/content/view/v2/Detail/{locale}/{page_id}', page_id)
common_metadata = traverse_obj(json_data, {
... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
... | yt_dlp/extractor/msn.py | 26 | Python | 0.571 | suggestion | 97 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
'modified_timestamp': ('updatedDateTime', {parse_iso8601}),
'thumbnail': ('thumbnail', 'image', 'url', {url_or_none}),
'duration': ('videoMetadata', 'playTime', {int_or_none}),
'tags': ('keywords', ..., {str}),
'uploader': ('provider', 'name', {str}),
... | ```suggestion
file_url, page_id, mpd_id='dash', fatal=False)
``` |
common_metadata = traverse_obj(json_data, {
'title': ('title', {str}),
'description': (('abstract', ('body', {clean_html})), {str}, filter, any),
'timestamp': ('createdDateTime', {parse_iso8601}),
'release_timestamp': ('publishedDateTime', {parse_iso8601}),
... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
... | yt_dlp/extractor/msn.py | 26 | Python | 0.571 | suggestion | 90 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
if page_type == 'video':
if traverse_obj(json_data, ('thirdPartyVideoPlayer', 'enabled')) and source_url:
return self.url_result(source_url)
formats = []
subtitles = {}
for file in traverse_obj(json_data, ('videoMetadata', 'externalVideoFiles', lam... | I would use `int_or_none` for these
```suggestion
'filesize': ('fileSize', {int_or_none}),
'height': ('height', {int_or_none}),
'width': ('width', {int_or_none}),
``` | 'uploader': ('provider', 'name', {str}),
'uploader_id': ('provider', 'id', {str}),
})
page_type = json_data['type']
source_url = traverse_obj(json_data, ('sourceHref', {url_or_none}))
if page_type == 'video':
if traverse_obj(json_data, ('thirdPartyVid... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
... | yt_dlp/extractor/msn.py | 26 | Python | 0.857 | suggestion | 255 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
url = file['url']
ext = determine_ext(url)
if ext == 'm3u8':
fmts, subs = self._extract_m3u8_formats_and_subtitles(
url, page_id, 'mp4', m3u8_id='hls', fatal=False)
formats.extend(fmts)
se... | ```suggestion
'ext': 'ttml',
})
``` | if page_type == 'video':
if traverse_obj(json_data, ('thirdPartyVideoPlayer', 'enabled')) and source_url:
return self.url_result(source_url)
formats = []
subtitles = {}
for file in traverse_obj(json_data, ('videoMetadata', 'externalVideoFiles', lam... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
... | yt_dlp/extractor/msn.py | 26 | Python | 0.571 | suggestion | 74 | 47 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
'modified_date': '20250225',
},
'playlist_count': 1,
}]
def _real_extract(self, url):
locale, display_id, page_id = self._match_valid_url(url).group('locale', 'display_id', 'id')
json_data = self._download_json(
f'https://assets.msn.com/content/view/v2/D... | I think we can have this be fatal since we raise anyways if it's not a known string value
```suggestion
page_type = json_data['type']
``` | 'uploader_id': 'AAyFWG',
'tags': 'count:11',
'timestamp': 1740485034,
'upload_date': '20250225',
'release_timestamp': 1740484875,
'release_date': '20250225',
'modified_timestamp': 1740488561,
'modified_date': '20250225',
... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
... | yt_dlp/extractor/msn.py | 26 | Python | 0.857 | suggestion | 148 | 51 | 51 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
from .common import InfoExtractor
from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class MSNIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|preview)\.)?msn\.com/(?P<locale>[a-z]{2}-[a-z]{2})/(?:[^/?#]+/)+(?P<disp... | ```suggestion
from ..utils import (
ExtractorError,
clean_html,
determine_ext,
int_or_none,
parse_iso8601,
url_or_none,
)
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
determine_ext,
int_or_none,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MSNIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|preview)\.)?msn\.com/(?P<locale>[a-z]{2}-[a... | @@ -1,167 +1,208 @@
-import re
-
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
- determine_ext,
- int_or_none,
- unescapeHTML,
-)
+from ..utils import ExtractorError, clean_html, determine_ext, int_or_none, parse_iso8601, url_or_none | yt_dlp/extractor/msn.py | 2 | Python | 0.929 | refactor | 158 | 27 | 27 | false | [ie/msn] Rework extractor | 12,513 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | thedenv |
'uploader_url': 'https://www.youtube.com/@sportklub',
'channel': 'Sport Klub',
'channel_id': 'UChpzBje9Ro6CComXe3BgNaw',
'channel_url': 'https://www.youtube.com/channel/UChpzBje9Ro6CComXe3BgNaw',
'channel_is_verified': True,
'channel_follower_count... | To keep it a bit shorter
```suggestion
'chapters': 'count:9',
'categories': ['Sports'],
'tags': 'count:10',
``` | 'uploader': 'Sport Klub',
'uploader_id': '@sportklub',
'uploader_url': 'https://www.youtube.com/@sportklub',
'channel': 'Sport Klub',
'channel_id': 'UChpzBje9Ro6CComXe3BgNaw',
'channel_url': 'https://www.youtube.com/channel/UChpzBje9Ro6CComXe3BgNaw... | @@ -35,17 +35,47 @@ class N1InfoIIE(InfoExtractor):
IE_NAME = 'N1Info:article'
_VALID_URL = r'https?://(?:(?:\w+\.)?n1info\.\w+|nova\.rs)/(?:[^/?#]+/){1,2}(?P<id>[^/?#]+)'
_TESTS = [{
- # Youtube embedded
+ # YouTube embedded
'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-d... | yt_dlp/extractor/n1.py | 26 | Python | 0.714 | suggestion | 152 | 51 | 51 | false | [ie/N1] Fix extractor on newer articles | 12,514 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | u-spec-png |
plugin_data = re.findall(r'\$bp\("(?:Brid|TargetVideo)_\d+",\s(.+)\);', webpage)
entries = []
if plugin_data:
site_id = self._html_search_regex(r'site:(\d+)', webpage, 'site id')
for video_data in plugin_data:
video_id = self._parse_json(video_data, title)... | ```suggestion
'thumbnail': traverse_obj(video_data, (('data-thumbnail', 'data-default_thumbnail'), {url_or_none}, any)),
```
and change the imports to
```
from ..utils import extract_attributes, unified_timestamp, url_or_none
from ..utils.traversal import traverse_obj
``` | 'timestamp': timestamp,
'thumbnail': self._html_search_meta('thumbnailURL', webpage),
'formats': self._extract_m3u8_formats(
f'https://cdn-uc.brid.tv/live/partners/{site_id}/streaming/{video_id}/{video_id}.m3u8',
... | @@ -140,7 +191,7 @@ def _real_extract(self, url):
'url': video_data.get('data-url'),
'id': video_data.get('id'),
'title': title,
- 'thumbnail': video_data.get('data-thumbnail'),
+ 'thumbnail': video_data.get('data-thumb... | yt_dlp/extractor/n1.py | 26 | Python | 0.857 | refactor | 299 | 47 | 38 | false | [ie/N1] Fix extractor on newer articles | 12,514 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | u-spec-png |
'thumbnail': 're:^https?://media.livr.jp/vod/img/.*$',
},
'skip': 'Paid video',
}, {
'url': 'https://livr.jp/contents/P316939908',
'info_dict': {
'id': 'P316939908',
'ext': 'mp4',
'title': '2024年5月16日(木) 「今日は誰に恋をする?」公演 小栗有以 生誕祭',
... | Is this really necessary? If present cookies are passed, you don't need to set them as a header.
```suggestion
``` | 'skip': 'Paid video',
}, {
'url': 'https://livr.jp/contents/P316939908',
'info_dict': {
'id': 'P316939908',
'ext': 'mp4',
'title': '2024年5月16日(木) 「今日は誰に恋をする?」公演 小栗有以 生誕祭',
'description': 'md5:2110bdcf947f28bd7d06ec420e51b619',
'dura... | @@ -0,0 +1,171 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ filter_dict,
+ parse_duration,
+ parse_qs,
+ try_get,
+)
+from ..utils.traversal import (
+ find_... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.714 | question | 116 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
'title': '2024年5月16日(木) 「今日は誰に恋をする?」公演 小栗有以 生誕祭',
'description': 'md5:2110bdcf947f28bd7d06ec420e51b619',
'duration': 8559.0,
'tags': list,
'thumbnail': 're:^https?://media.livr.jp/vod/img/.*$',
},
'skip': 'Premium channel subscribers only',
... | I was thinking if we could just skip checking the status here and instead throw a more generic error message below. If we want to keep the status check, we should make it non-fatal, and also make the error raising more specific:
```suggestion
status = self._download_json(
f'{self._BASE_URL}/webAp... | 'duration': 8559.0,
'tags': list,
'thumbnail': r're:https?://media\.livr\.jp/vod/img/.+\.jpg',
},
'skip': 'Premium channel subscribers only',
}, {
# Accessible only in the VR SQUARE app
'url': 'https://livr.jp/contents/P126481458',
'only_ma... | @@ -0,0 +1,171 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ filter_dict,
+ parse_duration,
+ parse_qs,
+ try_get,
+)
+from ..utils.traversal import (
+ find_... | yt_dlp/extractor/vrsquare.py | 26 | Python | 1 | suggestion | 548 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
import itertools
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
clean_html,
extract_attributes,
filter_dict,
parse_duration,
parse_qs,
try_get,
)
from ..utils.traversal import (
find_element,
find_elements,
t... | I think like so is more legible
```suggestion
class VrSquareIE(InfoExtractor):
``` | import itertools
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
clean_html,
extract_attributes,
parse_duration,
parse_qs,
)
from ..utils.traversal import (
find_element,
find_elements,
traverse_obj,
)
class VrSquar... | @@ -0,0 +1,171 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ filter_dict,
+ parse_duration,
+ parse_qs,
+ try_get,
+)
+from ..utils.traversal import (
+ find_... | yt_dlp/extractor/vrsquare.py | 21 | Python | 0.643 | refactor | 85 | 46 | 46 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
'tags': list,
'thumbnail': 're:^https?://media.livr.jp/vod/img/.*$',
},
'skip': 'Premium channel subscribers only',
}, {
# Accessible only in the VR SQUARE app
'url': 'https://livr.jp/contents/P126481458',
'only_matching': True,
}]
def _real_i... | snake_case is preferred
```suggestion
web_api = self._download_json(
``` | },
'skip': 'Premium channel subscribers only',
}, {
# Accessible only in the VR SQUARE app
'url': 'https://livr.jp/contents/P126481458',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_we... | @@ -0,0 +1,171 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ filter_dict,
+ parse_duration,
+ parse_qs,
+ try_get,
+)
+from ..utils.traversal import (
+ find_... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.643 | suggestion | 87 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
'title': '2024年5月16日(木) 「今日は誰に恋をする?」公演 小栗有以 生誕祭',
'description': 'md5:2110bdcf947f28bd7d06ec420e51b619',
'duration': 8559.0,
'tags': list,
'thumbnail': 're:^https?://media.livr.jp/vod/img/.*$',
},
'skip': 'Premium channel subscribers only',
... | I wonder if we can find the endpoint the API uses. `api.livr.jp/api` seems likely, but sadly `https://api.livr.jp/api/play/url/P154938721` does not work.
Maybe authentication is required inside the app? Not sure, I was unable to run the app.
Don't worry about this though, just using the web api is fine to be merg... | 'duration': 8559.0,
'tags': list,
'thumbnail': r're:https?://media\.livr\.jp/vod/img/.+\.jpg',
},
'skip': 'Premium channel subscribers only',
}, {
# Accessible only in the VR SQUARE app
'url': 'https://livr.jp/contents/P126481458',
'only_ma... | @@ -0,0 +1,171 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ filter_dict,
+ parse_duration,
+ parse_qs,
+ try_get,
+)
+from ..utils.traversal import (
+ find_... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.643 | security | 323 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
f'{self._BASE_URL}/contents/{x.removeprefix("/contents/")}', VRSQUAREIE)
for x in traverse_obj(source, (
*keys, {find_elements(cls='video', html=True)},
..., {extract_attributes}, 'data-url'))
]
def _entries(self, webpage, playlist_type, playlist_id, ... | I think I would move some of the shared logic in to a PlaylistBase class and then have a separate extractors for web-serach, channel, and headline/category. |
class VrSquareSearchIE(VrSquarePlaylistBaseIE):
IE_NAME = 'vrsquare:search'
_VALID_URL = r'https?://livr\.jp/web-search/?\?(?:[^#]+&)?w=[^#]+'
_TESTS = [{
'url': 'https://livr.jp/web-search?w=%23%E5%B0%8F%E6%A0%97%E6%9C%89%E4%BB%A5',
'info_dict': {
'id': '#小栗有以',
},
... | @@ -0,0 +1,171 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ filter_dict,
+ parse_duration,
+ parse_qs,
+ try_get,
+)
+from ..utils.traversal import (
+ find_... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.429 | refactor | 156 | 34 | 48 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
video_id, 'Checking contents status', fatal=False)
if traverse_obj(status, 'result_code') == '40407':
self.raise_login_required('Unable to access this video')
try:
web_api = self._download_json(
f'{self._BASE_URL}/webApi/play/url/{video_id}', video_id... | You should not inherit from a concrete IE
```suggestion
class VrSquarePlaylistBaseIE(InfoExtractor):
_BASE_URL = 'https://livr.jp'
``` | video_id, 'Checking contents status', fatal=False)
if traverse_obj(status, 'result_code') == '40407':
self.raise_login_required('Unable to access this video')
try:
web_api = self._download_json(
f'{self._BASE_URL}/webApi/play/url/{video_id}', video_id... | @@ -0,0 +1,191 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ parse_duration,
+ parse_qs,
+)
+from ..utils.traversal import (
+ find_element,
+ find_elements,
+ ... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.786 | refactor | 142 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
class VrSquareSearchIE(VrSquarePlaylistBaseIE):
IE_NAME = 'vrsquare:search'
_VALID_URL = r'https?://livr\.jp/web-search'
_TESTS = [{
'url': 'https://livr.jp/web-search?w=%23%E5%B0%8F%E6%A0%97%E6%9C%89%E4%BB%A5',
'info_dict': {
'id': '#小栗有以',
'title': '#小栗有以',
... | Might as well make this fatal
```suggestion
query = parse_qs(url)['w'][0]
``` | return self.playlist_result(
self._entries(f'/ajax/channel/{playlist_id}', playlist_id),
playlist_id, self._html_search_meta('og:title', webpage))
class VrSquareSearchIE(VrSquarePlaylistBaseIE):
IE_NAME = 'vrsquare:search'
_VALID_URL = r'https?://livr\.jp/web-search/?\?(?:[^#]... | @@ -0,0 +1,191 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ parse_duration,
+ parse_qs,
+)
+from ..utils.traversal import (
+ find_element,
+ find_elements,
+ ... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.571 | suggestion | 88 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
f'{self._BASE_URL}/webApi/play/url/{video_id}', video_id)
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 500:
raise ExtractorError('VR SQUARE app-only videos are not supported', expected=True)
return {
'id': vi... | ```suggestion
..., {extract_attributes}, 'data-url', {str}, filter))
``` | f'{self._BASE_URL}/webApi/play/url/{video_id}', video_id)
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 500:
raise ExtractorError('VR SQUARE app-only videos are not supported', expected=True)
raise
return {
... | @@ -0,0 +1,191 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ parse_duration,
+ parse_qs,
+)
+from ..utils.traversal import (
+ find_element,
+ find_elements,
+ ... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.643 | refactor | 90 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | doe1080 |
'duration': 8559.0,
'tags': list,
'thumbnail': 're:^https?://media.livr.jp/vod/img/.*$',
},
'skip': 'Premium channel subscribers only',
}, {
# Accessible only in the VR SQUARE app
'url': 'https://livr.jp/contents/P126481458',
'only_matching... | ```suggestion
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 500:
raise ExtractorError('VR SQUARE app-only videos are not supported', expected=True)
raise
``` | 'duration': 8559.0,
'tags': list,
'thumbnail': r're:https?://media\.livr\.jp/vod/img/.+\.jpg',
},
'skip': 'Premium channel subscribers only',
}, {
# Accessible only in the VR SQUARE app
'url': 'https://livr.jp/contents/P126481458',
'only_ma... | @@ -0,0 +1,193 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ parse_duration,
+ parse_qs,
+)
+from ..utils.traversal import (
+ find_element,
+ find_elements,
+ ... | yt_dlp/extractor/vrsquare.py | 26 | Python | 1 | refactor | 248 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
return {
'id': video_id,
'title': self._html_search_meta(['og:title', 'twitter:title'], webpage),
'description': self._html_search_meta('description', webpage),
'formats': self._extract_m3u8_formats(traverse_obj(web_api, (
'urls', ..., 'url', any)... | might be more readable as a generator | raise
return {
'id': video_id,
'title': self._html_search_meta(['og:title', 'twitter:title'], webpage),
'description': self._html_search_meta('description', webpage),
'formats': self._extract_m3u8_formats(traverse_obj(web_api, (
'urls'... | @@ -0,0 +1,193 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ parse_duration,
+ parse_qs,
+)
+from ..utils.traversal import (
+ find_element,
+ find_elements,
+ ... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.071 | suggestion | 37 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
..., {extract_attributes}, 'data-url', {str}, filter))
]
class VrSquareChannelIE(VrSquarePlaylistBaseIE):
IE_NAME = 'vrsquare:channel'
_VALID_URL = r'https?://livr\.jp/channel/(?P<id>\w+)'
_TESTS = [{
'url': 'https://livr.jp/channel/H372648599',
'info_dict': {
... | I think `_entries` can be generalized and moved into the baseclass. I have an impl written locally, will push | ):
yield self.url_result(
f'{self._BASE_URL}/contents/{url_path.removeprefix("/contents/")}', VrSquareIE)
def _entries(self, path, display_id, query=None):
for page in itertools.count(1):
ajax = self._download_json(
f'{self._BASE_URL}{path}', ... | @@ -0,0 +1,193 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ parse_duration,
+ parse_qs,
+)
+from ..utils.traversal import (
+ find_element,
+ find_elements,
+ ... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.571 | suggestion | 109 | 51 | 51 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
IE_NAME = 'vrsquare:search'
_VALID_URL = r'https?://livr\.jp/web-search'
_TESTS = [{
'url': 'https://livr.jp/web-search?w=%23%E5%B0%8F%E6%A0%97%E6%9C%89%E4%BB%A5',
'info_dict': {
'id': '#小栗有以',
'title': '#小栗有以',
},
'playlist_mincount': 70,
}]
... | don't duplicate the playlist id for playlist title
```suggestion
return self.playlist_result(self._entries(query), query)
``` |
class VrSquareSearchIE(VrSquarePlaylistBaseIE):
IE_NAME = 'vrsquare:search'
_VALID_URL = r'https?://livr\.jp/web-search/?\?(?:[^#]+&)?w=[^#]+'
_TESTS = [{
'url': 'https://livr.jp/web-search?w=%23%E5%B0%8F%E6%A0%97%E6%9C%89%E4%BB%A5',
'info_dict': {
'id': '#小栗有以',
},
... | @@ -0,0 +1,193 @@
+import itertools
+
+from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ extract_attributes,
+ parse_duration,
+ parse_qs,
+)
+from ..utils.traversal import (
+ find_element,
+ find_elements,
+ ... | yt_dlp/extractor/vrsquare.py | 26 | Python | 0.714 | refactor | 136 | 51 | 47 | false | [ie/vrsquare] Add extractors | 12,515 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
_VIDEO_ID_REGEX = r'videoId\s*=\s*"(\d+)"'
class TV8ItIE(SkyItVideoIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'tv8.it'
_VALID_URL = r'https?://(?:www\.)?tv8\.it/(?:show)?video/[0-9a-z-]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.tv8.it/video/ogni-mattina-ucciso-asino-di-andrea-... | ```suggestion
IE_NAME = 'tv8.it:live'
IE_DESC = 'TV8 Live'
``` | _VIDEO_ID_REGEX = r'videoId\s*=\s*"(\d+)"'
class TV8ItIE(SkyItVideoIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'tv8.it'
_VALID_URL = r'https?://(?:www\.)?tv8\.it/(?:show)?video/[0-9a-z-]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.tv8.it/video/ogni-mattina-ucciso-asino-di-andrea-... | @@ -223,3 +229,78 @@ class TV8ItIE(SkyItVideoIE): # XXX: Do not subclass from concrete IE
'params': {'skip_download': 'm3u8'},
}]
_DOMAIN = 'mtv8'
+
+
+class TV8ItLiveIE(SkyItBaseIE):
+ IE_DESC = 'TV8 Live' | yt_dlp/extractor/skyit.py | 26 | Python | 0.571 | suggestion | 73 | 51 | 51 | false | [ie/tv8.it] Add live and playlist extractors | 12,569 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DTrombett |
'description': str,
'is_live': True,
'live_status': 'is_live',
},
}]
def _real_extract(self, url):
video_id = 'tv8'
livestream = self._download_json(
'https://apid.sky.it/vdp/v1/getLivestream?id=7', video_id, 'Downloading manifest json inf... | ```suggestion
IE_NAME = 'tv8.it:playlist'
IE_DESC = 'TV8 Playlist'
``` | 'title': str,
'description': str,
'is_live': True,
'live_status': 'is_live',
},
}]
def _real_extract(self, url):
video_id = 'tv8'
livestream = self._download_json(
'https://apid.sky.it/vdp/v1/getLivestream', video_id,
... | @@ -223,3 +229,78 @@ class TV8ItIE(SkyItVideoIE): # XXX: Do not subclass from concrete IE
'params': {'skip_download': 'm3u8'},
}]
_DOMAIN = 'mtv8'
+
+
+class TV8ItLiveIE(SkyItBaseIE):
+ IE_DESC = 'TV8 Live'
+ _VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/skyit.py | 26 | Python | 0.571 | suggestion | 81 | 51 | 51 | false | [ie/tv8.it] Add live and playlist extractors | 12,569 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DTrombett |
video_id = 'tv8'
livestream = self._download_json(
'https://apid.sky.it/vdp/v1/getLivestream?id=7', video_id, 'Downloading manifest json info')
streaming = self._download_json(
'https://tv8.it/api/getStreaming', video_id, 'Downloading streaming data', fatal=False)
... | ```suggestion
'thumbnail': r're:https://static\.sky\.it/.+\.(png|jpe?g|webp)',
``` | def _real_extract(self, url):
video_id = 'tv8'
livestream = self._download_json(
'https://apid.sky.it/vdp/v1/getLivestream', video_id,
'Downloading manifest JSON', query={'id': '7'})
metadata = self._download_json('https://tv8.it/api/getStreaming', video_id, fatal=Fal... | @@ -223,3 +229,78 @@ class TV8ItIE(SkyItVideoIE): # XXX: Do not subclass from concrete IE
'params': {'skip_download': 'm3u8'},
}]
_DOMAIN = 'mtv8'
+
+
+class TV8ItLiveIE(SkyItBaseIE):
+ IE_DESC = 'TV8 Live'
+ _VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/skyit.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [ie/tv8.it] Add live and playlist extractors | 12,569 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DTrombett |
'title': ('title', 'text', {str}),
'description': ('description', 'html', {clean_html}),
})),
}
class TV8ItPlaylistIE(InfoExtractor):
IE_DESC = 'TV8 Playlist'
_VALID_URL = r'https?://(?:www\.)?tv8\.it/(?!video)[^/#?]+/(?P<id>[^/#?]+)'
_TESTS = [{
... | ```suggestion
'thumbnail': r're:https://static\.sky\.it/.+\.(png|jpe?g|webp)',
``` | **traverse_obj(metadata, ('info', {
'title': ('title', 'text', {str}),
'description': ('description', 'html', {clean_html}),
})),
}
class TV8ItPlaylistIE(InfoExtractor):
IE_NAME = 'tv8.it:playlist'
IE_DESC = 'TV8 Playlist'
_VALID_URL = r'http... | @@ -223,3 +229,78 @@ class TV8ItIE(SkyItVideoIE): # XXX: Do not subclass from concrete IE
'params': {'skip_download': 'm3u8'},
}]
_DOMAIN = 'mtv8'
+
+
+class TV8ItLiveIE(SkyItBaseIE):
+ IE_DESC = 'TV8 Live'
+ _VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/skyit.py | 26 | Python | 0.571 | suggestion | 96 | 49 | 51 | false | [ie/tv8.it] Add live and playlist extractors | 12,569 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DTrombett |
'params': {'skip_download': 'm3u8'},
}]
_DOMAIN = 'mtv8'
class TV8ItLiveIE(SkyItBaseIE):
IE_DESC = 'TV8 Live'
_VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
_TESTS = [{
'url': 'https://tv8.it/streaming',
'info_dict': {
'id': 'tv8',
'ext': 'mp4'... | ```suggestion
livestream = self._download_json(
'https://apid.sky.it/vdp/v1/getLivestream', video_id,
'Downloading manifest JSON', query={'id': '7'})
metadata = self._download_json('https://tv8.it/api/getStreaming', video_id, fatal=False)
``` | 'params': {'skip_download': 'm3u8'},
}]
_DOMAIN = 'mtv8'
class TV8ItLiveIE(SkyItBaseIE):
IE_NAME = 'tv8.it:live'
IE_DESC = 'TV8 Live'
_VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
_TESTS = [{
'url': 'https://tv8.it/streaming',
'info_dict': {
'id': 'tv... | @@ -223,3 +229,78 @@ class TV8ItIE(SkyItVideoIE): # XXX: Do not subclass from concrete IE
'params': {'skip_download': 'm3u8'},
}]
_DOMAIN = 'mtv8'
+
+
+class TV8ItLiveIE(SkyItBaseIE):
+ IE_DESC = 'TV8 Live'
+ _VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/skyit.py | 26 | Python | 0.786 | suggestion | 287 | 51 | 51 | false | [ie/tv8.it] Add live and playlist extractors | 12,569 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DTrombett |
class TV8ItLiveIE(SkyItBaseIE):
IE_DESC = 'TV8 Live'
_VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
_TESTS = [{
'url': 'https://tv8.it/streaming',
'info_dict': {
'id': 'tv8',
'ext': 'mp4',
'title': str,
'description': str,
'i... | ```suggestion
**traverse_obj(metadata, ('info', {
``` |
class TV8ItLiveIE(SkyItBaseIE):
IE_NAME = 'tv8.it:live'
IE_DESC = 'TV8 Live'
_VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
_TESTS = [{
'url': 'https://tv8.it/streaming',
'info_dict': {
'id': 'tv8',
'ext': 'mp4',
'title': str,
'descr... | @@ -223,3 +229,78 @@ class TV8ItIE(SkyItVideoIE): # XXX: Do not subclass from concrete IE
'params': {'skip_download': 'm3u8'},
}]
_DOMAIN = 'mtv8'
+
+
+class TV8ItLiveIE(SkyItBaseIE):
+ IE_DESC = 'TV8 Live'
+ _VALID_URL = r'https?://(?:www\.)?tv8\.it/streaming'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/skyit.py | 26 | Python | 0.571 | suggestion | 67 | 51 | 51 | false | [ie/tv8.it] Add live and playlist extractors | 12,569 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DTrombett |
if itag == '17':
quality = 'tiny'
if quality:
if itag:
itag_qualities[itag] = quality
if height:
res_qualities[height] = quality
display_name = audio_track.get('displayName') or ''
is... | should we do this so the warnings are `only_once` *per video*?
```suggestion
msg = f'{video_id}: Some {client_name} client https formats have been skipped as they are DRM protected. '
``` | if itag == '17':
quality = 'tiny'
if quality:
if itag:
itag_qualities[itag] = quality
if height:
res_qualities[height] = quality
display_name = audio_track.get('displayName') or ''
is... | @@ -3091,22 +3091,34 @@ def build_fragments(f):
if language_code and (is_original or (is_default and not original_language)):
original_language = language_code
+ has_drm = bool(fmt.get('drmFamilies'))
+
# FORMAT_STREAM_TYPE_OTF(otf=1) requires downloading the init... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.857 | question | 206 | 51 | 51 | false | [ie/youtube] Warn on DRM formats | 12,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
has_drm = bool(fmt.get('drmFamilies'))
# FORMAT_STREAM_TYPE_OTF(otf=1) requires downloading the init fragment
# (adding `&sq=0` to the URL) and parsing emsg box to determine the
# number of fragment that would subsequently requested with (`&sq=N`)
if fmt.get(... | ```suggestion
f'{video_id}: Some {client_name} client https formats have been skipped as they are missing a url. '
``` | has_drm = bool(fmt.get('drmFamilies'))
# FORMAT_STREAM_TYPE_OTF(otf=1) requires downloading the init fragment
# (adding `&sq=0` to the URL) and parsing emsg box to determine the
# number of fragment that would subsequently requested with (`&sq=N`)
if fmt.get(... | @@ -3091,22 +3091,34 @@ def build_fragments(f):
if language_code and (is_original or (is_default and not original_language)):
original_language = language_code
+ has_drm = bool(fmt.get('drmFamilies'))
+
# FORMAT_STREAM_TYPE_OTF(otf=1) requires downloading the init... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 144 | 51 | 51 | false | [ie/youtube] Warn on DRM formats | 12,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
# mweb previously did not require PO Token with this UA
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 16_7_10 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1,gzip(gfe)',
},
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 2,
... | rest of the PR looks good, just not sure about this | 'clientVersion': '2.20250311.03.00',
# mweb previously did not require PO Token with this UA
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 16_7_10 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1,gzip(gfe)',
},
... | @@ -170,61 +136,24 @@ class _PoTokenContext(enum.Enum):
'INNERTUBE_CONTEXT': {
'client': {
'clientName': 'IOS',
- 'clientVersion': '20.03.02',
+ 'clientVersion': '20.10.4',
'deviceMake': 'Apple',
'deviceModel': 'iPhon... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.214 | suggestion | 51 | 51 | 51 | false | [ie/youtube] Player client maintenance | 12,603 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'duration': ('total_file_duration', {int_or_none(scale=1000)}),
'thumbnails': ('thumb', {self._fixup_thumb}),
})
entries = []
for file_num, file_element in enumerate(
traverse_obj(data, ('files', lambda _, v: url_or_none(v['file']))), start=1):
... | Would this work?
```suggestion
'timestamp': ('file_start', {parse_iso8601(delimiter=' ', timezone=dt.timedelta(hours=9))}),
``` | file_url, video_id, 'mp4', m3u8_id='hls',
note=f'Downloading part {file_num} m3u8 information')
else:
formats = [{
'url': file_url,
'format_id': 'http',
}]
entries.append({
... | @@ -187,7 +198,7 @@ def _real_extract(self, url):
'formats': formats,
**traverse_obj(file_element, {
'duration': ('duration', {int_or_none(scale=1000)}),
- 'timestamp': ('file_start', {unified_timestamp}),
+ 'timestamp': ('file... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.714 | suggestion | 150 | 51 | 51 | false | [ie/soop] Fix timestamp extraction | 12,609 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | msikma |
import datetime
import functools
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
determine_ext,
filter_dict,
int_or_none,
orderedSet,
unified_timestamp,
url_or_none,
urlencode_postdata,
... | import convention
```suggestion
import datetime as dt
``` | import datetime as dt
import functools
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
determine_ext,
filter_dict,
int_or_none,
orderedSet,
parse_iso8601,
url_or_none,
urlencode_postdata,
... | @@ -1,3 +1,4 @@
+import datetime | yt_dlp/extractor/afreecatv.py | 1 | Python | 0.571 | suggestion | 60 | 26 | 26 | false | [ie/soop] Fix timestamp extraction | 12,609 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | msikma |
data=data, headers=headers, query=query,
extensions={'legacy_ssl': True}), display_id,
'Downloading API JSON', 'Unable to download API JSON')
@staticmethod
def _fixup_thumb(thumb_url):
if not url_or_none(thumb_url):
return None
# Core would determ... | ```suggestion
'thumbnail': r're:https?://videoimg\.(?:sooplive\.co\.kr|afreecatv\.com)/.+',
``` | data=data, headers=headers, query=query,
extensions={'legacy_ssl': True}), display_id,
'Downloading API JSON', 'Unable to download API JSON')
@staticmethod
def _fixup_thumb(thumb_url):
if not url_or_none(thumb_url):
return None
# Core would determ... | @@ -87,9 +88,9 @@ class AfreecaTVIE(AfreecaTVBaseIE):
'uploader_id': 'rlantnghks',
'uploader': '페이즈으',
'duration': 10840,
- 'thumbnail': r're:https?://videoimg\.sooplive\.co/.kr/.+',
+ 'thumbnail': r're:https?://videoimg\.(sooplive\.co\.kr|afreecatv\.com)/.+'... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.714 | suggestion | 109 | 51 | 51 | false | [ie/soop] Fix timestamp extraction | 12,609 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | msikma |
IE_DESC = 'sooplive.co.kr'
_VALID_URL = r'https?://vod\.(?:sooplive\.co\.kr|afreecatv\.com)/(?:PLAYER/STATION|player)/(?P<id>\d+)/?(?:$|[?#&])'
_TESTS = [{
'url': 'https://vod.sooplive.co.kr/player/96753363',
'info_dict': {
'id': '20230108_9FF5BEE1_244432674_1',
'ext'... | ```suggestion
'thumbnail': r're:https?://(?:video|st)img\.(?:sooplive\.co\.kr|afreecatv\.com)/.+',
``` | IE_DESC = 'sooplive.co.kr'
_VALID_URL = r'https?://vod\.(?:sooplive\.co\.kr|afreecatv\.com)/(?:PLAYER/STATION|player)/(?P<id>\d+)/?(?:$|[?#&])'
_TESTS = [{
'url': 'https://vod.sooplive.co.kr/player/96753363',
'info_dict': {
'id': '20230108_9FF5BEE1_244432674_1',
'ext'... | @@ -102,7 +103,7 @@ class AfreecaTVIE(AfreecaTVBaseIE):
'id': '20170411_BE689A0E_190960999_1_2_h',
'ext': 'mp4',
'title': '혼자사는여자집',
- 'thumbnail': r're:https?://(?:video|st)img\.sooplive\.co\.kr/.+',
+ 'thumbnail': r're:https?://(?:video|st)img\.(sooplive\.c... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.714 | suggestion | 116 | 51 | 51 | false | [ie/soop] Fix timestamp extraction | 12,609 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | msikma |
},
}, {
# non standard key
'url': 'http://vod.sooplive.co.kr/PLAYER/STATION/20515605',
'info_dict': {
'id': '20170411_BE689A0E_190960999_1_2_h',
'ext': 'mp4',
'title': '혼자사는여자집',
'thumbnail': r're:https?://(?:video|st)img\.(sooplive\.co... | ```suggestion
'thumbnail': r're:https?://(?:video|st)img\.(?:sooplive\.co\.kr|afreecatv\.com)/.+',
``` | },
}, {
# non standard key
'url': 'http://vod.sooplive.co.kr/PLAYER/STATION/20515605',
'info_dict': {
'id': '20170411_BE689A0E_190960999_1_2_h',
'ext': 'mp4',
'title': '혼자사는여자집',
'thumbnail': r're:https?://(?:video|st)img\.(?:sooplive\.... | @@ -119,7 +120,7 @@ class AfreecaTVIE(AfreecaTVBaseIE):
'id': '20180327_27901457_202289533_1',
'ext': 'mp4',
'title': '[생]빨개요♥ (part 1)',
- 'thumbnail': r're:https?://(?:video|st)img\.sooplive\.co\.kr/.+',
+ 'thumbnail': r're:https?://(?:video|st)img\.(soopli... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.714 | suggestion | 116 | 51 | 51 | false | [ie/soop] Fix timestamp extraction | 12,609 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | msikma |
# title = '%s - %s' % (artist_name, title)
# album = get_model('album')
artist = self._call_api('artist', track.get('artistId'), fatal=False)
album = self._call_api('album', track.get('albumId'), fatal=False)
formats = [{
'url': f'https://{sub_domain}.jamendo.com... | just line length
```suggestion
urlh = self._request_webpage(
HEADRequest(cover_url), track_id, 'Checking thumbnail extension',
errnote=False, fatal=False)
``` | # title = '%s - %s' % (artist_name, title)
# album = get_model('album')
artist = self._call_api('artist', track.get('artistId'), fatal=False)
album = self._call_api('album', track.get('albumId'), fatal=False)
formats = [{
'url': f'https://{sub_domain}.jamendo.com... | @@ -93,9 +95,14 @@ def _real_extract(self, url):
if not cover_url or cover_url in urls:
continue
urls.append(cover_url)
+ urlh = self._request_webpage(
+ HEADRequest(cover_url), track_id, 'Checking thumbnail extension', errnote=Fal... | yt_dlp/extractor/jamendo.py | 26 | Python | 0.786 | suggestion | 219 | 51 | 51 | false | [ie/jamendo] Fix thumbnail extraction | 12,622 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
'season': ('season', 'titleRaw', {str}),
'season_number': ('season', 'titleRaw', {int_or_none}),
'season_id': ('id', {str_or_none}),
'episode': ('title', {str}),
'episode_number': ('episodeNumberRaw', {int_or_none}),
'episod... | L452:
```py
'_old_archive_ids': [make_archive_id('Canvas', video_id),
make_archive_id('Ketnet', video_id)],
``` | return {
'duration': float_or_none(streaming_info.get('duration'), 1000),
'thumbnail': url_or_none(streaming_info.get('posterImageUrl')),
**self._json_ld(traverse_obj(metadata, ('ldjson', ..., {json.loads})), video_id, fatal=False),
**traverse_obj(metadata, ('epis... | @@ -431,65 +453,6 @@ def _real_extract(self, url):
} | yt_dlp/extractor/vrt.py | 26 | Python | 0.714 | suggestion | 162 | 51 | 51 | false | [ie/ketnet] Remove extractor | 12,628 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | MichaelDeBoey |
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://vi... | I'm guessing this test is HLS?
```suggestion
'params': {'skip_download': 'm3u8'},
``` | ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://vi... | @@ -22,8 +22,23 @@ class FC2IE(InfoExtractor):
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kUan1KHs',
- 'ext': 'flv',
'title': 'Boxing again with Puff',
+ 'ext': 'mp4',
+ 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?... | yt_dlp/extractor/fc2.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
import urllib.parse
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content... | I don't understand the thumbnail regex. Wouldn't something like this suffice?
```suggestion
'thumbnail': 're:https?://.+\.jpe?g',
``` | import urllib.parse
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content... | @@ -22,8 +22,23 @@ class FC2IE(InfoExtractor):
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kUan1KHs',
- 'ext': 'flv',
'title': 'Boxing again with Puff',
+ 'ext': 'mp4',
+ 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?... | yt_dlp/extractor/fc2.py | 26 | Python | 0.714 | suggestion | 148 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://video.fc2.com/en/content/20121103kUan1... | if this is the direct mp4 test, can we add a note/comment here about it? | traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://video.fc2.com/en/content/20121103kUan1... | @@ -22,8 +22,23 @@ class FC2IE(InfoExtractor):
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kUan1KHs',
- 'ext': 'flv',
'title': 'Boxing again with Puff',
+ 'ext': 'mp4',
+ 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?... | yt_dlp/extractor/fc2.py | 26 | Python | 0.214 | question | 72 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
import urllib.parse
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content... | ```suggestion
'thumbnail': r're:https?://.+\.jpe?g',
``` | import urllib.parse
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content... | @@ -24,20 +24,22 @@ class FC2IE(InfoExtractor):
'id': '20121103kUan1KHs',
'title': 'Boxing again with Puff',
'ext': 'mp4',
- 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?',
+ 'thumbnail': 're:https?://.+\.jpe?g', | yt_dlp/extractor/fc2.py | 26 | Python | 0.571 | suggestion | 70 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://video.fc2.com/en/content/20121103kUan1KHs',
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kU... | ```suggestion
'thumbnail': r're:https?://.+\.jpe?g',
``` | _VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://video.fc2.com/en/content/20121103kUan1KHs',
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kU... | @@ -24,20 +24,22 @@ class FC2IE(InfoExtractor):
'id': '20121103kUan1KHs',
'title': 'Boxing again with Puff',
'ext': 'mp4',
- 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?',
+ 'thumbnail': 're:https?://.+\.jpe?g',
},
'file_minsize': 633,
... | yt_dlp/extractor/fc2.py | 26 | Python | 0.571 | suggestion | 70 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
import urllib.parse
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content... | ```suggestion
'thumbnail': r're:https?://.+\.jpe?g',
``` | import urllib.parse
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content... | @@ -22,8 +22,25 @@ class FC2IE(InfoExtractor):
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kUan1KHs',
- 'ext': 'flv',
'title': 'Boxing again with Puff',
+ 'ext': 'mp4',
+ 'thumbnail': 're:https?://.+\\.jpe?g', | yt_dlp/extractor/fc2.py | 26 | Python | 0.571 | suggestion | 70 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://video.fc2.com/en/content/20121103kUan1KHs',
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kU... | ```suggestion
'thumbnail': r're:https?://.+\.jpe?g',
``` | _VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://video.fc2.com/en/content/20121103kUan1KHs',
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kU... | @@ -22,8 +22,25 @@ class FC2IE(InfoExtractor):
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kUan1KHs',
- 'ext': 'flv',
'title': 'Boxing again with Puff',
+ 'ext': 'mp4',
+ 'thumbnail': 're:https?://.+\\.jpe?g',
+ ... | yt_dlp/extractor/fc2.py | 26 | Python | 0.571 | suggestion | 70 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://vi... | `'skip_download': 'm3u8'` is the conventional way to communicate that the hls fragments are too small to download in tests
```suggestion
'params': {
'skip_download': 'm3u8',
``` | ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'
IE_NAME = 'fc2'
_NETRC_MACHINE = 'fc2'
_TESTS = [{
'url': 'http://vi... | @@ -22,8 +22,25 @@ class FC2IE(InfoExtractor):
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kUan1KHs',
- 'ext': 'flv',
'title': 'Boxing again with Puff',
+ 'ext': 'mp4',
+ 'thumbnail': 're:https?://.+\\.jpe?g',
+ ... | yt_dlp/extractor/fc2.py | 26 | Python | 0.786 | suggestion | 201 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'... | I keep suggesting to remove this and you're not removing it. Is there a reason why we need this? We are skipping the download so it's pointless AFAIK
```suggestion
``` | from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
urlencode_postdata,
urljoin,
)
class FC2IE(InfoExtractor):
_VALID_URL = r'(?:https?://video\.fc2\.com/(?:[^/]+/)*content/|fc2:)(?P<id>[^/]+)'... | @@ -22,8 +22,24 @@ class FC2IE(InfoExtractor):
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
'info_dict': {
'id': '20121103kUan1KHs',
- 'ext': 'flv',
'title': 'Boxing again with Puff',
+ 'ext': 'mp4',
+ 'thumbnail': r're:https?://.+\.jpe?g',
+ ... | yt_dlp/extractor/fc2.py | 26 | Python | 0.786 | refactor | 169 | 51 | 51 | false | [ie/fc2] Fix old video support | 12,633 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | JChris246 |
if not ref_id:
raise ExtractorError('Failed to extract reference ID for streaks.jp stream info')
if not project_id:
raise ExtractorError('Failed to extract project ID for streaks.jp stream info')
if not ref_id.isdigit() and not ref_id.startswith('ref:'):
re... | It looks like episode id is used instead of videoRefID. |
# Deprecated Brightcove extraction reachable w/extractor-arg or fallback; errors are expected
if backend == 'brightcove' or not streaks_id:
if backend != 'brightcove':
self.report_warning(
'No STREAKS ID found; falling back to Brightcove extraction', vide... | @@ -171,7 +166,87 @@ def _real_extract(self, url):
'channel': provider,
'description': str_or_none(video_info.get('description')),
'thumbnails': thumbnails,
+ }
+
+ backend = self._configuration_arg('backend', ['streaks'])[0]
+
+ if backend not in ('brightcove... | yt_dlp/extractor/tver.py | 26 | Python | 0.286 | suggestion | 55 | 47 | 29 | false | [ie/TVer] Fix extractor | 12,659 | yt-dlp/yt-dlp | 132,642 | Python | jackyzy823 | arabcoders |
if not r_id.isdigit():
r_id = f'ref:{r_id}'
result.update({
'_type': 'url_transparent',
'url': smuggle_url(
self.BRIGHTCOVE_URL_TEMPLATE % (p_id, r_id), {'geo_countries': ['JP']}),
'ie_key': 'BrightcoveNew',
})
return res... | This looks not correct.
For streak backend , all ref_id will prepend "ref:" , no matter it is digits or not. For example: https://tver.jp/episodes/epwkfr091w
| # an another title which is considered "full title" for some viewers
'alt_title': join_nonempty(title, provider, onair_label, delim=' '),
'channel': provider,
'thumbnails': thumbnails,
**traverse_obj(video_info, {
'description': ('description',... | @@ -171,7 +166,87 @@ def _real_extract(self, url):
'channel': provider,
'description': str_or_none(video_info.get('description')),
'thumbnails': thumbnails,
+ }
+
+ backend = self._configuration_arg('backend', ['streaks'])[0]
+
+ if backend not in ('brightcove... | yt_dlp/extractor/tver.py | 26 | Python | 0.357 | suggestion | 162 | 51 | 47 | false | [ie/TVer] Fix extractor | 12,659 | yt-dlp/yt-dlp | 132,642 | Python | jackyzy823 | arabcoders |
_PLATFORM_QUERY = {}
def _real_initialize(self):
session_info = self._download_json(
'https://platform-api.tver.jp/v2/api/platform_users/browser/create',
None, 'Creating session', data=b'device_type=pc')
self._PLATFORM_QUERY = traverse_obj(session_info, ('result', {
... | ```suggestion
series_id, 'Downloading seasons info', headers=self._HEADERS)
``` | _HEADERS = {
'x-tver-platform-type': 'web',
'Origin': 'https://tver.jp',
'Referer': 'https://tver.jp/',
}
_PLATFORM_QUERY = {}
def _real_initialize(self):
session_info = self._download_json(
'https://platform-api.tver.jp/v2/api/platform_users/browser/create',... | @@ -93,7 +112,10 @@ def _call_platform_api(self, path, video_id, note=None, fatal=True, query=None):
def _yield_episode_ids_for_series(self, series_id):
seasons_info = self._download_json(
f'https://service-api.tver.jp/api/v1/callSeriesSeasons/{series_id}',
- series_id, 'Downloadin... | yt_dlp/extractor/tver.py | 26 | Python | 0.571 | suggestion | 93 | 51 | 51 | false | [ie/TVer] Fix extractor | 12,659 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
import datetime as dt
import json
import re
import urllib.parse
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
join_nonempty,
mimetype2ext,
parse_iso8601,
qualities,
smuggle_url,
str_o... | `import datetime as dt` is a convention in this project | from .streaks import StreaksBaseIE
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
make_archive_id,
smuggle_url,
str_or_none,
strip_or_none,
update_url_query,
)
from ..utils.traversal import require, traverse_obj
class TVerIE(StreaksBaseIE):
_VALID_URL = r'https?:... | @@ -1,17 +1,31 @@
+import datetime as dt | yt_dlp/extractor/tver.py | 1 | Python | 0.357 | style | 55 | 26 | 26 | false | [ie/TVer] Fix extractor | 12,659 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
r_id = traverse_obj(video_info, (
'video', ('videoRefID', 'videoID'), {str}, any, {require('reference ID')}))
if not r_id.isdecimal():
r_id = f'ref:{r_id}'
return {
**metadata,
'_type': 'url_transparent',
... | I removed the brightcove method and moved the code back into `_real_extract` because A) it wasn't that much code and B) here we also want to return `'_old_archive_ids'` with the brightcove id if possible |
brightcove_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID'), {str}, any))
if brightcove_id and not brightcove_id.isdecimal():
brightcove_id = f'ref:{brightcove_id}'
streaks_id = traverse_obj(video_info, ('streaks', 'videoRefID', {str}))
if streaks_id and no... | @@ -161,17 +176,212 @@ def _real_extract(self, url):
]
]
- return {
- '_type': 'url_transparent',
+ metadata = {
'title': title,
'series': series,
'episode': episode,
# an another title which is considered "full title" ... | yt_dlp/extractor/tver.py | 26 | Python | 0.643 | refactor | 203 | 51 | 37 | false | [ie/TVer] Fix extractor | 12,659 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
}
def _format_broadcast_date(self, onair_label):
"""
Extracts the broadcast date from the onair label
Truth to be said, we cannot be sure or guarantee that the broadcast date is correct
as TVer doesn't really have consistent date format for the broadcast date.
At be... | ```suggestion
mobj = re.search(
r'(?:(?P<year>\d{4})年)|(?:(?P<month>\d{1,2})\D(?P<day>\d{1,2})\D)', onair_label)
if not mobj:
return {}
broadcast_date_info = mobj.groupdict()
``` | from .streaks import StreaksBaseIE
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
make_archive_id,
smuggle_url,
str_or_none,
strip_or_none,
update_url_query,
)
from ..utils.traversal import require, traverse_obj
class TVerIE(StreaksBaseIE):
_VALID_URL = r'https?:... | @@ -161,17 +176,212 @@ def _real_extract(self, url):
]
]
- return {
- '_type': 'url_transparent',
+ metadata = {
'title': title,
'series': series,
'episode': episode,
# an another title which is considered "full title" ... | yt_dlp/extractor/tver.py | 26 | Python | 0.929 | suggestion | 232 | 51 | 235 | false | [ie/TVer] Fix extractor | 12,659 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
data = {}
broadcast_date = match.groupdict()
if broadcast_date.get('year'):
data['release_year'] = int(broadcast_date['year'])
if broadcast_date.get('day') and broadcast_date.get('month'):
if 'release_year' in data:
year = data['release_year']
... | ```suggestion
data = {
'release_year': int_or_none(broadcast_date_info.get('year')),
}
day, month = [int_or_none(broadcast_date_info.get(key)) for key in ('day', 'month')]
if day and month:
year = data.get('release_year') or dt.datetime.now().year
... | from .streaks import StreaksBaseIE
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
make_archive_id,
smuggle_url,
str_or_none,
strip_or_none,
update_url_query,
)
from ..utils.traversal import require, traverse_obj
class TVerIE(StreaksBaseIE):
_VALID_URL = r'https?:... | @@ -161,17 +176,212 @@ def _real_extract(self, url):
]
]
- return {
- '_type': 'url_transparent',
+ metadata = {
'title': title,
'series': series,
'episode': episode,
# an another title which is considered "full title" ... | yt_dlp/extractor/tver.py | 26 | Python | 0.929 | suggestion | 747 | 51 | 235 | false | [ie/TVer] Fix extractor | 12,659 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
if broadcast_date.get('day') and broadcast_date.get('month'):
if 'release_year' in data:
year = data['release_year']
else:
year = dt.datetime.now().year
dt_ = dt.datetime.strptime(
f"{year}-{broadcast_date['month']}-{bro... | This and everything below this is just duplicated from #12679. Feel free to test this, but any suggestions and review should be done in #12679 for this code | from .streaks import StreaksBaseIE
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
make_archive_id,
smuggle_url,
str_or_none,
strip_or_none,
update_url_query,
)
from ..utils.traversal import require, traverse_obj
class TVerIE(StreaksBaseIE):
_VALID_URL = r'https?:... | @@ -161,17 +176,212 @@ def _real_extract(self, url):
]
]
- return {
- '_type': 'url_transparent',
+ metadata = {
'title': title,
'series': series,
'episode': episode,
# an another title which is considered "full title" ... | yt_dlp/extractor/tver.py | 26 | Python | 0.429 | refactor | 156 | 51 | 235 | false | [ie/TVer] Fix extractor | 12,659 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
# 'user.xdg.comment': 'description',
}
APPLE_PLIST_TEMPLATE = '''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
\t<string>%s</string>
</array>
</plist>'''
def format_value(s... | I would probably still inline the function call, since its just two `if`s but I think its fine like this as well | 'com.apple.metadata:kMDItemWhereFroms': 'webpage_url',
}
APPLE_PLIST_TEMPLATE = '''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
\t<string>%s</string>
</array>
</plist>'''
... | @@ -29,21 +29,36 @@ class XAttrMetadataPP(PostProcessor):
'user.dublincore.date': 'upload_date',
'user.dublincore.contributor': 'uploader',
'user.dublincore.format': 'format',
+ 'com.apple.metadata:kMDItemWhereFroms': 'webpage_url',
# We do this last because it may get us clos... | yt_dlp/postprocessor/xattrpp.py | 26 | Python | 0.5 | suggestion | 112 | 45 | 41 | false | [pp/XAttrMetadata] Add macOS "Where from" attribute | 12,664 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | rolandcrosby |
class XAttrMetadataPP(PostProcessor):
"""Set extended attributes on downloaded file (if xattr support is found)
More info about extended attributes for media:
http://freedesktop.org/wiki/CommonExtendedAttributes/
http://www.freedesktop.org/wiki/PhreedomDraft/
http://dublincore.org/doc... | maybe `com.apple.metadata:kMDItemWhereFroms` should go after `description` since even without any url it's already longer than many videos' description strings? |
class XAttrMetadataPP(PostProcessor):
"""Set extended attributes on downloaded file (if xattr support is found)
More info about extended attributes for media:
http://freedesktop.org/wiki/CommonExtendedAttributes/
http://www.freedesktop.org/wiki/PhreedomDraft/
http://dublincore.org/doc... | @@ -29,12 +29,21 @@ class XAttrMetadataPP(PostProcessor):
'user.dublincore.date': 'upload_date',
'user.dublincore.contributor': 'uploader',
'user.dublincore.format': 'format',
+ 'com.apple.metadata:kMDItemWhereFroms': 'webpage_url',
# We do this last because it may get us clos... | yt_dlp/postprocessor/xattrpp.py | 26 | Python | 0.571 | question | 160 | 51 | 51 | false | [pp/XAttrMetadata] Add macOS "Where from" attribute | 12,664 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rolandcrosby |
'md5': '45ebc8a47ee1c2240178757caf8881b5',
'info_dict': {
'id': 'c64916eb-10fb-46a9-9a19-8c4b7ed064e7',
'ext': 'mp4',
'title': 'PAULINHO LOKO NA LOCO!',
'description': 'live on na loco',
'uploader_id': '2MDO7Z1DPM',
'channel': 'paul... | I think I like raising a concise error more, a la
```suggestion
stream = traverse_obj(self._search_nextjs_data(webpage, video_id), ('props', 'pageProps', ('liveStreamData', 'stream'), any))
if not stream:
raise ...
```
alternatively, if we feel fancy, we could use `traversal.require`:
... | },
}, {
'url': 'https://loco.com/stream/c64916eb-10fb-46a9-9a19-8c4b7ed064e7',
'md5': '45ebc8a47ee1c2240178757caf8881b5',
'info_dict': {
'id': 'c64916eb-10fb-46a9-9a19-8c4b7ed064e7',
'ext': 'mp4',
'title': 'PAULINHO LOKO NA LOCO!',
'des... | @@ -0,0 +1,82 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class LocoIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?loco\.com/(?P<type>streamers|stream)/(?P<id>[^/?#]+)'
+ _TESTS = [{
+ 'url': 'https://loco.com/streamers/teuzinfps',
+ 'info_dict': {
+ ... | yt_dlp/extractor/loco.py | 26 | Python | 1 | suggestion | 508 | 51 | 51 | false | [ie/loco] Add extractor | 12,667 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | DTrombett |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.