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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'title': 'title',
'description': ('text', {clean_html}),
'uploader': ('creator', 'title'),
'uploader_id': ('creator', 'id'),
'channel': ('channel', 'title'),
'channel_id': ('channel', 'id'),
'like_count': ('l... | `_` is matched by `\w`
```suggestion
_VALID_URL = r'https?://(?:(?:www|beta)\.)?floatplane\.com/channel/(?P<id>\w+)/home(?:/(?P<channel>\w+))?'
``` | 'description': ('text', {clean_html}),
'uploader': ('creator', 'title'),
'uploader_id': ('creator', 'id'),
'channel': ('channel', 'title'),
'channel_id': ('channel', 'id'),
'like_count': ('likes', {int_or_none}),
... | @@ -0,0 +1,268 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ format_field,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal impor... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.714 | suggestion | 154 | 51 | 51 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'id': 'ShankMods',
'title': 'Shank Mods',
'description': 'md5:6dff1bb07cad8e5448e04daad9be1b30',
},
'playlist_mincount': 14,
}, {
'url': 'https://beta.floatplane.com/channel/bitwit_ultra/home',
'info_dict': {
'id': 'bitwit_ultra',
... | ```suggestion
query=query, note=f'Downloading page {page + 1}')
``` | 'title': 'Shank Mods',
'description': 'md5:6dff1bb07cad8e5448e04daad9be1b30',
},
'playlist_mincount': 14,
}, {
'url': 'https://beta.floatplane.com/channel/bitwit_ultra/home',
'info_dict': {
'id': 'bitwit_ultra',
'title': 'Bitwit Ultra',... | @@ -0,0 +1,268 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ format_field,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal impor... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.571 | suggestion | 81 | 47 | 47 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
def _fetch_page(self, display_id, creator_id, channel_id, page):
query = {
'id': creator_id,
'limit': self._PAGE_SIZE,
'fetchAfter': page * self._PAGE_SIZE,
}
if channel_id:
query['channel'] = channel_id
page_data = self._download_json(... | extremely pedantic nitpick (sorry): the convention for filtering like this is `lamba _, v` as in `k, v`
```suggestion
creator_data, ('channels', lambda _, v: v['urlname'] == channel, {dict}), get_all=False) or {}
``` | query = {
'id': creator_id,
'limit': self._PAGE_SIZE,
'fetchAfter': page * self._PAGE_SIZE,
}
if channel_id:
query['channel'] = channel_id
page_data = self._download_json(
'https://www.floatplane.com/api/v3/content/creator', dis... | @@ -0,0 +1,268 @@
+import functools
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ clean_html,
+ determine_ext,
+ format_field,
+ int_or_none,
+ join_nonempty,
+ parse_codecs,
+ parse_iso8601,
+ urljoin,
+)
+from ..utils.traversal impor... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.786 | suggestion | 231 | 32 | 32 | false | [ie/floatplane] Add extractor | 8,639 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
#!/usr/bin/env python3
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL, report_warning
from yt_dlp.update import Updater, UpdateInfo
TEST_API_DATA = {
'yt-dlp/yt-dlp/latest': {
... | Why not just import from there? | #!/usr/bin/env python3
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL, report_warning
from yt_dlp.update import Updater, UpdateInfo
# XXX: Keep in sync with yt_dlp.update.UPDATE_SOURCES
T... | @@ -11,6 +11,14 @@
from test.helper import FakeYDL, report_warning
from yt_dlp.update import Updater, UpdateInfo
+
+# XXX: Keep in sync with yt_dlp.update.UPDATE_SOURCES
+TEST_UPDATE_SOURCES = {
+ 'stable': 'yt-dlp/yt-dlp',
+ 'nightly': 'yt-dlp/yt-dlp-nightly-builds',
+ 'master': 'yt-dlp/yt-dlp-master-buil... | test/test_update.py | 20 | Python | 0.071 | question | 31 | 45 | 45 | false | [core] Release workflow & Updater maintenance | 8,640 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
}
}, {
'url': 'https://embed.cloudycdn.services/izm/media/26e_lv-8-5-1',
'md5': '798828a479151e2444d8dcfbec76e482',
'info_dict': {
'id': '26e_lv-8-5-1',
'ext': 'mp4',
'title': 'LV-8-5-1',
'timestamp': 1669767167,
'thumbnail'... | Since we only need the URL, this can be simplified:
```suggestion
for url in traverse_obj(json, ('source', 'sources', ..., 'src', {url_or_none})):
fmts, subs = self._extract_m3u8_formats_and_subtitles(url, video_id)
``` | 'title': 'D23-6000-105_cetstud',
'thumbnail': 'https://store.cloudycdn.services/tmsp00060/assets/media/660858/placeholder1700589200.jpg',
}
}, {
'url': 'https://embed.cloudycdn.services/izm/media/26e_lv-8-5-1',
'md5': '798828a479151e2444d8dcfbec76e482',
'info_... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class CloudyCDNIE(InfoExtractor):
+ _VALID_URL = r'https?://embed\.cloudycdn\.services/(?P<site_id>[^/]+)/media/(?P<id>[^?]+)'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/cloudycdn.py | 26 | Python | 0.857 | refactor | 243 | 39 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'timestamp': 1700589151,
'duration': 1442,
'upload_date': '20231121',
'title': 'D23-6000-105_cetstud',
'thumbnail': 'https://store.cloudycdn.services/tmsp00060/assets/media/660858/placeholder1700589200.jpg',
}
}, {
'url': 'https://embed.clo... | The site sends URL encoded post data. If we want to replicate this, we should use:
```suggestion
video_id, data=urlencode_postdata({
'version': '6.4.0',
'referer': url,
}))
```
`urlencode_postdata` needs to be imported from `..utils` | 'id': '46k_d23-6000-105',
'ext': 'mp4',
'timestamp': 1700589151,
'duration': 1442,
'upload_date': '20231121',
'title': 'D23-6000-105_cetstud',
'thumbnail': 'https://store.cloudycdn.services/tmsp00060/assets/media/660858/placeholder17005... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class CloudyCDNIE(InfoExtractor):
+ _VALID_URL = r'https?://embed\.cloudycdn\.services/(?P<site_id>[^/]+)/media/(?P<id>[^?]+)'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/cloudycdn.py | 26 | Python | 0.857 | suggestion | 296 | 44 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'upload_date': '20221130',
}
}]
def _real_extract(self, url):
site_id, video_id = self._match_valid_url(url).group('site_id', 'id')
json = self._download_json(
f'https://player.cloudycdn.services/player/{site_id}/media/{video_id}/',
video_id, data=b'... | I would combine the metadata in to a single `traverse_obj` call:
```suggestion
'formats': formats,
'subtitles': subtitles,
**traverse_obj(json, {
'title': 'name',
'duration': ('duration', {int_or_none}),
'timestamp': ('upload_dat... | 'thumbnail': 'https://store.cloudycdn.services/tmsp00120/assets/media/488306/placeholder1679423604.jpg',
'duration': 1205,
'upload_date': '20221130',
}
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.tavaklase.lv/video/es-esmu-mina-um-2/',
'md5': '63074e8e6... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class CloudyCDNIE(InfoExtractor):
+ _VALID_URL = r'https?://embed\.cloudycdn\.services/(?P<site_id>[^/]+)/media/(?P<id>[^?]+)'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/cloudycdn.py | 26 | Python | 0.786 | suggestion | 430 | 28 | 47 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
traverse_obj,
url_or_none,
)
class CloudyCDNIE(InfoExtractor):
_VALID_URL = r'https?://embed\.cloudycdn\.services/(?P<site_id>[^/]+)/media/(?P<id>[^?]+)'
_TESTS = [{
'url': 'https://embed.cloudycdn.serv... | We should add embed detection so that sites like https://www.tavaklase.lv/video/es-esmu-mina-um-2/ also work. Please add a `_WEBPAGE_TESTS` for that page.
```suggestion
_VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/]+)/media/(?P<id>[\w-]+)'
_EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](... | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class CloudyCDNIE(InfoExtractor):
_VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/?#]+)/media/(?P<id>[\w-]+)'
... | @@ -0,0 +1,60 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class CloudyCDNIE(InfoExtractor):
+ _VALID_URL = r'https?://embed\.cloudycdn\.services/(?P<site_id>[^/]+)/media/(?P<id>[^?]+)' | yt_dlp/extractor/cloudycdn.py | 11 | Python | 0.857 | suggestion | 347 | 36 | 36 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'only_matching': True,
}, {
'url': 'https://radioteatris.lsm.lv/lv/embed/?id=176439&show=0&theme=white&size=16x9',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
player_d... | Are there any pages with multiple audio tracks?
Since we only need the URL we can also do:
```suggestion
for url in traverse_obj(media_json, ('audio', 0, 'sources', ..., 'file', {url_or_none})):
if url.endswith('.m3u8'):
formats.extend(self._extract_m3u8_formats(url, video_id))
... | 'title': 'Eriks Emanuels Šmits "Pilāta evaņģēlijs". 1. daļa',
'thumbnail': 'https://radioteatris.lsm.lv/public/assets/shows/62f131ae81e3c.jpg',
'duration': 3300,
},
}],
}, {
'url': 'https://radioteatris.lsm.lv/lv/embed/?id=&show=1269&theme=... | @@ -0,0 +1,242 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self, webpage):
+ return re.sub(r'Object\.create... | yt_dlp/extractor/lsm.py | 26 | Python | 0.857 | refactor | 389 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'tags': [],
'uploader_url': 'https://www.youtube.com/@LTV16plus',
'like_count': int,
'description': 'md5:7ff0c42ba971e3c13e4b8a2ff03b70b5',
}
}]
def _real_extract(self, url):
video_id = urllib.parse.unquote(self._match_id(url))
webpage = s... | Should an error be raised on an unsupported embed type? |
player_json = self._parse_json(
player_data, video_id, transform_source=js_to_json, fatal=False) or {}
media_json = self._parse_json(media_data, video_id, transform_source=js_to_json)
entries = []
for item in traverse_obj(media_json, (('audio', 'video'), lambda _, v: v['id'... | @@ -0,0 +1,242 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self, webpage):
+ return re.sub(r'Object\.create... | yt_dlp/extractor/lsm.py | 26 | Python | 0.429 | question | 55 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'info_dict': {
'id': '46k_d23-6000-105',
'ext': 'mp4',
'timestamp': 1700586300,
'duration': 1442,
'upload_date': '20231121',
'title': '4. studija. Zolitūdes traģēdija un Inčupes stacija',
'thumbnail': 'https://ltv.lsm.lv/storage... | Maybe like this instead?
```suggestion
return {
'_type': 'url_transparent',
'ie_key': 'LSMLTVEmbed',
'id': video_id,
**traverse_obj(json, ('article', {
'url': ('videoMediaItem', 'video', 'embed_id', {lambda x: x and f'https://ltv.lsm.lv/em... | 'ext': 'mp4',
'timestamp': 1700589151,
'duration': 1442,
'upload_date': '20231121',
'title': 'D23-6000-105_cetstud',
'thumbnail': 'https://store.cloudycdn.services/tmsp00060/assets/media/660858/placeholder1700589200.jpg',
}
}, {
... | @@ -0,0 +1,242 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self, webpage):
+ return re.sub(r'Object\.create... | yt_dlp/extractor/lsm.py | 26 | Python | 1 | suggestion | 512 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'title': '#138 Nepilnīgā kompensējamo zāļu sistēma pat mēnešiem dzenā pacientus pa aptiekām',
'thumbnail': 'https://pic.latvijasradio.lv/public/assets/media/9/d/large_fd4675ac.jpg',
'upload_date': '20231102',
'timestamp': 1698921060,
'description': 'md5:7bac3b... | ```suggestion
'id': video_id,
**traverse_obj(json, {
'url': ('playback', 'service', 'url', {url_or_none}),
'title': ('mediaItem', 'title'),
'description': ('mediaItem', ('lead', 'body')),
'duration': ('mediaItem', 'duration', ... | embed_url = traverse_obj(data, ('source', 'id', {str}))
else:
raise ExtractorError(f'Unsupported embed type {embed_type!r}')
return self.url_result(
embed_url, ie_key, video_id, **traverse_obj(data, {
'title': ('parentInfo', 'title'),
... | @@ -0,0 +1,242 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self, webpage):
+ return re.sub(r'Object\.create... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | suggestion | 524 | 28 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
video_id = urllib.parse.unquote(self._match_id(url))
webpage = self._download_webpage(url, video_id)
json = self._search_json(r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
embed_type = traverse_obj(json, ('source', 'name'))
embed_data = {}
if embed_t... | ```suggestion
**traverse_obj(json, {
'title': ('parentInfo', 'title'),
'duration': ('parentInfo', 'duration', {int_or_none}),
'thumbnail': ('source', 'poster', {url_or_none}),
}),
``` | for source_url in traverse_obj(item, ('sources', ..., 'file', {url_or_none})):
if determine_ext(source_url) == 'm3u8':
formats.extend(self._extract_m3u8_formats(source_url, video_id, fatal=False))
else:
formats.append({'url': source_url... | @@ -0,0 +1,242 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self, webpage):
+ return re.sub(r'Object\.create... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | suggestion | 261 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
for i, audio_json in enumerate(traverse_obj(media_json, ('audio', ...))):
formats = []
for source_url in traverse_obj(media_json, (('audio', 'video'), i, 'sources', ..., 'file', {url_or_none})):
if source_url.endswith('.m3u8'):
formats.extend(self._ext... | ```suggestion
return self.playlist_result(entries, video_id)
``` |
def _real_extract(self, url):
query = parse_qs(url)
video_id = traverse_obj(query, (
('show', 'id'), 0, {int_or_none}, {lambda x: x or None}, {str_or_none}), get_all=False)
webpage = self._download_webpage(url, video_id)
player_data, media_data = self._search_regex(
... | @@ -0,0 +1,305 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ traverse_obj,
+ url_or_none,
+ urljoin,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self,... | yt_dlp/extractor/lsm.py | 26 | Python | 0.571 | suggestion | 74 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'only_matching': True,
}, {
'url': 'https://lr1.lsm.lv/lv/pleijeris/?embed=0&id=48205&time=00%3A00&idx=0',
'only_matching': True,
}]
def _real_extract(self, url):
query = parse_qs(url)
video_id = traverse_obj(query, ('show', 0, {int_or_none}))
if video_id is... | Hmm. I'm not a huge fan of this logic, as it could quite easily break. For example, if the index of audio and video doesn't match, or if there is a video for which no audio track exists. Maybe just treating them as separate entries would be better?
```suggestion
for item in traverse_obj(media_json, (('audio',... | 'only_matching': True,
}, {
'url': 'https://lr2.lsm.lv/lv/embed/?id=182126&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://klasika.lsm.lv/lv/embed/?id=110806&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://... | @@ -0,0 +1,305 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ traverse_obj,
+ url_or_none,
+ urljoin,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self,... | yt_dlp/extractor/lsm.py | 26 | Python | 0.857 | suggestion | 460 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'only_matching': True,
}, {
'url': 'https://klasika.lsm.lv/lv/embed/?id=110806&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr4.lsm.lv/lv/embed/?id=184282&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://... | It will either be an `int` or `None`, so we can use `not` instead:
```suggestion
if not video_id:
``` | 'title': 'Krustpunktā Lielā intervija: Valsts prezidents Egils Levits',
'duration': 3222,
},
}, {
'md5': '5d5e191e718b7644e5118b7b4e093a6d',
'info_dict': {
'id': 'v303104',
'ext': 'mp4',
'thumbnai... | @@ -0,0 +1,305 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ traverse_obj,
+ url_or_none,
+ urljoin,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self,... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | suggestion | 112 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | Caesim404 |
embed_type = traverse_obj(json, ('source', 'name'))
if embed_type == 'telia':
embed_data = {
'ie_key': 'CloudyCDN',
'url': traverse_obj(json, ('source', 'embed_url', {url_or_none})),
}
elif embed_type == 'youtube':
embed_data ... | I think these should be `url_result`, same as `playlist_result` above | 'duration': 5269,
'upload_date': '20220514',
'age_limit': 0,
'channel': 'LTV_16plus',
'playable_in_embed': True,
'tags': [],
'uploader_url': 'https://www.youtube.com/@LTV16plus',
'like_count': int,
'description':... | @@ -0,0 +1,305 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ traverse_obj,
+ url_or_none,
+ urljoin,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self,... | yt_dlp/extractor/lsm.py | 26 | Python | 0.429 | suggestion | 69 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | Caesim404 |
import re
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
js_to_json,
parse_iso8601,
parse_qs,
traverse_obj,
url_or_none,
urljoin,
)
class LSMBaseIE(InfoExtractor):
def fix_nuxt_data(self, webpage):
return re.sub(r'O... | ```suggestion
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
``` | import re
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
js_to_json,
parse_iso8601,
parse_qs,
str_or_none,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class LSMLREmbedIE(InfoExtractor):... | @@ -0,0 +1,314 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ traverse_obj,
+ url_or_none,
+ urljoin,
+) | yt_dlp/extractor/lsm.py | 14 | Python | 0.571 | suggestion | 97 | 39 | 39 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
traverse_obj,
url_or_none,
urlencode_postdata,
)
class CloudyCDNIE(InfoExtractor):
_VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/]+)/media/(?P<id>[\w-]+)'
_EMBED_REGEX = [rf'<iframe... | ```suggestion
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class CloudyCDNIE(InfoExtractor):
_VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/?#]+)/media/(?P<id>[\w-]+)'
... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ traverse_obj,
+ url_or_none,
+ urlencode_postdata,
+) | yt_dlp/extractor/cloudycdn.py | 8 | Python | 0.714 | suggestion | 108 | 33 | 33 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
}, {
'url': 'https://klasika.lsm.lv/lv/embed/?id=110806&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr4.lsm.lv/lv/embed/?id=184282&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://pieci.lv/lv/embed/?id=168896&sh... | ```suggestion
video_id = traverse_obj(query, (('show', 'id'), 0, {int_or_none}), get_all=False)
```
Should an error be thrown if no video_id was found? | }, {
'url': 'https://lr2.lsm.lv/lv/embed/?id=182126&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://klasika.lsm.lv/lv/embed/?id=110806&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr4.lsm.lv/lv/embed/?id=184282&... | @@ -0,0 +1,314 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ traverse_obj,
+ url_or_none,
+ urljoin,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self,... | yt_dlp/extractor/lsm.py | 26 | Python | 0.929 | question | 162 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
webpage = self._download_webpage(url, video_id)
player_data, media_data = self._html_search_regex(
r'LR\.audio\.Player\s*\([^{]*(?P<player>\{.*?\}),(?P<media>\{.*\})\);',
webpage, 'player json', group=('player', 'media'))
player_json = self._parse_json(player_data, vid... | I would format like so, but not sure:
```suggestion
title = traverse_obj(
media_json, ('audio', lambda _, v: v['id'][1:] == id[1:], 'title',
{lambda x: x and f'{x} - Video Version'}), get_all=False)
``` | ('show', 'id'), 0, {int_or_none}, {lambda x: x or None}, {str_or_none}), get_all=False)
webpage = self._download_webpage(url, video_id)
player_data, media_data = self._search_regex(
r'LR\.audio\.Player\s*\([^{]*(?P<player>\{.*?\}),(?P<media>\{.*\})\);',
webpage, 'pla... | @@ -0,0 +1,314 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ traverse_obj,
+ url_or_none,
+ urljoin,
+)
+
+
+class LSMBaseIE(InfoExtractor):
+ def fix_nuxt_data(self,... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | suggestion | 276 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Caesim404 |
'timestamp': 1700586300,
'description': 'md5:0f1b14798cc39e1ae578bd0eb268f759',
'duration': 1442,
'upload_date': '20231121',
'title': '4. studija. Zolitūdes traģēdija un Inčupes stacija',
'thumbnail': 'https://ltv.lsm.lv/storage/media/8/7/large/5/1... | ```suggestion
def _fix_nuxt_data(self, webpage):
``` | 'url': 'https://replay.lsm.lv/lv/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
'md5': '64f72a360ca530d5ed89c77646c9eee5',
'info_dict': {
'id': '46k_d23-6000-105',
'ext': 'mp4',
'timestamp': 1700586300,
'description': 'md5:0... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.571 | suggestion | 58 | 47 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
}, {
'url': 'https://replay.lsm.lv/lv/ieraksts/lr/183522/138-nepilniga-kompensejamo-zalu-sistema-pat-menesiem-dzena-pacientus-pa-aptiekam',
'md5': '719b33875cd1429846eeeaeec6df2830',
'info_dict': {
'id': 'a342781',
'ext': 'mp3',
'duration': 1823,
... | don't use `json` as var name
```suggestion
data = self._search_nuxt_data(
self._fix_nuxt_data(webpage), video_id, context_name='__REPLAY__')
``` | 'duration': 1442,
'upload_date': '20231121',
'title': '4. studija. Zolitūdes traģēdija un Inčupes stacija',
'thumbnail': 'https://ltv.lsm.lv/storage/media/8/7/large/5/1f9604e1.jpg',
}
}, {
'url': 'https://replay.lsm.lv/lv/ieraksts/lr/183522/138-nepilni... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | suggestion | 168 | 40 | 46 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'ext': 'mp3',
'duration': 1823,
'title': '#138 Nepilnīgā kompensējamo zāļu sistēma pat mēnešiem dzenā pacientus pa aptiekām',
'thumbnail': 'https://pic.latvijasradio.lv/public/assets/media/9/d/large_fd4675ac.jpg',
'upload_date': '20231102',
'timest... | ```suggestion
**traverse_obj(data, {
``` | }, {
'url': 'https://replay.lsm.lv/lv/ieraksts/lr/183522/138-nepilniga-kompensejamo-zalu-sistema-pat-menesiem-dzena-pacientus-pa-aptiekam',
'md5': '719b33875cd1429846eeeaeec6df2830',
'info_dict': {
'id': 'a342781',
'ext': 'mp3',
'duration': 1823,
... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.571 | suggestion | 54 | 35 | 41 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
video_id = urllib.parse.unquote(self._match_id(url))
webpage = self._download_webpage(url, video_id)
json = self._search_json(r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
embed_type = traverse_obj(json, ('source', 'name'))
if embed_type == 'telia':
... | don't accidentally match query or fragment
```suggestion
_VALID_URL = r'https?://replay\.lsm\.lv/.*/(?:ieraksts|statja)/[^/?#]+/(?P<id>\d+)'
``` | 'like_count': int,
'description': 'md5:7ff0c42ba971e3c13e4b8a2ff03b70b5',
}
}]
def _real_extract(self, url):
video_id = urllib.parse.unquote(self._match_id(url))
webpage = self._download_webpage(url, video_id)
data = self._search_json(
r'windo... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.714 | suggestion | 151 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'title': 'EIROVĪZIJA SALĀTOS',
'live_status': 'was_live',
'uploader_id': '@LTV16plus',
'comment_count': int,
'channel_id': 'UCNMrnafwXD2XKeeQOyfkFCw',
'channel_follower_count': int,
'categories': ['Entertainment'],
'duration... | don't use `json` as var name
```suggestion
webpage = self._download_webpage(url, video_id)
data = self._search_json(
r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
embed_type = traverse_obj(data, ('source', 'name', {str}))
``` | 'release_date': '20220514',
'channel_url': 'https://www.youtube.com/channel/UCNMrnafwXD2XKeeQOyfkFCw',
'view_count': int,
'availability': 'public',
'thumbnail': 'https://i.ytimg.com/vi/wUnFArIPDSY/maxresdefault.jpg',
'release_timestamp': 1652544074... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 1 | suggestion | 286 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'age_limit': 0,
'channel': 'LTV_16plus',
'playable_in_embed': True,
'tags': [],
'uploader_url': 'https://www.youtube.com/@LTV16plus',
'like_count': int,
'description': 'md5:7ff0c42ba971e3c13e4b8a2ff03b70b5',
}
}]
def _r... | include the unsupported value in the error msg
```suggestion
raise ExtractorError('Unsupported embed type {embed_type!r}')
``` | 'comment_count': int,
'channel_id': 'UCNMrnafwXD2XKeeQOyfkFCw',
'channel_follower_count': int,
'categories': ['Entertainment'],
'duration': 5269,
'upload_date': '20220514',
'age_limit': 0,
'channel': 'LTV_16plus',
... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.929 | refactor | 141 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'duration': 5269,
'upload_date': '20220514',
'age_limit': 0,
'channel': 'LTV_16plus',
'playable_in_embed': True,
'tags': [],
'uploader_url': 'https://www.youtube.com/@LTV16plus',
'like_count': int,
'description':... | don't redefine `url`
```suggestion
embed_url = traverse_obj(data, ('source', 'embed_url', {url_or_none}))
elif embed_type == 'youtube':
ie_key = 'Youtube'
embed_url = traverse_obj(data, ('source', 'id', {str}))
``` | 'live_status': 'was_live',
'uploader_id': '@LTV16plus',
'comment_count': int,
'channel_id': 'UCNMrnafwXD2XKeeQOyfkFCw',
'channel_follower_count': int,
'categories': ['Entertainment'],
'duration': 5269,
'upload_date': '202205... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.929 | suggestion | 264 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'tags': [],
'uploader_url': 'https://www.youtube.com/@LTV16plus',
'like_count': int,
'description': 'md5:7ff0c42ba971e3c13e4b8a2ff03b70b5',
}
}]
def _real_extract(self, url):
video_id = urllib.parse.unquote(self._match_id(url))
webpage = s... | ```suggestion
embed_url, ie_key, video_id, **traverse_obj(data, {
``` | 'categories': ['Entertainment'],
'duration': 5269,
'upload_date': '20220514',
'age_limit': 0,
'channel': 'LTV_16plus',
'playable_in_embed': True,
'tags': [],
'uploader_url': 'https://www.youtube.com/@LTV16plus',
... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.571 | suggestion | 83 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
else:
formats.append({'url': source_url})
id = item.get('id')
title = item.get('title')
if id and id.startswith('v') and not title:
title = traverse_obj(
media_json, ('audio', lambda _, v: v['id'][1:] == id[1:],... | ```suggestion
_VALID_URL = r'https?://ltv\.lsm\.lv/embed\?(?:[^#]+&)?c=(?P<id>[^#&]+)'
``` | entries = []
for item in traverse_obj(media_json, (('audio', 'video'), lambda _, v: v['id'])):
formats = []
for source_url in traverse_obj(item, ('sources', ..., 'file', {url_or_none})):
if determine_ext(source_url) == 'm3u8':
formats.extend(se... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'only_matching': True,
}, {
'url': 'https://lr4.lsm.lv/lv/embed/?id=184282&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://pieci.lv/lv/embed/?id=168896&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://naba.l... | `video_id` ultimately needs to be a string
```suggestion
video_id = traverse_obj(query, (
('show', 'id'), 0, {int_or_none}, {lambda x: x or None}, {str_or_none}), get_all=False)
webpage = self._download_webpage(url, video_id)
``` | }, {
'url': 'https://lr1.lsm.lv/lv/embed/?id=183522&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr2.lsm.lv/lv/embed/?id=182126&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://klasika.lsm.lv/lv/embed/?id=110806&... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | suggestion | 262 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'url': 'https://lr4.lsm.lv/lv/embed/?id=184282&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://pieci.lv/lv/embed/?id=168896&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://naba.lsm.lv/lv/embed/?id=182901&show=0&theme=w... | is unescaping html special chars necessary? unnecessarily doing so can lead to JSON parsing errors
```suggestion
player_data, media_data = self._search_regex(
``` | 'only_matching': True,
}, {
'url': 'https://lr2.lsm.lv/lv/embed/?id=182126&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://klasika.lsm.lv/lv/embed/?id=110806&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.857 | suggestion | 173 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
}, {
'url': 'https://radioteatris.lsm.lv/lv/embed/?id=176439&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr1.lsm.lv/lv/pleijeris/?embed=0&id=48205&time=00%3A00&idx=0',
'only_matching': True,
}]
def _real_extract(self, url):
query = ... | filter for mandatory keys
```suggestion
for item in traverse_obj(media_json, (('audio', 'video'), lambda _, v: v['id'])):
``` | 'url': 'https://lr4.lsm.lv/lv/embed/?id=184282&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://pieci.lv/lv/embed/?id=168896&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://naba.lsm.lv/lv/embed/?id=182901&show=0&theme=w... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
}, {
'url': 'https://lr1.lsm.lv/lv/pleijeris/?embed=0&id=48205&time=00%3A00&idx=0',
'only_matching': True,
}]
def _real_extract(self, url):
query = parse_qs(url)
video_id = traverse_obj(query, ('show', 0, {int_or_none}))
if not video_id:
video_id = trave... | import `determine_ext` from utils
```suggestion
if determine_ext(source_url) == 'm3u8':
``` | 'url': 'https://pieci.lv/lv/embed/?id=168896&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://naba.lsm.lv/lv/embed/?id=182901&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://radioteatris.lsm.lv/lv/embed/?id=176439&show=... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.714 | suggestion | 110 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'url': 'https://lr1.lsm.lv/lv/pleijeris/?embed=0&id=48205&time=00%3A00&idx=0',
'only_matching': True,
}]
def _real_extract(self, url):
query = parse_qs(url)
video_id = traverse_obj(query, ('show', 0, {int_or_none}))
if not video_id:
video_id = traverse_obj(q... | if multiple formats are available, m3u8 extraction should be false
```suggestion
formats.extend(self._extract_m3u8_formats(source_url, video_id, fatal=False))
``` | 'only_matching': True,
}, {
'url': 'https://naba.lsm.lv/lv/embed/?id=182901&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://radioteatris.lsm.lv/lv/embed/?id=176439&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'ht... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | refactor | 185 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
def _real_extract(self, url):
query = parse_qs(url)
video_id = traverse_obj(query, ('show', 0, {int_or_none}))
if not video_id:
video_id = traverse_obj(query, ('id', 0, {int_or_none}))
webpage = self._download_webpage(url, video_id)
player_data, media_data = se... | don't redefine built-ins
```suggestion
id_ = item['id']
``` | }, {
'url': 'https://radioteatris.lsm.lv/lv/embed/?id=176439&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr1.lsm.lv/lv/pleijeris/?embed=0&id=48205&time=00%3A00&idx=0',
'only_matching': True,
}]
def _real_extract(self, url):
query = ... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.571 | suggestion | 74 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
video_id = traverse_obj(query, ('show', 0, {int_or_none}))
if not video_id:
video_id = traverse_obj(query, ('id', 0, {int_or_none}))
webpage = self._download_webpage(url, video_id)
player_data, media_data = self._html_search_regex(
r'LR\.audio\.Player\s*\([^{]*... | ```suggestion
if id_.startswith('v') and not title:
``` | 'only_matching': True,
}, {
'url': 'https://lr1.lsm.lv/lv/pleijeris/?embed=0&id=48205&time=00%3A00&idx=0',
'only_matching': True,
}]
def _real_extract(self, url):
query = parse_qs(url)
video_id = traverse_obj(query, (
('show', 'id'), 0, {int_or_none}, {la... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.571 | suggestion | 69 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
if not video_id:
video_id = traverse_obj(query, ('id', 0, {int_or_none}))
webpage = self._download_webpage(url, video_id)
player_data, media_data = self._html_search_regex(
r'LR\.audio\.Player\s*\([^{]*(?P<player>\{.*?\}),(?P<media>\{.*\})\);',
webpage, 'pla... | ```suggestion
media_json, ('audio', lambda _, v: v['id'][1:] == id_[1:], 'title',
``` | 'url': 'https://lr1.lsm.lv/lv/pleijeris/?embed=0&id=48205&time=00%3A00&idx=0',
'only_matching': True,
}]
def _real_extract(self, url):
query = parse_qs(url)
video_id = traverse_obj(query, (
('show', 'id'), 0, {int_or_none}, {lambda x: x or None}, {str_or_none}), get_... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.714 | suggestion | 107 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
r'LR\.audio\.Player\s*\([^{]*(?P<player>\{.*?\}),(?P<media>\{.*\})\);',
webpage, 'player json', group=('player', 'media'))
player_json = self._parse_json(player_data, video_id, js_to_json)
media_json = self._parse_json(media_data, video_id, js_to_json)
entries = []
... | ```suggestion
'id': id_,
``` | video_id = traverse_obj(query, (
('show', 'id'), 0, {int_or_none}, {lambda x: x or None}, {str_or_none}), get_all=False)
webpage = self._download_webpage(url, video_id)
player_data, media_data = self._search_regex(
r'LR\.audio\.Player\s*\([^{]*(?P<player>\{.*?\}),(?P<med... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.429 | suggestion | 46 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'only_matching': True,
}, {
'url': 'https://naba.lsm.lv/lv/embed/?id=182901&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://radioteatris.lsm.lv/lv/embed/?id=176439&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'ht... | this is only used for the thumbnail and should be non-fatal
```suggestion
player_json = self._parse_json(
player_data, video_id, transform_source=js_to_json, fatal=False) or {}
``` | }, {
'url': 'https://klasika.lsm.lv/lv/embed/?id=110806&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr4.lsm.lv/lv/embed/?id=184282&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://pieci.lv/lv/embed/?id=168896&sh... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.857 | suggestion | 204 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
}, {
'url': 'https://naba.lsm.lv/lv/embed/?id=182901&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://radioteatris.lsm.lv/lv/embed/?id=176439&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr1.lsm.lv/lv/pleijeris/?... | for readability
```suggestion
media_json = self._parse_json(media_data, video_id, transform_source=js_to_json)
``` | 'url': 'https://klasika.lsm.lv/lv/embed/?id=110806&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://lr4.lsm.lv/lv/embed/?id=184282&show=0&theme=white&size=16x9',
'only_matching': True,
}, {
'url': 'https://pieci.lv/lv/embed/?id=168896&show=0&them... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.714 | suggestion | 125 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
import re
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
js_to_json,
parse_iso8601,
parse_qs,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class LSMLREmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:l... | if the URL doesn't have a `show` or `id` query param then it wouldn't be pointing at anything useful?
```suggestion
_VALID_URL = r'''(?x)
https?://(?:
(?:latvijasradio|lr1|lr2|klasika|lr4|naba|radioteatris)\.lsm|
pieci
)\.lv/[^/?#]+/(?:
pleijeris|embed
... | import re
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
js_to_json,
parse_iso8601,
parse_qs,
str_or_none,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class LSMLREmbedIE(InfoExtractor):... | @@ -0,0 +1,276 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
+
+class LSMLREmbedIE(InfoExtractor):
... | yt_dlp/extractor/lsm.py | 18 | Python | 0.857 | suggestion | 372 | 43 | 43 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class CloudyCDNIE(InfoExtractor):
_VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/]+)/media/(?P<id>[\w-]+)'
_... | ```suggestion
_VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/?#]+)/media/(?P<id>[\w-]+)'
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class CloudyCDNIE(InfoExtractor):
_VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/?#]+)/media/(?P<id>[\w-]+)'
... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+ urlencode_postdata,
+)
+from ..utils.traversal import traverse_obj
+
+
+class CloudyCDNIE(InfoExtractor):
+ _VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/]+... | yt_dlp/extractor/cloudycdn.py | 12 | Python | 0.714 | suggestion | 122 | 37 | 37 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'ext': 'mp4',
'title': 'LV-8-5-1',
'timestamp': 1669767167,
'thumbnail': 'https://store.cloudycdn.services/tmsp00120/assets/media/488306/placeholder1679423604.jpg',
'duration': 1205,
'upload_date': '20221130',
}
}]
_WEBPAGE_TESTS = ... | don't use `json` as var name
```suggestion
data = self._download_json(
``` | 'ext': 'mp4',
'title': 'LV-8-5-1',
'timestamp': 1669767167,
'thumbnail': 'https://store.cloudycdn.services/tmsp00120/assets/media/488306/placeholder1679423604.jpg',
'duration': 1205,
'upload_date': '20221130',
}
}]
_WEBPAGE_TESTS = ... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+ urlencode_postdata,
+)
+from ..utils.traversal import traverse_obj
+
+
+class CloudyCDNIE(InfoExtractor):
+ _VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/]+... | yt_dlp/extractor/cloudycdn.py | 26 | Python | 0.643 | suggestion | 85 | 51 | 50 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'md5': '63074e8e6c84ac2a01f2fb8bf03b8f43',
'info_dict': {
'id': 'cqd_lib-2',
'ext': 'mp4',
'upload_date': '20230223',
'duration': 629,
'thumbnail': 'https://store.cloudycdn.services/tmsp00120/assets/media/518407/placeholder1678748124.jpg',
... | avoid redefining `url` in `_real_extract()`
```suggestion
formats, subtitles = [], {}
for m3u8_url in traverse_obj(data, ('source', 'sources', ..., 'src', {url_or_none})):
fmts, subs = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, fatal=False)
``` | 'md5': '63074e8e6c84ac2a01f2fb8bf03b8f43',
'info_dict': {
'id': 'cqd_lib-2',
'ext': 'mp4',
'upload_date': '20230223',
'duration': 629,
'thumbnail': 'https://store.cloudycdn.services/tmsp00120/assets/media/518407/placeholder1678748124.jpg',
... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+ urlencode_postdata,
+)
+from ..utils.traversal import traverse_obj
+
+
+class CloudyCDNIE(InfoExtractor):
+ _VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/]+... | yt_dlp/extractor/cloudycdn.py | 26 | Python | 0.857 | refactor | 295 | 41 | 40 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
}
}]
def _real_extract(self, url):
site_id, video_id = self._match_valid_url(url).group('site_id', 'id')
json = self._download_json(
f'https://player.cloudycdn.services/player/{site_id}/media/{video_id}/',
video_id, data=urlencode_postdata({
'ver... | ```suggestion
**traverse_obj(data, {
'title': ('name', {str}),
``` | }
}]
def _real_extract(self, url):
site_id, video_id = self._match_valid_url(url).group('site_id', 'id')
data = self._download_json(
f'https://player.cloudycdn.services/player/{site_id}/media/{video_id}/',
video_id, data=urlencode_postdata({
'ver... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+ urlencode_postdata,
+)
+from ..utils.traversal import traverse_obj
+
+
+class CloudyCDNIE(InfoExtractor):
+ _VALID_URL = r'(?:https?:)?//embed\.cloudycdn\.services/(?P<site_id>[^/]+... | yt_dlp/extractor/cloudycdn.py | 26 | Python | 0.571 | suggestion | 97 | 32 | 31 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
def _real_extract(self, url):
video_id = urllib.parse.unquote(self._match_id(url))
webpage = self._download_webpage(url, video_id)
data = self._search_json(
r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
embed_type = traverse_obj(data, ('source', 'name',... | could we do this instead?
```suggestion
_VALID_URL = r'https?://replay\.lsm\.lv/[^/?#]+/(?:ieraksts|statja)/[^/?#]+/(?P<id>\d+)'
``` | def _real_extract(self, url):
video_id = urllib.parse.unquote(self._match_id(url))
webpage = self._download_webpage(url, video_id)
data = self._search_json(
r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
embed_type = traverse_obj(data, ('source', 'name',... | @@ -0,0 +1,282 @@
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ int_or_none,
+ js_to_json,
+ parse_iso8601,
+ parse_qs,
+ str_or_none,
+ url_or_none,
+ urljoin,
+)
+from ..utils.traversal import traverse_obj
+
... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | suggestion | 139 | 51 | 51 | false | [lsm] Add extractor | 8,643 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
if video_format == 'hls':
src = player_config['src'][video_format]
params = {}
uid = self._search_regex(r'window\.MDSTRMUID\s*=\s*["\']([^"\']+)["\'];', webpage, 'uid', fatal=False, default=None)
if uid:
params['uid'] = uid... | Use `parse_qs` from `..utils` instead
```suggestion
access_token = parse_qs(url).get('access_token', [None])[0]
if access_token:
params['access_token'] = access_token
``` | for video_format in player_config['src']:
if video_format == 'hls':
params = {
'at': 'web-app',
'access_token': traverse_obj(parse_qs(url), ('access_token', 0)),
}
for name, key in (('MDSTRMUID', 'uid'), ('MDSTRM... | @@ -118,7 +122,36 @@ def _real_extract(self, url):
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
- fmts, subs = self._extract_m3u8_formats_and_subtitles(player_config['src'][video_format], video_id)
+ src = pl... | yt_dlp/extractor/mediastream.py | 26 | Python | 0.857 | suggestion | 227 | 51 | 51 | false | Fixed mediastream when hls uses extra arguments | 8,657 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | NickCis |
if uid:
params['uid'] = uid
sid = self._search_regex(r'window\.MDSTRMSID\s*=\s*["\']([^"\']+)["\'];', webpage, 'sid', fatal=False, default=None)
if sid:
params['sid'] = sid
pid = self._search_regex(r'window\.MDSTRM... | ```suggestion
fmts, subs = self._extract_m3u8_formats_and_subtitles(update_url_query(src, params), video_id)
```
Import `update_url_query` from `..utils` | }
for name, key in (('MDSTRMUID', 'uid'), ('MDSTRMSID', 'sid'), ('MDSTRMPID', 'pid'), ('VERSION', 'av')):
params[key] = self._search_regex(
rf'window\.{name}\s*=\s*["\']([^"\']+)["\'];', webpage, key, default=None)
fmts, subs =... | @@ -118,7 +122,36 @@ def _real_extract(self, url):
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
- fmts, subs = self._extract_m3u8_formats_and_subtitles(player_config['src'][video_format], video_id)
+ src = pl... | yt_dlp/extractor/mediastream.py | 26 | Python | 0.786 | refactor | 172 | 51 | 51 | false | Fixed mediastream when hls uses extra arguments | 8,657 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | NickCis |
'El contenido sólo está disponible dentro de',
]:
if message in webpage:
self.raise_geo_restricted()
player_config = self._search_json(r'window\.MDSTRM\.OPTIONS\s*=', webpage, 'metadata', video_id)
formats, subtitles = [], {}
for video_format in ... | If you provide a default, `_search_regex` is non-fatal anyway.
```suggestion
version = self._search_regex(r'window\.VERSION\s*=\s*["\']([^"\']+)["\'];', webpage, 'version', default=None)
```
Also change for the other instances | 'Este contenido no está disponible en tu zona geográfica.',
'El contenido sólo está disponible dentro de',
]:
if message in webpage:
self.raise_geo_restricted()
player_config = self._search_json(r'window\.MDSTRM\.OPTIONS\s*=', webpage, 'metadata', vid... | @@ -118,7 +122,36 @@ def _real_extract(self, url):
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
- fmts, subs = self._extract_m3u8_formats_and_subtitles(player_config['src'][video_format], video_id)
+ src = pl... | yt_dlp/extractor/mediastream.py | 26 | Python | 0.857 | suggestion | 246 | 51 | 51 | false | Fixed mediastream when hls uses extra arguments | 8,657 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | NickCis |
if message in webpage:
self.raise_geo_restricted()
player_config = self._search_json(r'window\.MDSTRM\.OPTIONS\s*=', webpage, 'metadata', video_id)
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
... | How about we write this as:
```suggestion
params = {'at': 'web-app'}
for name, key in [('MDSTRMUID', 'uid'), ('MDSTRMSID', 'sid'), ('MDSTRMPID', 'pid'), ('VERSION', 'av')]:
if val := self._search_regex(rf'window\.{name}\s*=\s*["\']([^"\']+)["\'];',
... | ]:
if message in webpage:
self.raise_geo_restricted()
player_config = self._search_json(r'window\.MDSTRM\.OPTIONS\s*=', webpage, 'metadata', video_id)
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':... | @@ -118,7 +122,29 @@ def _real_extract(self, url):
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
- fmts, subs = self._extract_m3u8_formats_and_subtitles(player_config['src'][video_format], video_id)
+ params =... | yt_dlp/extractor/mediastream.py | 26 | Python | 0.786 | suggestion | 433 | 51 | 51 | false | Fixed mediastream when hls uses extra arguments | 8,657 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | NickCis |
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
params = {}
uid = self._search_regex(r'window\.MDSTRMUID\s*=\s*["\']([^"\']+)["\'];', webpage, 'uid', default=None)
if uid:
par... | Sorry, I forgot the line break
```suggestion
fmts, subs = self._extract_m3u8_formats_and_subtitles(
update_url_query(player_config['src'][video_format], params), video_id)
``` |
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
params = {
'at': 'web-app',
'access_token': traverse_obj(parse_qs(url), ('access_token', 0)),
}
for name, k... | @@ -118,7 +122,29 @@ def _real_extract(self, url):
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
- fmts, subs = self._extract_m3u8_formats_and_subtitles(player_config['src'][video_format], video_id)
+ params =... | yt_dlp/extractor/mediastream.py | 26 | Python | 0.857 | refactor | 215 | 51 | 51 | false | Fixed mediastream when hls uses extra arguments | 8,657 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | NickCis |
for message in [
'Debido a tu ubicación no puedes ver el contenido',
'You are not allowed to watch this video: Geo Fencing Restriction',
'Este contenido no está disponible en tu zona geográfica.',
'El contenido sólo está disponible dentro de',
]:
... | ```suggestion
params = {
'at': 'web-app',
'access_token': traverse_obj(parse_qs(url), ('access_token', 0)),
}
for name, key in (('MDSTRMUID', 'uid'), ('MDSTRMSID', 'sid'), ('MDSTRMPID', 'pid'), ('VERSION', 'av')):
... |
for message in [
'Debido a tu ubicación no puedes ver el contenido',
'You are not allowed to watch this video: Geo Fencing Restriction',
'Este contenido no está disponible en tu zona geográfica.',
'El contenido sólo está disponible dentro de',
]:
... | @@ -118,7 +122,18 @@ def _real_extract(self, url):
formats, subtitles = [], {}
for video_format in player_config['src']:
if video_format == 'hls':
- fmts, subs = self._extract_m3u8_formats_and_subtitles(player_config['src'][video_format], video_id)
+ params =... | yt_dlp/extractor/mediastream.py | 26 | Python | 0.857 | refactor | 726 | 51 | 51 | false | Fixed mediastream when hls uses extra arguments | 8,657 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NickCis |
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
remove_end,
traverse_obj,
urljoin,
parse_qs,
update_url_query
)
class MediaStreamBaseIE(InfoExtractor):
_EMBED_BASE_URL = 'https://mdstrm.com/embed'
_BASE_URL_RE = r'https?://mdstrm\.com/(?:embed|live-stream... | ```suggestion
filter_dict,
parse_qs,
remove_end,
traverse_obj,
update_url_query,
urljoin,
``` | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
filter_dict,
parse_qs,
remove_end,
traverse_obj,
update_url_query,
urljoin,
)
class MediaStreamBaseIE(InfoExtractor):
_EMBED_BASE_URL = 'https://mdstrm.com/embed'
_BASE_URL_RE = r'https?://mdstrm\.com/(?... | @@ -6,6 +6,8 @@
remove_end,
traverse_obj,
urljoin,
+ parse_qs,
+ update_url_query | yt_dlp/extractor/mediastream.py | 10 | Python | 0.786 | suggestion | 124 | 35 | 35 | false | Fixed mediastream when hls uses extra arguments | 8,657 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NickCis |
'live_status': 'was_live',
'release_date': '20210719',
'release_timestamp': 1626703200,
'description': None,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
'expected_warnings': [
... | Maybe the check should use `drm_mode` instead?
```suggestion
if data_json.get('drm_mode') == 'ON':
``` | 'id': 'stream1ng20210719-test-005',
'title': 'Online streaming test for DRM',
'live_status': 'was_live',
'release_date': '20210719',
'release_timestamp': 1626703200,
'description': None,
},
'params': {
'skip_download': T... | @@ -29,14 +32,39 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.786 | suggestion | 113 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_call,
unified_timestamp,
)
class EplusIbIE(InfoExtractor):
IE_NAME = 'eplus:inbound'
IE_DESC = 'e+ (イープラス) overseas'
_VALID_URL = [
r'https?://live\.eplus\.jp/ex/player\?ib=(?P<id>(?:\w|%2B|%2F){86}%3D%3D)',
... | I only know very little about the site, so bear with me.
As I understand it, `https://live.eplus.jp/ex/player?ib=`, are pre-authenticated URLs. Looking around, I found lots of URLs like this: `https://live.eplus.jp/2612511` that redirect to a login-in page. Are these the same playback pages, but unauthenticated? If ye... | import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_call,
unified_timestamp,
urlencode_postdata,
)
class EplusIbIE(InfoExtractor):
_NETRC_MACHINE = 'eplus'
IE_NAME = 'eplus'
IE_DESC = 'e+ (イープラス)'
_VALID_URL = [r'https?://live\.eplus\.jp/ex/player\?... | @@ -9,7 +9,10 @@
class EplusIbIE(InfoExtractor):
IE_NAME = 'eplus:inbound'
IE_DESC = 'e+ (イープラス) overseas'
- _VALID_URL = r'https?://live\.eplus\.jp/ex/player\?ib=(?P<id>(?:\w|%2B|%2F){86}%3D%3D)'
+ _VALID_URL = [
+ r'https?://live\.eplus\.jp/ex/player\?ib=(?P<id>(?:\w|%2B|%2F){86}%3D%3D)',
+ ... | yt_dlp/extractor/eplus.py | 14 | Python | 0.643 | security | 381 | 39 | 39 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
import json
import random
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_call,
unified_timestamp,
urlencode_postdata,
xpath_text,
)
class EplusIE(InfoExtractor):
_NETRC_MACHINE = 'eplus'
IE_NAME = 'eplus'
IE_DESC = 'e+ (イープラス)'
_VALID_URL = [
r... | Renaming the class creates issues with archives. Please revert. `IE_NAME` is all that user will see, so you can just change that. | import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_call,
unified_timestamp,
urlencode_postdata,
)
class EplusIbIE(InfoExtractor):
_NETRC_MACHINE = 'eplus'
IE_NAME = 'eplus'
IE_DESC = 'e+ (イープラス)'
_VALID_URL = [r'https?://live\.eplus\.jp/ex/player\?... | @@ -1,15 +1,24 @@
+import json
+import random
+
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_call,
unified_timestamp,
+ urlencode_postdata,
+ xpath_text,
)
-class EplusIbIE(InfoExtractor):
- IE_NAME = 'eplus:inbound'
- IE_DESC = 'e+ (イープラス) overseas'
- ... | yt_dlp/extractor/eplus.py | 14 | Python | 0.571 | suggestion | 129 | 39 | 39 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | pzhlkj6612 |
'This video is DRM protected',
],
}, {
'url': 'https://live.eplus.jp/2053935',
'info_dict': {
'id': '331320-0001-001',
'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
'live_status': 'was_live',
'release_date': '20200920',... | I think it would be better to use a fixed number, just in case some of them happen to be free to access, like the sample stream. | 'info_dict': {
'id': '331320-0001-001',
'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
'live_status': 'was_live',
'release_date': '20200920',
'release_timestamp': 1600596000,
},
'params': {
'skip_download': True,... | @@ -29,14 +38,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.429 | suggestion | 128 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
'expected_warnings': [
'Could not find the playlist URL. This event may not be accessible',
'No video formats found!',
'Requested format is not available'... | I think throwing an error would be more appropriate. | },
'expected_warnings': [
'Could not find the playlist URL. This event may not be accessible',
'No video formats found!',
'Requested format is not available',
],
}]
_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, li... | @@ -29,14 +38,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.357 | suggestion | 52 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0'
def _perform_login(self, id, password):
fake_event_url = f'https://live.eplus.jp/{random.randrange(2000000, 10000000)}'
webpage, urlh = self._download_we... | utf-8 is the default
```suggestion
}).encode())
``` | raise ExtractorError('Unable to get ci_session cookie')
cltft_token = urlh.headers.get('X-CLTFT-Token')
if not cltft_token:
raise ExtractorError('Unable to get X-CLTFT-Token')
self._set_cookie('live.eplus.jp', 'X-CLTFT-Token', cltft_token)
login_json = self._dow... | @@ -29,14 +38,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.571 | suggestion | 66 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
'ignore_no_formats_error': True,
},
'expected_warnings': [
'Could not find the playlist URL. This event may not be accessible',
'No video formats found!',
'Requested format is not available',
],
}]
_USER_AGENT = 'Mozilla/5.0 (Windows NT 10... | `_download_xml`? In my testing, this endpoint returned JSON data. | 'No video formats found!',
'Requested format is not available',
],
}]
_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0'
def _login(self, username, password, urlh):
if not sel... | @@ -29,14 +38,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.357 | suggestion | 65 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
_TEST_EVENT_URL = 'https://live.eplus.jp/2053935'
def _perform_login(self, id, password):
webpage, urlh = self._download_webpage_handle(
self._TEST_EVENT_URL, None, note='Getting auth status', errnote='Unable to get auth status')
if urlh.url.startswith(self._TEST_EVENT_URL):
... | ```suggestion
if not login_json.get('isSuccess'):
``` | if not self._get_cookies('https://live.eplus.jp/').get('ci_session'):
raise ExtractorError('Unable to get ci_session cookie')
cltft_token = urlh.headers.get('X-CLTFT-Token')
if not cltft_token:
raise ExtractorError('Unable to get X-CLTFT-Token')
self._set_cookie(... | @@ -29,14 +36,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.571 | suggestion | 63 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_call,
unified_timestamp,
urlencode_postdata,
)
class EplusIbIE(InfoExtractor):
_NETRC_MACHINE = 'eplus'
IE_NAME = 'eplus'
IE_DESC = 'e+ (イープラス)'
_VALID_URL = [
r'https?://live\.eplus\.jp/ex... | ```suggestion
_VALID_URL = [r'https?://live\.eplus\.jp/ex/player\?ib=(?P<id>(?:\w|%2B|%2F){86}%3D%3D)',
r'https?://live\.eplus\.jp/(?P<id>sample|\d+)']
``` | import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_call,
unified_timestamp,
urlencode_postdata,
)
class EplusIbIE(InfoExtractor):
_NETRC_MACHINE = 'eplus'
IE_NAME = 'eplus'
IE_DESC = 'e+ (イープラス)'
_VALID_URL = [r'https?://live\.eplus\.jp/ex/player\?... | @@ -1,15 +1,22 @@
+import json
+
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_call,
unified_timestamp,
+ urlencode_postdata,
)
class EplusIbIE(InfoExtractor):
- IE_NAME = 'eplus:inbound'
- IE_DESC = 'e+ (イープラス) overseas'
- _VALID_URL = r'https?://live\.e... | yt_dlp/extractor/eplus.py | 19 | Python | 0.714 | suggestion | 180 | 44 | 44 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
login_json = self._download_json(
'https://live.eplus.jp/member/api/v1/FTAuth/idpw', None,
note='Sending pre-login info', errnote='Unable to send pre-login info', headers={
'Content-Type': 'application/json; charset=UTF-8',
'Referer': urlh.url,
... | `'Content-Type': 'application/x-www-form-urlencoded'` is added by default with POST requests
```suggestion
}), headers={'Referer': urlh.url})
``` | 'Content-Type': 'application/json; charset=UTF-8',
'Referer': urlh.url,
'X-Cltft-Token': cltft_token,
'Accept': '*/*',
}, data=json.dumps({
'loginId': username,
'loginPassword': password,
}).encode())... | @@ -29,14 +34,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.857 | suggestion | 160 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
'live_status': 'was_live',
'release_date': '20200920',
'release_timestamp': 1600596000,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
... | Is there a cookie we can check for instead? | 'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
'live_status': 'was_live',
'release_date': '20200920',
'release_timestamp': 1600596000,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
... | @@ -29,14 +34,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.143 | question | 43 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
'expected_warnings': [
'Could not find the playlist URL. This event may not be accessible',
'No video formats found!',
'Requested format is not available',
]... | In order to retrieve the `X-CLTFT-Token` value, is there a more impartial URL we could request, such as `https://live.eplus.jp/member/auth`? My concern is that if the test event is ever removed / returns 404, then login will break | 'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
'expected_warnings': [
'Could not find the playlist URL. This event may not be accessible',
'No video formats found!',
'Requested format is not available',
]... | @@ -29,14 +34,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.643 | security | 230 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'Could not find the playlist URL. This event may not be accessible',
'No video formats found!',
'Requested format is not available',
'This video is DRM protected',
],
}, {
'url': 'https://live.eplus.jp/2053935',
'info_dict': {
'id':... | Are you sure the Edge UA is needed to check `drm_mode`? When I request the sample event's webpage with a default Chrome UA, the `drm_mode` field is still present in the JSON object | 'Could not find the playlist URL. This event may not be accessible',
'No video formats found!',
'Requested format is not available',
'This video is DRM protected',
],
}, {
'url': 'https://live.eplus.jp/2053935',
'info_dict': {
'id':... | @@ -29,14 +34,99 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.5 | suggestion | 180 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'url': 'https://live.eplus.jp/2053935',
'info_dict': {
'id': '331320-0001-001',
'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
'live_status': 'was_live',
'release_date': '20200920',
'release_timestamp': 1600596000,
},
... | would this work?
```suggestion
def _perform_login(self, id, password):
if self._get_cookies('https://live.eplus.jp/').get('ci_session'):
# already logged in
return
``` | 'url': 'https://live.eplus.jp/2053935',
'info_dict': {
'id': '331320-0001-001',
'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
'live_status': 'was_live',
'release_date': '20200920',
'release_timestamp': 1600596000,
},
... | @@ -29,14 +34,100 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online stre... | yt_dlp/extractor/eplus.py | 26 | Python | 0.786 | suggestion | 209 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'id': '331320-0001-001',
'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
'live_status': 'was_live',
'release_date': '20200920',
'release_timestamp': 1600596000,
},
'params': {
'skip_download': True,
'ignore_no... | `expected=False` is default
```suggestion
raise ExtractorError('Unable to get X-CLTFT-Token')
``` | 'id': '331320-0001-001',
'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
'live_status': 'was_live',
'release_date': '20200920',
'release_timestamp': 1600596000,
},
'params': {
'skip_download': True,
'ignore_no... | @@ -29,14 +34,97 @@ class EplusIbIE(InfoExtractor):
'No video formats found!',
'Requested format is not available',
],
+ }, {
+ 'url': 'https://live.eplus.jp/sample',
+ 'info_dict': {
+ 'id': 'stream1ng20210719-test-005',
+ 'title': 'Online strea... | yt_dlp/extractor/eplus.py | 26 | Python | 0.929 | refactor | 112 | 51 | 51 | false | [ie/eplus] detect DRM by using Microsoft Edge UA; make regex more robust; Support eplus account login | 8,661 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
if... | Use single quotes
```suggestion
if 'Streaming is not available in your area.' in webpage:
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
js_to_json,
traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe... | @@ -0,0 +1,31 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage... | yt_dlp/extractor/rudovideo.py | 12 | Python | 0.786 | suggestion | 104 | 32 | 37 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
if... | It's more robust to accept both `'` and `"`
```suggestion
stream_url = self._search_regex(r'var\s+streamURL\s*=\s*[\'"]([^\'"]+)', webpage, 'stream url')
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
js_to_json,
traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe... | @@ -0,0 +1,31 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage... | yt_dlp/extractor/rudovideo.py | 15 | Python | 0.714 | suggestion | 168 | 32 | 40 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
if... | Can be written as:
```suggestion
token_array = self._search_json(
r'<script>var\s+_\$_[a-zA-Z0-9]+\s*=', webpage, 'access token array', video_id,
contains_pattern=r'\[(?s:.+)\]', default=None, transform_source=js_to_json)
if token_array:
```
Import `js_to_json` from `..uti... | from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
js_to_json,
traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe... | @@ -0,0 +1,31 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage... | yt_dlp/extractor/rudovideo.py | 19 | Python | 0.786 | suggestion | 323 | 32 | 44 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
if... | ```suggestion
access_token = self._download_json(token_array[0], video_id, note='Downloading access token')
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
js_to_json,
traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe... | @@ -0,0 +1,31 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage... | yt_dlp/extractor/rudovideo.py | 23 | Python | 0.714 | suggestion | 125 | 32 | 48 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
from ..utils import ExtractorError, traverse_obj
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
if "Streaming is not available in yo... | These values seem fairly generic and unlikely to change. I think it's more likely that they change position in the array than name, so I would suggest using:
```suggestion
stream_url = update_url_query(
stream_url, {'auth-token': traverse_obj(access_token, ('data', 'authToken'))})
``` | from ..utils import (
ExtractorError,
determine_ext,
js_to_json,
traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:)/... | @@ -0,0 +1,31 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage... | yt_dlp/extractor/rudovideo.py | 26 | Python | 0.857 | security | 317 | 31 | 51 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
_VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
if "Streaming is not available in your area." in webpage:
self.raise_geo_restricted()
stream_url = s... | Since this is a livestream, it needs to be returned as such
```suggestion
return {
'id': video_id,
'title': self._search_regex(r'var\s+titleVideo\s*=\s*[\'"]([^\'"]+)', webpage, 'titel', fatal=False),
'formats': self._extract_m3u8_formats(stream_url, video_id, live=True)... | traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:)//rudo\.video/(?:vod|podcast|live)/[^\'"]+)']
_TESTS = [{
'url': '... | @@ -0,0 +1,31 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage... | yt_dlp/extractor/rudovideo.py | 26 | Python | 0.857 | refactor | 369 | 27 | 51 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/live/(?P<id>[^/]+)'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
if... | Since RudoVideo hosts other content such as [VODs](https://rudo.video/vod/bN5AaJ) and [podcasts](https://rudo.video/podcast/cz2wrUy8l0o), this should be preemptively named to reflect that
```suggestion
class RudoVideoLiveIE(InfoExtractor):
```
If you like, you can also implement those, or just leave them for now. | from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
js_to_json,
traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe... | @@ -0,0 +1,31 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class RudoVideoIE(InfoExtractor): | yt_dlp/extractor/rudovideo.py | 12 | Python | 1 | refactor | 318 | 32 | 37 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj, js_to_json, update_url_query
class RudoVideoLiveIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>live|vod|podcast)/(?P<id>[^/?]+)'
_EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:)//rudo\.video/(?:live|... | With how different the structure of the live and the VOD/Podcast site is, my idea was to have two extractors `RudoVideoLiveIE` for the live content and `RudoVideoIE` for VOD/Podcast content. Sorry if I didn't express that properly. | from .common import InfoExtractor
from ..utils import (
ExtractorError,
determine_ext,
js_to_json,
traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe... | @@ -0,0 +1,116 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, js_to_json, update_url_query
+
+
+class RudoVideoLiveIE(InfoExtractor): | yt_dlp/extractor/rudovideo.py | 5 | Python | 0.786 | refactor | 231 | 30 | 30 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
'live_status': 'is_live',
'title': r're:^LIVE BBTV\s\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$',
'thumbnail': r're:^(?:https?:)?//.*\.(png|jpg)$',
},
}, {
'url': 'https://rudo.video/live/c13',
'info_dict': {
'id': 'c13',
'title': 'CANAL13',
... | You can just use `self._og_search_title` and `self._og_search_thumbnail` | }, {
'url': 'https://rudo.video/vod/bN5AaJ',
'md5': '01324a329227e2591530ecb4f555c881',
'info_dict': {
'id': 'bN5AaJ',
'title': 'Ucrania 19.03',
'creator': 'La Tercera',
'ext': 'mp4',
'thumbnail': r're:^(?:https?:)?//.*\.(png|jpg)$'... | @@ -0,0 +1,116 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, js_to_json, update_url_query
+
+
+class RudoVideoLiveIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/(?P<type>live|vod|podcast)/(?P<id>[^/?]+)'
+ _EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https... | yt_dlp/extractor/rudovideo.py | 26 | Python | 0.429 | suggestion | 72 | 51 | 51 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
'id': 'c13',
'title': 'CANAL13',
'ext': 'mp4',
},
'skip': 'Geo-restricted to Chile',
}, {
'url': 'https://rudo.video/live/t13-13cl',
'info_dict': {
'id': 't13-13cl',
'title': 'T13',
'ext': 'mp4',
},
... | That isn't obvious from code. So a comment would help
```suggestion
m3u8_url = (
self._search_regex(
r'var\s+streamURL\s*=\s*[\'"]([^?\'"]+)', webpage, 'stream url', default=None)
# Source URL must be used only if streamURL is unavailable
or self._sear... | 'ext': 'mp4',
'thumbnail': r're:^(?:https?:)?//.*\.(png|jpg)$',
},
}, {
'url': 'https://rudo.video/live/bbtv',
'info_dict': {
'id': 'bbtv',
'ext': 'mp4',
'creator': 'BioBioTV',
'live_status': 'is_live',
'titl... | @@ -0,0 +1,105 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, js_to_json, traverse_obj, update_url_query
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
+ _EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:... | yt_dlp/extractor/rudovideo.py | 26 | Python | 0.857 | suggestion | 424 | 51 | 51 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nicodato |
'skip': 'Geo-restricted to Chile',
}]
def _real_extract(self, url):
video_id, type_ = self._match_valid_url(url).group('id', 'type')
is_live = type_ == 'live'
webpage = self._download_webpage(url, video_id)
if 'Streaming is not available in your area' in webpage:
... | Could specify what country it is geo-restricted to
```suggestion
self.raise_geo_restricted(countries=['CL'])
```
and if doing this, we should also set `_GEO_BYPASS = False` (assuming that xff doesn't work) | },
}, {
'url': 'https://rudo.video/live/c13',
'info_dict': {
'id': 'c13',
'title': 'CANAL13',
'ext': 'mp4',
},
'skip': 'Geo-restricted to Chile',
}, {
'url': 'https://rudo.video/live/t13-13cl',
'info_dict': {
... | @@ -0,0 +1,108 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, js_to_json, traverse_obj, update_url_query
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
+ _EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:... | yt_dlp/extractor/rudovideo.py | 26 | Python | 0.857 | suggestion | 221 | 49 | 51 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | nicodato |
if 'Streaming is not available in your area' in webpage:
self.raise_geo_restricted()
m3u8_url = (
self._search_regex(
r'var\s+streamURL\s*=\s*[\'"]([^?\'"]+)', webpage, 'stream url', default=None)
# Source URL must be used only if streamURL is unavail... | should this be fatal?
```suggestion
m3u8_url = update_url_query(m3u8_url, {
'auth-token': access_token['data']['authToken'],
})
``` | 'skip': 'Geo-restricted to Chile',
}, {
'url': 'https://rudo.video/live/t13-13cl',
'info_dict': {
'id': 't13-13cl',
'title': 'T13',
'ext': 'mp4',
},
'skip': 'Geo-restricted to Chile',
}]
def _real_extract(self, url):
video_... | @@ -0,0 +1,108 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, js_to_json, traverse_obj, update_url_query
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
+ _EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:... | yt_dlp/extractor/rudovideo.py | 26 | Python | 0.786 | security | 176 | 41 | 51 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | nicodato |
def _real_extract(self, url):
video_id, type_ = self._match_valid_url(url).group('id', 'type')
is_live = type_ == 'live'
webpage = self._download_webpage(url, video_id)
if 'Streaming is not available in your area' in webpage:
self.raise_geo_restricted()
m3u8_url... | As we are only using the first element, which we assume it's the token API endpoint:
```suggestion
if len(token_array) == 0:
``` | 'info_dict': {
'id': 'c13',
'title': 'CANAL13',
'ext': 'mp4',
},
'skip': 'Geo-restricted to Chile',
}, {
'url': 'https://rudo.video/live/t13-13cl',
'info_dict': {
'id': 't13-13cl',
'title': 'T13',
'ext': ... | @@ -0,0 +1,108 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, js_to_json, traverse_obj, update_url_query
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
+ _EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:... | yt_dlp/extractor/rudovideo.py | 26 | Python | 0.714 | suggestion | 143 | 46 | 51 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | nicodato | nicodato |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
js_to_json,
traverse_obj,
update_url_query,
url_or_none,
)
class RudoVideoIE(InfoExtractor):
_VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
_EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<u... | Podcasts such as `https://rudo.video/podcast/b42ZUznHX0` are sometimes served as direct mp3 files, which currently break the extractor. A simple solution would be to check by extension:
```suggestion
if determine_ext(media_url) == 'm3u8':
formats = self._extract_m3u8_formats(media_url, video_id... | if youtube_url:
return self.url_result(youtube_url, 'Youtube')
raise ExtractorError('Unable to extract stream url')
token_array = self._search_json(
r'<script>var\s+_\$_[a-zA-Z0-9]+\s*=', webpage, 'access token array', video_id,
contains_pattern=r... | @@ -0,0 +1,114 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ traverse_obj,
+ update_url_query,
+ url_or_none,
+)
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
+ _EMBED_REGEX ... | yt_dlp/extractor/rudovideo.py | 26 | Python | 1 | refactor | 447 | 115 | 40 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
if youtube_url:
return self.url_result(youtube_url, 'Youtube')
raise ExtractorError('Unable to extract stream url')
token_array = self._search_json(
r'<script>var\s+_\$_[a-zA-Z0-9]+\s*=', webpage, 'access token array', video_id,
contains_pattern=r... | ```suggestion
'formats': formats,
``` |
media_url = (
self._search_regex(
r'var\s+streamURL\s*=\s*[\'"]([^?\'"]+)', webpage, 'stream url', default=None)
# Source URL must be used only if streamURL is unavailable
or self._search_regex(
r'<source[^>]+src=[\'"]([^\'"]+)', webpage, 'sou... | @@ -0,0 +1,114 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ js_to_json,
+ traverse_obj,
+ update_url_query,
+ url_or_none,
+)
+
+
+class RudoVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://rudo\.video/(?P<type>vod|podcast|live)/(?P<id>[^/?&#]+)'
+ _EMBED_REGEX ... | yt_dlp/extractor/rudovideo.py | 26 | Python | 0.571 | suggestion | 51 | 29 | 50 | false | [c13cl] Adding support for www.13.cl and rudo.video | 8,664 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | nicodato |
- `slice`: Branch out and return all values in `obj[key]`.
- `Ellipsis`: Branch out and return a list of all values.
- `tuple`/`list`: Branch out and return a list of all matching values.
Read as: `[traverse_obj(obj, branch) for branch in branches]`.
... | grammar nitpick
```suggestion
`traverse_string` is only meant to be used by YoutubeDL.prepare_outtmpl and is not part of the API
``` | - `slice`: Branch out and return all values in `obj[key]`.
- `Ellipsis`: Branch out and return a list of all values.
- `tuple`/`list`: Branch out and return a list of all matching values.
Read as: `[traverse_obj(obj, branch) for branch in branches]`.
... | @@ -63,10 +63,8 @@ def traverse_obj(
@param get_all If `False`, return the first matching result, otherwise all matching ones.
@param casesense If `False`, consider string dictionary keys as case insensitive.
- The following are only meant to be used by YoutubeDL.prepare_outtmpl and are n... | yt_dlp/utils/traversal.py | 26 | Python | 0.786 | suggestion | 139 | 51 | 51 | false | [utils] `traverse_obj`: Move `is_user_input` into output template | 8,673 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
self._call_api('get', video_id, {'id': video_id, 'flags': self._maximum_flags}),
('items', 0, {dict}))
source = video_info.get('image')
if not source or not source.endswith('mp4'):
self.raise_no_formats('Could not extract a video', expected=bool(source), video_id=vid... | ```suggestion
'filesize': ('fileSize', {int}),
``` | video_id = self._match_id(url)
video_info = traverse_obj(
self._call_api('get', video_id, {'id': video_id, 'flags': self._maximum_flags}),
('items', 0, {dict}))
source = video_info.get('image')
if not source or not source.endswith('mp4'):
self.raise_n... | @@ -110,40 +118,65 @@ def _call_api(self, endpoint, video_id, query={}, note='Downloading API json'):
return data
+ @staticmethod
+ def _create_source_url(path):
+ return urljoin('https://img.pr0gramm.com', path)
+
def _real_extract(self, url):
video_id = self._match_id(url)
... | yt_dlp/extractor/pr0gramm.py | 26 | Python | 0.571 | suggestion | 68 | 51 | 51 | false | [ie/pr0gramm] Support variant formats and subtitles | 8,674 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
metadata = self._call_api('info', video_id, {'itemId': video_id}, note='Downloading tags')
tags = traverse_obj(metadata, ('tags', ..., 'tag', {str}))
# Sorted by "confidence", higher confidence = earlier in list
confidences = traverse_obj(metadata, ('tags', ..., 'confiden... | This's unnecessarily complex imo
```suggestion
formats = traverse_obj(video_info, ('variants', ..., {
'format_id': ('name', {str}),
'url': ('path', {self._create_source_url}),
'ext': ('mimeType', {mimetype2ext}),
'vcodec': ('codec', {str}),
'wid... | tags = None
if self._is_logged_in:
metadata = self._call_api('info', video_id, {'itemId': video_id}, note='Downloading tags')
tags = traverse_obj(metadata, ('tags', ..., 'tag', {str}))
# Sorted by "confidence", higher confidence = earlier in list
confidenc... | @@ -110,40 +118,65 @@ def _call_api(self, endpoint, video_id, query={}, note='Downloading API json'):
return data
+ @staticmethod
+ def _create_source_url(path):
+ return urljoin('https://img.pr0gramm.com', path)
+
def _real_extract(self, url):
video_id = self._match_id(url)
... | yt_dlp/extractor/pr0gramm.py | 26 | Python | 1 | suggestion | 985 | 51 | 51 | false | [ie/pr0gramm] Support variant formats and subtitles | 8,674 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
})
else:
format_traversal = ((None,), {
'url': ('image', {self._create_source_url}),
'ext': {lambda _: 'mp4'},
'format_id': {lambda _: 'source'},
'width': ('width', {int}),
'height': ('height', {int}),
... | ```suggestion
'formats': formats,
'subtitles': subtitles,
'age_limit': 18 if traverse_obj(video_info, ('flags', {0b110.__and__})) else 0,
'_old_archive_ids': [make_archive_id('Pr0grammStatic', video_id)],
**traverse_obj(video_info, {
```
see above | 'filesize': ('fileSize', {int_or_none}),
})) if video_info.get('variants') else [{
'ext': 'mp4',
'format_id': 'source',
**traverse_obj(video_info, {
'url': ('image', {self._create_source_url}),
'width': ('width', {int_or_none}),
... | @@ -110,40 +118,65 @@ def _call_api(self, endpoint, video_id, query={}, note='Downloading API json'):
return data
+ @staticmethod
+ def _create_source_url(path):
+ return urljoin('https://img.pr0gramm.com', path)
+
def _real_extract(self, url):
video_id = self._match_id(url)
... | yt_dlp/extractor/pr0gramm.py | 26 | Python | 0.786 | suggestion | 314 | 36 | 37 | false | [ie/pr0gramm] Support variant formats and subtitles | 8,674 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
live_status = 'is_live'
else:
live_status = None
self.report_warning(f'unknown status: {data.get("status")}')
start_time = rfc3339_to_atende(params['start'])
# current streams have a stop time of *expected* end of session, but actual times
# can chang... | You must have missed this when applying the suggestion
```suggestion
file = update_url_query(file, {'startTime': start_time})
if stop_time is not None:
file = update_url_query(file, {'stopTime': stop_time})
``` | live_status = 'is_live'
else:
live_status = None
self.report_warning(f'unknown status: {data.get("status")}')
start_time = rfc3339_to_atende(params['start'])
# current streams have a stop time of *expected* end of session, but actual times
# can chang... | @@ -0,0 +1,219 @@
+from .common import InfoExtractor
+from .redge import RedCDNLivxIE
+from ..utils import (
+ clean_html,
+ js_to_json,
+ strip_or_none,
+ traverse_obj,
+ update_url_query,
+ ExtractorError,
+)
+
+import datetime
+try:
+ from zoneinfo import ZoneInfo
+ _HAS_ZONEINFO = True
+exce... | yt_dlp/extractor/sejmpl.py | 26 | Python | 0.786 | suggestion | 267 | 51 | 51 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | selfisekai |
elif mode != 'sc':
file_qs['indexMode'] = 'true'
return update_url_query(f'https://r.dcs.redcdn.pl/{mode}/o2/{tenant}/{path}.livx{suffix}', file_qs)
# no id or title for a transmission. making ones up.
title = path \
.replace('/live/', '/').replace('/... | `getcode()` is deprecated
```suggestion
if nvr_urlh and nvr_urlh.status == 200:
```
Also, any thoughts on my DST suggestion from above? | elif mode != 'sc':
file_qs['indexMode'] = 'true'
return update_url_query(f'https://r.dcs.redcdn.pl/{mode}/o2/{tenant}/{path}.livx{suffix}', file_qs)
# no id or title for a transmission. making ones up.
title = path \
.replace('/live', '').replace('liv... | @@ -0,0 +1,134 @@
+from .common import InfoExtractor
+from ..networking import HEADRequest
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_qs,
+ traverse_obj,
+ update_url_query,
+)
+
+from functools import partial
+
+
+class RedCDNLivxIE(InfoExtractor):
+ _VALID_URL... | yt_dlp/extractor/redge.py | 26 | Python | 0.714 | question | 147 | 51 | 51 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | selfisekai |
tenant, path = self._match_valid_url(url).group('tenant', 'id')
qs = parse_qs(url)
start_time = traverse_obj(qs, ('startTime', 0, {int_or_none}))
stop_time = traverse_obj(qs, ('stopTime', 0, {int_or_none}))
def livx_mode(mode):
suffix = ''
if mode == 'liv... | ```suggestion
title = path \
.replace('/live', '').replace('live/', '') \
.replace('/channel', '').replace('channel/', '')
```
`/live/`=>`/` is included in `/live`=>` `
PS: regex is better here imo | tenant, path = self._match_valid_url(url).group('tenant', 'id')
qs = parse_qs(url)
start_time = traverse_obj(qs, ('startTime', 0, {int_or_none}))
stop_time = traverse_obj(qs, ('stopTime', 0, {int_or_none}))
def livx_mode(mode):
suffix = ''
if mode == 'liv... | @@ -0,0 +1,134 @@
+from .common import InfoExtractor
+from ..networking import HEADRequest
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_qs,
+ traverse_obj,
+ update_url_query,
+)
+
+from functools import partial
+
+
+class RedCDNLivxIE(InfoExtractor):
+ _VALID_URL... | yt_dlp/extractor/redge.py | 26 | Python | 0.857 | suggestion | 237 | 51 | 51 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
float_or_none,
int_or_none,
join_nonempty,
parse_qs,
traverse_obj,
update_url_query,
)
from functools import partial
class RedCDNLivxIE(InfoExtractor):
_VALID_URL = r'https?://[^.]+\.(?:dcs\.redcd... | ```suggestion
_VALID_URL = r'https?://[^.]+\.(?:dcs\.redcdn|atmcdn)\.pl/(?:live(?:dash|hls|ss)|nvr)/o2/(?P<tenant>[^/?#]+)/(?P<id>[^?#]+)\.livx'
``` | import functools
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
float_or_none,
int_or_none,
join_nonempty,
parse_qs,
update_url_query,
)
from ..utils.traversal import traverse_obj
class RedCDNLivxIE(InfoExtractor):
_VALID_URL = r'https?://[^.]+\.(... | @@ -0,0 +1,135 @@
+from .common import InfoExtractor
+from ..networking import HEADRequest
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_qs,
+ traverse_obj,
+ update_url_query,
+)
+
+from functools import partial
+
+
+class RedCDNLivxIE(InfoExtractor):
+ _VALID_URL... | yt_dlp/extractor/redge.py | 16 | Python | 0.714 | suggestion | 154 | 41 | 41 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
float_or_none,
int_or_none,
join_nonempty,
parse_qs,
traverse_obj,
update_url_query,
)
from functools import partial
class RedCDNLivxIE(InfoExtractor):
_VALID_URL = r'https?://[^.]+\.(?:dcs\.redcd... | ```suggestion
import functools
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
float_or_none,
int_or_none,
join_nonempty,
parse_qs,
traverse_obj,
update_url_query,
)
``` | import functools
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
float_or_none,
int_or_none,
join_nonempty,
parse_qs,
update_url_query,
)
from ..utils.traversal import traverse_obj
class RedCDNLivxIE(InfoExtractor):
_VALID_URL = r'https?://[^.]+\.(... | @@ -0,0 +1,135 @@
+from .common import InfoExtractor
+from ..networking import HEADRequest
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_qs,
+ traverse_obj,
+ update_url_query,
+)
+
+from functools import partial | yt_dlp/extractor/redge.py | 12 | Python | 0.857 | refactor | 252 | 37 | 37 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
livx_mode('livess'), video_id,
note='Downloading ISM manifest',
errnote='Failed to download ISM manifest',
fatal=False)
ism_doc = None
if ism_res is not False:
ism_doc, ism_urlh = ism_res
formats, _ = self._parse_ism_formats_and_sub... | ```suggestion
ism_doc, ('@Duration', {functools.partial(float_or_none, scale=time_scale)})) or None
``` | livx_mode('livess'), video_id,
note='Downloading ISM manifest',
errnote='Failed to download ISM manifest',
fatal=False)
ism_doc = None
if ism_res is not False:
ism_doc, ism_urlh = ism_res
formats, _ = self._parse_ism_formats_and_sub... | @@ -0,0 +1,135 @@
+from .common import InfoExtractor
+from ..networking import HEADRequest
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_qs,
+ traverse_obj,
+ update_url_query,
+)
+
+from functools import partial
+
+
+class RedCDNLivxIE(InfoExtractor):
+ _VALID_URL... | yt_dlp/extractor/redge.py | 26 | Python | 0.714 | suggestion | 117 | 41 | 41 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
# despite it says "transmisje_arch", it works for live streams too!
data = self._download_json(
f'https://www.sejm.gov.pl/Sejm{term}.nsf/transmisje_arch.xsp/json/{video_id}',
video_id)
params = data['params']
title = data['title'].strip()
if data.get('st... | ```suggestion
if live_status == 'was_live':
stop_time = rfc3339_to_atende(params['stop'])
duration = (stop_time - start_time) // 1000
else:
stop_time, duration = None, None
``` | video_id)
# despite it says "transmisje_arch", it works for live streams too!
data = self._download_json(
f'https://www.sejm.gov.pl/Sejm{term}.nsf/transmisje_arch.xsp/json/{video_id}',
video_id)
params = data['params']
title = strip_or_none(data.get('... | @@ -0,0 +1,218 @@
+from .common import InfoExtractor
+from .redge import RedCDNLivxIE
+from ..utils import (
+ clean_html,
+ js_to_json,
+ strip_or_none,
+ traverse_obj,
+ update_url_query,
+)
+
+from datetime import datetime, timedelta
+
+
+def is_dst(date):
+ year = date.year
+ # last sunday of m... | yt_dlp/extractor/sejmpl.py | 26 | Python | 0.786 | suggestion | 234 | 51 | 51 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
if data.get('status') == 'VIDEO_ENDED':
live_status = 'was_live'
elif data.get('status') == 'VIDEO_PLAYING':
live_status = 'is_live'
else:
live_status = None
self.report_warning(f'unknown status: {data.get("status")}')
start_time = rfc333... | ```suggestion
file = self._proto_relative_url(file)
``` | title = strip_or_none(data.get('title'))
if data.get('status') == 'VIDEO_ENDED':
live_status = 'was_live'
elif data.get('status') == 'VIDEO_PLAYING':
live_status = 'is_live'
else:
live_status = None
self.report_warning(f'unknown status: {d... | @@ -0,0 +1,218 @@
+from .common import InfoExtractor
+from .redge import RedCDNLivxIE
+from ..utils import (
+ clean_html,
+ js_to_json,
+ strip_or_none,
+ traverse_obj,
+ update_url_query,
+)
+
+from datetime import datetime, timedelta
+
+
+def is_dst(date):
+ year = date.year
+ # last sunday of m... | yt_dlp/extractor/sejmpl.py | 26 | Python | 0.571 | suggestion | 69 | 51 | 51 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
if stop_time is not None:
file = update_url_query(file, {'stopTime': stop_time})
stream_id = self._search_regex(r'/o2/sejm/([^/]+)/[^./]+\.livx', file, 'stream id')
common_info = {
'url': file,
'duration': duration,
... | IMO it's cleaner to just make this always non-fatal -- if there are no formats the user has not passed the param it will error upon return anyways
```suggestion
fatal=False) or []
``` | if stop_time is not None:
file = update_url_query(file, {'stopTime': stop_time})
stream_id = self._search_regex(r'/o2/sejm/([^/]+)/[^./]+\.livx', file, 'stream id')
common_info = {
'url': file,
'duration': duration,
... | @@ -0,0 +1,218 @@
+from .common import InfoExtractor
+from .redge import RedCDNLivxIE
+from ..utils import (
+ clean_html,
+ js_to_json,
+ strip_or_none,
+ traverse_obj,
+ update_url_query,
+)
+
+from datetime import datetime, timedelta
+
+
+def is_dst(date):
+ year = date.year
+ # last sunday of m... | yt_dlp/extractor/sejmpl.py | 26 | Python | 0.929 | suggestion | 198 | 49 | 49 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
from .common import InfoExtractor
from .redge import RedCDNLivxIE
from ..utils import (
clean_html,
js_to_json,
strip_or_none,
traverse_obj,
update_url_query,
)
from datetime import datetime, timedelta
def is_dst(date):
year = date.year
# last sunday of march and october, respectively. mi... | in light of https://github.com/yt-dlp/yt-dlp/pull/8978/commits/f070f2d48e39dd65351307590370941f30cdbe07 we may want to revise this somehow
in discord discussion, somebody suggested `import datetime as dt` and I thought that was a manageable solution/compromise | import datetime
from .common import InfoExtractor
from .redge import RedCDNLivxIE
from ..utils import (
clean_html,
join_nonempty,
js_to_json,
strip_or_none,
update_url_query,
)
from ..utils.traversal import traverse_obj
def is_dst(date):
last_march = datetime.datetime(date.year, 3, 31)
l... | @@ -0,0 +1,218 @@
+from .common import InfoExtractor
+from .redge import RedCDNLivxIE
+from ..utils import (
+ clean_html,
+ js_to_json,
+ strip_or_none,
+ traverse_obj,
+ update_url_query,
+)
+
+from datetime import datetime, timedelta
+
+
+def is_dst(date):
+ year = date.year
+ # last sunday of m... | yt_dlp/extractor/sejmpl.py | 25 | Python | 0.571 | suggestion | 263 | 50 | 50 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
from .common import InfoExtractor
from .redge import RedCDNLivxIE
from ..utils import (
clean_html,
js_to_json,
strip_or_none,
traverse_obj,
update_url_query,
)
import datetime
def is_dst(date):
year = date.year
# last sunday of march and october, respectively. might break on switch days.... | ```suggestion
def is_dst(date):
last_march = datetime.datetime(date.year, 3, 31)
last_october = datetime.datetime(date.year, 10, 31)
last_sunday_march = last_march - datetime.timedelta(days=last_march.isoweekday() % 7)
last_sunday_october = last_october - datetime.timedelta(days=last_october.isowee... | import datetime
from .common import InfoExtractor
from .redge import RedCDNLivxIE
from ..utils import (
clean_html,
join_nonempty,
js_to_json,
strip_or_none,
update_url_query,
)
from ..utils.traversal import traverse_obj
def is_dst(date):
last_march = datetime.datetime(date.year, 3, 31)
l... | @@ -0,0 +1,217 @@
+from .common import InfoExtractor
+from .redge import RedCDNLivxIE
+from ..utils import (
+ clean_html,
+ js_to_json,
+ strip_or_none,
+ traverse_obj,
+ update_url_query,
+)
+
+import datetime
+
+
+def is_dst(date):
+ year = date.year
+ # last sunday of march and october, respect... | yt_dlp/extractor/sejmpl.py | 19 | Python | 0.857 | suggestion | 429 | 44 | 44 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
from .common import InfoExtractor
from .redge import RedCDNLivxIE
from ..utils import (
clean_html,
js_to_json,
strip_or_none,
traverse_obj,
update_url_query,
)
import datetime
def is_dst(date):
year = date.year
# last sunday of march and october, respectively. might break on switch days.... | ```suggestion
import datetime
from .common import InfoExtractor
from .redge import RedCDNLivxIE
from ..utils import (
clean_html,
join_nonempty,
js_to_json,
strip_or_none,
update_url_query,
)
from ..utils.traversal import traverse_obj
``` | import datetime
from .common import InfoExtractor
from .redge import RedCDNLivxIE
from ..utils import (
clean_html,
join_nonempty,
js_to_json,
strip_or_none,
update_url_query,
)
from ..utils.traversal import traverse_obj
def is_dst(date):
last_march = datetime.datetime(date.year, 3, 31)
l... | @@ -0,0 +1,217 @@
+from .common import InfoExtractor
+from .redge import RedCDNLivxIE
+from ..utils import (
+ clean_html,
+ js_to_json,
+ strip_or_none,
+ traverse_obj,
+ update_url_query,
+)
+
+import datetime | yt_dlp/extractor/sejmpl.py | 11 | Python | 0.857 | refactor | 272 | 36 | 36 | false | redcdn livx and sejm.pl extractors | 8,676 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.