before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
import re
from .common import InfoExtractor
from ..utils.traversal import traverse_obj
from ..utils import (
urlhandle_detect_ext,
url_or_none,
int_or_none,
unified_timestamp,
)
from ..networking import HEADRequest
class Mx3BaseIE(InfoExtractor):
_MX3_DOMAIN = None
def _real_extract(self, ur... | Don't redefine `json`. Can also be non-fatal, since we only use it for metadata.
```suggestion
data = self._download_json(
f'https://{self._MX3_DOMAIN}/t/{track_id}.json', track_id, fatal=False)
``` | import re
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
get_element_by_class,
int_or_none,
try_call,
url_or_none,
urlhandle_detect_ext,
)
from ..utils.traversal import traverse_obj
class Mx3BaseIE(InfoExtractor):
_VALID_URL_TMPL = r'https?://(?:w... | @@ -0,0 +1,160 @@
+import re
+
+from .common import InfoExtractor
+from ..utils.traversal import traverse_obj
+from ..utils import (
+ urlhandle_detect_ext,
+ url_or_none,
+ int_or_none,
+ unified_timestamp,
+)
+from ..networking import HEADRequest
+
+
+class Mx3BaseIE(InfoExtractor):
+ _MX3_DOMAIN = Non... | yt_dlp/extractor/mx3.py | 20 | Python | 0.857 | suggestion | 222 | 45 | 45 | false | [extractor/mx3] Add extractor | 8,736 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | martinxyz |
track_id = self._match_id(url)
webpage = self._download_webpage(url, track_id)
json = self._download_json(f'https://{self._MX3_DOMAIN}/t/{track_id}.json', track_id)
artists = []
if json.get('artist'):
artists.append(json['artist'])
performer = json.get('perfo... | `timestamp` is not a valid key here
```suggestion
``` | 'url': 'player_asset',
'format_id': 'default',
'quality': 0,
}, {
'url': 'player_asset?quality=hd',
'format_id': 'hd',
'quality': 1,
}, {
'url': 'download',
'format_id': 'download',
'quality': 2,
}, {
'url': 'player_asset?qualit... | @@ -0,0 +1,160 @@
+import re
+
+from .common import InfoExtractor
+from ..utils.traversal import traverse_obj
+from ..utils import (
+ urlhandle_detect_ext,
+ url_or_none,
+ int_or_none,
+ unified_timestamp,
+)
+from ..networking import HEADRequest
+
+
+class Mx3BaseIE(InfoExtractor):
+ _MX3_DOMAIN = Non... | yt_dlp/extractor/mx3.py | 26 | Python | 0.571 | suggestion | 55 | 51 | 51 | false | [extractor/mx3] Add extractor | 8,736 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | martinxyz |
class Mx3BaseIE(InfoExtractor):
_MX3_DOMAIN = None
def _real_extract(self, url):
track_id = self._match_id(url)
webpage = self._download_webpage(url, track_id)
json = self._download_json(f'https://{self._MX3_DOMAIN}/t/{track_id}.json', track_id)
artists = []
if json.get... | I think all formats should be non-fatal
```suggestion
urlh = self._request_webpage(
HEADRequest(fmt['url']), track_id, fatal=False, expected_status=404,
note=f'Checking for format {fmt["format_id"]}')
``` |
class Mx3BaseIE(InfoExtractor):
_VALID_URL_TMPL = r'https?://(?:www\.)?%s/t/(?P<id>\w+)'
_FORMATS = [{
'url': 'player_asset',
'format_id': 'default',
'quality': 0,
}, {
'url': 'player_asset?quality=hd',
'format_id': 'hd',
'quality': 1,
}, {
'url':... | @@ -0,0 +1,160 @@
+import re
+
+from .common import InfoExtractor
+from ..utils.traversal import traverse_obj
+from ..utils import (
+ urlhandle_detect_ext,
+ url_or_none,
+ int_or_none,
+ unified_timestamp,
+)
+from ..networking import HEADRequest
+
+
+class Mx3BaseIE(InfoExtractor):
+ _MX3_DOMAIN = Non... | yt_dlp/extractor/mx3.py | 26 | Python | 0.857 | suggestion | 253 | 51 | 51 | false | [extractor/mx3] Add extractor | 8,736 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | martinxyz |
else:
urlh = self._request_webpage(HEADRequest(fmt['url']), track_id, fatal=False, expected_status=404,
note=f'Trying media headers for optional format {fmt["format_id"]}')
if urlh and urlh.status == 200:
fmt['ext'] = u... | imo. yt-dlp should always download the highest quality format by default. We also prefer the source file on other extractors like Vimeo. If you don't want to download the highest quality format, you can use `-f` or `-S`.
```suggestion
add_format({
'url': f'{track_url}/player_asset',
... | for fmt in self._FORMATS:
format_url = f'https://{self._DOMAIN}/tracks/{track_id}/{fmt["url"]}'
urlh = self._request_webpage(
HEADRequest(format_url), track_id, fatal=False, expected_status=404,
note=f'Checking for format {fmt["format_id"]}')
i... | @@ -0,0 +1,160 @@
+import re
+
+from .common import InfoExtractor
+from ..utils.traversal import traverse_obj
+from ..utils import (
+ urlhandle_detect_ext,
+ url_or_none,
+ int_or_none,
+ unified_timestamp,
+)
+from ..networking import HEADRequest
+
+
+class Mx3BaseIE(InfoExtractor):
+ _MX3_DOMAIN = Non... | yt_dlp/extractor/mx3.py | 26 | Python | 0.857 | refactor | 848 | 51 | 51 | false | [extractor/mx3] Add extractor | 8,736 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | martinxyz |
import re
from .common import InfoExtractor
from ..utils.traversal import traverse_obj
from ..utils import (
urlhandle_detect_ext,
url_or_none,
int_or_none,
unified_timestamp,
)
from ..networking import HEADRequest
class Mx3BaseIE(InfoExtractor):
_MX3_DOMAIN = None
def _real_extract(self, ur... | ```suggestion
import re
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
get_element_by_class,
int_or_none,
try_call,
url_or_none,
urlhandle_detect_ext,
)
from ..utils.traversal import traverse_obj
``` | import re
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
get_element_by_class,
int_or_none,
try_call,
url_or_none,
urlhandle_detect_ext,
)
from ..utils.traversal import traverse_obj
class Mx3BaseIE(InfoExtractor):
_VALID_URL_TMPL = r'https?://(?:w... | @@ -0,0 +1,160 @@
+import re
+
+from .common import InfoExtractor
+from ..utils.traversal import traverse_obj
+from ..utils import (
+ urlhandle_detect_ext,
+ url_or_none,
+ int_or_none,
+ unified_timestamp,
+)
+from ..networking import HEADRequest | yt_dlp/extractor/mx3.py | 11 | Python | 1 | refactor | 279 | 36 | 36 | false | [extractor/mx3] Add extractor | 8,736 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | martinxyz |
urlhandle_detect_ext,
url_or_none,
int_or_none,
unified_timestamp,
)
from ..networking import HEADRequest
class Mx3BaseIE(InfoExtractor):
_MX3_DOMAIN = None
def _real_extract(self, url):
track_id = self._match_id(url)
webpage = self._download_webpage(url, track_id)
jso... | I'd move this down/inline.
```suggestion
``` | get_element_by_class,
int_or_none,
try_call,
url_or_none,
urlhandle_detect_ext,
)
from ..utils.traversal import traverse_obj
class Mx3BaseIE(InfoExtractor):
_VALID_URL_TMPL = r'https?://(?:www\.)?%s/t/(?P<id>\w+)'
_FORMATS = [{
'url': 'player_asset',
'format_id': 'default',... | @@ -0,0 +1,160 @@
+import re
+
+from .common import InfoExtractor
+from ..utils.traversal import traverse_obj
+from ..utils import (
+ urlhandle_detect_ext,
+ url_or_none,
+ int_or_none,
+ unified_timestamp,
+)
+from ..networking import HEADRequest
+
+
+class Mx3BaseIE(InfoExtractor):
+ _MX3_DOMAIN = Non... | yt_dlp/extractor/mx3.py | 26 | Python | 0.5 | refactor | 46 | 51 | 51 | false | [extractor/mx3] Add extractor | 8,736 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | martinxyz |
'format_id': 'default',
'quality': 1,
}, fatal=True)
# the formats below don't always exist
add_format({
'url': f'{track_url}/player_asset?quality=hd',
'format_id': 'hd',
'quality': 10,
}, fatal=False)
add_format({
... | Okay, I wrote a function to extract more metadata fields. For artist/performer, how about we split this across `artist` and `album_artist`, with a fallback for `artist`.
```suggestion
more_info = get_element_by_class('single-more-info', webpage)
def get_info_field(name):
return self._h... | return formats
def _real_extract(self, url):
track_id = self._match_id(url)
webpage = self._download_webpage(url, track_id)
more_info = get_element_by_class('single-more-info', webpage)
data = self._download_json(f'https://{self._DOMAIN}/t/{track_id}.json', track_id, fatal=F... | @@ -0,0 +1,160 @@
+import re
+
+from .common import InfoExtractor
+from ..utils.traversal import traverse_obj
+from ..utils import (
+ urlhandle_detect_ext,
+ url_or_none,
+ int_or_none,
+ unified_timestamp,
+)
+from ..networking import HEADRequest
+
+
+class Mx3BaseIE(InfoExtractor):
+ _MX3_DOMAIN = Non... | yt_dlp/extractor/mx3.py | 26 | Python | 0.857 | refactor | 1,316 | 51 | 51 | false | [extractor/mx3] Add extractor | 8,736 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | martinxyz |
},
{
'url': 'https://www.cnbc.com/video/2023/12/08/the-epicenter-of-ai-is-in-seattle-says-jim-cramer.html',
'info_dict': {
'author': 'Jim Cramer',
'channel': 'Mad Money with Jim Cramer',
'description': '\'Mad Money\' host Jim Cramer... | Use `_match_id`
```suggestion
display_id = self._match_id(url)
``` | 'info_dict': {
'author': 'Jim Cramer',
'channel': 'Mad Money with Jim Cramer',
'description': 'md5:72925be21b952e95eba51178dddf4e3e',
'duration': 113.0,
'ext': 'mp4',
'id': '107345474',
'display_id': 'the-epicenter-of-ai-is-in-s... | @@ -1,68 +1,114 @@
+import json
from .common import InfoExtractor
-from ..utils import smuggle_url
+from ..utils import traverse_obj, unified_strdate, url_or_none
-class CNBCIE(InfoExtractor):
- _VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
- _TEST = {
- 'url': 'http://video... | yt_dlp/extractor/cnbc.py | 26 | Python | 0.643 | suggestion | 77 | 51 | 48 | false | Fix cnbc.py / add CNBCVideoIE extractor | 8,741 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | gonzalezjo |
'author': 'Jim Cramer',
'channel': 'Mad Money with Jim Cramer',
'description': '\'Mad Money\' host Jim Cramer returns from his trip to the West Coast with insight into the tech scene in Seattle, WA.',
'duration': 113.0,
'ext': 'mp4',
... | Can be simplified
```suggestion
data = self._search_json(r'window\.__s_data=', webpage, 'video data', display_id)
``` | 'duration': 113.0,
'ext': 'mp4',
'id': '107345474',
'display_id': 'the-epicenter-of-ai-is-in-seattle-says-jim-cramer',
'thumbnail': 'https://image.cnbcfm.com/api/v1/image/107345486-Screenshot_2023-12-08_at_70339_PM.png?v=1702080248',
'timestamp': 1... | @@ -1,68 +1,114 @@
+import json
from .common import InfoExtractor
-from ..utils import smuggle_url
+from ..utils import traverse_obj, unified_strdate, url_or_none
-class CNBCIE(InfoExtractor):
- _VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
- _TEST = {
- 'url': 'http://video... | yt_dlp/extractor/cnbc.py | 26 | Python | 0.714 | suggestion | 128 | 51 | 44 | false | Fix cnbc.py / add CNBCVideoIE extractor | 8,741 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | gonzalezjo |
'ext': 'mp4',
'id': 'the-epicenter-of-ai-is-in-seattle-says-jim-cramer',
'thumbnail': 'https://image.cnbcfm.com/api/v1/image/107345486-Screenshot_2023-12-08_at_70339_PM.png?v=1702080248',
'thumbnails': [
{
'url':... | I would not hardcode the position in the array:
```suggestion
player_data = traverse_obj(data, (
'page', 'page', 'layout', ..., 'columns', ..., 'modules',
lambda _, v: v['name'] == 'clipPlayer', 'data', {dict}), get_all=False)
``` | 'thumbnail': 'https://image.cnbcfm.com/api/v1/image/107345486-Screenshot_2023-12-08_at_70339_PM.png?v=1702080248',
'timestamp': 1702080535,
'title': 'The epicenter of AI is in Seattle, says Jim Cramer',
'release_timestamp': 1702077347,
'modified_timestamp': 17... | @@ -1,68 +1,114 @@
+import json
from .common import InfoExtractor
-from ..utils import smuggle_url
+from ..utils import traverse_obj, unified_strdate, url_or_none
-class CNBCIE(InfoExtractor):
- _VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
- _TEST = {
- 'url': 'http://video... | yt_dlp/extractor/cnbc.py | 26 | Python | 0.786 | suggestion | 267 | 51 | 40 | false | Fix cnbc.py / add CNBCVideoIE extractor | 8,741 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | gonzalezjo |
{
'url': 'https://image.cnbcfm.com/api/v1/image/107345486-Screenshot_2023-12-08_at_70339_PM.png?v=1702080248'
}
],
'timestamp': 1702080535,
'title': 'The epicenter of AI is in Seattle, says Jim Cramer',
... | Just inline this along with other data below
```suggestion
``` | 'modified_timestamp': 1702080535,
'release_date': '20231208',
'upload_date': '20231209',
'modified_date': '20231209',
},
'expected_warnings': ['Unable to download f4m manifest'],
}]
def _real_extract(self, url):
display_id = self._match_id... | @@ -1,68 +1,114 @@
+import json
from .common import InfoExtractor
-from ..utils import smuggle_url
+from ..utils import traverse_obj, unified_strdate, url_or_none
-class CNBCIE(InfoExtractor):
- _VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
- _TEST = {
- 'url': 'http://video... | yt_dlp/extractor/cnbc.py | 26 | Python | 0.571 | suggestion | 64 | 51 | 36 | false | Fix cnbc.py / add CNBCVideoIE extractor | 8,741 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | gonzalezjo |
return {
'author': self._html_search_regex(
r'<meta name="parsely-author" content="([^<]+)"',
webpage,
'video author',
default=None),
'channel': self._html_search_regex(
r'<div class="ClipPlayer-clipPlayerIn... | I would simplify this like so and also extract some other values:
```suggestion
return {
'id': display_id,
'display_id': display_id,
'formats': self._extract_akamai_formats(player_data['playbackURL'], display_id),
**self._search_json_ld(webpage, display_id, ... | from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
class CNBCVideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/?#]+/)+(?P<id>[^./?#&]+)\.html'
_TESTS = [{
'url': 'https://w... | @@ -1,68 +1,114 @@
+import json
from .common import InfoExtractor
-from ..utils import smuggle_url
+from ..utils import traverse_obj, unified_strdate, url_or_none
-class CNBCIE(InfoExtractor):
- _VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
- _TEST = {
- 'url': 'http://video... | yt_dlp/extractor/cnbc.py | 26 | Python | 0.857 | security | 1,167 | 27 | 98 | false | Fix cnbc.py / add CNBCVideoIE extractor | 8,741 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | gonzalezjo |
import json
from .common import InfoExtractor
from ..utils import traverse_obj, unified_strdate, url_or_none
class CNBCVideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/]+/)+(?P<id>[^./?#&]+)\.html'
_TESTS = [
{
'url': 'https://www.cnbc.com/video/2023/12/07/m... | Use the md5 for long fields such as the description | from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
class CNBCVideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/?#]+/)+(?P<id>[^./?#&]+)\.html'
_TESTS = [{
'url': 'https://w... | @@ -1,68 +1,114 @@
+import json
from .common import InfoExtractor
-from ..utils import smuggle_url
+from ..utils import traverse_obj, unified_strdate, url_or_none
-class CNBCIE(InfoExtractor):
- _VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
- _TEST = {
- 'url': 'http://video... | yt_dlp/extractor/cnbc.py | 15 | Python | 0.286 | suggestion | 51 | 40 | 40 | false | Fix cnbc.py / add CNBCVideoIE extractor | 8,741 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | gonzalezjo |
import json
from .common import InfoExtractor
from ..utils import traverse_obj, unified_strdate, url_or_none
class CNBCVideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/]+/)+(?P<id>[^./?#&]+)\.html'
_TESTS = [
{
'url': 'https://www.cnbc.com/video/2023/12/07/m... | ```suggestion
from ..utils import int_or_none, parse_iso8601, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
class CNBCVideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/?#]+/)+(?P<id>[^./?#&]+)\.html'
_TESTS = [{
'url': 'https://w... | @@ -1,68 +1,114 @@
+import json
from .common import InfoExtractor
-from ..utils import smuggle_url
+from ..utils import traverse_obj, unified_strdate, url_or_none | yt_dlp/extractor/cnbc.py | 3 | Python | 0.714 | suggestion | 136 | 28 | 28 | false | Fix cnbc.py / add CNBCVideoIE extractor | 8,741 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | gonzalezjo |
from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
class CNBCVideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/]+/)+(?P<id>[^./?#&]+)\.html'
_TESTS = [{
'url': 'https://www... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/?#]+/)+(?P<id>[^./?#&]+)\.html'
``` | from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
class CNBCVideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/?#]+/)+(?P<id>[^./?#&]+)\.html'
_TESTS = [{
'url': 'https://w... | @@ -1,68 +1,97 @@
from .common import InfoExtractor
-from ..utils import smuggle_url
+from ..utils import int_or_none, parse_iso8601, str_or_none, url_or_none
+from ..utils.traversal import traverse_obj
-class CNBCIE(InfoExtractor):
- _VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
- ... | yt_dlp/extractor/cnbc.py | 7 | Python | 0.714 | suggestion | 111 | 32 | 32 | false | Fix cnbc.py / add CNBCVideoIE extractor | 8,741 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gonzalezjo |
ZattooMoviesIE,
ZattooRecordingsIE,
)
from .zdf import ZDFIE, ZDFChannelIE
from .zee5 import (
Zee5IE,
Zee5SeriesIE,
)
from .zeenews import ZeeNewsIE
from .zhihu import ZhihuIE
from .zingmp3 import (
ZingMp3IE,
ZingMp3AlbumIE,
ZingMp3ChartHomeIE,
ZingMp3WeekChartIE,
ZingMp3ChartMusic... | Change this to be in the correct place alphabetically | ZattooLiveIE,
ZattooMoviesIE,
ZattooRecordingsIE,
)
from .zdf import ZDFIE, ZDFChannelIE
from .zee5 import (
Zee5IE,
Zee5SeriesIE,
)
from .zeenews import ZeeNewsIE
from .zhihu import ZhihuIE
from .zingmp3 import (
ZingMp3IE,
ZingMp3AlbumIE,
ZingMp3ChartHomeIE,
ZingMp3WeekChartIE,
... | @@ -2463,3 +2463,5 @@
)
from .zoom import ZoomIE
from .zype import ZypeIE
+
+from .amadeustv import AmadeusTVIE | yt_dlp/extractor/_extractors.py | 26 | Python | 0.286 | suggestion | 53 | 26 | 26 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ArnauvGilotra |
ExtractorError,
traverse_obj,
)
class AmadeusTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
_TESTS = [{
'url': 'http://www.amadeus.tv/library/65091a87ff85af59d9fc54c3',
'info_dict': {
'id': '5576678021301411311',
'ex... | I would change this to be `display_id` and `video_id`
```suggestion
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
nuxt_data = self._search_nuxt_data(webpage, display_id, traverse=('fetch', '0'))
video_id = traverse_obj(nuxt_data, ('item', 'vide... | float_or_none,
int_or_none,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class AmadeusTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
_TESTS = [{
'url': 'http://www.amadeus.tv/library/65091a87ff85af59d9fc54c3',
... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class AmadeusTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
+ _TESTS = [{
+ 'url': 'http://www.amadeus.tv/library/6509... | yt_dlp/extractor/amadeustv.py | 26 | Python | 0.857 | suggestion | 357 | 51 | 51 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ArnauvGilotra |
_TESTS = [{
'url': 'http://www.amadeus.tv/library/65091a87ff85af59d9fc54c3',
'info_dict': {
'id': '5576678021301411311',
'ext': 'mp4',
'title': '02Jieon Park.mp4',
'thumbnail': 'http://1253584441.vod2.myqcloud.com/a0046a27vodtransbj1253584441/7db4af535... | Formatting
```suggestion
video_data = self._download_json(
f'http://playvideo.qcloud.com/getplayinfo/v2/1253584441/{video_id}',
video_id, headers={'Referer': 'http://www.amadeus.tv/'})
``` |
class AmadeusTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
_TESTS = [{
'url': 'http://www.amadeus.tv/library/65091a87ff85af59d9fc54c3',
'info_dict': {
'id': '5576678021301411311',
'ext': 'mp4',
'title': 'Jieon Pa... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class AmadeusTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
+ _TESTS = [{
+ 'url': 'http://www.amadeus.tv/library/6509... | yt_dlp/extractor/amadeustv.py | 26 | Python | 0.786 | suggestion | 225 | 51 | 51 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ArnauvGilotra |
actual_video_id = traverse_obj(nuxt_data, ('item', 'video'))
if not actual_video_id:
raise ExtractorError('Unable to extract actual video ID')
video_data = self._download_json(
f'http://playvideo.qcloud.com/getplayinfo/v2/1253584441/{actual_video_id}',
actua... | I would write this like so to also extract the source video:
```suggestion
formats = []
for video in traverse_obj(video_data, ('videoInfo', ('sourceVideo', ('transcodeList', ...)), {dict})):
if not url_or_none(video.get('url')):
continue
formats.append({
... | }
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
nuxt_data = self._search_nuxt_data(webpage, display_id, traverse=('fetch', '0'))
video_id = traverse_obj(nuxt_data, ('item', 'video', {str}))
i... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class AmadeusTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
+ _TESTS = [{
+ 'url': 'http://www.amadeus.tv/library/6509... | yt_dlp/extractor/amadeustv.py | 26 | Python | 0.857 | refactor | 994 | 35 | 51 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ArnauvGilotra |
headers={'Referer': 'http://www.amadeus.tv/'}
)
transcode_list = traverse_obj(video_data, ('videoInfo', 'transcodeList'), default=[])
formats = []
for video in transcode_list:
format_info = {
'url': video['url'],
'format_id': 'http... | Can be written like so:
```suggestion
return {
'id': video_id,
'display_id': display_id,
'formats': formats,
**traverse_obj(video_data, {
'title': ('videoInfo', 'basicInfo', 'name'),
'thumbnail': ('coverInfo', 'coverUrl', {u... | video_id = traverse_obj(nuxt_data, ('item', 'video', {str}))
if not video_id:
raise ExtractorError('Unable to extract actual video ID')
video_data = self._download_json(
f'http://playvideo.qcloud.com/getplayinfo/v2/1253584441/{video_id}',
video_id, headers={... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class AmadeusTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
+ _TESTS = [{
+ 'url': 'http://www.amadeus.tv/library/6509... | yt_dlp/extractor/amadeustv.py | 26 | Python | 0.929 | suggestion | 1,012 | 27 | 44 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ArnauvGilotra |
from .common import InfoExtractor
from ..utils import (
int_or_none,
ExtractorError,
traverse_obj,
)
class AmadeusTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
_TESTS = [{
'url': 'http://www.amadeus.tv/library/65091a87ff85af59d9fc54c3',
... | Sorted and with the additional imports:
```suggestion
ExtractorError,
float_or_none,
int_or_none,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
parse_iso8601,
url_or_none,
)
from ..utils.traversal import traverse_obj
class AmadeusTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P<id>[\da-f]+)'
_TESTS = [{... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ ExtractorError,
+ traverse_obj,
+) | yt_dlp/extractor/amadeustv.py | 6 | Python | 1 | refactor | 203 | 31 | 31 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ArnauvGilotra |
continue
formats.append({
**traverse_obj(video, {
'url': 'url',
'format_id': ('definition', {lambda x: f'http-{x or "0"}'}),
'width': ('width', {int_or_none}),
'height': ('height', {int_or_none}),... | ```suggestion
'title': (('title', 'title_en', 'title_cn'), {str}),
``` | continue
formats.append({
**traverse_obj(video, {
'url': 'url',
'format_id': ('definition', {lambda x: f'http-{x or "0"}'}),
'width': ('width', {int_or_none}),
'height': ('height', {int_or_none}),... | @@ -0,0 +1,77 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ float_or_none,
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class AmadeusTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P... | yt_dlp/extractor/amadeustv.py | 26 | Python | 0.571 | suggestion | 88 | 32 | 32 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ArnauvGilotra |
formats.append({
**traverse_obj(video, {
'url': 'url',
'format_id': ('definition', {lambda x: f'http-{x or "0"}'}),
'width': ('width', {int_or_none}),
'height': ('height', {int_or_none}),
'fil... | ```suggestion
'description': (('description', 'description_en', 'description_cn'), {str}),
``` | formats.append({
**traverse_obj(video, {
'url': 'url',
'format_id': ('definition', {lambda x: f'http-{x or "0"}'}),
'width': ('width', {int_or_none}),
'height': ('height', {int_or_none}),
'fil... | @@ -0,0 +1,77 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ float_or_none,
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class AmadeusTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P... | yt_dlp/extractor/amadeustv.py | 26 | Python | 0.714 | suggestion | 112 | 31 | 31 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ArnauvGilotra |
video_id, headers={'Referer': 'http://www.amadeus.tv/'})
formats = []
for video in traverse_obj(video_data, ('videoInfo', ('sourceVideo', ('transcodeList', ...)), {dict})):
if not url_or_none(video.get('url')):
continue
formats.append({
... | ```suggestion
'title': ('videoInfo', 'basicInfo', 'name', {str}),
``` | video_id, headers={'Referer': 'http://www.amadeus.tv/'})
formats = []
for video in traverse_obj(video_data, ('videoInfo', ('sourceVideo', ('transcodeList', ...)), {dict})):
if not url_or_none(video.get('url')):
continue
formats.append({
... | @@ -0,0 +1,77 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ float_or_none,
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class AmadeusTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?amadeus\.tv/library/(?P... | yt_dlp/extractor/amadeustv.py | 26 | Python | 0.571 | suggestion | 87 | 37 | 37 | false | Add support for Amadeus.tv | 8,744 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ArnauvGilotra |
'id': '1213',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'live_status': 'not_live',
'release_timestamp': 1701421200,
}
}, {
'url': 'https://mixch.tv/archive/1214',
'only_matching': True,
}]
def _real_extract(self, url):
... | Entries are always from the current year? | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import ExtractorError, UserNotLive, url_or_none
from ..utils.traversal import traverse_obj
class MixchIE(InfoExtractor):
IE_NAME = 'mixch'
_VALID_URL = r'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
_TESTS = [{
... | @@ -62,20 +69,44 @@ class MixchArchiveIE(InfoExtractor):
'id': '421',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip': 'paid video, no DRM. expires at Dec 31, 2023',
+ 'info_dict': {
+ 'id': '1213',
+ ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.071 | question | 41 | 38 | 100 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
'info_dict': {
'id': '421',
'title': '96NEKO SHOW TIME',
}
}, {
'url': 'https://mixch.tv/archive/1213',
'skip': 'paid video, no DRM. expires at Dec 31, 2023',
'info_dict': {
'id': '1213',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd... | Since we raise an error no return is needed
```suggestion
``` | }, {
'url': 'https://mixch.tv/archive/1213',
'skip': 'paid video, no DRM. expires at Dec 31, 2023',
'info_dict': {
'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'release_date': '20231201',
'thum... | @@ -62,20 +69,44 @@ class MixchArchiveIE(InfoExtractor):
'id': '421',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip': 'paid video, no DRM. expires at Dec 31, 2023',
+ 'info_dict': {
+ 'id': '1213',
+ ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.714 | suggestion | 63 | 46 | 33 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
'ext': 'mp4',
'protocol': 'm3u8',
}],
'is_live': True,
}
class MixchArchiveIE(InfoExtractor):
IE_NAME = 'mixch:archive'
_VALID_URL = r'https?://(?:www\.)?mixch\.tv/archive/(?P<id>\d+)'
_TESTS = [{
'url': 'https://mixch.tv/archive/421... | While I can't run the tests myself this seems incomplete. Shouldn't there be a `release_date` and `thumbnail`? |
class MixchArchiveIE(InfoExtractor):
IE_NAME = 'mixch:archive'
_VALID_URL = r'https?://(?:www\.)?mixch\.tv/archive/(?P<id>\d+)'
_TESTS = [{
'url': 'https://mixch.tv/archive/421',
'skip': 'paid video, no DRM. expires at Jan 23',
'info_dict': {
'id': '421',
'... | @@ -62,20 +69,44 @@ class MixchArchiveIE(InfoExtractor):
'id': '421',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip': 'paid video, no DRM. expires at Dec 31, 2023',
+ 'info_dict': {
+ 'id': '1213',
+ ... | yt_dlp/extractor/mixch.py | 26 | Python | 0.571 | question | 110 | 51 | 47 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
'url': 'https://mixch.tv/archive/1213',
'skip': 'paid video, no DRM. expires at Dec 31, 2023',
'info_dict': {
'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'live_status': 'not_live',
'release_date':... | ```suggestion
'title': traverse_obj(info_json, ('archive', 'title', {str})),
``` | }, {
'url': 'https://mixch.tv/archive/1213',
'skip': 'paid video, no DRM. expires at Dec 31, 2023',
'info_dict': {
'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'release_date': '20231201',
'thum... | @@ -60,22 +61,38 @@ class MixchArchiveIE(InfoExtractor):
'skip': 'paid video, no DRM. expires at Jan 23',
'info_dict': {
'id': '421',
+ 'ext': 'mp4',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip':... | yt_dlp/extractor/mixch.py | 26 | Python | 0.571 | suggestion | 94 | 32 | 33 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'live_status': 'not_live',
'release_date': '20231201',
'thumbnail': str,
}
}, {
'url': 'https://mixch.tv/archive/1214',
'only_matching': True,
}]
def _re... | ```suggestion
'thumbnail': traverse_obj(info_json, ('archive', 'thumbnailURL', {url_or_none})),
``` | 'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'release_date': '20231201',
'thumbnail': str,
}
}, {
'url': 'https://mixch.tv/archive/1214',
'only_matching': True,
}]
def _real_extract(se... | @@ -60,22 +61,38 @@ class MixchArchiveIE(InfoExtractor):
'skip': 'paid video, no DRM. expires at Jan 23',
'info_dict': {
'id': '421',
+ 'ext': 'mp4',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip':... | yt_dlp/extractor/mixch.py | 26 | Python | 0.714 | suggestion | 113 | 28 | 29 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
from .common import InfoExtractor
from ..utils import UserNotLive
from ..utils.traversal import traverse_obj
class MixchIE(InfoExtractor):
IE_NAME = 'mixch'
_VALID_URL = r'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
_TESTS = [{
'url': 'https://mixch.tv/u/16236849/live',
'skip': 'don\'t kn... | ```suggestion
from ..utils import UserNotLive, url_or_none
``` | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import ExtractorError, UserNotLive, url_or_none
from ..utils.traversal import traverse_obj
class MixchIE(InfoExtractor):
IE_NAME = 'mixch'
_VALID_URL = r'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
_TESTS = [{
... | @@ -1,5 +1,6 @@
from .common import InfoExtractor
-from ..utils import UserNotLive, traverse_obj
+from ..utils import UserNotLive | yt_dlp/extractor/mixch.py | 2 | Python | 0.643 | suggestion | 64 | 27 | 27 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
'ext': 'mp4',
'title': '96NEKO SHOW TIME',
}
}, {
'url': 'https://mixch.tv/archive/1213',
'skip': 'paid video, no DRM. expires at Dec 31, 2023',
'info_dict': {
'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲... | I'd use `try/except` here instead in case the response body is not valid JSON (current code would raise a JSONDecodeError instead of raising for login required) | 'id': '421',
'ext': 'mp4',
'title': '96NEKO SHOW TIME',
}
}, {
'url': 'https://mixch.tv/archive/1213',
'skip': 'paid video, no DRM. expires at Dec 31, 2023',
'info_dict': {
'id': '1213',
'ext': 'mp4',
'title': '【... | @@ -60,22 +61,38 @@ class MixchArchiveIE(InfoExtractor):
'skip': 'paid video, no DRM. expires at Jan 23',
'info_dict': {
'id': '421',
+ 'ext': 'mp4',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip':... | yt_dlp/extractor/mixch.py | 26 | Python | 0.714 | suggestion | 160 | 36 | 37 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'live_status': 'not_live',
'release_date': '20231201',
'thumbnail': str,
}
}, {
'url': 'https://mixch.tv/archive/1214',
'only_matching':... | IMO probably better to not return anything for `live_status` if we're not sure of the accuracy of `not_live` | 'info_dict': {
'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'release_date': '20231201',
'thumbnail': str,
}
}, {
'url': 'https://mixch.tv/archive/1214',
'only_matching': True,
}]
... | @@ -60,22 +61,38 @@ class MixchArchiveIE(InfoExtractor):
'skip': 'paid video, no DRM. expires at Jan 23',
'info_dict': {
'id': '421',
+ 'ext': 'mp4',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip':... | yt_dlp/extractor/mixch.py | 26 | Python | 0.571 | suggestion | 108 | 29 | 30 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'skip': 'paid video, no DRM. expires at Dec 31, 2023',
'info_dict': {
'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'release_date': '20231201',
'thumbnail': str,
}
}, {
'url': 'https://m... | I'm not sure about expecting a 404... if the endpoint changes/breaks, we'd wanna get a report about it. I'd keep it simple and do this:
```suggestion
try:
info_json = self._download_json(
f'https://mixch.tv/api-web/archive/{video_id}', video_id)['archive']
except Extract... | 'skip': 'paid video, no DRM. expires at Dec 31, 2023',
'info_dict': {
'id': '1213',
'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'release_date': '20231201',
'thumbnail': str,
}
}, {
'url': 'https://m... | @@ -60,22 +62,42 @@ class MixchArchiveIE(InfoExtractor):
'skip': 'paid video, no DRM. expires at Jan 23',
'info_dict': {
'id': '421',
+ 'ext': 'mp4',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip':... | yt_dlp/extractor/mixch.py | 26 | Python | 1 | refactor | 476 | 35 | 31 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
}
}, {
'url': 'https://mixch.tv/archive/1214',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
try:
info_json = self._download_json(
f'https://mixch.tv/api-web/archive/{video_id}', video_id)
... | and with the `info_json = self._download_json(...)['archive']` change above we can simplify down here
```suggestion
'id': video_id,
'title': traverse_obj(info_json, ('title', {str})),
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
'thumbnai... | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import ExtractorError, UserNotLive, url_or_none
from ..utils.traversal import traverse_obj
class MixchIE(InfoExtractor):
IE_NAME = 'mixch'
_VALID_URL = r'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
_TESTS = [{
... | @@ -60,22 +62,42 @@ class MixchArchiveIE(InfoExtractor):
'skip': 'paid video, no DRM. expires at Jan 23',
'info_dict': {
'id': '421',
+ 'ext': 'mp4',
'title': '96NEKO SHOW TIME',
}
+ }, {
+ 'url': 'https://mixch.tv/archive/1213',
+ 'skip':... | yt_dlp/extractor/mixch.py | 26 | Python | 0.857 | refactor | 386 | 28 | 100 | false | [ie/mixch] Fix info extraction for archives | 8,761 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
list) or []):
tbrs = variadic(
traverse_obj(
tlb, ('toggleButtonRenderer', ...),
('segmentedLikeDislikeButtonRenderer', ..., 'toggleButtonRenderer')))
for tbr in tbrs:
for getter, ... | extracting metadata such as `like_count` should be completely non-fatal, so we want to use `traverse_obj` and `parse_count`
```suggestion
info['like_count'] = traverse_obj(vpir, (
'videoActions', 'menuRenderer', 'topLevelButtons', ...,
'segmentedLikeDislikeButtonViewModel... | list) or []):
tbrs = variadic(
traverse_obj(
tlb, ('toggleButtonRenderer', ...),
('segmentedLikeDislikeButtonRenderer', ..., 'toggleButtonRenderer')))
for tbr in tbrs:
for getter, ... | @@ -4480,14 +4480,15 @@ def process_language(container, base_url, lang_code, sub_name, query):
if mobj:
info[mobj.group('type') + '_count'] = str_to_int(mobj.group('count'))
break
- sbr_tooltip = try_get(
- ... | yt_dlp/extractor/youtube.py | 26 | Python | 0.857 | refactor | 554 | 51 | 51 | false | fixed key error for like_count | 8,763 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pandeyganesha |
import re
import json
from datetime import datetime, timezone
from .common import InfoExtractor
class RinseFMIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>.+)'
_TESTS = [{
'url': 'https://rinse.fm/episodes/cameo-blush-01-09-2023-2300/',
'md5': '9284abbd785e6b8... | ```suggestion
info = self._search_nextjs_data(webpage, video_id)
``` | from .common import InfoExtractor
from ..utils import format_field, parse_iso8601
class RinseFMIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://rinse.fm/episodes/club-glow-15-12-2023-2000/',
'md5': '76ee0b719315617df42e15e710f... | @@ -0,0 +1,45 @@
+import re
+import json
+from datetime import datetime, timezone
+
+from .common import InfoExtractor
+
+
+class RinseFMIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>.+)'
+ _TESTS = [{
+ 'url': 'https://rinse.fm/episodes/cameo-blush-01-09-2023-2300/',
+ ... | yt_dlp/extractor/rinsefm.py | 26 | Python | 0.571 | suggestion | 78 | 46 | 34 | false | [RinseFM] Add extractor | 8,778 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | hashFactory |
from datetime import datetime, timezone
from .common import InfoExtractor
class RinseFMIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>.+)'
_TESTS = [{
'url': 'https://rinse.fm/episodes/cameo-blush-01-09-2023-2300/',
'md5': '9284abbd785e6b86e67d1cdca6224feb',
... | We don't want to match query/fragment/etc
```suggestion
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>[^/?#]+)'
``` | from .common import InfoExtractor
from ..utils import format_field, parse_iso8601
class RinseFMIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://rinse.fm/episodes/club-glow-15-12-2023-2000/',
'md5': '76ee0b719315617df42e15e710f... | @@ -0,0 +1,44 @@
+from datetime import datetime, timezone
+
+from .common import InfoExtractor
+
+
+class RinseFMIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>.+)' | yt_dlp/extractor/rinsefm.py | 7 | Python | 0.714 | suggestion | 136 | 32 | 32 | false | [RinseFM] Add extractor | 8,778 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hashFactory |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
info = self._search_nextjs_data(webpage, video_id)
entry = info['props']['pageProps']['entry']
track_id = entry['id']
title = entry['title']
... | - inline metadata extraction in the return when you are able to
- metadata extraction should be non-fatal; use `.get()` (when it is actually non-fatal) or use the `traverse_obj()` util func (instead of chaining `.get()`s)
- use helper funcs like `parse_iso8601` or `unified_timestamp` (import from utils) instead of `d... | from .common import InfoExtractor
from ..utils import format_field, parse_iso8601
class RinseFMIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://rinse.fm/episodes/club-glow-15-12-2023-2000/',
'md5': '76ee0b719315617df42e15e710f... | @@ -0,0 +1,44 @@
+from datetime import datetime, timezone
+
+from .common import InfoExtractor
+
+
+class RinseFMIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>.+)'
+ _TESTS = [{
+ 'url': 'https://rinse.fm/episodes/cameo-blush-01-09-2023-2300/',
+ 'md5': '9284abbd78... | yt_dlp/extractor/rinsefm.py | 26 | Python | 0.857 | refactor | 987 | 27 | 34 | false | [RinseFM] Add extractor | 8,778 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hashFactory |
from .common import InfoExtractor
from ..utils import (
parse_iso8601,
format_field,
)
class RinseFMIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://rinse.fm/episodes/cameo-blush-01-09-2023-2300/',
'md5': '9284abbd785e... | ```suggestion
from ..utils import format_field, parse_iso8601
``` | from .common import InfoExtractor
from ..utils import format_field, parse_iso8601
class RinseFMIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://rinse.fm/episodes/club-glow-15-12-2023-2000/',
'md5': '76ee0b719315617df42e15e710f... | @@ -0,0 +1,36 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ format_field,
+) | yt_dlp/extractor/rinsefm.py | 5 | Python | 0.571 | suggestion | 67 | 30 | 30 | false | [RinseFM] Add extractor | 8,778 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hashFactory |
'ext': 'mp4',
'title': '145. Sitzung vom 15.12.2023, TOP 24 Barrierefreiheit',
'description': 'md5:321a9dc6bdad201264c0045efc371561',
},
}, {
'url': 'https://www.bundestag.de/mediathek?videoid=7602120&url=L21lZGlhdGhla292ZXJsYXk=&mod=mediathek',
'info_dict... | `lang` capture groups are not used, `channels` too | 'ext': 'mp4',
'title': '145. Sitzung vom 15.12.2023, TOP 24 Barrierefreiheit',
'description': 'md5:321a9dc6bdad201264c0045efc371561',
},
}, {
'url': 'https://www.bundestag.de/mediathek?videoid=7602120&url=L21lZGlhdGhla292ZXJsYXk=&mod=mediathek',
'info_dict... | @@ -0,0 +1,127 @@
+import re
+from functools import partial
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ bug_reports_message,
+ clean_html,
+ format_field,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse... | yt_dlp/extractor/bundestag.py | 26 | Python | 0.429 | suggestion | 50 | 51 | 51 | false | [ie/bundestag] Add extractor | 8,783 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
'format_id': name,
'url': url,
'vcodec': 'none',
**traverse_obj(match, {
'acodec': 'codec',
'abr': ('bitrate', {int_or_none}),
'ext': 'ext',
}),
}
for name, ur... | ```suggestion
for name, url in share_data.items():
if not isinstance(name, str) or not url_or_none(url):
continue
elif name.startswith('audio'):
match = re.search(self._SHARE_AUDIO_REGEX, url)
yield {
'format_id... | 'format_id': name,
'url': url,
'vcodec': 'none',
**traverse_obj(match, {
'acodec': 'codec',
'audio_channels': ('channels', {{'mono': 1, 'stereo': 2}.get}),
'abr': ('bit... | @@ -0,0 +1,127 @@
+import re
+from functools import partial
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ bug_reports_message,
+ clean_html,
+ format_field,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse... | yt_dlp/extractor/bundestag.py | 26 | Python | 0.786 | suggestion | 1,203 | 51 | 51 | false | [ie/bundestag] Add extractor | 8,783 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
'width': ('width', {int_or_none}),
'height': ('height', {int_or_none}),
'ext': 'ext',
}),
}
def _real_extract(self, url):
video_id = self._match_id(url)
formats = []
result = {'id': video_id, 'formats': ... | ```suggestion
metadata_overlay_html = self._download_webpage(
self._OVERLAY_URL, video_id,
query={'videoid': video_id, 'view': 'main'},
note='Downloading metadata overlay', fatal=False) or ''
if metadata_overlay_html.strip():
``` | 'ext': 'ext',
}),
}
def _real_extract(self, url):
video_id = self._match_id(url)
formats = []
result = {'id': video_id, 'formats': formats}
try:
formats.extend(self._extract_m3u8_formats(
self._... | @@ -0,0 +1,127 @@
+import re
+from functools import partial
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ bug_reports_message,
+ clean_html,
+ format_field,
+ get_element_text_and_html_by_tag,
+ int_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse... | yt_dlp/extractor/bundestag.py | 26 | Python | 0.786 | suggestion | 287 | 37 | 33 | false | [ie/bundestag] Add extractor | 8,783 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
from .common import InfoExtractor
from ..utils import format_field, parse_iso8601, traverse_obj
class RinseFMBaseIE(InfoExtractor):
@staticmethod
def _parse_entry(entry):
return {
**traverse_obj(entry, {
'id': ('id'),
'title': ('title'),
'url... | This would return `None` for `vcodec` instead of `'none'`.
```suggestion
return {
**traverse_obj(entry, {
'id': ('id', {str}),
'title': ('title', {str}),
'url': ('fileUrl', {url_or_none}),
'release_timestamp': ('episodeDate', {pa... | from .common import InfoExtractor
from ..utils import (
MEDIA_EXTENSIONS,
determine_ext,
parse_iso8601,
traverse_obj,
url_or_none,
)
class RinseFMBaseIE(InfoExtractor):
@staticmethod
def _parse_entry(entry):
return {
**traverse_obj(entry, {
'id': ('id', ... | @@ -1,8 +1,24 @@
from .common import InfoExtractor
-from ..utils import format_field, parse_iso8601
+from ..utils import format_field, parse_iso8601, traverse_obj
-class RinseFMIE(InfoExtractor):
+class RinseFMBaseIE(InfoExtractor):
+ @staticmethod
+ def _parse_entry(entry):
+ return {
+ **... | yt_dlp/extractor/rinsefm.py | 18 | Python | 0.857 | suggestion | 556 | 43 | 43 | false | [RinseFM] - Add: Artist episodes playlist | 8,794 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | SirElderling |
from .common import InfoExtractor
from ..utils import parse_iso8601, traverse_obj, url_or_none
class RinseFMBaseIE(InfoExtractor):
@staticmethod
def _parse_entry(entry):
return {
**traverse_obj(entry, {
'id': ('id', {str}),
'title': ('title', {str}),
... | since this method is being used by the playlist extractor but returning results for `RinseFMIE`, we need to set `extractor`, `extractor_key` and `webpage_url` in the result
```suggestion
@staticmethod
def _parse_entry(entry):
return {
**traverse_obj(entry, {
'id': ('id'... | from .common import InfoExtractor
from ..utils import (
MEDIA_EXTENSIONS,
determine_ext,
parse_iso8601,
traverse_obj,
url_or_none,
)
class RinseFMBaseIE(InfoExtractor):
@staticmethod
def _parse_entry(entry):
return {
**traverse_obj(entry, {
'id': ('id', ... | @@ -1,8 +1,24 @@
from .common import InfoExtractor
-from ..utils import format_field, parse_iso8601
+from ..utils import parse_iso8601, traverse_obj, url_or_none
-class RinseFMIE(InfoExtractor):
+class RinseFMBaseIE(InfoExtractor):
+ @staticmethod
+ def _parse_entry(entry):
+ return {
+ **t... | yt_dlp/extractor/rinsefm.py | 18 | Python | 0.857 | refactor | 915 | 43 | 43 | false | [RinseFM] - Add: Artist episodes playlist | 8,794 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
},
'playlist_mincount': 40
}, {
'url': 'https://rinse.fm/shows/ivy/',
'info_dict': {
'id': 'ivy',
'title': '[IVY]',
'description': 'A dedicated space for DNB/Turbo House and 4x4.'
},
'playlist_mincount': 7
}]
def _entries(s... | this should be more future-proof in case the site changes their audio encoding
import `MEDIA_EXTENSIONS` and `determine_ext` from utils
```suggestion
episodes = traverse_obj(
self._search_nextjs_data(webpage, playlist_id),
('props', 'pageProps', 'episodes', lambda _, v: determine_... |
class RinseFMArtistPlaylistIE(RinseFMBaseIE):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/shows/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://rinse.fm/shows/resources/',
'info_dict': {
'id': 'resources',
'title': '[re]sources',
'description': '[re]sources est... | @@ -22,12 +38,43 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, display_id)
entry = self._search_nextjs_data(webpage, display_id)['props']['pageProps']['entry']
- return {
- 'id': entry['id'],
- 'title': entry.get('title'),
- 'url': ent... | yt_dlp/extractor/rinsefm.py | 26 | Python | 0.857 | suggestion | 370 | 30 | 39 | false | [RinseFM] - Add: Artist episodes playlist | 8,794 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
return self._parse_entry(entry)
class RinseFMArtistPlaylistIE(RinseFMBaseIE):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/shows/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://rinse.fm/shows/resources/',
'info_dict': {
'id': 'resources',
'title': '[re]sources',
... | ```suggestion
def _entries(self, data):
for episode in traverse_obj(data, (
'props', 'pageProps', 'episodes', lambda _, v: determine_ext(v['fileUrl']) in MEDIA_EXTENSIONS.audio)
):
yield self._parse_entry(episode)
``` | return self._parse_entry(entry)
class RinseFMArtistPlaylistIE(RinseFMBaseIE):
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/shows/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://rinse.fm/shows/resources/',
'info_dict': {
'id': 'resources',
'title': '[re]sources',
... | @@ -22,12 +48,44 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, display_id)
entry = self._search_nextjs_data(webpage, display_id)['props']['pageProps']['entry']
- return {
- 'id': entry['id'],
- 'title': entry.get('title'),
- 'url': ent... | yt_dlp/extractor/rinsefm.py | 26 | Python | 0.786 | suggestion | 267 | 42 | 40 | false | [RinseFM] - Add: Artist episodes playlist | 8,794 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'info_dict': {
'id': 'ivy',
'title': '[IVY]',
'description': 'A dedicated space for DNB/Turbo House and 4x4.'
},
'playlist_mincount': 7
}]
def _entries(self, episodes):
for episode in episodes:
yield self._parse_entry(episode)
... | ```suggestion
description = self._og_search_description(webpage) or self._html_search_meta(
'description', webpage)
data = self._search_nextjs_data(webpage, playlist_id)
return self.playlist_result(
self._entries(data), playlist_id, title, description=description)
... | from .common import InfoExtractor
from ..utils import (
MEDIA_EXTENSIONS,
determine_ext,
parse_iso8601,
traverse_obj,
url_or_none,
)
class RinseFMBaseIE(InfoExtractor):
@staticmethod
def _parse_entry(entry):
return {
**traverse_obj(entry, {
'id': ('id', ... | @@ -22,12 +48,44 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, display_id)
entry = self._search_nextjs_data(webpage, display_id)['props']['pageProps']['entry']
- return {
- 'id': entry['id'],
- 'title': entry.get('title'),
- 'url': ent... | yt_dlp/extractor/rinsefm.py | 26 | Python | 0.786 | suggestion | 324 | 27 | 90 | false | [RinseFM] - Add: Artist episodes playlist | 8,794 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
self._search_json(r'window\.__INITIAL_(?:DATA|STATE)__\s*=', webpage, 'preload state', video_id, default={})
or self._search_nuxt_data(webpage, video_id, '__initialState', fatal=False, traverse=None))
video_data = traverse_obj(
initial_data, ('OgvVideo', 'epDetail'), ('UgcVid... | keep these as fallbacks unless you are sure they aren't relevant anymore. Often sites have slightly different page structures in diff countries. | initial_data = (
self._search_json(r'window\.__INITIAL_(?:DATA|STATE)__\s*=', webpage, 'preload state', video_id, default={})
or self._search_nuxt_data(webpage, video_id, '__initialState', fatal=False, traverse=None))
video_data = traverse_obj(
initial_data, ('OgvVide... | @@ -1929,9 +1920,9 @@ def _extract_video_metadata(self, url, video_id, season_id):
# XXX: webpage metadata may not accurate, it just used to not crash when video_data not found
return merge_dicts(
- self._parse_video_metadata(video_data), self._search_json_ld(webpage, video_id, fatal=Fals... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.357 | suggestion | 144 | 51 | 51 | false | [BiliBili] - Few adjustments to the ``BiliIntlIE`` class | 8,832 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | SirElderling |
if smuggled_data.get('title'):
return smuggled_data
webpage = self._download_webpage(url, video_id)
# Bstation layout
initial_data = (
self._search_json(r'window\.__INITIAL_(?:DATA|STATE)__\s*=', webpage, 'preload state', video_id, default={})
or self... | maybe always merge the json ld but default to dict to prevent unnecessary warnings in every log
```suggestion
}, self._search_json_ld(webpage, video_id, default={}))
``` | if smuggled_data.get('title'):
return smuggled_data
webpage = self._download_webpage(url, video_id)
# Bstation layout
initial_data = (
self._search_json(r'window\.__INITIAL_(?:DATA|STATE)__\s*=', webpage, 'preload state', video_id, default={})
or self... | @@ -1929,10 +1921,12 @@ def _extract_video_metadata(self, url, video_id, season_id):
# XXX: webpage metadata may not accurate, it just used to not crash when video_data not found
return merge_dicts(
- self._parse_video_metadata(video_data), self._search_json_ld(webpage, video_id, fatal=Fa... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.714 | suggestion | 184 | 51 | 51 | false | [BiliBili] - Few adjustments to the ``BiliIntlIE`` class | 8,832 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'title': '<Untitled Chapter 1>'
}, {
'start_time': 61.0,
'end_time': 134.0,
'title': 'Intro'
}, {
'start_time': 1290.0,
'end_time': 1379.0,
'title': 'Outro'
}],
},
... | ```suggestion
'thumbnail': r're:https://pic\.bstarstatic\.(?:com|net)/ugc/f6c363659efd2eabe5683fbb906b1582\.jpg',
``` | 'title': '<Untitled Chapter 1>'
}, {
'start_time': 61.0,
'end_time': 134.0,
'title': 'Intro'
}, {
'start_time': 1290.0,
'end_time': 1379.0,
'title': 'Outro'
}],
},
... | @@ -1864,9 +1856,9 @@ class BiliIntlIE(BiliIntlBaseIE):
'description': 'md5:693b6f3967fb4e7e7764ea817857c33a',
'timestamp': 1667891924,
'upload_date': '20221108',
- 'title': 'That Time I Got Reincarnated as a Slime: Scarlet Bond - Official Trailer 3| AnimeStan - Bstatio... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.714 | suggestion | 131 | 51 | 51 | false | [BiliBili] - Few adjustments to the ``BiliIntlIE`` class | 8,832 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
media_data = self._download_json(
'https://www.jiosaavn.com/api.php', audio_id, f'Downloading format info for {bitrate}',
fatal=False, data=urlencode_postdata({
'__call': 'song.generateAuthToken',
'_format': 'json',
... | These are formats of a single video/audio entry, and not different videos of a playlist.
We can also add more metadata.
```suggestion
formats.append({
'url': media_data['auth_url'],
'ext': media_data.get('type'),
'format_id': bitrate,
'a... | def _real_extract(self, url):
audio_id = self._match_id(url)
extract_bitrates = self._configuration_arg('bitrate', ['128', '320'], ie_key='JioSaavn')
if invalid_bitrates := [br for br in extract_bitrates if br not in self._VALID_BITRATES]:
raise ValueError(
f'Inva... | @@ -36,29 +36,39 @@ class JioSaavnSongIE(JioSaavnBaseIE):
def _real_extract(self, url):
audio_id = self._match_id(url)
song_data = self._extract_initial_data(url, audio_id)['song']['song']
- media_data = self._download_json(
- 'https://www.jiosaavn.com/api.php', audio_id, data=u... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.929 | security | 944 | 49 | 51 | false | Update jiosaavn.py | 8,834 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | alien-developers |
'init json', audio_id, transform_source=js_to_json)
class JioSaavnSongIE(JioSaavnBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.jiosaavn.com/song/leja-re/OQsEfQFVUXk',
'md5... | The idea here was that we don't request all bitrates in order to speed up downloading, and instead allow the user to extract additional formats if they so desire. I would also add a check to see if the provided bitrate was valid (the server returns a file, regardless of what you request) and change the order:
```sugge... | r'window\.__INITIAL_DATA__\s*=', webpage,
'init json', audio_id, transform_source=js_to_json)
class JioSaavnSongIE(JioSaavnBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://ww... | @@ -36,29 +36,39 @@ class JioSaavnSongIE(JioSaavnBaseIE):
def _real_extract(self, url):
audio_id = self._match_id(url)
song_data = self._extract_initial_data(url, audio_id)['song']['song']
- media_data = self._download_json(
- 'https://www.jiosaavn.com/api.php', audio_id, data=u... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 1 | refactor | 799 | 51 | 51 | false | Update jiosaavn.py | 8,834 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | alien-developers |
'id': 'OQsEfQFVUXk',
'ext': 'mp3',
'title': 'Leja Re',
'album': 'Leja Re',
'thumbnail': 'https://c.saavncdn.com/258/Leja-Re-Hindi-2018-20181124024539-500x500.jpg',
},
}, {
'url': 'https://www.saavn.com/s/song/hindi/Saathiya/O-Humdum-Suniyo-... | With the changes from above, this line should be removed.
```suggestion
``` | 'info_dict': {
'id': 'OQsEfQFVUXk',
'ext': 'mp4',
'title': 'Leja Re',
'album': 'Leja Re',
'thumbnail': 'https://c.saavncdn.com/258/Leja-Re-Hindi-2018-20181124024539-500x500.jpg',
'duration': 205,
'view_count': int,
'... | @@ -36,29 +36,39 @@ class JioSaavnSongIE(JioSaavnBaseIE):
def _real_extract(self, url):
audio_id = self._match_id(url)
song_data = self._extract_initial_data(url, audio_id)['song']['song'] | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.643 | suggestion | 77 | 51 | 51 | false | Update jiosaavn.py | 8,834 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | alien-developers |
'_format': 'json',
'bitrate': bitrate,
'url': song_data['encrypted_media_url'],
}))
if not media_data.get('auth_url'):
self.report_warning(f'Unable to extract format info for {bitrate}')
continue
... | Are you sure this is correct? From what I can see, playlists work differently than albums.
A test would also need to be added. | raise ValueError(
f'Invalid bitrate(s): {", ".join(invalid_bitrates)}. '
+ f'Valid bitrates are: {", ".join(self._VALID_BITRATES)}')
song_data = self._extract_initial_data(url, audio_id)['song']['song']
formats = []
for bitrate in extract_bitrates:
... | @@ -36,29 +36,39 @@ class JioSaavnSongIE(JioSaavnBaseIE):
def _real_extract(self, url):
audio_id = self._match_id(url)
song_data = self._extract_initial_data(url, audio_id)['song']['song']
- media_data = self._download_json(
- 'https://www.jiosaavn.com/api.php', audio_id, data=u... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.357 | suggestion | 127 | 45 | 51 | false | Update jiosaavn.py | 8,834 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | alien-developers |
return self._search_json(
r'window\.__INITIAL_DATA__\s*=', webpage,
'init json', audio_id, transform_source=js_to_json)
class JioSaavnSongIE(JioSaavnBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
_TES... | ```suggestion
_VALID_BITRATES = ('16', '32', '64', '128', '320')
def _real_extract(self, url):
``` | return self._search_json(
r'window\.__INITIAL_DATA__\s*=', webpage,
'init json', audio_id, transform_source=js_to_json)
class JioSaavnSongIE(JioSaavnBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
_TES... | @@ -35,24 +39,42 @@ class JioSaavnSongIE(JioSaavnBaseIE):
def _real_extract(self, url): | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.786 | refactor | 113 | 51 | 51 | false | Update jiosaavn.py | 8,834 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | alien-developers |
class JioSaavnSongIE(JioSaavnBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.jiosaavn.com/song/leja-re/OQsEfQFVUXk',
'md5': '3b84396d15ed9e083c3106f1fa589c04',
'info_dict': {
... | ```suggestion
extract_bitrates = self._configuration_arg('bitrate', ['128', '320'], ie_key='JioSaavn')
if invalid_bitrates := [br for br in extract_bitrates if br not in self._VALID_BITRATES]:
raise ValueError(
f'Invalid bitrate(s): {", ".join(invalid_bitrates)}. '
... | class JioSaavnSongIE(JioSaavnBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.jiosaavn.com/song/leja-re/OQsEfQFVUXk',
'md5': '3b84396d15ed9e083c3106f1fa589c04',
'info_dict': {
... | @@ -35,24 +39,42 @@ class JioSaavnSongIE(JioSaavnBaseIE):
def _real_extract(self, url):
audio_id = self._match_id(url)
- song_data = self._extract_initial_data(url, audio_id)['song']['song']
- media_data = self._download_json(
- 'https://www.jiosaavn.com/api.php', audio_id, data... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 1 | refactor | 395 | 51 | 51 | false | Update jiosaavn.py | 8,834 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | alien-developers |
raise ValueError(
f'Invalid bitrate(s): {", ".join(invalid_bitrates)}. '
+ f'Valid bitrates are: {", ".join(self._VALID_BITRATES)}')
song_data = self._extract_initial_data(url, audio_id)['song']['song']
formats = []
for bitrate in extract_bitrates:
... | ```suggestion
})
return {
``` | raise ValueError(
f'Invalid bitrate(s): {", ".join(invalid_bitrates)}. '
+ f'Valid bitrates are: {", ".join(self._VALID_BITRATES)}')
song_data = self._extract_initial_data(url, audio_id)['song']['song']
formats = []
for bitrate in extract_bitrates:
... | @@ -20,39 +21,63 @@ class JioSaavnSongIE(JioSaavnBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.jiosaavn.com/song/leja-re/OQsEfQFVUXk',
- 'md5': '7b1f70de088ede3a152ea34aece4df42',
+ ... | yt_dlp/extractor/jiosaavn.py | 26 | Python | 0.571 | suggestion | 54 | 51 | 51 | false | Update jiosaavn.py | 8,834 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | alien-developers |
}, {
'url': 'https://www.9news.com.au/national/outrage-as-parents-banned-from-giving-gifts-to-kindergarten-teachers/e19b49d4-a1a4-4533-9089-6e10e2d9386a',
'info_dict': {
'id': '6343716797112',
'ext': 'mp4',
'title': 'Outrage as parents banned from giving gifts to ... | ```suggestion
video_id = traverse_obj(
initial_state, ('videoIndex', 'currentVideo', 'brightcoveId', {str}),
('article', ..., 'media', lambda _, v: v['type'] == 'video', 'urn', {str}), get_all=False)
account = traverse_obj(initial_state, (
'videoIndex', 'config',... | }, {
'url': 'https://www.9news.com.au/national/outrage-as-parents-banned-from-giving-gifts-to-kindergarten-teachers/e19b49d4-a1a4-4533-9089-6e10e2d9386a',
'info_dict': {
'id': '6343716797112',
'ext': 'mp4',
'title': 'Outrage as parents banned from giving gifts to ... | @@ -0,0 +1,72 @@
+from .common import InfoExtractor
+from .brightcove import BrightcoveNewIE
+
+from ..utils import ExtractorError, traverse_obj
+
+
+class NineNewsIE(InfoExtractor):
+ IE_NAME = '9News'
+ _VALID_URL = r'https?://(?:www\.)?9news\.com\.au/\w+/(?:\w+/)?[^/]+/(?P<id>[^/]+)(?:$|[?#])'
+ _TESTS = [{... | yt_dlp/extractor/ninenews.py | 26 | Python | 0.929 | suggestion | 376 | 34 | 34 | false | [9News] Add Extractor | 8,840 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'thumbnail': 'md5:5ee4d66717bdd0dee9fc9a705ef041b8',
'duration': 91.307,
'timestamp': 1703229584,
'upload_date': '20231222',
'uploader_id': '664969388001',
'tags': ['networkclip', 'aunews_aunationalninenews', 'presents', 'teachers', 'kindergarten',... | ```suggestion
BrightcoveNewIE, video_id)
``` | 'thumbnail': 'md5:5ee4d66717bdd0dee9fc9a705ef041b8',
'duration': 91.307,
'timestamp': 1703229584,
'upload_date': '20231222',
'uploader_id': '664969388001',
'tags': ['networkclip', 'aunews_aunationalninenews', 'presents', 'teachers', 'kindergarten',... | @@ -0,0 +1,72 @@
+from .common import InfoExtractor
+from .brightcove import BrightcoveNewIE
+
+from ..utils import ExtractorError, traverse_obj
+
+
+class NineNewsIE(InfoExtractor):
+ IE_NAME = '9News'
+ _VALID_URL = r'https?://(?:www\.)?9news\.com\.au/\w+/(?:\w+/)?[^/]+/(?P<id>[^/]+)(?:$|[?#])'
+ _TESTS = [{... | yt_dlp/extractor/ninenews.py | 26 | Python | 0.571 | suggestion | 58 | 27 | 27 | false | [9News] Add Extractor | 8,840 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
from .common import InfoExtractor
from .brightcove import BrightcoveNewIE
from ..utils import ExtractorError, traverse_obj
class NineNewsIE(InfoExtractor):
IE_NAME = '9News'
_VALID_URL = r'https?://(?:www\.)?9news\.com\.au/\w+/(?:\w+/)?[^/]+/(?P<id>[^/]+)(?:$|[?#])'
_TESTS = [{
'url': 'https://ww... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?9news\.com\.au/(?:[\w-]+/){2,3}(?P<id>[\w-]+)/?(?:$|[?#])'
``` | from .common import InfoExtractor
from .brightcove import BrightcoveNewIE
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class NineNewsIE(InfoExtractor):
IE_NAME = '9News'
_VALID_URL = r'https?://(?:www\.)?9news\.com\.au/(?:[\w-]+/){2,3}(?P<id>[\w-]+)/?(?:$|[?#])'
_TESTS = [... | @@ -0,0 +1,72 @@
+from .common import InfoExtractor
+from .brightcove import BrightcoveNewIE
+
+from ..utils import ExtractorError, traverse_obj
+
+
+class NineNewsIE(InfoExtractor):
+ IE_NAME = '9News'
+ _VALID_URL = r'https?://(?:www\.)?9news\.com\.au/\w+/(?:\w+/)?[^/]+/(?P<id>[^/]+)(?:$|[?#])' | yt_dlp/extractor/ninenews.py | 9 | Python | 0.714 | suggestion | 116 | 34 | 34 | false | [9News] Add Extractor | 8,840 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
from .common import InfoExtractor
from .brightcove import BrightcoveNewIE
from ..utils import ExtractorError, traverse_obj
class NineNewsIE(InfoExtractor):
IE_NAME = '9News'
_VALID_URL = r'https?://(?:www\.)?9news\.com\.au/\w+/(?:\w+/)?[^/]+/(?P<id>[^/]+)(?:$|[?#])'
_TESTS = [{
'url': 'https://ww... | ```suggestion
from .common import InfoExtractor
from .brightcove import BrightcoveNewIE
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from .brightcove import BrightcoveNewIE
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class NineNewsIE(InfoExtractor):
IE_NAME = '9News'
_VALID_URL = r'https?://(?:www\.)?9news\.com\.au/(?:[\w-]+/){2,3}(?P<id>[\w-]+)/?(?:$|[?#])'
_TESTS = [... | @@ -0,0 +1,72 @@
+from .common import InfoExtractor
+from .brightcove import BrightcoveNewIE
+
+from ..utils import ExtractorError, traverse_obj | yt_dlp/extractor/ninenews.py | 4 | Python | 0.929 | refactor | 174 | 29 | 29 | false | [9News] Add Extractor | 8,840 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | SirElderling |
'duration': ('duration', {int_or_none}),
'episode_number': ('number', {int_or_none}),
'series': ('season', 'serial', 'title', {str_or_none}),
'thumbnails': ('images', ..., ..., {'url': ('url', {url_or_none})}),
})
info_dict['description'] = clean_html(dict... | Can't we just not match URLs that contain a date?
```suggestion
_VALID_URL = r'https?://vod\.tvp\.pl/(?P<category>[a-z\d-]+,\d+)/[a-z\d-]+(?<!-odcinki)(?:-odcinki,\d+/odcinek-\d+,S\d+E\d+)?,(?P<id>\d+)/?(?:[?#]|$)'
``` | 'thumbnails': ('images', ..., ..., {'url': ('url', {url_or_none})}),
})
info_dict['description'] = clean_html(dict_get(video, ('lead', 'description')))
if with_url:
info_dict.update({
'_type': 'url',
'url': video['webUrl'],
... | @@ -514,7 +525,7 @@ def _parse_video(self, video, with_url=True):
class TVPVODVideoIE(TVPVODBaseIE):
IE_NAME = 'tvp:vod'
- _VALID_URL = r'https?://vod\.tvp\.pl/[a-z\d-]+,\d+/[a-z\d-]+(?<!-odcinki)(?:-odcinki,\d+/odcinek-\d+,S\d+E\d+)?,(?P<id>\d+)(?:\?[^#]+)?(?:#.+)?$'
+ _VALID_URL = r'https?://vod\.tvp\.p... | yt_dlp/extractor/tvp.py | 26 | Python | 0.786 | suggestion | 225 | 51 | 51 | false | [extractor/tvp] fix live via vod | 8,860 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | selfisekai |
'thumbnail': 're:https?://.+',
},
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://vod.tvp.pl/live,1/tvp-world,399731',
'info_dict': {
'id': '399731',
'ext': 'mp4',
'title': r're:TVP WORLD \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
... | If we don't match URLs containing the date, we can do:
```suggestion
entity = 'lives' if category == 'live,1' else 'vods'
``` | },
}]
def _real_extract(self, url):
category, video_id = self._match_valid_url(url).group('category', 'id')
is_live = category == 'live,1'
entity = 'lives' if is_live else 'vods'
info_dict = self._parse_video(self._call_api(f'{entity}/{video_id}', video_id), with_url=Fa... | @@ -560,12 +571,30 @@ class TVPVODVideoIE(TVPVODBaseIE):
'thumbnail': 're:https?://.+',
},
'params': {'skip_download': 'm3u8'},
+ }, {
+ 'url': 'https://vod.tvp.pl/live,1/tvp-world,399731',
+ 'info_dict': {
+ 'id': '399731',
+ 'ext': 'mp4',
+ ... | yt_dlp/extractor/tvp.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 51 | false | [extractor/tvp] fix live via vod | 8,860 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | selfisekai |
query={'lang': 'pl', 'platform': 'BROWSER', **query},
expected_status=lambda x: is_valid(x) or 400 <= x < 500, **kwargs)
if is_valid(urlh.status):
return document
raise ExtractorError(f'Woronicza said: {document.get("code")} (HTTP {urlh.status})')
def _parse_vide... | I'm not familiar with the site, but by the looks of things, type `PROGRAMME` are the EPG entries. If we raise on date/don't even match date, is it even required to handle them here? Maybe I missed some other URL format that is also of the `PROGRAMME` type.
Could you also share an example of an upcoming/expired lives... | if is_valid(urlh.status):
return document
raise ExtractorError(f'Woronicza said: {document.get("code")} (HTTP {urlh.status})')
def _parse_video(self, video, with_url=True):
info_dict = traverse_obj(video, {
'id': ('id', {str_or_none}),
'title': 'title',
... | @@ -503,6 +506,14 @@ def _parse_video(self, video, with_url=True):
'thumbnails': ('images', ..., ..., {'url': ('url', {url_or_none})}),
})
info_dict['description'] = clean_html(dict_get(video, ('lead', 'description')))
+ if type_ in ('PROGRAMME', 'LIVE'):
+ now = datetim... | yt_dlp/extractor/tvp.py | 26 | Python | 0.786 | question | 326 | 51 | 51 | false | [extractor/tvp] fix live via vod | 8,860 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | selfisekai |
'thumbnail': 're:https?://.+',
'subtitles': 'count:2',
},
'params': {'skip_download': 'm3u8'},
}, {
'note': 'embed fails with "payment required"',
'url': 'https://vod.tvp.pl/seriale,18/polowanie-na-cmy-odcinki,390116/odcinek-7,S01E07,398869',
'info_dic... | Why is the date optional?
```suggestion
'title': r're:TVP WORLD \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
``` | 'thumbnail': 're:https?://.+',
'subtitles': 'count:2',
},
'params': {'skip_download': 'm3u8'},
}, {
'note': 'embed fails with "payment required"',
'url': 'https://vod.tvp.pl/seriale,18/polowanie-na-cmy-odcinki,390116/odcinek-7,S01E07,398869',
'info_dic... | @@ -560,12 +560,23 @@ class TVPVODVideoIE(TVPVODBaseIE):
'thumbnail': 're:https?://.+',
},
'params': {'skip_download': 'm3u8'},
+ }, {
+ 'url': 'https://vod.tvp.pl/live,1/tvp-world,399731',
+ 'info_dict': {
+ 'id': '399731',
+ 'ext': 'mp4',
+ ... | yt_dlp/extractor/tvp.py | 26 | Python | 0.714 | question | 114 | 51 | 51 | false | [extractor/tvp] fix live via vod | 8,860 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | selfisekai |
def _real_extract(self, url):
container = self._get_container(url)
stream = traverse_obj(container, ('media_container_streams', 0))
media = try_get(stream, lambda x: x['stream_media'][0])
if not media:
raise ExtractorError('Cannot extract media data', expected=True)
... | I think attempting to download the livestreams here is unexpected.
In my opinion, it would make more sense to handle this like the YouTube extractor:
`https://nuum.ru/channel/channel_name` - return all the tabs (the links below)
`https://nuum.ru/channel/channel_name/streams` - return all currently ongoing streams (n... |
video_id = str(container['media_container_id'])
is_live = media.get('media_status') == 'RUNNING'
formats, subtitles = None, None
if extract_formats:
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
media_url, video_id, 'mp4', live=is_live)
... | @@ -0,0 +1,133 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ try_get,
+)
+
+
+class NuumBaseIE(InfoExtractor):
+
+ def _fetch(self, path, video_id, description, query={}):
+ response = self._download_json(
+ ... | yt_dlp/extractor/nuum.py | 26 | Python | 0.786 | refactor | 555 | 51 | 51 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | DmitryScaletta |
_TESTS = [{
'url': 'https://nuum.ru/channel/mts_live',
'only_matching': True,
}]
def _get_container(self, url):
channel_name = self._match_id(url)
broadcast = self._fetch(
'broadcasts/public', video_id=channel_name, description='channel',
query={
... | As streams, videos, and clips have the same ID space and no code differences, I think they should be a single extractor.
If the channel extractor is changed to be for playlists, then some stuff should also be moved out of the base class/can be simplified. | 'duration': ('media_duration', {int_or_none}),
'thumbnail': ('media_meta', ('media_preview_archive_url', 'media_preview_url'), {url_or_none}),
}, get_all=False),
})
class NuumMediaIE(NuumBaseIE):
IE_NAME = 'nuum:media'
_VALID_URL = r'https?://nuum\.ru/(?:str... | @@ -0,0 +1,133 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ try_get,
+)
+
+
+class NuumBaseIE(InfoExtractor):
+
+ def _fetch(self, path, video_id, description, query={}):
+ response = self._download_json(
+ ... | yt_dlp/extractor/nuum.py | 26 | Python | 0.5 | refactor | 256 | 51 | 51 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | DmitryScaletta |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
parse_iso8601,
traverse_obj,
try_get,
)
class NuumBaseIE(InfoExtractor):
def _fetch(self, path, video_id, description, query={}):
response = self._download_json(
f'https://nuum.ru/api/v2/{... | Is this really expected?
```suggestion
raise ExtractorError(f'API returned error: {error!r}')
``` | import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
filter_dict,
int_or_none,
parse_iso8601,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class NuumBaseIE(InfoExtractor):
def _call_api(s... | @@ -0,0 +1,133 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ try_get,
+)
+
+
+class NuumBaseIE(InfoExtractor):
+
+ def _fetch(self, path, video_id, description, query={}):
+ response = self._download_json(
+ ... | yt_dlp/extractor/nuum.py | 20 | Python | 0.929 | refactor | 112 | 45 | 45 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | DmitryScaletta |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
parse_iso8601,
traverse_obj,
try_get,
)
class NuumBaseIE(InfoExtractor):
def _fetch(self, path, video_id, description, query={}):
response = self._download_json(
f'https://nuum.ru/api/v2/{... | `_call_api` is the convention
```suggestion
def _call_api(self, path, video_id, description, query={}):
``` | import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
filter_dict,
int_or_none,
parse_iso8601,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class NuumBaseIE(InfoExtractor):
def _call_api(s... | @@ -0,0 +1,133 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ try_get,
+)
+
+
+class NuumBaseIE(InfoExtractor):
+
+ def _fetch(self, path, video_id, description, query={}): | yt_dlp/extractor/nuum.py | 13 | Python | 0.714 | suggestion | 114 | 38 | 38 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | DmitryScaletta |
import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
int_or_none,
parse_iso8601,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class NuumBaseIE(InfoExtractor):
def _call_api(self, path, video... | ```suggestion
class NuumBaseIE(InfoExtractor):
def _call_api(self, path, video_id, description, query={}):
``` | import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
filter_dict,
int_or_none,
parse_iso8601,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class NuumBaseIE(InfoExtractor):
def _call_api(s... | @@ -0,0 +1,200 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UserNotLive,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class NuumBaseIE(InfoExtractor):
+
... | yt_dlp/extractor/nuum.py | 18 | Python | 0.786 | refactor | 117 | 43 | 43 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
int_or_none,
parse_iso8601,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class NuumBaseIE(InfoExtractor):
def _call_api(self, path, video... | would be worse to return `None` than `KeyError` here
```suggestion
return response['result']
``` | import functools
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
filter_dict,
int_or_none,
parse_iso8601,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class NuumBaseIE(InfoExtractor):
def _call_api(s... | @@ -0,0 +1,200 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UserNotLive,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class NuumBaseIE(InfoExtractor):
+
... | yt_dlp/extractor/nuum.py | 25 | Python | 0.857 | suggestion | 107 | 50 | 50 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
from ..utils.traversal import traverse_obj
class NuumBaseIE(InfoExtractor):
def _call_api(self, path, video_id, description, query={}):
response = self._download_json(
f'https://nuum.ru/api/v2/{path}', video_id, query=query,
note=f'Downloading {description} metadata',
... | if the idea is to make this non-fatal we should do this, yeah?
```suggestion
stream = traverse_obj(container, ('media_container_streams', 0, {dict})) or {}
media = traverse_obj(stream, ('stream_media', 0, {dict})) or {}
```
| )
from ..utils.traversal import traverse_obj
class NuumBaseIE(InfoExtractor):
def _call_api(self, path, video_id, description, query={}):
response = self._download_json(
f'https://nuum.ru/api/v2/{path}', video_id, query=query,
note=f'Downloading {description} metadata',
... | @@ -0,0 +1,200 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UserNotLive,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class NuumBaseIE(InfoExtractor):
+
... | yt_dlp/extractor/nuum.py | 26 | Python | 0.857 | suggestion | 245 | 51 | 51 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
m3u8_url, info = self._parse_video_data(video_data)
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
m3u8_url, video_id, 'mp4', live=info['is_live'])
info.update({
'formats': formats,
'subtitles': subtitles,
})
return info
cla... | I'd just do this since we don't want to continue extraction unless truthy
```suggestion
if not traverse_obj(channel_info, ('channel', 'channel_is_live')):
``` | 'concurrent_view_count': int,
'channel_id': '3320',
'channel': 'Misalelik',
'duration': 41,
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_data = self._call_api(f'media-containers/{video_id}', video_id, 'media')
... | @@ -0,0 +1,200 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UserNotLive,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class NuumBaseIE(InfoExtractor):
+
... | yt_dlp/extractor/nuum.py | 26 | Python | 0.786 | refactor | 169 | 51 | 51 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
class NuumTabIE(NuumBaseIE):
IE_NAME = 'nuum:tab'
_VALID_URL = r'https?://nuum\.ru/channel/(?P<id>[^/#?]+)/(?P<type>streams|videos|clips)'
_TESTS = [{
'url': 'https://nuum.ru/channel/dankon_/clips',
'info_dict': {
'id': 'dankon__clips',
'title': 'Dankon_',
},
... | have you tested what happens when the number of entries is exactly a multiple of 50? when we request the next page then is it just an empty list? or do we need to add additional logic to handle an API error? | IE_NAME = 'nuum:tab'
_VALID_URL = r'https?://nuum\.ru/channel/(?P<id>[^/#?]+)/(?P<type>streams|videos|clips)'
_TESTS = [{
'url': 'https://nuum.ru/channel/dankon_/clips',
'info_dict': {
'id': 'dankon__clips',
'title': 'Dankon_',
},
'playlist_mincount': ... | @@ -0,0 +1,200 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UserNotLive,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class NuumBaseIE(InfoExtractor):
+
... | yt_dlp/extractor/nuum.py | 26 | Python | 0.571 | question | 207 | 51 | 51 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DmitryScaletta |
class NuumTabIE(NuumBaseIE):
IE_NAME = 'nuum:tab'
_VALID_URL = r'https?://nuum\.ru/channel/(?P<id>[^/#?]+)/(?P<type>streams|videos|clips)'
_TESTS = [{
'url': 'https://nuum.ru/channel/dankon_/clips',
'info_dict': {
'id': 'dankon__clips',
'title': 'Dankon_',
}... | I think they store clips and videos indefinitely, but streams are stored only for two weeks.
So this test wont pass after two weeks. |
class NuumTabIE(NuumBaseIE):
IE_NAME = 'nuum:tab'
_VALID_URL = r'https?://nuum\.ru/channel/(?P<id>[^/#?]+)/(?P<type>streams|videos|clips)'
_TESTS = [{
'url': 'https://nuum.ru/channel/dankon_/clips',
'info_dict': {
'id': 'dankon__clips',
'title': 'Dankon_',
},... | @@ -0,0 +1,200 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UserNotLive,
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class NuumBaseIE(InfoExtractor):
+
... | yt_dlp/extractor/nuum.py | 26 | Python | 0.357 | suggestion | 133 | 51 | 51 | false | [NUUM] Add extractors | 8,868 | yt-dlp/yt-dlp | 132,642 | Python | DmitryScaletta | DmitryScaletta |
_TESTS = [{
'url': 'https://www.facebook.com/reel/1195289147628387',
'md5': 'f13dd37f2633595982db5ed8765474d3',
'info_dict': {
'id': '1195289147628387',
'ext': 'mp4',
'title': 'md5:b05800b5b1ad56c0ca78bd3807b6a61e',
'description': 'md5:22f0330... | ```suggestion
_VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library/?\?(?:[^#]+&)?id=(?P<id>\d+)'
```
are there other subdomains we need to match besides `www`? if so, tests should be added for them | IE_NAME = 'facebook:reel'
_TESTS = [{
'url': 'https://www.facebook.com/reel/1195289147628387',
'md5': 'f13dd37f2633595982db5ed8765474d3',
'info_dict': {
'id': '1195289147628387',
'ext': 'mp4',
'title': 'md5:b05800b5b1ad56c0ca78bd3807b6a61e',
... | @@ -889,3 +889,106 @@ def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
f'https://m.facebook.com/watch/?v={video_id}&_rdr', FacebookIE, video_id)
+
+
+class FacebookAdsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library... | yt_dlp/extractor/facebook.py | 26 | Python | 0.857 | suggestion | 214 | 51 | 51 | false | [ie/facebook] Support facebook.com/ads (Meta Ad Library) | 8,870 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'uploader_id': '100040874179269',
'duration': 9.579,
'timestamp': 1637502609,
'upload_date': '20211121',
'thumbnail': r're:^https?://.*',
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(... | `uploader_id` needs to be str, not int | 'uploader': 'md5:723e6cb3091241160f20b3c5dc282af1',
'uploader_id': '100040874179269',
'duration': 9.579,
'timestamp': 1637502609,
'upload_date': '20211121',
'thumbnail': r're:^https?://.*',
}
}]
def _real_extract(self, url):
... | @@ -889,3 +889,106 @@ def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
f'https://m.facebook.com/watch/?v={video_id}&_rdr', FacebookIE, video_id)
+
+
+class FacebookAdsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library... | yt_dlp/extractor/facebook.py | 26 | Python | 0.214 | suggestion | 38 | 51 | 51 | false | [ie/facebook] Support facebook.com/ads (Meta Ad Library) | 8,870 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'ext': 'mp4',
'title': 'video by Kandao',
'uploader': 'Kandao',
'uploader_id': 774114102743284,
'uploader_url': r're:^https?://.*',
'timestamp': 1702548330,
'thumbnail': r're:^https?://.*',
'upload_date': '20231214',
... | this entire method can just be `_real_extract()` instead | 'id': '899206155126718',
'ext': 'mp4',
'title': 'video by Kandao',
'uploader': 'Kandao',
'uploader_id': '774114102743284',
'uploader_url': r're:^https?://.*',
'timestamp': 1702548330,
'thumbnail': r're:^https?://.*',
... | @@ -889,3 +889,106 @@ def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
f'https://m.facebook.com/watch/?v={video_id}&_rdr', FacebookIE, video_id)
+
+
+class FacebookAdsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library... | yt_dlp/extractor/facebook.py | 26 | Python | 0.429 | refactor | 56 | 51 | 51 | false | [ie/facebook] Support facebook.com/ads (Meta Ad Library) | 8,870 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'uploader_url': r're:^https?://.*',
'timestamp': 1702548330,
'thumbnail': r're:^https?://.*',
'upload_date': '20231214',
'like_count': int,
}
}, {
'url': 'https://www.facebook.com/ads/library/?id=893637265423481',
'info_dict': {
... | The many/complex nested inner functions that `FacebookIE` has are not something that should emulated elsewhere, imo. It makes everything harder to read, harder to maintain, and impossible to override with plugins.
`extract_format` should be a method for the reasons above. `extract_metadata` is unnecessary -- its cod... | 'uploader_id': '774114102743284',
'uploader_url': r're:^https?://.*',
'timestamp': 1702548330,
'thumbnail': r're:^https?://.*',
'upload_date': '20231214',
'like_count': int,
}
}, {
'url': 'https://www.facebook.com/ads/library/?i... | @@ -889,3 +889,106 @@ def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
f'https://m.facebook.com/watch/?v={video_id}&_rdr', FacebookIE, video_id)
+
+
+class FacebookAdsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library... | yt_dlp/extractor/facebook.py | 26 | Python | 0.643 | refactor | 349 | 51 | 51 | false | [ie/facebook] Support facebook.com/ads (Meta Ad Library) | 8,870 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'like_count': int,
}
}, {
'url': 'https://www.facebook.com/ads/library/?id=893637265423481',
'info_dict': {
'id': '893637265423481',
'title': 'Jusqu\u2019\u00e0 -25% sur une s\u00e9lection de vins p\u00e9tillants italiens ',
'uploader': 'Eataly... | these keys should be in a class variable since they we are using them in multiple places and they need to be in sync | 'upload_date': '20231214',
'like_count': int,
}
}, {
'url': 'https://www.facebook.com/ads/library/?id=893637265423481',
'info_dict': {
'id': '893637265423481',
'title': 'Jusqu\u2019\u00e0 -25% sur une s\u00e9lection de vins p\u00e9tillants ital... | @@ -889,3 +889,106 @@ def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
f'https://m.facebook.com/watch/?v={video_id}&_rdr', FacebookIE, video_id)
+
+
+class FacebookAdsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library... | yt_dlp/extractor/facebook.py | 26 | Python | 0.429 | suggestion | 116 | 51 | 51 | false | [ie/facebook] Support facebook.com/ads (Meta Ad Library) | 8,870 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'like_count': int,
},
'playlist_count': 3,
}]
def _extract_from_url(self, url, video_id):
webpage = self._download_webpage(url, video_id)
def extract_metadata(webpage):
def extract_format(video_dict):
formats = []
for i, u... | watch line length, this is too long | 'upload_date': '20231226',
'like_count': int,
},
'playlist_count': 3,
}, {
'url': 'https://es-la.facebook.com/ads/library/?id=901230958115569',
'only_matching': True,
}, {
'url': 'https://m.facebook.com/ads/library/?id=901230958115569',
'on... | @@ -889,3 +889,106 @@ def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
f'https://m.facebook.com/watch/?v={video_id}&_rdr', FacebookIE, video_id)
+
+
+class FacebookAdsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library... | yt_dlp/extractor/facebook.py | 26 | Python | 0.071 | refactor | 35 | 51 | 51 | false | [ie/facebook] Support facebook.com/ads (Meta Ad Library) | 8,870 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
},
'playlist_count': 3,
}]
def _extract_from_url(self, url, video_id):
webpage = self._download_webpage(url, video_id)
def extract_metadata(webpage):
def extract_format(video_dict):
formats = []
for i, url in enumerate(
... | `{dict}` needs to be within the `snapshot` path | 'like_count': int,
},
'playlist_count': 3,
}, {
'url': 'https://es-la.facebook.com/ads/library/?id=901230958115569',
'only_matching': True,
}, {
'url': 'https://m.facebook.com/ads/library/?id=901230958115569',
'only_matching': True,
}]
_FORMAT... | @@ -889,3 +889,106 @@ def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
f'https://m.facebook.com/watch/?v={video_id}&_rdr', FacebookIE, video_id)
+
+
+class FacebookAdsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library... | yt_dlp/extractor/facebook.py | 26 | Python | 0.214 | suggestion | 47 | 51 | 51 | false | [ie/facebook] Support facebook.com/ads (Meta Ad Library) | 8,870 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
):
if url:
formats.append({
'format_id': ['sd-wmk', 'sd', 'hd-wmk', 'hd'][i],
'format_note': ['SD, watermarked', None, 'HD, watermarked', None][i],
'url': url,
... | use `traverse_obj()` and make everything non-fatal | 'video_sd_url': ('sd', None),
'watermarked_video_hd_url': ('hd-wmk', 'HD, watermarked'),
'video_hd_url': ('hd', None),
}
def _extract_formats(self, video_dict):
formats = []
for format_key, format_url in traverse_obj(video_dict, (
{dict.items}, lambda _, v: v... | @@ -889,3 +889,106 @@ def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
f'https://m.facebook.com/watch/?v={video_id}&_rdr', FacebookIE, video_id)
+
+
+class FacebookAdsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[\w-]+\.)?facebook\.com/ads/library... | yt_dlp/extractor/facebook.py | 26 | Python | 0.429 | suggestion | 50 | 51 | 51 | false | [ie/facebook] Support facebook.com/ads (Meta Ad Library) | 8,870 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
}]
def _real_extract(self, url):
valid_url = self._match_valid_url(url)
if not valid_url:
raise ExtractorError('Invalid URL found', expected=True)
webpage = self._download_webpage(url,
None,
... | Removed in my local version, but will commit / push after implementing possible review remarks. | 'duration': 1693
},
'skip': 'JWT expired',
}]
def _real_extract(self, url):
webpage = self._download_webpage(url, None, 'Downloading player page')
window_configs = self._search_json(
r'window\.configs\s*=', webpage, 'config', None)
video_id = str(... | @@ -0,0 +1,58 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class GetCourseRuIE(InfoExtractor):
+ _NETRC_MACHINE = 'getcourseru'
+ _VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
+
+ _TESTS = [{
+ 'url': 'http://player02.getcourse.ru/sign-player/?js... | yt_dlp/extractor/getcourseru.py | 26 | Python | 0.286 | suggestion | 95 | 40 | 51 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | divStar | divStar |
from .common import InfoExtractor
from ..utils import ExtractorError
class GetCourseRuIE(InfoExtractor):
_NETRC_MACHINE = 'getcourseru'
_VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
_TESTS = [{
'url': 'http://player02.getcourse.ru/sign-player/?json=eyJ2aWRlb19oYXNoIjoiZTJl... | URL is dynamic and is usually only valid for a few hours, after it's regenerated. Use `AcademyMelIE` to test this extractor in a much more user-friendly way. | import re
import time
import urllib.parse
from .common import InfoExtractor
from ..utils import ExtractorError, int_or_none, url_or_none, urlencode_postdata
from ..utils.traversal import traverse_obj
class GetCourseRuPlayerIE(InfoExtractor):
_VALID_URL = r'https?://player02\.getcourse\.ru/sign-player/?\?(?:[^#]+... | @@ -0,0 +1,58 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class GetCourseRuIE(InfoExtractor):
+ _NETRC_MACHINE = 'getcourseru'
+ _VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
+
+ _TESTS = [{
+ 'url': 'http://player02.getcourse.ru/sign-player/?js... | yt_dlp/extractor/getcourseru.py | 10 | Python | 0.571 | refactor | 157 | 35 | 35 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | divStar | divStar |
GabIE,
)
from .gaia import GaiaIE
from .gameinformer import GameInformerIE
from .gamejolt import (
GameJoltIE,
GameJoltUserIE,
GameJoltGameIE,
GameJoltGameSoundtrackIE,
GameJoltCommunityIE,
GameJoltSearchIE,
)
from .gamespot import GameSpotIE
from .gamestar import GameStarIE
from .gaskrank i... | also might want to consider naming this `GetCourseRuPlayerIE` if there are proper webpages that can be extracted from this site
```suggestion
from .getcourseru import GetCourseRuIE
``` | )
from .gaia import GaiaIE
from .gameinformer import GameInformerIE
from .gamejolt import (
GameJoltIE,
GameJoltUserIE,
GameJoltGameIE,
GameJoltGameSoundtrackIE,
GameJoltCommunityIE,
GameJoltSearchIE,
)
from .gamespot import GameSpotIE
from .gamestar import GameStarIE
from .gaskrank import Gaskr... | @@ -680,6 +681,9 @@
GeniusIE,
GeniusLyricsIE,
)
+from .getcourseru import (
+ GetCourseRuIE
+) | yt_dlp/extractor/_extractors.py | 26 | Python | 0.786 | refactor | 187 | 51 | 51 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
from .common import InfoExtractor
from ..utils import ExtractorError
class GetCourseRuIE(InfoExtractor):
_NETRC_MACHINE = 'getcourseru'
_VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
_TESTS = [{
'url': 'http://player02.getcourse.ru/sign-player/?json=eyJ2aWRlb19oYXNoIjoiZTJl... | the comments from the other extractor's `_VALID_URL` also apply here
```suggestion
_VALID_URL = r'https?://[^.]+\.getcourse\.ru/sign-player/\?json=(?P<id>[^#]+)'
``` | import re
import time
import urllib.parse
from .common import InfoExtractor
from ..utils import ExtractorError, int_or_none, url_or_none, urlencode_postdata
from ..utils.traversal import traverse_obj
class GetCourseRuPlayerIE(InfoExtractor):
_VALID_URL = r'https?://player02\.getcourse\.ru/sign-player/?\?(?:[^#]+... | @@ -0,0 +1,52 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class GetCourseRuIE(InfoExtractor):
+ _NETRC_MACHINE = 'getcourseru'
+ _VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$' | yt_dlp/extractor/getcourseru.py | 7 | Python | 0.786 | refactor | 172 | 32 | 32 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
_VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
_TESTS = [{
'url': 'http://player02.getcourse.ru/sign-player/?json=eyJ2aWRlb19oYXNoIjoiZTJlZWE3MTI5ZDk3OWQzYzYzMDYzMDUzOGJkMzZlZjEiLCJ1c2VyX2lkIjozNTc3NjY5NjIsInN1Yl9sb2dpbl91c2VyX2lkIjpudWxsLCJsZXNzb25faWQiOm51bGwsImlwIjoiNDYuMTQyLj... | this is all we need here
```suggestion
webpage = self._download_webpage(url, None, 'Downloading player page')
``` | from ..utils.traversal import traverse_obj
class GetCourseRuPlayerIE(InfoExtractor):
_VALID_URL = r'https?://player02\.getcourse\.ru/sign-player/?\?(?:[^#]+&)?json=[^#&]+'
_EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](?P<url>{_VALID_URL}[^\'"]*)']
_TESTS = [{
'url': 'http://player02.getcourse.ru/sign... | @@ -0,0 +1,52 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class GetCourseRuIE(InfoExtractor):
+ _NETRC_MACHINE = 'getcourseru'
+ _VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
+
+ _TESTS = [{
+ 'url': 'http://player02.getcourse.ru/sign-player/?js... | yt_dlp/extractor/getcourseru.py | 26 | Python | 0.714 | suggestion | 124 | 47 | 51 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
'note': 'This extractor is used by AcademyMel extractor, which has a login feature'
}]
def _real_extract(self, url):
valid_url = self._match_valid_url(url)
if not valid_url:
raise ExtractorError('Invalid URL found', expected=True)
webpage = self._download_webpage(u... | `video_id` and the m3u8 URL can (and should be) fatal
```suggestion
window_configs = self._search_json(
r'window\.configs\s*=', webpage, 'config', None)
video_id = str(window_configs['videoId'])
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
window_c... | 'thumbnail': 'https://preview-htz.kinescopecdn.net/preview/190bdf93f1b29735309853a7a19e24b3/preview.jpg?version=1702370546&host=vh-80',
'duration': 1693
},
'skip': 'JWT expired',
}]
def _real_extract(self, url):
webpage = self._download_webpage(url, None, 'Downlo... | @@ -0,0 +1,52 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class GetCourseRuIE(InfoExtractor):
+ _NETRC_MACHINE = 'getcourseru'
+ _VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
+
+ _TESTS = [{
+ 'url': 'http://player02.getcourse.ru/sign-player/?js... | yt_dlp/extractor/getcourseru.py | 26 | Python | 0.857 | refactor | 363 | 35 | 51 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
webpage = self._download_webpage(url,
None,
fatal=True,
note='Retrieving metadata...',
errnote='Failed to retrieve metadata')
window_confi... | you can use `traverse_obj` and type-check/transform the values
metadata extraction should not be fatal, use `yt_dlp.utils.int_or_none()` instead of `int()`
```suggestion
return {
**traverse_obj(window_configs, {
'title': ('videoHash', {str}),
'thubnail': ('thu... | window_configs = self._search_json(
r'window\.configs\s*=', webpage, 'config', None)
video_id = str(window_configs['gcFileId'])
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
window_configs['masterPlaylistUrl'], video_id)
return {
**tr... | @@ -0,0 +1,52 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class GetCourseRuIE(InfoExtractor):
+ _NETRC_MACHINE = 'getcourseru'
+ _VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
+
+ _TESTS = [{
+ 'url': 'http://player02.getcourse.ru/sign-player/?js... | yt_dlp/extractor/getcourseru.py | 26 | Python | 1 | refactor | 541 | 27 | 51 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
from .common import InfoExtractor
from ..utils import ExtractorError
class GetCourseRuIE(InfoExtractor):
_NETRC_MACHINE = 'getcourseru'
_VALID_URL = r'^https?:\/\/[^\/]+\.getcourse\.ru\/sign-player\/\?.*$'
_TESTS = [{
'url': 'http://player02.getcourse.ru/sign-player/?json=eyJ2aWRlb19oYXNoIjoiZTJl... | ```suggestion
from ..utils import ExtractorError, int_or_none, traverse_obj, url_or_none
``` | import re
import time
import urllib.parse
from .common import InfoExtractor
from ..utils import ExtractorError, int_or_none, url_or_none, urlencode_postdata
from ..utils.traversal import traverse_obj
class GetCourseRuPlayerIE(InfoExtractor):
_VALID_URL = r'https?://player02\.getcourse\.ru/sign-player/?\?(?:[^#]+... | @@ -0,0 +1,52 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError | yt_dlp/extractor/getcourseru.py | 2 | Python | 0.786 | refactor | 94 | 27 | 27 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
import re
import time
import urllib.parse
from .common import InfoExtractor
from ..utils import int_or_none, url_or_none, urlencode_postdata
from ..utils.traversal import traverse_obj
class GetCourseRuPlayerIE(InfoExtractor):
_VALID_URL = r'https?://player02\.getcourse\.ru/sign-player/?\?(?:[^#]+&)?json=[^#&]+'
... | ```suggestion
_EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](?P<url>{_VALID_URL}[^\'"]*)']
``` | import re
import time
import urllib.parse
from .common import InfoExtractor
from ..utils import ExtractorError, int_or_none, url_or_none, urlencode_postdata
from ..utils.traversal import traverse_obj
class GetCourseRuPlayerIE(InfoExtractor):
_VALID_URL = r'https?://player02\.getcourse\.ru/sign-player/?\?(?:[^#]+... | @@ -0,0 +1,181 @@
+import re
+import time
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import int_or_none, url_or_none, urlencode_postdata
+from ..utils.traversal import traverse_obj
+
+
+class GetCourseRuPlayerIE(InfoExtractor):
+ _VALID_URL = r'https?://player02\.getcourse\.ru/sign-playe... | yt_dlp/extractor/getcourseru.py | 23 | Python | 0.571 | suggestion | 96 | 48 | 48 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
'duration': 30
},
}],
'skip': 'paid lesson'
}, {
'url': 'https://gaismasmandalas.getcourse.io/ATLAUTSEVBUT',
'only_matching': True,
}]
_DOMAINS = [
'academymel.online',
'marafon.mani-beauty.com',
]
_BASE_URL_RE = rf'https?:/... | ```suggestion
r'<form[^>]+\bclass="[^"]*\bstate-login[^"]*"[^>]+\bdata-xdget-id="([^"]+)"',
``` | 'title': 'Мотивация к тренировкам',
},
'playlist_count': 1,
'playlist': [{
'info_dict': {
'id': '447479687',
'ext': 'mp4',
'title': 'Мотивация к тренировкам',
'thumbnail': 'https://preview-htz.vhcdn.com/previ... | @@ -0,0 +1,181 @@
+import re
+import time
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import int_or_none, url_or_none, urlencode_postdata
+from ..utils.traversal import traverse_obj
+
+
+class GetCourseRuPlayerIE(InfoExtractor):
+ _VALID_URL = r'https?://player02\.getcourse\.ru/sign-playe... | yt_dlp/extractor/getcourseru.py | 26 | Python | 0.714 | suggestion | 109 | 51 | 51 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
'url': 'https://gaismasmandalas.getcourse.io/ATLAUTSEVBUT',
'only_matching': True,
}]
_DOMAINS = [
'academymel.online',
'marafon.mani-beauty.com',
]
_BASE_URL_RE = rf'https?://(?:(?!player02\.)[^.]+\.getcourse\.(?:ru|io)|{"|".join(map(re.escape, _DOMAINS))})'
_VALID_U... | ```suggestion
r'window.requestSimpleSign\s*=\s*"([\da-f]+)"', webpage, 'simple sign')
```
or even better, this could be inlined below | 'id': '447479687',
'ext': 'mp4',
'title': 'Мотивация к тренировкам',
'thumbnail': 'https://preview-htz.vhcdn.com/preview/70ed5b9f489dd03b4aff55bfdff71a26/preview.jpg?version=1685115787&host=vh-71',
'duration': 30
},
}],
... | @@ -0,0 +1,181 @@
+import re
+import time
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import int_or_none, url_or_none, urlencode_postdata
+from ..utils.traversal import traverse_obj
+
+
+class GetCourseRuPlayerIE(InfoExtractor):
+ _VALID_URL = r'https?://player02\.getcourse\.ru/sign-playe... | yt_dlp/extractor/getcourseru.py | 26 | Python | 0.786 | suggestion | 148 | 51 | 51 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
self._request_webpage(
login_url, None, 'Logging in', 'Failed to log in',
data=urlencode_postdata({
'action': 'processXdget',
'xdgetId': xdget_id,
'params[action]': 'login',
'params[url]': login_url,
'params[... | should we add a msg explaining the netrc machine is the full hostname rather than `getcourseru`? | webpage, 'xdgetId'),
'params[action]': 'login',
'params[url]': login_url,
'params[object_type]': 'cms_page',
'params[object_id]': -1,
'params[email]': username,
'params[password]': password,
... | @@ -0,0 +1,181 @@
+import re
+import time
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import int_or_none, url_or_none, urlencode_postdata
+from ..utils.traversal import traverse_obj
+
+
+class GetCourseRuPlayerIE(InfoExtractor):
+ _VALID_URL = r'https?://player02\.getcourse\.ru/sign-playe... | yt_dlp/extractor/getcourseru.py | 26 | Python | 0.429 | question | 96 | 39 | 37 | false | [GetCourseRuIE] & [AcademyMel] Add extractor | 8,873 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | divStar |
'release_date': '20220108',
'release_timestamp': 1641672000,
'duration': 2789.38122,
'thumbnail': r're:^https?://content\.production\.cdn\.art19\.com/images/.*\.jpeg$'
}
}]
def _entries(self, containers):
for container in containers:
y... | How about:
```suggestion
urls = traverse_obj(
get_elements_html_by_class('iframeContainer', webpage),
(..., {extract_attributes}, lambda k, v: k == 'data-src' and Art19IE.suitable(v)))
return self.playlist_from_matches(urls, article_id, ie=Art19IE)
```
That way, we preve... | 'series_id': '3c30e8f4-ab48-415b-9421-1ae06cd4058b',
'upload_date': '20220108',
'timestamp': 1641656064,
'modified_date': '20230418',
'episode_id': '6beed803-b1ef-4536-9fef-c23cf6b4dcac',
'modified_timestamp': 1681843318,
... | @@ -0,0 +1,74 @@
+from .common import InfoExtractor
+from .art19 import Art19IE
+
+from ..utils import (
+ ExtractorError,
+ extract_attributes,
+ get_elements_html_by_class,
+ traverse_obj,
+)
+
+
+class RideHomeIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/techmeme-ride-hom... | yt_dlp/extractor/ridehome.py | 26 | Python | 0.857 | refactor | 393 | 27 | 49 | false | [RideHome] Add extractor | 8,875 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | SirElderling |
}
}, {
'url': 'https://www.ridehome.info/show/techmeme-ride-home/portfolio-profile-sensel-with-ilyarosenberg/',
'md5': 'bf9d6efad221008ce71aea09d5533cf6',
'info_dict': {
'id': '6beed803-b1ef-4536-9fef-c23cf6b4dcac',
'ext': 'mp3',
'title': '(Portfol... | Can be removed
```suggestion
``` | },
}],
}, {
'url': 'https://www.ridehome.info/show/techmeme-ride-home/portfolio-profile-sensel-with-ilyarosenberg/',
'info_dict': {
'id': 'portfolio-profile-sensel-with-ilyarosenberg',
},
'playlist_count': 1,
'playlist': [{
'md5': '... | @@ -0,0 +1,74 @@
+from .common import InfoExtractor
+from .art19 import Art19IE
+
+from ..utils import (
+ ExtractorError,
+ extract_attributes,
+ get_elements_html_by_class,
+ traverse_obj,
+)
+
+
+class RideHomeIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/techmeme-ride-hom... | yt_dlp/extractor/ridehome.py | 26 | Python | 0.5 | suggestion | 34 | 43 | 51 | false | [RideHome] Add extractor | 8,875 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | SirElderling |
from .common import InfoExtractor
from .art19 import Art19IE
from ..utils import (
ExtractorError,
extract_attributes,
get_elements_html_by_class,
traverse_obj,
)
class RideHomeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/techmeme-ride-home/(?P<id>[\w-]+)(?:/|$)'
_... | Other shows exist
```suggestion
_VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/[\w-]+/(?P<id>[\w-]+)/?(?:$|[?#])'
```
| from .art19 import Art19IE
from .common import InfoExtractor
from ..utils import extract_attributes, get_elements_html_by_class
from ..utils.traversal import traverse_obj
class RideHomeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/[\w-]+/(?P<id>[\w-]+)/?(?:$|[?#])'
_TESTS = [{
... | @@ -0,0 +1,74 @@
+from .common import InfoExtractor
+from .art19 import Art19IE
+
+from ..utils import (
+ ExtractorError,
+ extract_attributes,
+ get_elements_html_by_class,
+ traverse_obj,
+)
+
+
+class RideHomeIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/techmeme-ride-hom... | yt_dlp/extractor/ridehome.py | 13 | Python | 0.714 | suggestion | 133 | 38 | 38 | false | [RideHome] Add extractor | 8,875 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | SirElderling |
from .common import InfoExtractor
from .art19 import Art19IE
from ..utils import (
ExtractorError,
extract_attributes,
get_elements_html_by_class,
traverse_obj,
)
class RideHomeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/techmeme-ride-home/(?P<id>[\w-]+)(?:/|$)'
_... | ```suggestion
from .art19 import Art19IE
from .common import InfoExtractor
from ..utils import extract_attributes, get_elements_html_by_class
from ..utils.traversal import traverse_obj
``` | from .art19 import Art19IE
from .common import InfoExtractor
from ..utils import extract_attributes, get_elements_html_by_class
from ..utils.traversal import traverse_obj
class RideHomeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/[\w-]+/(?P<id>[\w-]+)/?(?:$|[?#])'
_TESTS = [{
... | @@ -0,0 +1,74 @@
+from .common import InfoExtractor
+from .art19 import Art19IE
+
+from ..utils import (
+ ExtractorError,
+ extract_attributes,
+ get_elements_html_by_class,
+ traverse_obj,
+) | yt_dlp/extractor/ridehome.py | 9 | Python | 0.786 | refactor | 193 | 34 | 34 | false | [RideHome] Add extractor | 8,875 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | SirElderling |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
get_element_by_id,
urljoin,
)
from ..compat import compat_parse_qs
class KukuluLiveIE(InfoExtractor):
_VALID_URL = r'https?://live\.erinn\.biz/live\.php\?h(?P<id>\d+)'
_TESTS = [{
'url': 'https://live.e... | Use
```suggestion
from urllib.parse import parse_qs
``` | import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
filter_dict,
get_element_by_id,
int_or_none,
join_nonempty,
js_to_json,
qualities,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class KukuluLiveIE(Info... | @@ -0,0 +1,125 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ get_element_by_id,
+ urljoin,
+)
+from ..compat import compat_parse_qs | yt_dlp/extractor/kukululive.py | 8 | Python | 0.643 | suggestion | 58 | 33 | 33 | false | [KukuluLive] Add extractor | 8,877 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | DmitryScaletta |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.