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
query={ 'hash': video_id, 'action': f'get{code}liveByAjax', 'force_h264': force_h264, }, note=f'Downloading {description} quality metadata', errnote=f'Unable to download {description} quality metadata') return compat...
You should add at least one test for a VOD recording.
'url': 'https://live.erinn.biz/live.php?h675134569', 'md5': 'e380fa6a47fc703d91cea913ab44ec2e', 'info_dict': { 'id': '675134569', 'ext': 'mp4', 'title': 'プロセカ', 'description': 'テストも兼ねたプロセカ配信。', 'timestamp': 1702689148, 'uplo...
@@ -0,0 +1,125 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + urljoin, +) +from ..compat import compat_parse_qs + + +class KukuluLiveIE(InfoExtractor): + _VALID_URL = r'https?://live\.erinn\.biz/live\.php\?h(?P<id>\d+)' + _TESTS = [{...
yt_dlp/extractor/kukululive.py
26
Python
0.286
suggestion
53
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
note='Downloading player html', errnote='Unable to download player html') # https://regex101.com/r/3AXpSA/3 sources = self._search_regex(r'var fplayer_source = ([^;]+)', player_html, 'sources') sources_json = self._parse_json(sources.replace('.mp4",',...
But this isn't expected, is it? ```suggestion raise ExtractorError('Could not detect media type') ```
if desc == 'high' and traverse_obj(quality_meta, ('vcodec', 0)) == 'HEVC': self._add_quality_formats( formats, self._get_quality_meta(video_id, desc, code, force_h264='1')) return { 'id': video_id, 'title': title, ...
@@ -0,0 +1,125 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + urljoin, +) +from ..compat import compat_parse_qs + + +class KukuluLiveIE(InfoExtractor): + _VALID_URL = r'https?://live\.erinn\.biz/live\.php\?h(?P<id>\d+)' + _TESTS = [{...
yt_dlp/extractor/kukululive.py
26
Python
0.929
refactor
112
27
42
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
for (desc, code) in qualities: quality_meta = self._get_quality_meta(video_id, desc, code) self._add_quality_formats(formats, quality_meta) if desc == 'high' and quality_meta.get('vcodec')[0] == 'HEVC': h264_meta = self._get_quality_meta(vi...
```suggestion sources_json = self._search_json( r'var\s+fplayer_source\s*=', player_html, 'stream data', video_id, contains_pattern=r'\[(?s:.+)\]', transform_source=js_to_json) ``` `js_to_json` is from `..utils`
'quality': quality_priority, }) def _real_extract(self, url): video_id = self._match_id(url) html = self._download_webpage(url, video_id) if '>タイムシフトが見つかりませんでした。<' in html: raise ExtractorError('This stream has expired', expected=True) title...
@@ -0,0 +1,125 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + urljoin, +) +from ..compat import compat_parse_qs + + +class KukuluLiveIE(InfoExtractor): + _VALID_URL = r'https?://live\.erinn\.biz/live\.php\?h(?P<id>\d+)' + _TESTS = [{...
yt_dlp/extractor/kukululive.py
26
Python
0.786
suggestion
260
47
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
'https://live.erinn.biz/live.timeshift.fplayer.php', video_id, query={'hash': video_id}, note='Downloading player html', errnote='Unable to download player html') # https://regex101.com/r/3AXpSA/3 sources = self._search_regex(r'var...
I think these are not separate formats of the same video, but segments of the stream, say if the connection dropped for part of the stream. So maybe returning this as a multi video would make sense: ```suggestion entries = [] for i, segment in enumerate(sources_json): path =...
quality_meta = self._get_quality_meta(video_id, desc, code) self._add_quality_formats(formats, quality_meta) if desc == 'high' and traverse_obj(quality_meta, ('vcodec', 0)) == 'HEVC': self._add_quality_formats( formats, self._ge...
@@ -0,0 +1,125 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + urljoin, +) +from ..compat import compat_parse_qs + + +class KukuluLiveIE(InfoExtractor): + _VALID_URL = r'https?://live\.erinn\.biz/live\.php\?h(?P<id>\d+)' + _TESTS = [{...
yt_dlp/extractor/kukululive.py
26
Python
0.786
suggestion
1,196
29
44
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
'h264': 2, 'low': 1, } formats.extend([ { 'format_id': quality, 'url': quality_meta.get('hlsaddr')[0], 'ext': 'mp4', 'vcodec': vcodec, 'quality': quality_priority[quality], }, ...
From my testing, RTMP doesn't work. Can you report something different? ```suggestion vcodec = traverse_obj(quality_meta, ('vcodec', 0)) quality = traverse_obj(quality_meta, ('now_quality', 0)) quality_priority = { 'high': 3, 'h264': 2, 'low': 1, ...
'info_dict': { 'id': '102338092', 'ext': 'mp4', 'title': 'Among Usで遊びます!!', 'description': 'VTuberになりましたねんねこ㌨ですよろしくお願いします', 'timestamp': 1704603118, 'upload_date': '20240107', 'thumbnail': r're:^https?://.*', }, }, {...
@@ -0,0 +1,125 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + urljoin, +) +from ..compat import compat_parse_qs + + +class KukuluLiveIE(InfoExtractor): + _VALID_URL = r'https?://live\.erinn\.biz/live\.php\?h(?P<id>\d+)' + _TESTS = [{...
yt_dlp/extractor/kukululive.py
26
Python
0.786
suggestion
1,020
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
'formats': formats, } if is_vod: player_html = self._download_webpage( 'https://live.erinn.biz/live.timeshift.fplayer.php', video_id, query={'hash': video_id}, note='Downloading player html', errnote='Unable...
I think to have it extra clear, I would name these `segment_id`/`segment_title`. ```suggestion def parse_segment(segment, segment_id, segment_title): path = segment.get('file') if not path: return None formats = [{ ...
player_html = self._download_webpage( 'https://live.erinn.biz/live.timeshift.fplayer.php', video_id, 'Downloading player html', 'Unable to download player html', query={'hash': video_id}) sources = traverse_obj(self._search_json( r'var\s+fplayer_source\s*=', player_h...
@@ -0,0 +1,158 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + urljoin, + js_to_json, + traverse_obj, + int_or_none, + url_or_none, +) +from urllib.parse import parse_qs + + +class KukuluLiveIE(InfoExtractor): + _VALID_URL = ...
yt_dlp/extractor/kukululive.py
26
Python
0.786
suggestion
587
46
28
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
return None formats = [{ 'url': urljoin('https://live.erinn.biz', path), 'ext': 'mp4', 'protocol': 'm3u8_native', }] return { 'id': id, 'title': title, ...
I would slightly adjust this: ```suggestion if len(sources_json) == 1: return parse_segment(sources_json[0], video_id, title) entries = [] for i, segment in enumerate(sources_json): if entry := parse_segment(segment, f'{video_id}_{i}', f'{title...
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, filter_dict, get_element_by_id, int_or_none, join_nonempty, js_to_json, qualities, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class KukuluLiveIE(Info...
@@ -0,0 +1,158 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + urljoin, + js_to_json, + traverse_obj, + int_or_none, + url_or_none, +) +from urllib.parse import parse_qs + + +class KukuluLiveIE(InfoExtractor): + _VALID_URL = ...
yt_dlp/extractor/kukululive.py
26
Python
0.786
suggestion
485
29
141
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, get_element_by_id, urljoin, js_to_json, traverse_obj, int_or_none, url_or_none, ) from urllib.parse import parse_qs class KukuluLiveIE(InfoExtractor): _VALID_URL = r'https?://live\.erinn\.biz/live\....
Sort imports ```suggestion from urllib.parse import parse_qs from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, get_element_by_id, int_or_none, js_to_json, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj ```
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, filter_dict, get_element_by_id, int_or_none, join_nonempty, js_to_json, qualities, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class KukuluLiveIE(Info...
@@ -0,0 +1,158 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + urljoin, + js_to_json, + traverse_obj, + int_or_none, + url_or_none, +) +from urllib.parse import parse_qs
yt_dlp/extractor/kukululive.py
12
Python
1
refactor
303
37
37
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
from urllib.parse import parse_qs from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, get_element_by_id, int_or_none, js_to_json, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class KukuluLiveIE(InfoExtractor): _VALID_URL = r'https?...
I personally don't like `from` imports from stdlib. But it's become widespread in code now, so I won't say never to use it. But especially for `parse_qs`, there is a `utils.parse_qs` which is easily confused with this
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, filter_dict, get_element_by_id, int_or_none, join_nonempty, js_to_json, qualities, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class KukuluLiveIE(Info...
@@ -0,0 +1,156 @@ +from urllib.parse import parse_qs
yt_dlp/extractor/kukululive.py
1
Python
0.643
suggestion
217
26
26
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
pukkandan
DmitryScaletta
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, get_element_by_id, int_or_none, js_to_json, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class KukuluLiveIE(InfoExtractor): _VALID_URL = r'https?://live\.erinn...
```suggestion join_nonempty, js_to_json, qualities, url_or_none, ```
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, filter_dict, get_element_by_id, int_or_none, join_nonempty, js_to_json, qualities, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class KukuluLiveIE(Info...
@@ -0,0 +1,156 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + js_to_json, + url_or_none,
yt_dlp/extractor/kukululive.py
10
Python
0.571
suggestion
89
35
35
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
'id': '675134569', 'ext': 'mp4', 'title': 'プロセカ', 'description': 'テストも兼ねたプロセカ配信。', 'timestamp': 1702689148, 'upload_date': '20231216', 'thumbnail': r're:^https?://.*', }, }, { 'url': 'https://live.erinn.biz/live.php?...
```suggestion }] _QUALITIES = qualities(('low', 'h264', 'high')) def _get_quality_meta(self, video_id, desc, code, force_h264=''): ```
'url': 'https://live.erinn.biz/live.php?h675134569', 'md5': 'e380fa6a47fc703d91cea913ab44ec2e', 'info_dict': { 'id': '675134569', 'ext': 'mp4', 'title': 'プロセカ', 'description': 'テストも兼ねたプロセカ配信。', 'timestamp': 1702689148, 'uplo...
@@ -0,0 +1,156 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + js_to_json, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +class KukuluLiveIE(InfoExtractor): + ...
yt_dlp/extractor/kukululive.py
26
Python
0.714
suggestion
154
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
}, { 'url': 'https://live.erinn.biz/live.php?h878049531', 'only_matching': True, }] def _get_quality_meta(self, video_id, desc, code, force_h264=''): description = desc if force_h264 == '' else f'{desc} (force_h264)' qs = self._download_webpage( 'https://live.eri...
```suggestion quality_priority = self._QUALITIES(quality) ```
'upload_date': '20240107', 'thumbnail': r're:^https?://.*', }, }, { 'url': 'https://live.erinn.biz/live.php?h878049531', 'only_matching': True, }] def _get_quality_meta(self, video_id, desc, code, force_h264=None): desc += ' (force_h264)' if force_h26...
@@ -0,0 +1,156 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + js_to_json, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +class KukuluLiveIE(InfoExtractor): + ...
yt_dlp/extractor/kukululive.py
26
Python
0.571
suggestion
71
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
'description': 'VTuberになりましたねんねこ㌨ですよろしくお願いします', 'timestamp': 1704603118, 'upload_date': '20240107', 'thumbnail': r're:^https?://.*', }, }, { 'url': 'https://live.erinn.biz/live.php?h878049531', 'only_matching': True, }] def _get_qualit...
```suggestion vcodec = traverse_obj(quality_meta, ('vcodec', 0, {str})) quality = traverse_obj(quality_meta, ('now_quality', 0, {str})) ```
'id': '102338092', 'ext': 'mp4', 'title': 'Among Usで遊びます!!', 'description': 'VTuberになりましたねんねこ㌨ですよろしくお願いします', 'timestamp': 1704603118, 'upload_date': '20240107', 'thumbnail': r're:^https?://.*', }, }, { 'url': 'https:...
@@ -0,0 +1,156 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + js_to_json, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +class KukuluLiveIE(InfoExtractor): + ...
yt_dlp/extractor/kukululive.py
26
Python
0.714
suggestion
158
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
'action': f'get{code}liveByAjax', 'force_h264': force_h264, }, note=f'Downloading {description} quality metadata', errnote=f'Unable to download {description} quality metadata') return urllib.parse.parse_qs(qs) def _add_quality_formats(self...
```suggestion 'format_id': join_nonempty(quality, 'audioonly'), ```
'https://live.erinn.biz/live.player.fplayer.php', video_id, f'Downloading {desc} quality metadata', f'Unable to download {desc} quality metadata', query=filter_dict({ 'hash': video_id, 'action': f'get{code}liveByAjax', 'force_h264': for...
@@ -0,0 +1,156 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + js_to_json, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +class KukuluLiveIE(InfoExtractor): + ...
yt_dlp/extractor/kukululive.py
26
Python
0.571
suggestion
85
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
'quality': quality_priority, }) def _real_extract(self, url): video_id = self._match_id(url) html = self._download_webpage(url, video_id) title = clean_html(get_element_by_id('livetitle', html.replace('<SPAN', '<span').replace('SPAN>', 'span>'))) descrip...
```suggestion self._add_quality_formats( formats, self._get_quality_meta(video_id, desc, code, force_h264='1')) ```
def _real_extract(self, url): video_id = self._match_id(url) html = self._download_webpage(url, video_id) if '>タイムシフトが見つかりませんでした。<' in html: raise ExtractorError('This stream has expired', expected=True) title = clean_html( get_element_by_id('livetitle', ht...
@@ -0,0 +1,156 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + js_to_json, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +class KukuluLiveIE(InfoExtractor): + ...
yt_dlp/extractor/kukululive.py
26
Python
0.714
suggestion
162
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
formats.append({ 'format_id': f'{quality}-audioonly', 'url': quality_meta['hlsaddr_audioonly'][0], 'ext': 'm4a', 'vcodec': 'none', 'quality': quality_priority, }) def _real_extract(self, url): video_id =...
```suggestion streams = [ ('high', 'Z'), ('low', 'ForceLow'), ] formats = [] for (desc, code) in streams: ```
'url': quality_meta['hlsaddr_audioonly'][0], 'ext': 'm4a', 'vcodec': 'none', 'quality': quality_priority, }) def _real_extract(self, url): video_id = self._match_id(url) html = self._download_webpage(url, video_id) ...
@@ -0,0 +1,156 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + js_to_json, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +class KukuluLiveIE(InfoExtractor): + ...
yt_dlp/extractor/kukululive.py
26
Python
0.714
suggestion
196
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
'high': 3, 'h264': 2, 'low': 1, }.get(quality, 0) if traverse_obj(quality_meta, ('hlsaddr', 0, {url_or_none})): formats.append({ 'format_id': quality, 'url': quality_meta['hlsaddr'][0], 'ext': 'mp4', ...
```suggestion title = clean_html( get_element_by_id('livetitle', html.replace('<SPAN', '<span').replace('SPAN>', 'span>'))) ```
quality = traverse_obj(quality_meta, ('now_quality', 0, {str})) quality_priority = qualities(('low', 'h264', 'high'))(quality) if traverse_obj(quality_meta, ('hlsaddr', 0, {url_or_none})): formats.append({ 'format_id': quality, 'url': quality_meta['hls...
@@ -0,0 +1,156 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + js_to_json, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +class KukuluLiveIE(InfoExtractor): + ...
yt_dlp/extractor/kukululive.py
26
Python
0.786
suggestion
150
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
}) if traverse_obj(quality_meta, ('hlsaddr_audioonly', 0, {url_or_none})): formats.append({ 'format_id': join_nonempty(quality, 'audioonly'), 'url': quality_meta['hlsaddr_audioonly'][0], 'ext': 'm4a', 'vcodec': 'none', ...
```suggestion formats = [] for (desc, code) in [('high', 'Z'), ('low', 'ForceLow')]: ```
'quality': quality_priority, }) if traverse_obj(quality_meta, ('hlsaddr_audioonly', 0, {url_or_none})): formats.append({ 'format_id': join_nonempty(quality, 'audioonly'), 'url': quality_meta['hlsaddr_audioonly'][0], 'ext': '...
@@ -0,0 +1,140 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + clean_html, + get_element_by_id, + int_or_none, + join_nonempty, + js_to_json, + qualities, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +class KukuluLiveIE(InfoEx...
yt_dlp/extractor/kukululive.py
26
Python
0.714
suggestion
115
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
def _add_quality_formats(self, formats, quality_meta): vcodec = traverse_obj(quality_meta, ('vcodec', 0, {str})) quality = traverse_obj(quality_meta, ('now_quality', 0, {str})) quality_priority = qualities(('low', 'h264', 'high'))(quality) if traverse_obj(quality_meta, ('hlsaddr', 0,...
make sure this isn't added by a user ```suggestion if '>タイムシフトが見つかりませんでした。<' in html: ```
def _add_quality_formats(self, formats, quality_meta): vcodec = traverse_obj(quality_meta, ('vcodec', 0, {str})) quality = traverse_obj(quality_meta, ('now_quality', 0, {str})) quality_priority = qualities(('low', 'h264', 'high'))(quality) if traverse_obj(quality_meta, ('hlsaddr', 0,...
@@ -0,0 +1,140 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + join_nonempty, + js_to_json, + qualities, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +clas...
yt_dlp/extractor/kukululive.py
26
Python
0.786
suggestion
100
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, get_element_by_id, int_or_none, join_nonempty, js_to_json, qualities, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class KukuluLiveIE(InfoExtractor): _...
```suggestion clean_html, filter_dict, get_element_by_id, ```
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, filter_dict, get_element_by_id, int_or_none, join_nonempty, js_to_json, qualities, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class KukuluLiveIE(Info...
@@ -0,0 +1,140 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id,
yt_dlp/extractor/kukululive.py
7
Python
0.571
suggestion
77
32
32
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
'info_dict': { 'id': '102338092', 'ext': 'mp4', 'title': 'Among Usで遊びます!!', 'description': 'VTuberになりましたねんねこ㌨ですよろしくお願いします', 'timestamp': 1704603118, 'upload_date': '20240107', 'thumbnail': r're:^https?://.*', }, }, {...
```suggestion def _get_quality_meta(self, video_id, desc, code, force_h264=None): if force_h264: desc += ' (force_h264)' qs = self._download_webpage( 'https://live.erinn.biz/live.player.fplayer.php', video_id, f'Downloading {desc} quality metadata', f'Unable...
'md5': 'dcf5167a934b1c60333461e13a81a6e2', 'info_dict': { 'id': '102338092', 'ext': 'mp4', 'title': 'Among Usで遊びます!!', 'description': 'VTuberになりましたねんねこ㌨ですよろしくお願いします', 'timestamp': 1704603118, 'upload_date': '20240107', '...
@@ -0,0 +1,140 @@ +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_id, + int_or_none, + join_nonempty, + js_to_json, + qualities, + url_or_none, + urljoin, +) +from ..utils.traversal import traverse_obj + + +clas...
yt_dlp/extractor/kukululive.py
26
Python
0.786
suggestion
584
51
51
false
[KukuluLive] Add extractor
8,877
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
'info_dict': { 'id': '140535', 'ext': 'mp4', 'live_status': 'is_live', 'channel': 'KBS뉴스', 'channel_id': 'kbsnews', 'start_time': 1696867320, 'title': 're:^언제 어디서나! KBS 뉴스 24 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', ...
```suggestion raise ExtractorError(f'Unknown status {status!r}') ```
'info_dict': { 'id': '140535', 'ext': 'mp4', 'live_status': 'is_live', 'channel': 'KBS뉴스', 'channel_id': 'kbsnews', 'start_time': 1696867320, 'title': 're:^언제 어디서나! KBS 뉴스 24 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', ...
@@ -205,55 +240,28 @@ class NaverLiveIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - page = self._download_webpage(url, video_id, 'Downloading Page', 'Unable to download Page') - secure_url = self._search_regex(r'sApiF:\s+(?:"|\')([^"\']+)', page, 'secureu...
yt_dlp/extractor/naver.py
26
Python
0.786
refactor
82
51
51
false
[ie/Naver] Fix extractor
8,883
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'start_time': 1696867320, 'title': 're:^언제 어디서나! KBS 뉴스 24 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'description': 'md5:6ad419c0bf2f332829bda3f79c295284', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)', 'like_count': int, }, }, { 'u...
could inline `playback_info` ```suggestion 'formats': self._extract_m3u8_formats( traverse_obj(data, ('playbackBody', {json.loads}, 'media', 0, 'path')), video_id, live=True), ```
'start_time': 1696867320, 'title': 're:^언제 어디서나! KBS 뉴스 24 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'description': 'md5:6ad419c0bf2f332829bda3f79c295284', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)', 'like_count': int, }, }, { 'u...
@@ -205,55 +240,28 @@ class NaverLiveIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - page = self._download_webpage(url, video_id, 'Downloading Page', 'Unable to download Page') - secure_url = self._search_regex(r'sApiF:\s+(?:"|\')([^"\']+)', page, 'secureu...
yt_dlp/extractor/naver.py
26
Python
0.857
refactor
211
51
51
false
[ie/Naver] Fix extractor
8,883
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'is_live': True, 'formats': formats, 'subtitles': subtitles, } class CHZZKVideoIE(InfoExtractor): IE_NAME = 'chzzk:video' _VALID_URL = r'https?://chzzk\.naver\.com/video/(?P<id>\d+)' _TESTS = [{ 'url': 'https://chzzk.naver.com/video/1754', 'only_...
Already needs to be updated to v2. Getting `'content'` should also be fatal. ```suggestion video_meta = self._download_json( f'https://api.chzzk.naver.com/service/v2/videos/{video_id}', video_id, note='Downloading video info', errnote='Unable to download video info')['content'] ``` ...
formats, subtitles = [], {} for media in traverse_obj(live_playback, ('media', lambda _, v: url_or_none(v['path']))): is_low_latency = media.get('mediaId') == 'LLHLS' fmts, subs = self._extract_m3u8_formats_and_subtitles( media['path'], channel_id, 'mp4', fatal=Fa...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
0.857
suggestion
321
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
note='Downloading video info', errnote='Unable to download video info') video_meta = video_meta_response.get('content') vod_id = video_meta.get('videoId') in_key = video_meta.get('inKey') playback_xml = self._download_xml( f'https://apis.naver.com/neon...
Hmm, I don't think it's worth it to extract the preview thumbnails, since we already have the regular thumbnail. Any specific reason you implemented this? ```suggestion formats, subtitles = self._extract_mpd_formats_and_subtitles( f'https://apis.naver.com/neonplayer/vodplay/v1/playback/{video_met...
'concurrent_view_count': ('concurrentUserCount', {int_or_none}), 'view_count': ('accumulateCount', {int_or_none}), 'channel': ('channel', 'channelName', {str}), 'channel_id': ('channel', 'channelId', {str}), 'channel_is_verified': ('channel...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
0.857
refactor
609
42
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
for fmt in fmts: fmt['format_id'] += '-ll' formats.extend(fmts) self._merge_subtitles(subtitles, subs) return { 'id': str(channel_id), 'title': live_detail.get('liveTitle'), 'thumbnails': thumbnails, 'ti...
Please fill in the actual test data
live_playback = self._parse_json(live_detail['livePlaybackJson'], channel_id) thumbnails = [] thumbnail_template = traverse_obj( live_playback, ('thumbnail', 'snapshotThumbnailTemplate', {url_or_none})) if thumbnail_template and '{type}' in thumbnail_template: f...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
0.071
suggestion
35
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
thumbnails = [] i = 0 for source in playback_xml.iterfind( './Period/SupplementalProperty/nvod:Thumbnails/nvod:ThumbnailSet/nvod:Thumbnail/nvod:Source', NS_MAP, ): thumbnails.append({'id': str(i), 'url': source.text.split('?')[0]}) i += 1 ...
Can be combined in to a single `traverse_obj` call: ```suggestion return { 'id': video_id, 'formats': formats, 'subtitles': subtitles, **traverse_obj(video_meta, { 'title': ('videoTitle', {str}), 'thumbnail': ('thumbnailImag...
'info_dict': { 'id': '1754', 'ext': 'mp4', 'title': '치지직 테스트 방송', 'channel': '침착맨', 'channel_id': 'bb382c2c0cc9fa7c86ab3b037fb5799c', 'channel_is_verified': False, 'thumbnail': r're:^https?://.*\.jpg$', 'duration': 1...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
0.786
suggestion
762
27
45
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
from .common import InfoExtractor from ..utils import ( ExtractorError, traverse_obj, parse_iso8601, ) class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' _TESTS = [{ 'url': 'https://chzzk.naver.com/live/c68b8ef525fb3...
Channels are always hexadecimal? ```suggestion _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' ```
import functools from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)'
yt_dlp/extractor/chzzk.py
11
Python
0.714
suggestion
122
36
36
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
from .common import InfoExtractor from ..utils import ( ExtractorError, traverse_obj, parse_iso8601, ) class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' _TESTS = [{ 'url': 'https://chzzk.naver.com/live/c68b8ef525fb3...
Even if users are not constantly live, I would still add a test. Maybe skip it by default.
import functools from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
14
Python
0.286
suggestion
90
39
39
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
from .common import InfoExtractor from ..utils import ( ExtractorError, traverse_obj, parse_iso8601, ) class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' _TESTS = [{ 'url': 'https://chzzk.naver.com/live/c68b8ef525fb3...
```suggestion live_detail = self._download_json( f'https://api.chzzk.naver.com/service/v2/channels/{channel_id}/live-detail', channel_id, note='Downloading channel info', errnote='Unable to download channel info')['content'] ```
import functools from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
23
Python
0.786
suggestion
264
48
48
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
ExtractorError, traverse_obj, parse_iso8601, ) class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' _TESTS = [{ 'url': 'https://chzzk.naver.com/live/c68b8ef525fb3d2fa146344d84991753', 'only_matching': True, ...
```suggestion live_playback = self._parse_json(live_detail['livePlaybackJson'], channel_id) ```
from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
0.714
suggestion
105
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
f'https://api.chzzk.naver.com/service/v1/channels/{channel_id}/live-detail', channel_id, note='Downloading channel info', errnote='Unable to download channel info') live_detail = live_detail_response.get('content') if live_detail.get('status') == 'CLOSE': ...
```suggestion for media in traverse_obj(live_playback, ('media', lambda _, v: url_or_none(v['path']))): is_low_latency = media.get('mediaId') == 'LLHLS' fmts, subs = self._extract_m3u8_formats_and_subtitles( media['path'], channel_id, 'mp4', fatal=False, live=True, ...
'id': 'c68b8ef525fb3d2fa146344d84991753', 'ext': 'mp4', 'title': str, 'channel': '진짜도현', 'channel_id': 'c68b8ef525fb3d2fa146344d84991753', 'channel_is_verified': False, 'thumbnail': r're:^https?://.*\.jpg$', 'timestamp': 170...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
0.857
performance
795
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
errnote='Unable to download channel info') live_detail = live_detail_response.get('content') if live_detail.get('status') == 'CLOSE': raise ExtractorError('The channel is not currently live', expected=True) live_playback = self._parse_json(live_detail.get('livePlaybackJ...
Need to actually be saved ```suggestion self._merge_subtitles(subs, target=subtitles) ```
'title': str, 'channel': '진짜도현', 'channel_id': 'c68b8ef525fb3d2fa146344d84991753', 'channel_is_verified': False, 'thumbnail': r're:^https?://.*\.jpg$', 'timestamp': 1705510344, 'upload_date': '20240117', 'live_status': 'is_l...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
0.714
suggestion
104
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
_TESTS = [{ 'url': 'https://chzzk.naver.com/live/c68b8ef525fb3d2fa146344d84991753', 'only_matching': True, }] def _real_extract(self, url): channel_id = self._match_id(url) live_detail_response = self._download_json( f'https://api.chzzk.naver.com/service/v1/chann...
```suggestion thumbnail_template = traverse_obj( live_playback, ('thumbnail', 'snapshotThumbnailTemplate', {url_or_none})) if thumbnail_template: for width in traverse_obj(live_playback, ('thumbnail', 'types', ..., {str})): thumbnails.append({ ...
class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' _TESTS = [{ 'url': 'https://chzzk.naver.com/live/c68b8ef525fb3d2fa146344d84991753', 'info_dict': { 'id': 'c68b8ef525fb3d2fa146344d84991753', 'ex...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
1
suggestion
486
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
for width in traverse_obj(live_playback, ('thumbnail', 'types')): thumbnails.append({ 'id': width, 'url': thumbnail_template.replace('{type}', width), 'width': int(width), }) formats, subtitles = [], {} for media in live_pl...
These can also be combined in to a single `traverse_obj` call like above
}, 'skip': 'The channel is not currently live', }] def _real_extract(self, url): channel_id = self._match_id(url) live_detail = self._download_json( f'https://api.chzzk.naver.com/service/v2/channels/{channel_id}/live-detail', channel_id, note='Downloading...
@@ -0,0 +1,121 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + parse_iso8601, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[^/#?]+)' + _TESTS = [{ + 'url': 'https://chz...
yt_dlp/extractor/chzzk.py
26
Python
0.357
suggestion
72
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, parse_iso8601, traverse_obj, url_or_none, ) class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' _TESTS = [{ 'url': 'https:/...
Use single quotes ```suggestion 'id': 'c68b8ef525fb3d2fa146344d84991753', 'ext': 'mp4', ```
import functools from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/...
@@ -0,0 +1,134 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_iso8601, + traverse_obj, + url_or_none, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' + _TE...
yt_dlp/extractor/chzzk.py
18
Python
0.786
suggestion
119
43
43
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
return { 'id': str(channel_id), 'title': live_detail.get('liveTitle'), 'thumbnails': thumbnails, **traverse_obj(live_detail, { 'timestamp': ('openDate', {lambda d: parse_iso8601(d, ' ')}), 'view_count': ('concurrentUserCount', {int_...
```suggestion 'md5': 'b0c0c1bb888d913b93d702b1512c7f06', 'info_dict': { 'id': '1754', 'ext': 'mp4', ```
f['quality'] = -2 formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) return { 'id': channel_id, 'is_live': True, 'formats': formats, 'subtitles': subtitles, 'thumbnails': thumbnails, ...
@@ -0,0 +1,134 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_iso8601, + traverse_obj, + url_or_none, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' + _TE...
yt_dlp/extractor/chzzk.py
26
Python
0.714
suggestion
148
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
'view_count': int, }, }] def _real_extract(self, url): video_id = self._match_id(url) video_meta = self._download_json( f'https://api.chzzk.naver.com/service/v2/videos/{video_id}', video_id, note='Downloading video info', errnote='Unable to download v...
```suggestion 'timestamp': ('publishDateAt', {functools.partial(float_or_none, scale=1000)}), ```
'channel_is_verified': False, 'thumbnail': r're:^https?://.*\.jpg$', 'duration': 15577, 'timestamp': 1702970505.417, 'upload_date': '20231219', 'view_count': int, }, }] def _real_extract(self, url): video_id = self._match_i...
@@ -0,0 +1,134 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_iso8601, + traverse_obj, + url_or_none, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' + _TE...
yt_dlp/extractor/chzzk.py
26
Python
0.714
suggestion
115
34
39
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
fmts, subs = self._extract_m3u8_formats_and_subtitles( media['path'], channel_id, 'mp4', fatal=False, live=True, m3u8_id='hls-ll' if is_low_latency else 'hls') for f in fmts: if is_low_latency: f['source_preference'] = -2 ...
`channel_id` must already be a string due to coming from a regex. I moved the title in to the `traverse_obj` call and renamed `view_count` to `concurrent_view_count`. ```suggestion return { 'id': channel_id, 'is_live': True, 'formats': formats, 'subtitles': ...
formats, subtitles = [], {} for media in traverse_obj(live_playback, ('media', lambda _, v: url_or_none(v['path']))): is_low_latency = media.get('mediaId') == 'LLHLS' fmts, subs = self._extract_m3u8_formats_and_subtitles( media['path'], channel_id, 'mp4', fatal=F...
@@ -0,0 +1,134 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_iso8601, + traverse_obj, + url_or_none, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' + _TE...
yt_dlp/extractor/chzzk.py
26
Python
0.857
suggestion
941
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
'channel': ('channel', 'channelName', {str}), 'channel_id': ('channel', 'channelId', {str}), 'channel_is_verified': ('channel', 'verifiedMark', {bool}), }), 'is_live': True, 'formats': formats, 'subtitles': subtitles, ...
```suggestion 'timestamp': 1702970505.417, ```
'formats': formats, 'subtitles': subtitles, 'thumbnails': thumbnails, **traverse_obj(live_detail, { 'title': ('liveTitle', {str}), 'timestamp': ('openDate', {functools.partial(parse_iso8601, delimiter=' ')}), 'concurrent_vie...
@@ -0,0 +1,134 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_iso8601, + traverse_obj, + url_or_none, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' + _TE...
yt_dlp/extractor/chzzk.py
26
Python
0.571
suggestion
60
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, parse_iso8601, traverse_obj, url_or_none, ) class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' _TESTS = [{ 'url': 'https:/...
```suggestion import functools from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj ```
import functools from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/...
@@ -0,0 +1,134 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_iso8601, + traverse_obj, + url_or_none, +)
yt_dlp/extractor/chzzk.py
8
Python
1
refactor
240
33
33
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
parse_iso8601, traverse_obj, url_or_none, ) class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' _TESTS = [{ 'url': 'https://chzzk.naver.com/live/c68b8ef525fb3d2fa146344d84991753', 'info_dict': { "...
```suggestion 'view_count': int, 'concurrent_view_count': int, ```
ExtractorError, float_or_none, int_or_none, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class CHZZKLiveIE(InfoExtractor): IE_NAME = 'chzzk:live' _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' _TESTS = [{ 'url': 'https://chzzk.naver...
@@ -0,0 +1,134 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_iso8601, + traverse_obj, + url_or_none, +) + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_URL = r'https?://chzzk\.naver\.com/live/(?P<id>[\da-f]+)' + _TE...
yt_dlp/extractor/chzzk.py
26
Python
0.571
suggestion
93
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
seproDev
DmitryScaletta
'channel_is_verified': False, 'thumbnail': r're:^https?://.*\.jpg$', 'timestamp': 1705510344, 'upload_date': '20240117', 'live_status': 'is_live', 'view_count': int, 'concurrent_view_count': int, }, 'skip': 'The channel ...
maybe we should do this just in case? not a mandatory change ```suggestion if thumbnail_template and '{type}' in thumbnail_template: ```
'channel_is_verified': False, 'thumbnail': r're:^https?://.*\.jpg$', 'timestamp': 1705510344, 'upload_date': '20240117', 'live_status': 'is_live', 'view_count': int, 'concurrent_view_count': int, }, 'skip': 'The channel ...
@@ -0,0 +1,139 @@ +import functools + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + int_or_none, + parse_iso8601, + url_or_none, +) +from ..utils.traversal import traverse_obj + + +class CHZZKLiveIE(InfoExtractor): + IE_NAME = 'chzzk:live' + _VALID_U...
yt_dlp/extractor/chzzk.py
26
Python
0.929
suggestion
147
51
51
false
[CHZZK] Add extractors
8,887
yt-dlp/yt-dlp
132,642
Python
bashonly
DmitryScaletta
import re from .common import InfoExtractor from ..utils import orderedSet class CTVNewsIE(InfoExtractor): _VALID_URL = r'https?://(?:.+?\.)?ctvnews\.ca/(?:video\?(?:clip|playlist|bin)Id=|.*?)(?P<id>[0-9.]+)(?:$|[#?])' _TESTS = [{ 'url': 'http://www.ctvnews.ca/video?clipId=901995', 'md5': 'b6...
```suggestion _VALID_URL = r'https?://(?:.+?\.)?ctvnews\.ca/(?:video\?(?:clip|playlist|bin)Id=|.*?)(?P<id>[0-9.]+)(?:$|[#?&])' ```
import re from .common import InfoExtractor from ..utils import orderedSet class CTVNewsIE(InfoExtractor): _VALID_URL = r'https?://(?:.+?\.)?ctvnews\.ca/(?:video\?(?:clip|playlist|bin)Id=|.*?)(?P<id>[0-9.]+)(?:$|[#?&])' _TESTS = [{ 'url': 'http://www.ctvnews.ca/video?clipId=901995', 'md5': 'b...
@@ -5,17 +5,25 @@ class CTVNewsIE(InfoExtractor): - _VALID_URL = r'https?://(?:.+?\.)?ctvnews\.ca/(?:video\?(?:clip|playlist|bin)Id=|.*?)(?P<id>[0-9.]+)' + _VALID_URL = r'https?://(?:.+?\.)?ctvnews\.ca/(?:video\?(?:clip|playlist|bin)Id=|.*?)(?P<id>[0-9.]+)(?:$|[#?])'
yt_dlp/extractor/ctvnews.py
8
Python
0.714
suggestion
136
33
33
false
[ie/ctvnews] Fix playlist ID extraction
8,892
yt-dlp/yt-dlp
132,642
Python
seproDev
qbnu
h.update(nonce) tmp = h.digest() def mix_tmp(count): nonlocal tmp for i in range(count): mix_once(tmp) def mix_twist(nonce): nonlocal tmp mix_once(base64.urlsafe_b64encode(tmp).rstrip(b'=') + nonce) mix_on...
Why not just move the opener also up here? ```suggestion AbemaTVBaseIE._DEVICE_ID = str(uuid.uuid4()) add_opener(self._downloader, AbemaLicenseHandler(self)) username, _ = self._get_login_info() AbemaTVBaseIE._USERTOKEN = username and self.cache.load(self._NETRC_MACHINE, usernam...
h.update(nonce) tmp = h.digest() def mix_tmp(count): nonlocal tmp for i in range(count): mix_once(tmp) def mix_twist(nonce): nonlocal tmp mix_once(base64.urlsafe_b64encode(tmp).rstrip(b'=') + nonce) mix_on...
@@ -138,15 +138,16 @@ def _get_device_token(self): username, _ = self._get_login_info() AbemaTVBaseIE._USERTOKEN = username and self.cache.load(self._NETRC_MACHINE, username) + AbemaTVBaseIE._DEVICE_ID = str(uuid.uuid4())
yt_dlp/extractor/abematv.py
26
Python
1
performance
327
51
51
false
[ie/abematv]: fix extraction when using cache
8,895
yt-dlp/yt-dlp
132,642
Python
pukkandan
sefidel
def mix_tmp(count): nonlocal tmp for i in range(count): mix_once(tmp) def mix_twist(nonce): nonlocal tmp mix_once(base64.urlsafe_b64encode(tmp).rstrip(b'=') + nonce) mix_once(cls._SECRETKEY) mix_tmp(time_struct.tm_mon) ...
note to maintainers: Update the version before merge
def mix_tmp(count): nonlocal tmp for i in range(count): mix_once(tmp) def mix_twist(nonce): nonlocal tmp mix_once(base64.urlsafe_b64encode(tmp).rstrip(b'=') + nonce) mix_once(cls._SECRETKEY) mix_tmp(time_struct.tm_mon) ...
@@ -136,11 +136,15 @@ def _get_device_token(self): if self._USERTOKEN: return self._USERTOKEN + add_opener(self._downloader, AbemaLicenseHandler(self)) + username, _ = self._get_login_info() - AbemaTVBaseIE._USERTOKEN = username and self.cache.load(self._NETRC_MACHINE, use...
yt_dlp/extractor/abematv.py
26
Python
0.214
suggestion
52
51
51
false
[ie/abematv]: fix extraction when using cache
8,895
yt-dlp/yt-dlp
132,642
Python
pukkandan
sefidel
has_specials = special.startswith('@') or special == 'text()' if not has_specials: xpath = f'{xpath}{sep}{special}' # Allow abbreviations of relative paths, absolute paths error if xpath.startswith('/'): xpath = f'.{xpath}' eli...
I would be for only returning the value instead of a list, when `@attr` ot `text()` are used without a leading xpath. Pretty much in every case that you pass a sole `@attr` you would want to retrieve the actual value and not a list with the value. Currently, you need to do this: ```python traverse_obj(etree, ('@name...
if not special.startswith('@') and special != 'text()': xpath = key special = None # Allow abbreviations of relative paths, absolute paths error if xpath.startswith('/'): xpath = f'.{xpath}' elif xpath and not xpath.startsw...
@@ -168,14 +169,38 @@ def apply_key(key, obj, is_last): result = next((v for k, v in obj.groupdict().items() if casefold(k) == key), None) elif isinstance(key, (int, slice)): - if is_iterable_like(obj, collections.abc.Sequence): + if is_iterable_like(obj, collections.ab...
yt_dlp/utils/traversal.py
26
Python
0.857
suggestion
386
51
51
false
[utils] `traverse_obj`: Support `xml.etree.ElementTree.Element`
8,911
yt-dlp/yt-dlp
132,642
Python
seproDev
Grub4K
result = (v for k, v in iter_obj if try_call(key, args=(k, v))) if not branching: # string traversal result = ''.join(result) elif isinstance(key, dict): iter_obj = ((k, _traverse_obj(obj, v, False, is_last)) for k, v in key.items()) result = { ...
```suggestion if is_iterable_like(obj, (collections.abc.Sequence, xml.etree.ElementTree.Element)): ``` is better imo
result = (v for k, v in iter_obj if try_call(key, args=(k, v))) if not branching: # string traversal result = ''.join(result) elif isinstance(key, dict): iter_obj = ((k, _traverse_obj(obj, v, False, is_last)) for k, v in key.items()) result = { ...
@@ -168,14 +169,43 @@ def apply_key(key, obj, is_last): result = next((v for k, v in obj.groupdict().items() if casefold(k) == key), None) elif isinstance(key, (int, slice)): - if is_iterable_like(obj, collections.abc.Sequence): + if is_iterable_like(obj, collections.ab...
yt_dlp/utils/traversal.py
26
Python
0.786
suggestion
131
51
51
false
[utils] `traverse_obj`: Support `xml.etree.ElementTree.Element`
8,911
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
with contextlib.suppress(IndexError): result = obj[key] elif traverse_string: with contextlib.suppress(IndexError): result = str(obj)[key] elif isinstance(obj, xml.etree.ElementTree.Element) and isinstance(key, str): ...
```suggestion assert not has_specials, f'invalid special {special}' return element ``` see below
with contextlib.suppress(IndexError): result = obj[key] elif traverse_string: with contextlib.suppress(IndexError): result = str(obj)[key] elif isinstance(obj, xml.etree.ElementTree.Element) and isinstance(key, str): ...
@@ -168,14 +169,43 @@ def apply_key(key, obj, is_last): result = next((v for k, v in obj.groupdict().items() if casefold(k) == key), None) elif isinstance(key, (int, slice)): - if is_iterable_like(obj, collections.abc.Sequence): + if is_iterable_like(obj, collections.ab...
yt_dlp/utils/traversal.py
26
Python
0.714
suggestion
134
51
51
false
[utils] `traverse_obj`: Support `xml.etree.ElementTree.Element`
8,911
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
has_specials = special.startswith('@') or special == 'text()' if not has_specials: xpath = f'{xpath}{sep}{special}' # Allow abbreviations of relative paths, absolute paths error if xpath.startswith('/'): xpath = f'.{xpath}' eli...
Why list when special and iterable otherwise? traverse_obj is currently never lazy. So imo, always list works
if not special.startswith('@') and special != 'text()': xpath = key special = None # Allow abbreviations of relative paths, absolute paths error if xpath.startswith('/'): xpath = f'.{xpath}' elif xpath and not xpath.startsw...
@@ -168,14 +169,43 @@ def apply_key(key, obj, is_last): result = next((v for k, v in obj.groupdict().items() if casefold(k) == key), None) elif isinstance(key, (int, slice)): - if is_iterable_like(obj, collections.abc.Sequence): + if is_iterable_like(obj, collections.ab...
yt_dlp/utils/traversal.py
26
Python
0.357
question
109
51
51
false
[utils] `traverse_obj`: Support `xml.etree.ElementTree.Element`
8,911
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
has_specials = special.startswith('@') or special == 'text()' if not has_specials: xpath = f'{xpath}{sep}{special}' # Allow abbreviations of relative paths, absolute paths error if xpath.startswith('/'): xpath = f'.{xpath}' eli...
with above change, this is just: ```suggestion result = list(map(apply_specials, obj.iterfind(xpath))) ```
if not special.startswith('@') and special != 'text()': xpath = key special = None # Allow abbreviations of relative paths, absolute paths error if xpath.startswith('/'): xpath = f'.{xpath}' elif xpath and not xpath.startsw...
@@ -168,14 +169,43 @@ def apply_key(key, obj, is_last): result = next((v for k, v in obj.groupdict().items() if casefold(k) == key), None) elif isinstance(key, (int, slice)): - if is_iterable_like(obj, collections.abc.Sequence): + if is_iterable_like(obj, collections.ab...
yt_dlp/utils/traversal.py
26
Python
0.786
suggestion
129
51
51
false
[utils] `traverse_obj`: Support `xml.etree.ElementTree.Element`
8,911
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
elif isinstance(obj, collections.abc.Mapping): result = (try_call(obj.get, args=(key,)) if casesense or try_call(obj.__contains__, args=(key,)) else next((v for k, v in obj.items() if casefold(k) == key), None)) elif isinstance(obj, re.Match): if isinstance...
How about: ```suggestion if not special.startswith('@') and special != 'text()' xpath, special = key, None ``` This way, there's no need for separate `special` and `has_special` (Alternatively, regex could be used instead of partition to do all this in one go)
elif isinstance(obj, collections.abc.Mapping): result = (try_call(obj.get, args=(key,)) if casesense or try_call(obj.__contains__, args=(key,)) else next((v for k, v in obj.items() if casefold(k) == key), None)) elif isinstance(obj, re.Match): if isinstance...
@@ -168,14 +169,43 @@ def apply_key(key, obj, is_last): result = next((v for k, v in obj.groupdict().items() if casefold(k) == key), None) elif isinstance(key, (int, slice)): - if is_iterable_like(obj, collections.abc.Sequence): + if is_iterable_like(obj, collections.ab...
yt_dlp/utils/traversal.py
26
Python
0.857
suggestion
300
51
51
false
[utils] `traverse_obj`: Support `xml.etree.ElementTree.Element`
8,911
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
result = obj[key] elif traverse_string: with contextlib.suppress(IndexError): result = str(obj)[key] elif isinstance(obj, xml.etree.ElementTree.Element) and isinstance(key, str): xpath, sep, special = key.rpartition('/') ...
```suggestion if special == '@': return element.attrib elif special.startswith('@'): return try_call(element.attrib.get, args=(special[1:],)) elif special == 'text()': return element.text ``` just for c...
result = obj[key] elif traverse_string: with contextlib.suppress(IndexError): result = str(obj)[key] elif isinstance(obj, xml.etree.ElementTree.Element) and isinstance(key, str): xpath, _, special = key.rpartition('/') ...
@@ -168,14 +169,43 @@ def apply_key(key, obj, is_last): result = next((v for k, v in obj.groupdict().items() if casefold(k) == key), None) elif isinstance(key, (int, slice)): - if is_iterable_like(obj, collections.abc.Sequence): + if is_iterable_like(obj, collections.ab...
yt_dlp/utils/traversal.py
26
Python
0.786
suggestion
326
51
51
false
[utils] `traverse_obj`: Support `xml.etree.ElementTree.Element`
8,911
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
<year>2008</year> <gdppc>141100</gdppc> <neighbor name="Austria" direction="E"/> <neighbor name="Switzerland" direction="W"/> </country> <country name="Singapore"> <rank>4</rank> <year>2011</year> ...
```suggestion self.assertEqual(traverse_obj(etree, lambda _, x: x[0].text == '4'), [etree[1]], ```
<year>2008</year> <gdppc>141100</gdppc> <neighbor name="Austria" direction="E"/> <neighbor name="Switzerland" direction="W"/> </country> <country name="Singapore"> <rank>4</rank> <year>2011</year> ...
@@ -2338,6 +2338,58 @@ def test_traverse_obj(self): self.assertEqual(traverse_obj(mobj, lambda k, _: k in (0, 'group')), ['0123', '3'], msg='function on a `re.Match` should give group name as well') + # Test xml.etree.ElementTree.Element as input obj + etree = xml.etre...
test/test_utils.py
26
Python
0.714
suggestion
108
51
51
false
[utils] `traverse_obj`: Support `xml.etree.ElementTree.Element`
8,911
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
return traverse_obj(patterns, (..., {partial(re.match, string=title)}, { 'season_number': ('season_number', {int_or_none}), 'episode_number': ('episode_number', {int_or_none}), 'episode': (( ('episode', {str_or_none}), ('ep_info', {lambda x: t...
We have to use the new id here ```suggestion archive_ids = [make_archive_id(ARDBetaMediathekIE, display_id)] ```
return traverse_obj(patterns, (..., {partial(re.match, string=title)}, { 'season_number': ('season_number', {int_or_none}), 'episode_number': ('episode_number', {int_or_none}), 'episode': (( ('episode', {str_or_none}), ('ep_info', {lambda x: t...
@@ -357,14 +358,25 @@ def _extract_episode_info(self, title): }), get_all=False) def _real_extract(self, url): - video_id, display_id = self._match_valid_url(url).group('id', 'display_id') + display_id = self._match_id(url) page_data = self._download_json( - f'https:/...
yt_dlp/extractor/ard.py
26
Python
0.786
suggestion
127
51
51
false
[ie/ard] Revert to using old id
8,916
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
return traverse_obj(patterns, (..., {partial(re.match, string=title)}, { 'season_number': ('season_number', {int_or_none}), 'episode_number': ('episode_number', {int_or_none}), 'episode': (( ('episode', {str_or_none}), ('ep_info', {lambda x: t...
```suggestion old_id = traverse_obj(page_data, ('tracking', 'atiCustomVars', 'contentId', {int})) if old_id is not None: video_id = str(old_id) archive_ids = [make_archive_id(ARDBetaMediathekIE, display_id)] ```
return traverse_obj(patterns, (..., {partial(re.match, string=title)}, { 'season_number': ('season_number', {int_or_none}), 'episode_number': ('episode_number', {int_or_none}), 'episode': (( ('episode', {str_or_none}), ('ep_info', {lambda x: t...
@@ -357,14 +358,25 @@ def _extract_episode_info(self, title): }), get_all=False) def _real_extract(self, url): - video_id, display_id = self._match_valid_url(url).group('id', 'display_id') + display_id = self._match_id(url) page_data = self._download_json( - f'https:/...
yt_dlp/extractor/ard.py
26
Python
0.786
suggestion
256
51
51
false
[ie/ard] Revert to using old id
8,916
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
import contextlib import copy import datetime import errno import fileinput import http.cookiejar import io import itertools import json import locale import operator import os import random import re import shutil import string import subprocess import sys import tempfile import time import tokenize import traceback i...
```suggestion ``` unrelated change revert
import contextlib import copy import datetime import errno import fileinput import http.cookiejar import io import itertools import json import locale import operator import os import random import re import shutil import string import subprocess import sys import tempfile import time import tokenize import traceback i...
@@ -24,6 +24,7 @@ import unicodedata from .cache import Cache +
yt_dlp/YoutubeDL.py
26
Python
0.5
suggestion
45
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
except UserNotLive as e: if process: if self.params.get('wait_for_video'): self.report_warning(e) self._wait_for_video() raise if ie_result is None: # Finished already (backwards compatibility; listformats and friends should be...
Move inside `_fill_common_fields`
@_handle_extraction_exceptions def __extract_info(self, url, ie, download, extra_info, process): self._apply_header_cookies(url) try: ie_result = ie.extract(url) except UserNotLive as e: if process: if self.params.get('wait_for_video'): ...
@@ -1744,6 +1746,19 @@ def __extract_info(self, url, ie, download, extra_info, process): else: return ie_result + def fix_deprecated_fields(self, ie_result):
yt_dlp/YoutubeDL.py
26
Python
0.286
suggestion
33
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
# Backwards compatibility: old IE result format ie_result = { '_type': 'compat_list', 'entries': ie_result, } self.fix_deprecated_fields(ie_result) if extra_info.get('original_url'): ie_result.setdefault('original_url', extr...
Let's not add warning till we've migrated the popular extractors. Otherwise every user just ends up with it ```suggestion ```
self._wait_for_video() raise if ie_result is None: # Finished already (backwards compatibility; listformats and friends should be moved here) self.report_warning(f'Extractor {ie.IE_NAME} returned nothing{bug_reports_message()}') return if isinstance(i...
@@ -1744,6 +1746,19 @@ def __extract_info(self, url, ie, download, extra_info, process): else: return ie_result + def fix_deprecated_fields(self, ie_result): + deprecated_multivalue_fields = { + 'artist': 'artist_list', + 'composer': 'composer_list', + ...
yt_dlp/YoutubeDL.py
26
Python
0.786
refactor
127
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
chapter_id: Id of the chapter the video belongs to, as a unicode string. The following fields should only be used when the video is an episode of some series, programme or podcast: series: Title of the series or programme the video episode belongs to. series_id: Id of the series o...
```suggestion artist_list: List of artists of the track. composer_list: List of composers of the piece genre_list: List of genres of the track. ```
chapter_id: Id of the chapter the video belongs to, as a unicode string. The following fields should only be used when the video is an episode of some series, programme or podcast: series: Title of the series or programme the video episode belongs to. series_id: Id of the series o...
@@ -422,16 +422,23 @@ class InfoExtractor: track_number: Number of the track within an album or a disc, as an integer. track_id: Id of the track (useful in case of custom indexing, e.g. 6.iii), as a unicode string. - artist: Artist(s) of the track. - genre: ...
yt_dlp/extractor/common.py
26
Python
0.714
suggestion
171
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
series_id: Id of the series or programme the video episode belongs to, as a unicode string. season: Title of the season the video episode belongs to. season_number: Number of the season the video episode belongs to, as an integer. season_id: Id of the season the video episode belongs ...
```suggestion album_artist_list: List of all artists appeared on the album. E.g. ["Ash Borer", "Fell Voices"] or ["Various Artists"]. Useful for splits and compilations. ```
series_id: Id of the series or programme the video episode belongs to, as a unicode string. season: Title of the season the video episode belongs to. season_number: Number of the season the video episode belongs to, as an integer. season_id: Id of the season the video episode belongs ...
@@ -422,16 +422,23 @@ class InfoExtractor: track_number: Number of the track within an album or a disc, as an integer. track_id: Id of the track (useful in case of custom indexing, e.g. 6.iii), as a unicode string. - artist: Artist(s) of the track. - genre: ...
yt_dlp/extractor/common.py
26
Python
0.857
suggestion
221
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
episode_id: Id of the video episode, as a unicode string. The following fields should only be used when the media is a track or a part of a music album: track: Title of the track. track_number: Number of the track within an album or a disc, as an integer. track_id: Id of t...
```suggestion composer: Deprecated; use "composer_list" instead. Composer(s) of the piece, comma-separated. artist: Deprecated; use "artist_list" instead. Artist(s) of the track, comma-separated. genre: Deprecated; use "genre_list" instead....
episode_id: Id of the video episode, as a unicode string. The following fields should only be used when the media is a track or a part of a music album: track: Title of the track. track_number: Number of the track within an album or a disc, as an integer. track_id: Id of t...
@@ -422,16 +422,23 @@ class InfoExtractor: track_number: Number of the track within an album or a disc, as an integer. track_id: Id of the track (useful in case of custom indexing, e.g. 6.iii), as a unicode string. - artist: Artist(s) of the track. - genre: ...
yt_dlp/extractor/common.py
26
Python
0.857
suggestion
525
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
def add(meta_list, info_list=None): value = next(( info[key] for key in [f'{meta_prefix}_'] + list(variadic(info_list or meta_list)) if info.get(key) is not None), None) if value not in ('', None): if is_iterable_like(value): ...
These changes should reflect in https://github.com/yt-dlp/yt-dlp#modifying-metadata
value = next(( info[key] for key in [f'{meta_prefix}_'] + list(variadic(info_list or meta_list)) if info.get(key) is not None), None) if value not in ('', None): value = ', '.join(map(str, variadic(value))) value = value.replace('\0...
@@ -754,10 +758,11 @@ def add(meta_list, info_list=None): add(('description', 'synopsis'), 'description') add(('purl', 'comment'), 'webpage_url') add('track', 'track_number') - add('artist', ('artist', 'creator', 'uploader', 'uploader_id')) - add('genre') + add('artist', ...
yt_dlp/postprocessor/ffmpeg.py
26
Python
0.286
suggestion
83
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
def ffmpeg_escape(text): return re.sub(r'([\\=;#\n])', r'\\\1', text) metadata_file_content = ';FFMETADATA1\n' for chapter in chapters: metadata_file_content += '[CHAPTER]\nTIMEBASE=1/1000\n' metadata_file_content += 'START=%d\n' % (ch...
```suggestion value = ', '.join(map(str, variadic(value))) ```
return re.sub(r'([\\=;#\n])', r'\\\1', text) metadata_file_content = ';FFMETADATA1\n' for chapter in chapters: metadata_file_content += '[CHAPTER]\nTIMEBASE=1/1000\n' metadata_file_content += 'START=%d\n' % (chapter['start_time'] * 1000) ...
@@ -738,9 +739,12 @@ def _get_metadata_opts(self, info): def add(meta_list, info_list=None): value = next(( - str(info[key]) for key in [f'{meta_prefix}_'] + list(variadic(info_list or meta_list)) + info[key] for key in [f'{meta_prefix}_'] + list(variadic(info_list ...
yt_dlp/postprocessor/ffmpeg.py
26
Python
0.571
suggestion
80
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
series: Title of the series or programme the video episode belongs to. series_id: Id of the series or programme the video episode belongs to, as a unicode string. season: Title of the season the video episode belongs to. season_number: Number of the season the video episode belong...
```suggestion album_artist_list: List of all artists appeared on the album. E.g. ["Ash Borer", "Fell Voices"] or ["Various Artists"]. ```
series: Title of the series or programme the video episode belongs to. series_id: Id of the series or programme the video episode belongs to, as a unicode string. season: Title of the season the video episode belongs to. season_number: Number of the season the video episode belong...
@@ -422,16 +422,24 @@ class InfoExtractor: track_number: Number of the track within an album or a disc, as an integer. track_id: Id of the track (useful in case of custom indexing, e.g. 6.iii), as a unicode string. - artist: Artist(s) of the track. - genre: ...
yt_dlp/extractor/common.py
26
Python
0.714
suggestion
164
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
# Backwards compatibility: old IE result format ie_result = { '_type': 'compat_list', 'entries': ie_result, } self.fix_deprecated_fields(ie_result) if extra_info.get('original_url'): ie_result.setdefault('original_url', extr...
```suggestion if ie_result.get(deprecated_field): ie_result[new_field] = re.split(r', ?', ie_result[deprecated_field]) ``` Value can be `None`
self.report_warning(e) self._wait_for_video() raise if ie_result is None: # Finished already (backwards compatibility; listformats and friends should be moved here) self.report_warning(f'Extractor {ie.IE_NAME} returned nothing{bug_reports_message()}')...
@@ -1744,6 +1745,18 @@ def __extract_info(self, url, ie, download, extra_info, process): else: return ie_result + def fix_deprecated_fields(self, ie_result): + deprecated_multivalue_fields = { + 'artist': 'artist_list', + 'composer': 'composer_list', + ...
yt_dlp/YoutubeDL.py
26
Python
0.714
suggestion
176
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
break if all(info_dict.get(key) is False for key in live_keys): live_status = 'not_live' if live_status: info_dict['live_status'] = live_status for key in live_keys: if info_dict.get(key) is None: info_dict[k...
I found a new issue. These use-cases will break. We need a way to handle it https://github.com/yt-dlp/yt-dlp/blob/85b33f5c163f60dbd089a6b9bc2ba1366d3ddf93/README.md#L1781-L1785 I'm not sure what's the best soln, but this should work: ```suggestion for deprecated_field, new_field in deprecated_multivalue...
live_status = info_dict.get('live_status') if live_status is None: for key in live_keys: if info_dict.get(key) is False: continue if info_dict.get(key): live_status = key break if all(info_dic...
@@ -2641,6 +2641,16 @@ def _fill_common_fields(self, info_dict, final=True): if final and info_dict.get('%s_number' % field) is not None and not info_dict.get(field): info_dict[field] = '%s %d' % (field.capitalize(), info_dict['%s_number' % field]) + deprecated_multivalue_fields =...
yt_dlp/YoutubeDL.py
26
Python
1
question
801
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
if all(info_dict.get(key) is False for key in live_keys): live_status = 'not_live' if live_status: info_dict['live_status'] = live_status for key in live_keys: if info_dict.get(key) is None: info_dict[key] = (live_status == ...
Do we need the leniency? How about: ```suggestion info_dict[new_key] = old_value.split(', ') ```
if live_status is None: for key in live_keys: if info_dict.get(key) is False: continue if info_dict.get(key): live_status = key break if all(info_dict.get(key) is False for key in live_keys): ...
@@ -2641,6 +2641,19 @@ def _fill_common_fields(self, info_dict, final=True): if final and info_dict.get('%s_number' % field) is not None and not info_dict.get(field): info_dict[field] = '%s %d' % (field.capitalize(), info_dict['%s_number' % field]) + multivalue_fields = { + ...
yt_dlp/YoutubeDL.py
26
Python
0.714
question
117
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
if live_status: info_dict['live_status'] = live_status for key in live_keys: if info_dict.get(key) is None: info_dict[key] = (live_status == key) if live_status == 'post_live': info_dict['was_live'] = True # Auto generate t...
We could perhaps do (remove space): ```suggestion info_dict[old_key] = ', '.join(re.replace(', +', ',', v) for v in new_value) ``` or maybe (unicode): ```suggestion info_dict[old_key] = ', '.join(v.replace(', ', ', ') for v in new_value) ``` as partial workaround to https://git...
if info_dict.get(key) is False: continue if info_dict.get(key): live_status = key break if all(info_dict.get(key) is False for key in live_keys): live_status = 'not_live' if live_status: ...
@@ -2641,6 +2641,19 @@ def _fill_common_fields(self, info_dict, final=True): if final and info_dict.get('%s_number' % field) is not None and not info_dict.get(field): info_dict[field] = '%s %d' % (field.capitalize(), info_dict['%s_number' % field]) + multivalue_fields = { + ...
yt_dlp/YoutubeDL.py
26
Python
0.857
suggestion
473
51
51
false
[ie] Add new fields with proper support for multiple values
8,917
yt-dlp/yt-dlp
132,642
Python
pukkandan
llistochek
get_elements_html_by_class, ) class ViouslyIE(InfoExtractor): _VALID_URL = False _API_URL = 'https://www.viously.com/video/hls/{0:}/index.m3u8' _WEBPAGE_TESTS = [{ 'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley-continental-gt-speed-ces-guide-acha...
I think we can just ```suggestion viously_players = re.findall(r'<div[^>]*class="(?:[^"]*\s)?v(?:iou)?sly-player(?:\s[^"]*)?"[^>]*>', webpage) if not viously_players: return ```
from .common import InfoExtractor from ..utils import ( extract_attributes, int_or_none, parse_iso8601, ) from ..utils.traversal import traverse_obj class ViouslyIE(InfoExtractor): _VALID_URL = False _WEBPAGE_TESTS = [{ 'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-...
@@ -0,0 +1,38 @@ +from .common import InfoExtractor +from ..utils import ( + get_element_html_by_class, + get_elements_html_by_class, +) + + +class ViouslyIE(InfoExtractor): + _VALID_URL = False + _API_URL = 'https://www.viously.com/video/hls/{0:}/index.m3u8' + _WEBPAGE_TESTS = [{ + 'url': 'http:/...
yt_dlp/extractor/viously.py
26
Python
0.786
suggestion
212
36
51
false
[ie/Turbo] Fix turbo extractor
8,927
yt-dlp/yt-dlp
132,642
Python
seproDev
nbr23
'md5': '37a6c3381599381ff53a7e1e0575c0bc', 'info_dict': { 'id': 'F_xQzS2jwb3', 'ext': 'mp4', 'title': 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...', 'description': 'Turbo du 07/09/2014 : Renault Twingo 3,...
Here I would actually call their API to extract the metadata ```suggestion def custom_decode(text): STANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' CUSTOM_ALPHABET = 'VIOUSLYABCDEFGHJKMNPQRTWXZviouslyabcdefghjkmnpqrtwxz9876543210+/=' ...
class ViouslyIE(InfoExtractor): _VALID_URL = False _WEBPAGE_TESTS = [{ 'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley-continental-gt-speed-ces-guide-achat-dacia.html', 'md5': '37a6c3381599381ff53a7e1e0575c0bc', 'info_dict': { 'i...
@@ -0,0 +1,38 @@ +from .common import InfoExtractor +from ..utils import ( + get_element_html_by_class, + get_elements_html_by_class, +) + + +class ViouslyIE(InfoExtractor): + _VALID_URL = False + _API_URL = 'https://www.viously.com/video/hls/{0:}/index.m3u8' + _WEBPAGE_TESTS = [{ + 'url': 'http:/...
yt_dlp/extractor/viously.py
26
Python
0.857
refactor
1,484
27
49
false
[ie/Turbo] Fix turbo extractor
8,927
yt-dlp/yt-dlp
132,642
Python
seproDev
nbr23
from .common import InfoExtractor from ..utils import ( get_element_html_by_class, get_elements_html_by_class, ) class ViouslyIE(InfoExtractor): _VALID_URL = False _API_URL = 'https://www.viously.com/video/hls/{0:}/index.m3u8' _WEBPAGE_TESTS = [{ 'url': 'http://www.turbo.fr/videos-voiture/...
```suggestion import base64 import re from .common import InfoExtractor from ..utils import extract_attributes, int_or_none, parse_iso8601 from ..utils.traversal import traverse_obj ```
import base64 import re from .common import InfoExtractor from ..utils import ( extract_attributes, int_or_none, parse_iso8601, ) from ..utils.traversal import traverse_obj class ViouslyIE(InfoExtractor): _VALID_URL = False _WEBPAGE_TESTS = [{ 'url': 'http://www.turbo.fr/videos-voiture/45...
@@ -0,0 +1,38 @@ +from .common import InfoExtractor +from ..utils import ( + get_element_html_by_class, + get_elements_html_by_class, +)
yt_dlp/extractor/viously.py
5
Python
0.786
refactor
193
30
30
false
[ie/Turbo] Fix turbo extractor
8,927
yt-dlp/yt-dlp
132,642
Python
seproDev
nbr23
extract_attributes, get_elements_html_by_class, int_or_none, parse_iso8601, ) from ..utils.traversal import traverse_obj class ViouslyIE(InfoExtractor): _VALID_URL = False _WEBPAGE_TESTS = [{ 'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley...
Sorry, this should use `re.findall`. The `get_element_by ` functions can throw on malformed HTML, so they could throw on any generic webpage. ```suggestion viously_players = re.findall(r'<div[^>]*class="(?:[^"]*\s)?v(?:iou)?sly-player(?:\s[^"]*)?"[^>]*>', webpage) ```
from ..utils import ( extract_attributes, int_or_none, parse_iso8601, ) from ..utils.traversal import traverse_obj class ViouslyIE(InfoExtractor): _VALID_URL = False _WEBPAGE_TESTS = [{ 'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley-continent...
@@ -0,0 +1,58 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_elements_html_by_class, + int_or_none, + parse_iso8601, +) +from ..utils.traversal import traverse_obj + + +class ViouslyIE(InfoExtractor): + _VALID_URL = False + _WEBPAGE_TESTS = [{...
yt_dlp/extractor/viously.py
26
Python
0.857
suggestion
279
51
51
false
[ie/Turbo] Fix turbo extractor
8,927
yt-dlp/yt-dlp
132,642
Python
seproDev
nbr23
import base64 from .common import InfoExtractor from ..utils import ( extract_attributes, get_elements_html_by_class, int_or_none, parse_iso8601, ) from ..utils.traversal import traverse_obj class ViouslyIE(InfoExtractor): _VALID_URL = False _WEBPAGE_TESTS = [{ 'url': 'http://www.turb...
```suggestion 'title': 'Turbo du 07/09/2014\xa0: Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...', 'description': 'Turbo du 07/09/2014\xa0: Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...', 'age_limit': 0, 'upload_da...
import base64 import re from .common import InfoExtractor from ..utils import ( extract_attributes, int_or_none, parse_iso8601, ) from ..utils.traversal import traverse_obj class ViouslyIE(InfoExtractor): _VALID_URL = False _WEBPAGE_TESTS = [{ 'url': 'http://www.turbo.fr/videos-voiture/45...
@@ -0,0 +1,58 @@ +import base64 + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_elements_html_by_class, + int_or_none, + parse_iso8601, +) +from ..utils.traversal import traverse_obj + + +class ViouslyIE(InfoExtractor): + _VALID_URL = False + _WEBPAGE_TESTS = [{...
yt_dlp/extractor/viously.py
25
Python
0.786
suggestion
449
50
50
false
[ie/Turbo] Fix turbo extractor
8,927
yt-dlp/yt-dlp
132,642
Python
seproDev
nbr23
'upload_date': '20230328', 'timestamp': 1680037507, 'duration': 3716, 'categories': ['motors'], } }] def _extract_from_webpage(self, url, webpage): viously_players = re.findall(r'<div[^>]*class="(?:[^"]*\s)?v(?:iou)?sly-player(?:\s[^"]*)?"[^>]*>',...
we can still extract if we have formats w/o metadata ```suggestion formats = self._extract_m3u8_formats( f'https://www.viously.com/video/hls/{video_id}/index.m3u8', video_id, fatal=False) if not formats: continue data = self._download_json( ...
'upload_date': '20230328', 'timestamp': 1680037507, 'duration': 3716, 'categories': ['motors'], } }] def _extract_from_webpage(self, url, webpage): viously_players = re.findall(r'<div[^>]*class="(?:[^"]*\s)?v(?:iou)?sly-player(?:\s[^"]*)?"[^>]*>',...
@@ -0,0 +1,60 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + int_or_none, + parse_iso8601, +) +from ..utils.traversal import traverse_obj + + +class ViouslyIE(InfoExtractor): + _VALID_URL = False + _WEBPAGE_TESTS = [{ + 'url': 'http...
yt_dlp/extractor/viously.py
26
Python
0.857
refactor
459
38
38
false
[ie/Turbo] Fix turbo extractor
8,927
yt-dlp/yt-dlp
132,642
Python
bashonly
nbr23
if not viously_players: return def custom_decode(text): STANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' CUSTOM_ALPHABET = 'VIOUSLYABCDEFGHJKMNPQRTWXZviouslyabcdefghjkmnpqrtwxz9876543210+/=' data = base64.b64decode(t...
```suggestion 'categories': ('category', 'name', {str}, {lambda x: [x] if x else None}), ``` or else we could get `[None]` and `['']` etc
if not viously_players: return def custom_decode(text): STANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' CUSTOM_ALPHABET = 'VIOUSLYABCDEFGHJKMNPQRTWXZviouslyabcdefghjkmnpqrtwxz9876543210+/=' data = base64.b64decode(t...
@@ -0,0 +1,60 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + int_or_none, + parse_iso8601, +) +from ..utils.traversal import traverse_obj + + +class ViouslyIE(InfoExtractor): + _VALID_URL = False + _WEBPAGE_TESTS = [{ + 'url': 'http...
yt_dlp/extractor/viously.py
26
Python
0.786
suggestion
160
29
29
false
[ie/Turbo] Fix turbo extractor
8,927
yt-dlp/yt-dlp
132,642
Python
bashonly
nbr23
def _extract_from_webpage(self, url, webpage): viously_players = re.findall(r'<div[^>]*class="(?:[^"]*\s)?v(?:iou)?sly-player(?:\s[^"]*)?"[^>]*>', webpage) if not viously_players: return def custom_decode(text): STANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefg...
```suggestion 'title': ('title', {str}), 'description': ('description', {str}), ```
def _extract_from_webpage(self, url, webpage): viously_players = re.findall(r'<div[^>]*class="(?:[^"]*\s)?v(?:iou)?sly-player(?:\s[^"]*)?"[^>]*>', webpage) if not viously_players: return def custom_decode(text): STANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefg...
@@ -0,0 +1,60 @@ +import base64 +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + int_or_none, + parse_iso8601, +) +from ..utils.traversal import traverse_obj + + +class ViouslyIE(InfoExtractor): + _VALID_URL = False + _WEBPAGE_TESTS = [{ + 'url': 'http...
yt_dlp/extractor/viously.py
26
Python
0.714
suggestion
126
32
32
false
[ie/Turbo] Fix turbo extractor
8,927
yt-dlp/yt-dlp
132,642
Python
bashonly
nbr23
PolskieRadioPlayerIE, PolskieRadioPodcastIE, PolskieRadioPodcastListIE, ) from .popcorntimes import PopcorntimesIE from .popcorntv import PopcornTVIE from .porn91 import Porn91IE from .pornbox import PornboxIE from .pornflip import PornFlipIE from .pornhub import ( PornHubIE, PornHubUserIE, Porn...
```suggestion from .prankcast import PrankCastIE, PrankCastPostIE ``` Move back to same file.
PolskieRadioPlayerIE, PolskieRadioPodcastIE, PolskieRadioPodcastListIE, ) from .popcorntimes import PopcorntimesIE from .popcorntv import PopcornTVIE from .porn91 import Porn91IE from .pornbox import PornboxIE from .pornflip import PornFlipIE from .pornhub import ( PornHubIE, PornHubUserIE, Porn...
@@ -1483,6 +1483,7 @@ ) from .pr0gramm import Pr0grammIE from .prankcast import PrankCastIE +from .prankcastpost import PrankCastPostIE
yt_dlp/extractor/_extractors.py
26
Python
0.786
suggestion
98
51
51
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
pukkandan
columndeeply
'channel_id': json_info.get('user_id'), 'duration': try_call(lambda: parse_iso8601(json_info['end_date']) - start_date), 'cast': list(filter(None, [uploader] + traverse_obj(guests_json, (..., 'name')))), 'description': json_info.get('broadcast_description'), '...
if the value is `None` the field can be omitted from the test
'url': f'{json_info["broadcast_url"]}{json_info["recording_hash"]}.mp3', 'timestamp': start_date, 'uploader': uploader, 'channel_id': json_info.get('user_id'), 'duration': try_call(lambda: parse_iso8601(json_info['end_date']) - start_date), 'cast':...
@@ -64,3 +64,71 @@ def _real_extract(self, url): 'categories': [json_info.get('broadcast_category')], 'tags': try_call(lambda: json_info['broadcast_tags'].split(',')) } + + +class PrankCastPostIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/posts/(?P<i...
yt_dlp/extractor/prankcast.py
26
Python
0.357
suggestion
61
51
51
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
'title': json_info.get('broadcast_title') or self._og_search_title(webpage), 'display_id': display_id, 'url': f'{json_info["broadcast_url"]}{json_info["recording_hash"]}.mp3', 'timestamp': start_date, 'uploader': uploader, 'channel_id': json_info.g...
`channel_id` needs to be a string
return { 'id': video_id, 'title': json_info.get('broadcast_title') or self._og_search_title(webpage), 'display_id': display_id, 'url': f'{json_info["broadcast_url"]}{json_info["recording_hash"]}.mp3', 'timestamp': start_date, 'uploader': u...
@@ -64,3 +64,71 @@ def _real_extract(self, url): 'categories': [json_info.get('broadcast_category')], 'tags': try_call(lambda: json_info['broadcast_tags'].split(',')) } + + +class PrankCastPostIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/posts/(?P<i...
yt_dlp/extractor/prankcast.py
26
Python
0.214
suggestion
33
51
51
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
'info_dict': { 'id': '6217', 'ext': 'mp3', 'title': 'Jake the Work Crow!', 'display_id': 'jake-the-work-crow-', 'timestamp': 1704346592, 'uploader': 'despicabledogs', 'channel_id': 957, 'duration': 263.287, ...
we should make this completely non-fatal ```suggestion guests_json = traverse_obj(content, ('guests_json', {json.loads}, {dict})) or {} ```
}, { 'url': 'https://prankcast.com/despicabledogs/posts/6217-jake-the-work-crow-', 'info_dict': { 'id': '6217', 'ext': 'mp3', 'title': 'Jake the Work Crow!', 'display_id': 'jake-the-work-crow-', 'timestamp': 1704346592, 'uploade...
@@ -64,3 +64,71 @@ def _real_extract(self, url): 'categories': [json_info.get('broadcast_category')], 'tags': try_call(lambda: json_info['broadcast_tags'].split(',')) } + + +class PrankCastPostIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/posts/(?P<i...
yt_dlp/extractor/prankcast.py
26
Python
0.786
suggestion
150
46
49
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
'timestamp': 1704346592, 'uploader': 'despicabledogs', 'channel_id': 957, 'duration': 263.287, 'cast': ['despicabledogs'], 'description': 'https://imgur.com/a/vtxLvKU', 'categories': [], 'tags': None, 'upload_dat...
we could inline this below ```suggestion return { ```
'title': 'Jake the Work Crow!', 'display_id': 'jake-the-work-crow-', 'timestamp': 1704346592, 'uploader': 'despicabledogs', 'channel_id': '957', 'duration': 263.287, 'cast': ['despicabledogs'], 'description': 'https://imgur....
@@ -64,3 +64,71 @@ def _real_extract(self, url): 'categories': [json_info.get('broadcast_category')], 'tags': try_call(lambda: json_info['broadcast_tags'].split(',')) } + + +class PrankCastPostIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/posts/(?P<i...
yt_dlp/extractor/prankcast.py
26
Python
0.643
suggestion
64
41
44
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
video_id, display_id = self._match_valid_url(url).group('id', 'display_id') webpage = self._download_webpage(url, video_id) post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts'] content = self._parse_json(post['post_contents_json'], video_id)[0] ...
```suggestion 'subtitles': { 'live_chat': [{ 'url': f'https://prankcast.com/api/private/chat/select-broadcast?id={post["content_id"]}&cache=', 'ext': 'json', }], } if post.get('content_id') else None, ```
def _real_extract(self, url): video_id, display_id = self._match_valid_url(url).group('id', 'display_id') webpage = self._download_webpage(url, video_id) post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts'] content = self._parse_json(post['post_...
@@ -64,3 +64,71 @@ def _real_extract(self, url): 'categories': [json_info.get('broadcast_category')], 'tags': try_call(lambda: json_info['broadcast_tags'].split(',')) } + + +class PrankCastPostIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/posts/(?P<i...
yt_dlp/extractor/prankcast.py
26
Python
0.929
performance
307
28
31
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
'tags': None, 'upload_date': '20240104' } }] def _real_extract(self, url): video_id, display_id = self._match_valid_url(url).group('id', 'display_id') webpage = self._download_webpage(url, video_id) post = self._search_nextjs_data(webpage, video_id)['pro...
needs to be str ```suggestion 'channel_id': str_or_none(post.get('user_id')), ```
'description': 'https://imgur.com/a/vtxLvKU', 'categories': [], 'upload_date': '20240104' } }] def _real_extract(self, url): video_id, display_id = self._match_valid_url(url).group('id', 'display_id') webpage = self._download_webpage(url, video_id) ...
@@ -64,3 +64,71 @@ def _real_extract(self, url): 'categories': [json_info.get('broadcast_category')], 'tags': try_call(lambda: json_info['broadcast_tags'].split(',')) } + + +class PrankCastPostIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/posts/(?P<i...
yt_dlp/extractor/prankcast.py
26
Python
0.643
suggestion
96
34
37
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
'upload_date': '20240104' } }] def _real_extract(self, url): video_id, display_id = self._match_valid_url(url).group('id', 'display_id') webpage = self._download_webpage(url, video_id) post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_dat...
```suggestion 'duration': float_or_none(content.get('duration')), ```
'categories': [], 'upload_date': '20240104' } }] def _real_extract(self, url): video_id, display_id = self._match_valid_url(url).group('id', 'display_id') webpage = self._download_webpage(url, video_id) post = self._search_nextjs_data(webpage, video_id)[...
@@ -64,3 +64,71 @@ def _real_extract(self, url): 'categories': [json_info.get('broadcast_category')], 'tags': try_call(lambda: json_info['broadcast_tags'].split(',')) } + + +class PrankCastPostIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/posts/(?P<i...
yt_dlp/extractor/prankcast.py
26
Python
0.571
suggestion
83
33
36
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
from .common import InfoExtractor from ..utils import parse_iso8601, traverse_obj, try_call, str_or_none, float_or_none, json class PrankCastIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)' _TESTS = [{ 'url': 'https://prankcast.c...
```suggestion import json from .common import InfoExtractor ```
import json from .common import InfoExtractor from ..utils import float_or_none, parse_iso8601, str_or_none, try_call from ..utils.traversal import traverse_obj class PrankCastIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)' _TESTS = [{...
@@ -1,5 +1,5 @@ from .common import InfoExtractor
yt_dlp/extractor/prankcast.py
3
Python
0.643
refactor
68
28
28
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
from .common import InfoExtractor from ..utils import parse_iso8601, traverse_obj, try_call, str_or_none, float_or_none, json class PrankCastIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)' _TESTS = [{ 'url': 'https://prankcast.c...
```suggestion from ..utils import float_or_none, parse_iso8601, str_or_none, try_call from ..utils.traversal import traverse_obj ```
import json from .common import InfoExtractor from ..utils import float_or_none, parse_iso8601, str_or_none, try_call from ..utils.traversal import traverse_obj class PrankCastIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?prankcast\.com/[^/?#]+/showreel/(?P<id>\d+)-(?P<display_id>[^/?#]+)' _TESTS = [{...
@@ -1,5 +1,5 @@ from .common import InfoExtractor -from ..utils import parse_iso8601, traverse_obj, try_call +from ..utils import parse_iso8601, traverse_obj, try_call, str_or_none, float_or_none, json
yt_dlp/extractor/prankcast.py
2
Python
0.714
suggestion
135
27
27
false
[Prankcast] Fix extractor and add live chat
8,933
yt-dlp/yt-dlp
132,642
Python
bashonly
columndeeply
'uploader': 'LinusTechTips', 'uploader_id': '59f94c0bdd241b70349eb72b', 'uploader_url': 'https://www.floatplane.com/channel/linustechtips/home', 'channel': 'GameLinked', 'channel_id': '649dbade3540dbc3945eeda7', 'channel_url': 'https://www.floatpla...
None tests are not necessary ```suggestion ```
'comment_count': int, 'uploader': 'LinusTechTips', 'uploader_id': '59f94c0bdd241b70349eb72b', 'uploader_url': 'https://www.floatplane.com/channel/linustechtips/home', 'channel': 'GameLinked', 'channel_id': '649dbade3540dbc3945eeda7', 'c...
@@ -108,6 +108,68 @@ class FloatplaneIE(InfoExtractor): 'availability': 'subscriber_only', }, 'params': {'skip_download': 'm3u8'}, + }, { + 'url': 'https://www.floatplane.com/post/65B5PNoBtf', + 'info_dict': { + 'id': '65B5PNoBtf', + 'ext': None, + ...
yt_dlp/extractor/floatplane.py
26
Python
0.429
suggestion
48
51
51
false
[floatplane] feat: share playlist post fields with playlist entries
8,934
yt-dlp/yt-dlp
132,642
Python
seproDev
chtk
}] def _real_initialize(self): if not self._get_cookies('https://www.floatplane.com').get('sails.sid'): self.raise_login_required() def _real_extract(self, url): post_id = self._match_id(url) post_data = self._download_json( 'https://www.floatplane.com/api/...
I know this wasn't there initially, but to be safe we might as well add: ```suggestion 'uploader': ('creator', 'title', {str}), 'uploader_id': ('creator', 'id', {str}), 'channel': ('channel', 'title', {str}), 'channel_id': ('channel', 'id', {str}), `...
if not self._get_cookies('https://www.floatplane.com').get('sails.sid'): self.raise_login_required() def _real_extract(self, url): post_id = self._match_id(url) post_data = self._download_json( 'https://www.floatplane.com/api/v3/content/post', post_id, query={'id': ...
@@ -124,6 +186,23 @@ def _real_extract(self, url): if not any(traverse_obj(post_data, ('metadata', ('hasVideo', 'hasAudio')))): raise ExtractorError('Post does not contain a video or audio track', expected=True) + uploader_url = format_field( + post_data, [('creator', 'urlname'...
yt_dlp/extractor/floatplane.py
26
Python
0.786
suggestion
322
51
51
false
[floatplane] feat: share playlist post fields with playlist entries
8,934
yt-dlp/yt-dlp
132,642
Python
seproDev
chtk
'params': {'skip_download': 'm3u8'}, }, { 'url': 'https://www.floatplane.com/post/65B5PNoBtf', 'info_dict': { 'id': '65B5PNoBtf', 'ext': None, 'description': 'I recorded the inbuilt demo mode for your 90\'s enjoyment, thanks for being Floaties!', ...
Use single quotes ```suggestion 'playlist_count': 2, ```
}, 'params': {'skip_download': 'm3u8'}, }, { 'url': 'https://www.floatplane.com/post/65B5PNoBtf', 'info_dict': { 'id': '65B5PNoBtf', 'description': 'I recorded the inbuilt demo mode for your 90\'s enjoyment, thanks for being Floaties!', 'display_id...
@@ -108,6 +108,68 @@ class FloatplaneIE(InfoExtractor): 'availability': 'subscriber_only', }, 'params': {'skip_download': 'm3u8'}, + }, { + 'url': 'https://www.floatplane.com/post/65B5PNoBtf', + 'info_dict': { + 'id': '65B5PNoBtf', + 'ext': None, + ...
yt_dlp/extractor/floatplane.py
26
Python
0.643
suggestion
67
51
51
false
[floatplane] feat: share playlist post fields with playlist entries
8,934
yt-dlp/yt-dlp
132,642
Python
seproDev
chtk
}, 'params': {'skip_download': 'm3u8'}, }, { 'url': 'https://www.floatplane.com/post/65B5PNoBtf', 'info_dict': { 'id': '65B5PNoBtf', 'ext': None, 'description': 'I recorded the inbuilt demo mode for your 90\'s enjoyment, thanks for being Floaties!'...
I don't think this should be here. ```suggestion ```
'availability': 'subscriber_only', }, 'params': {'skip_download': 'm3u8'}, }, { 'url': 'https://www.floatplane.com/post/65B5PNoBtf', 'info_dict': { 'id': '65B5PNoBtf', 'description': 'I recorded the inbuilt demo mode for your 90\'s enjoyment, thank...
@@ -108,6 +108,68 @@ class FloatplaneIE(InfoExtractor): 'availability': 'subscriber_only', }, 'params': {'skip_download': 'm3u8'}, + }, { + 'url': 'https://www.floatplane.com/post/65B5PNoBtf', + 'info_dict': { + 'id': '65B5PNoBtf', + 'ext': None, + ...
yt_dlp/extractor/floatplane.py
26
Python
0.643
suggestion
54
51
51
false
[floatplane] feat: share playlist post fields with playlist entries
8,934
yt-dlp/yt-dlp
132,642
Python
seproDev
chtk
def _real_extract(self, url): post_id = self._match_id(url) post_data = self._download_json( 'https://www.floatplane.com/api/v3/content/post', post_id, query={'id': post_id}, note='Downloading post data', errnote='Unable to download post data') if not any(traverse_o...
could inline `channel_url` ```suggestion uploader_url = format_field( post_data, [('creator', 'urlname')], 'https://www.floatplane.com/channel/%s/home') or None common_info = { **traverse_obj(post_data, { 'uploader': ('creator', 'title', {str}), ...
def _real_extract(self, url): post_id = self._match_id(url) post_data = self._download_json( 'https://www.floatplane.com/api/v3/content/post', post_id, query={'id': post_id}, note='Downloading post data', errnote='Unable to download post data') if not any(traverse_...
@@ -124,6 +182,23 @@ def _real_extract(self, url): if not any(traverse_obj(post_data, ('metadata', ('hasVideo', 'hasAudio')))): raise ExtractorError('Post does not contain a video or audio track', expected=True) + uploader_url = format_field( + post_data, [('creator', 'urlname'...
yt_dlp/extractor/floatplane.py
26
Python
0.857
suggestion
809
51
51
false
[floatplane] feat: share playlist post fields with playlist entries
8,934
yt-dlp/yt-dlp
132,642
Python
bashonly
chtk
}) if is_type(traverse_obj(e, ('video', 0)), 'VideoObject'): extract_video_object(e['video'][0]) elif is_type(traverse_obj(e, ('subjectOf', 0)), 'VideoObject'): extract_video_object(e['subjectOf'][0]) ...
This is a bugfix and we don't really need this if we can fix the IEs instead imo. But your call.
'tbr': int_or_none(e.get('bitrate')), 'width': int_or_none(e.get('width')), 'height': int_or_none(e.get('height')), 'view_count': int_or_none(e.get('interactionCount')), 'tags': try_call(lambda: e.get('keywords').split(',')), })...
@@ -1680,12 +1680,16 @@ def traverse_json_ld(json_ld, at_top_level=True): traverse_json_ld(json_ld) return filter_dict(info) - def _search_nextjs_data(self, webpage, video_id, *, transform_source=None, fatal=True, **kw): - return self._parse_json( - self._search_regex( - ...
yt_dlp/extractor/common.py
26
Python
0.429
bug
96
51
51
false
[ie] Make `_search_nextjs_data` non fatal
8,937
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'description': unescapeHTML(e.get('articleBody') or e.get('description')), }) if is_type(traverse_obj(e, ('video', 0)), 'VideoObject'): extract_video_object(e['video'][0]) elif is_type(traverse_obj(e, ('subjectOf...
```suggestion self._downloader.deprecation_warning('using `default=\'{}\'` is deprecated, use `default={}` instead') ```
'description': unescapeHTML(e.get('articleBody') or e.get('description')), }) if is_type(traverse_obj(e, ('video', 0)), 'VideoObject'): extract_video_object(e['video'][0]) elif is_type(traverse_obj(e, ('subjectOf...
@@ -1738,12 +1738,16 @@ def traverse_json_ld(json_ld, at_top_level=True): traverse_json_ld(json_ld) return filter_dict(info) - def _search_nextjs_data(self, webpage, video_id, *, transform_source=None, fatal=True, **kw): - return self._parse_json( - self._search_regex( - ...
yt_dlp/extractor/common.py
26
Python
0.786
suggestion
134
51
51
false
[ie] Make `_search_nextjs_data` non fatal
8,937
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
'info_dict': { 'title': 'Viktor, 18, förlorade armar och ben i sepsis – vill återuppta karaten och bli svetsare', 'id': 'viktor-18-forlorade-armar-och-ben-i-sepsis-vill-ateruppta-karaten-och-bli-svetsare', }, 'playlist_count': 2, }, { 'url': 'https://www.svt.s...
You want to add `skip`, not only_matching
'info_dict': { 'title': 'Viktor, 18, förlorade armar och ben i sepsis – vill återuppta karaten och bli svetsare', 'id': 'viktor-18-forlorade-armar-och-ben-i-sepsis-vill-ateruppta-karaten-och-bli-svetsare', }, 'playlist_count': 2, }, { 'url': 'https://www.svt.s...
@@ -388,21 +386,44 @@ def _real_extract(self, url): dict_get(series, ('longDescription', 'shortDescription'))) -class SVTPageIE(InfoExtractor): +class SVTPageIE(SVTBaseIE): _VALID_URL = r'https?://(?:www\.)?svt\.se/(?P<path>(?:[^/]+/)*(?P<id>[^/?&#]+))' _TESTS = [{ + 'url': 'https://ww...
yt_dlp/extractor/svt.py
26
Python
0.214
suggestion
41
51
51
false
[SVTPage] Fix extractor
8,938
yt-dlp/yt-dlp
132,642
Python
pukkandan
diman8
items = season.get('items') if not isinstance(items, list): continue for item in items: video = item.get('item') or {} content_id = video.get('videoSvtId') if not content_id or not isinstance(content_id, compat_str): ...
we don't need to capture `path` anymore ```suggestion _VALID_URL = r'https?://(?:www\.)?svt\.se/(?:[^/?#]+/)*(?P<id>[^/?&#]+)' ```
items = season.get('items') if not isinstance(items, list): continue for item in items: video = item.get('item') or {} content_id = video.get('videoSvtId') if not content_id or not isinstance(content_id, compat_str): ...
@@ -388,22 +386,63 @@ def _real_extract(self, url): dict_get(series, ('longDescription', 'shortDescription'))) -class SVTPageIE(InfoExtractor): +class SVTPageIE(SVTBaseIE): _VALID_URL = r'https?://(?:www\.)?svt\.se/(?P<path>(?:[^/]+/)*(?P<id>[^/?&#]+))'
yt_dlp/extractor/svt.py
26
Python
0.714
suggestion
137
51
51
false
[SVTPage] Fix extractor
8,938
yt-dlp/yt-dlp
132,642
Python
bashonly
diman8
'skip': 'Video is gone' }, { 'url': 'https://www.svt.se/nyheter/utrikes/svenska-andrea-ar-en-mil-fran-branderna-i-kalifornien', 'info_dict': { 'id': '24243746', 'title': 'Svenska Andrea redo att fly sitt hem i Kalifornien', }, 'playlist_count': 2, ...
the tests that were previously `only_matching` can stay `only_matching`
'skip': 'Video is gone' }, { 'url': 'https://www.svt.se/nyheter/utrikes/svenska-andrea-ar-en-mil-fran-branderna-i-kalifornien', 'info_dict': { 'id': '24243746', 'title': 'Svenska Andrea redo att fly sitt hem i Kalifornien', }, 'playlist_count': 2, ...
@@ -414,12 +453,13 @@ class SVTPageIE(InfoExtractor): 'duration': 27, 'age_limit': 0, }, + 'skip': 'Video is gone' }, { 'url': 'https://www.svt.se/nyheter/lokalt/vast/svt-testar-tar-nagon-upp-skrapet-1', - 'only_matching': True, + 'skip': 'Video is g...
yt_dlp/extractor/svt.py
26
Python
0.357
suggestion
71
51
51
false
[SVTPage] Fix extractor
8,938
yt-dlp/yt-dlp
132,642
Python
bashonly
diman8
}, { # only programTitle 'url': 'http://www.svt.se/sport/ishockey/jagr-tacklar-giroux-under-intervjun', 'info_dict': { 'id': '8439V2K', 'ext': 'mp4', 'title': 'Stjärnorna skojar till det - under SVT-intervjun', 'duration': 27, 'age_...
we only need to match the id now ```suggestion def _real_extract(self, url): display_id = self._match_id(url) ```
}, { # only programTitle 'url': 'http://www.svt.se/sport/ishockey/jagr-tacklar-giroux-under-intervjun', 'info_dict': { 'id': '8439V2K', 'ext': 'mp4', 'title': 'Stjärnorna skojar till det - under SVT-intervjun', 'duration': 27, 'age_...
@@ -429,24 +469,27 @@ def suitable(cls, url): def _real_extract(self, url): path, display_id = self._match_valid_url(url).groups()
yt_dlp/extractor/svt.py
26
Python
0.786
refactor
129
51
45
false
[SVTPage] Fix extractor
8,938
yt-dlp/yt-dlp
132,642
Python
bashonly
diman8
'ext': 'mp4', 'title': 'Stjärnorna skojar till det - under SVT-intervjun', 'duration': 27, 'age_limit': 0, }, 'skip': 'Video is gone' }, { 'url': 'https://www.svt.se/nyheter/lokalt/vast/svt-testar-tar-nagon-upp-skrapet-1', 'skip': 'Vide...
- snake_case for var names - we should use `\s*=` instead of `[^{]+` - line too long - why default to `None`? imo this should be fatal ```suggestion urql_state = self._search_json( r'window\.svt\.nyh\.urqlState\s*=', webpage, 'json data', display_id) ```
'ext': 'mp4', 'title': 'Stjärnorna skojar till det - under SVT-intervjun', 'duration': 27, 'age_limit': 0, }, 'skip': 'Video is gone' }, { 'url': 'https://www.svt.se/nyheter/lokalt/vast/svt-testar-tar-nagon-upp-skrapet-1', 'only_matchin...
@@ -429,24 +469,27 @@ def suitable(cls, url): def _real_extract(self, url): path, display_id = self._match_valid_url(url).groups() - article = self._download_json( - 'https://api.svt.se/nss-api/page/' + path, display_id, - query={'q': 'articles'})['articles']['content'][0] -...
yt_dlp/extractor/svt.py
26
Python
0.857
refactor
281
46
40
false
[SVTPage] Fix extractor
8,938
yt-dlp/yt-dlp
132,642
Python
bashonly
diman8
'duration': 27, 'age_limit': 0, }, 'skip': 'Video is gone' }, { 'url': 'https://www.svt.se/nyheter/lokalt/vast/svt-testar-tar-nagon-upp-skrapet-1', 'skip': 'Video is gone' }, { 'url': 'https://www.svt.se/vader/manadskronikor/maj2018', 'skip...
we can parse the json within the traversal path ```suggestion data = traverse_obj(urql_state, (..., 'data', {str}, {json.loads}), get_all=False) or {} ```
'duration': 27, 'age_limit': 0, }, 'skip': 'Video is gone' }, { 'url': 'https://www.svt.se/nyheter/lokalt/vast/svt-testar-tar-nagon-upp-skrapet-1', 'only_matching': True, }, { 'url': 'https://www.svt.se/vader/manadskronikor/maj2018', 'only_...
@@ -429,24 +469,27 @@ def suitable(cls, url): def _real_extract(self, url): path, display_id = self._match_valid_url(url).groups() - article = self._download_json( - 'https://api.svt.se/nss-api/page/' + path, display_id, - query={'q': 'articles'})['articles']['content'][0] -...
yt_dlp/extractor/svt.py
26
Python
0.714
suggestion
165
44
38
false
[SVTPage] Fix extractor
8,938
yt-dlp/yt-dlp
132,642
Python
bashonly
diman8