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
_NETRC_MACHINE = 'wikimediaorg' _API_BASE_URL = 'https://commons.wikimedia.org/' _VALID_URL = 'https://commons.wikimedia.org/wiki/File:(?P<id>[^/]+)' _TEST = { 'url': 'https://commons.wikimedia.org/wiki/File:Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS.webm', 'info_dict': {...
I don't think this check is needed. But you want it, do: ```suggestion if not determine_ext(url, None): raise ExtractorError('The URL does not contain a video', expected=True) ``` Or even better, the valid_url can be improved to not match URLs without extension
'info_dict': { 'url': 're:https?://upload.wikimedia.org/wikipedia', 'ext': 'webm', 'id': 'Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS', 'title': 'Die Temperaturkurve der Erde (ZDF, Terra X) 720p HD 50FPS.webm - Wikimedia Commons', 'descri...
@@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + +from ..utils import ( + clean_html, + determine_ext, + get_element_by_class, + urljoin, + parse_qs as compat_parse_qs, + ExtractorError) + + +class WikimediaIE(InfoExtractor)...
yt_dlp/extractor/wikimedia.py
26
Python
1
refactor
288
51
38
false
Add support for wikimedia.org
4,314
yt-dlp/yt-dlp
132,642
Python
pukkandan
EhtishamSabir
_TEST = { 'url': 'https://commons.wikimedia.org/wiki/File:Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS.webm', 'info_dict': { 'description': 'md5:7cd84f76e7081f1be033d0b155b4a460', 'ext': 'webm', 'id': 'Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS', ...
```suggestion video_url = self._html_search_regex('<source\s[^>]*\bsrc="([^"]+)"', webpage, 'video URL') ```
'title': 'Die Temperaturkurve der Erde (ZDF, Terra X) 720p HD 50FPS.webm - Wikimedia Commons', 'description': 'md5:7cd84f76e7081f1be033d0b155b4a460', 'license': 'Creative Commons Attribution 4.0 International', 'uploader': 'ZDF/Terra X/Gruppe 5/Luise Wagner, Jonas Sichert...
@@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + +from ..utils import ( + clean_html, + determine_ext, + get_element_by_class, + urljoin, + parse_qs as compat_parse_qs, + ExtractorError) + + +class WikimediaIE(InfoExtractor)...
yt_dlp/extractor/wikimedia.py
26
Python
0.714
suggestion
118
48
34
false
Add support for wikimedia.org
4,314
yt-dlp/yt-dlp
132,642
Python
pukkandan
EhtishamSabir
'url': 'https://commons.wikimedia.org/wiki/File:Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS.webm', 'info_dict': { 'description': 'md5:7cd84f76e7081f1be033d0b155b4a460', 'ext': 'webm', 'id': 'Die_Temperaturkurve_der_Erde_(ZDF,_Terra_X)_720p_HD_50FPS', 'ti...
Does it have to be this strict? What do you get with just `licensetpl`?
'description': 'md5:7cd84f76e7081f1be033d0b155b4a460', 'license': 'Creative Commons Attribution 4.0 International', 'uploader': 'ZDF/Terra X/Gruppe 5/Luise Wagner, Jonas Sichert, Andreas Hougardy', 'subtitles': 'count:4' } }] def _real_extract(self, url):...
@@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + +from ..utils import ( + clean_html, + determine_ext, + get_element_by_class, + urljoin, + parse_qs as compat_parse_qs, + ExtractorError) + + +class WikimediaIE(InfoExtractor)...
yt_dlp/extractor/wikimedia.py
26
Python
0.357
question
71
47
33
false
Add support for wikimedia.org
4,314
yt-dlp/yt-dlp
132,642
Python
pukkandan
EhtishamSabir
'title': 'Die Temperaturkurve der Erde (ZDF, Terra X) 720p HD 50FPS.webm - Wikimedia Commons', 'license': 'md5:62907cddf705a9f7ae7076c15407a977', 'author': None, 'subtitles': {'de': [{'ext': 'srt', 'url': 'https?://commons.wikimedia.o...
The `?` isnt doing anything? ```suggestion author = self._html_search_regex(r'>\s*Author\s*</td>\s*<td\b[^>]*>\s*([^<]+)\s*</td>', ```
} }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) subtitles = {} for sub in set(re.findall(r'\bsrc\s*=\s*["\'](/w/api[^"]+)["\']', webpage)): sub = urljoin('https://commons.wikimedia.org', unesc...
@@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + +from ..utils import ( + clean_html, + determine_ext, + get_element_by_class, + urljoin, + parse_qs as compat_parse_qs, + ExtractorError) + + +class WikimediaIE(InfoExtractor)...
yt_dlp/extractor/wikimedia.py
26
Python
0.714
security
147
43
29
false
Add support for wikimedia.org
4,314
yt-dlp/yt-dlp
132,642
Python
pukkandan
EhtishamSabir
'en-gb': [{'ext': 'srt', 'url': 'https?://commons.wikimedia.org/w/api.php'}], 'nl': [{'ext': 'srt', 'url': 'https?://commons.wikimedi...
each key in new line, follow trailing parens convention
import re from .common import InfoExtractor from ..utils import ( clean_html, get_element_by_class, parse_qs, remove_start, unescapeHTML, urljoin, ) class WikimediaIE(InfoExtractor): IE_NAME = 'wikimedia.org' _VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\...
@@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + +from ..utils import ( + clean_html, + determine_ext, + get_element_by_class, + urljoin, + parse_qs as compat_parse_qs, + ExtractorError) + + +class WikimediaIE(InfoExtractor)...
yt_dlp/extractor/wikimedia.py
26
Python
0.214
style
55
39
56
false
Add support for wikimedia.org
4,314
yt-dlp/yt-dlp
132,642
Python
pukkandan
EhtishamSabir
'en': [{'ext': 'srt', 'url': 're:https?://commons.wikimedia.org/w/api.php'}]}} } def _real_extract(self, url): video_id = self._match_id(url) ext = determine_ext(url, None) if ext is None: ...
Remove unnecessary triple quotes and escapes
import re from .common import InfoExtractor from ..utils import ( clean_html, get_element_by_class, parse_qs, remove_start, unescapeHTML, urljoin, ) class WikimediaIE(InfoExtractor): IE_NAME = 'wikimedia.org' _VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\...
@@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + +from ..utils import ( + clean_html, + determine_ext, + get_element_by_class, + urljoin, + parse_qs as compat_parse_qs, + ExtractorError) + + +class WikimediaIE(InfoExtractor)...
yt_dlp/extractor/wikimedia.py
26
Python
0.143
security
44
35
56
false
Add support for wikimedia.org
4,314
yt-dlp/yt-dlp
132,642
Python
pukkandan
EhtishamSabir
ext = determine_ext(url, None) if ext is None: raise ExtractorError('invalid video url', expected=True) webpage = self._download_webpage(url, video_id) self.report_extraction(video_id) video_url = self._html_search_regex('<source [^>]*src="([^"]+)"', webpage, ...
https://github.com/ytdl-org/youtube-dl/pull/30796#discussion_r849287567
import re from .common import InfoExtractor from ..utils import ( clean_html, get_element_by_class, parse_qs, remove_start, unescapeHTML, urljoin, ) class WikimediaIE(InfoExtractor): IE_NAME = 'wikimedia.org' _VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\...
@@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + +from ..utils import ( + clean_html, + determine_ext, + get_element_by_class, + urljoin, + parse_qs as compat_parse_qs, + ExtractorError) + + +class WikimediaIE(InfoExtractor)...
yt_dlp/extractor/wikimedia.py
26
Python
0.214
suggestion
71
29
56
false
Add support for wikimedia.org
4,314
yt-dlp/yt-dlp
132,642
Python
pukkandan
EhtishamSabir
raise ExtractorError('invalid video url', expected=True) webpage = self._download_webpage(url, video_id) self.report_extraction(video_id) video_url = self._html_search_regex('<source [^>]*src="([^"]+)"', webpage, 'video URL') licens...
why build the info, modify, and then return. Just return verbose here. Like: ```py return { 'id': video_id, ... } ```
import re from .common import InfoExtractor from ..utils import ( clean_html, get_element_by_class, parse_qs, remove_start, unescapeHTML, urljoin, ) class WikimediaIE(InfoExtractor): IE_NAME = 'wikimedia.org' _VALID_URL = r'https?://commons\.wikimedia\.org/wiki/File:(?P<id>[^/#?]+)\.\...
@@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + +from ..utils import ( + clean_html, + determine_ext, + get_element_by_class, + urljoin, + parse_qs as compat_parse_qs, + ExtractorError) + + +class WikimediaIE(InfoExtractor)...
yt_dlp/extractor/wikimedia.py
26
Python
0.714
suggestion
131
27
56
false
Add support for wikimedia.org
4,314
yt-dlp/yt-dlp
132,642
Python
pukkandan
EhtishamSabir
from .common import InfoExtractor from ..utils import extract_attributes, remove_end class TheHoleTvExtractorIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?the-hole\.tv/episodes/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://the-hole.tv/episodes/gromkii-vopros-sergey-orlov', 'md5': 'fea6682...
```suggestion player_attrs = extract_attributes(self._search_regex( r'(<div[^>]*\bdata-controller="player"[^>]*>)', webpage, 'video player')) formats, subtitles = self._extract_m3u8_formats_and_subtitles( player_attrs['data-player-source-value'], video_id, 'mp4') ```
from .common import InfoExtractor from ..utils import extract_attributes, remove_end class TheHoleTvIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?the-hole\.tv/episodes/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://the-hole.tv/episodes/gromkii-vopros-sergey-orlov', 'md5': 'fea6682f47786f3a...
@@ -0,0 +1,34 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, remove_end + + +class TheHoleTvExtractorIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?the-hole\.tv/episodes/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://the-hole.tv/episodes/gromkii-vopros-sergey-orlov'...
yt_dlp/extractor/theholetv.py
24
Python
0.857
refactor
312
35
37
false
[theholetv] Add extractor
4,325
yt-dlp/yt-dlp
132,642
Python
pukkandan
dosy4ev
from .common import InfoExtractor from ..utils import extract_attributes, remove_end class TheHoleTvExtractorIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?the-hole\.tv/episodes/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://the-hole.tv/episodes/gromkii-vopros-sergey-orlov', 'md5': 'fea6682...
```suggestion class TheHoleTvIE(InfoExtractor): ```
from .common import InfoExtractor from ..utils import extract_attributes, remove_end class TheHoleTvIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?the-hole\.tv/episodes/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://the-hole.tv/episodes/gromkii-vopros-sergey-orlov', 'md5': 'fea6682f47786f3a...
@@ -0,0 +1,36 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, remove_end + + +class TheHoleTvExtractorIE(InfoExtractor):
yt_dlp/extractor/theholetv.py
5
Python
0.643
refactor
53
30
30
false
[theholetv] Add extractor
4,325
yt-dlp/yt-dlp
132,642
Python
pukkandan
dosy4ev
TedSeriesIE, TedTalkIE, ) from .tele5 import Tele5IE from .tele13 import Tele13IE from .telebruxelles import TeleBruxellesIE from .telecinco import TelecincoIE from .telegraaf import TelegraafIE from .telegram import TelegramEmbedIE from .telemb import TeleMBIE from .telemundo import TelemundoIE from .telequebe...
```suggestion from .theholetv import TheHoleTvIE ```
TedSeriesIE, TedTalkIE, ) from .tele5 import Tele5IE from .tele13 import Tele13IE from .telebruxelles import TeleBruxellesIE from .telecinco import TelecincoIE from .telegraaf import TelegraafIE from .telegram import TelegramEmbedIE from .telemb import TeleMBIE from .telemundo import TelemundoIE from .telequebe...
@@ -1718,6 +1718,7 @@ from .testurl import TestURLIE from .tf1 import TF1IE from .tfo import TFOIE +from .theholetv import TheHoleTvExtractorIE
yt_dlp/extractor/_extractors.py
26
Python
0.571
suggestion
54
51
51
false
[theholetv] Add extractor
4,325
yt-dlp/yt-dlp
132,642
Python
pukkandan
dosy4ev
from re import findall from .common import InfoExtractor from ..utils import traverse_obj class HytaleIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/20\d\d/(?:0?[1-9]|1[0-2])/(?P<id>[a-z0-9-]+)' _TESTS = [{ 'url': 'https://hytale.com/news/2021/07/summer-2021-development-update'...
```suggestion _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/\d+/\d+/(?P<id>[a-z0-9-]+)' ``` There is no need for it to be so strict
import re from .common import InfoExtractor from ..utils import traverse_obj class HytaleIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/\d+/\d+/(?P<id>[a-z0-9-]+)' _TESTS = [{ 'url': 'https://hytale.com/news/2021/07/summer-2021-development-update', 'info_dict': { ...
@@ -0,0 +1,62 @@ +from re import findall + +from .common import InfoExtractor +from ..utils import traverse_obj + + +class HytaleIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/20\d\d/(?:0?[1-9]|1[0-2])/(?P<id>[a-z0-9-]+)'
yt_dlp/extractor/hytale.py
8
Python
0.714
suggestion
143
33
33
false
[extractor/hytale] Add extractor
4,326
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
from ..utils import traverse_obj class HytaleIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/20\d\d/(?:0?[1-9]|1[0-2])/(?P<id>[a-z0-9-]+)' _TESTS = [{ 'url': 'https://hytale.com/news/2021/07/summer-2021-development-update', 'info_dict': { 'id': 'summer-2021-de...
remove variables that are only used once
from ..utils import traverse_obj class HytaleIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/\d+/\d+/(?P<id>[a-z0-9-]+)' _TESTS = [{ 'url': 'https://hytale.com/news/2021/07/summer-2021-development-update', 'info_dict': { 'id': 'summer-2021-development-update',...
@@ -0,0 +1,62 @@ +from re import findall + +from .common import InfoExtractor +from ..utils import traverse_obj + + +class HytaleIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/20\d\d/(?:0?[1-9]|1[0-2])/(?P<id>[a-z0-9-]+)' + _TESTS = [{ + 'url': 'https://hytale.com/news/2021/07/summ...
yt_dlp/extractor/hytale.py
26
Python
0.143
suggestion
40
51
51
false
[extractor/hytale] Add extractor
4,326
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
_VIDEO_BASE_URL = 'https://cloudflarestream.com/{}/manifest/video.mpd?parentOrigin=https%3A%2F%2Fhytale.com' _MEDIA_PAGE_URL = 'https://hytale.com/media' _MEDIA_START_PATTERN = r'window\.__INITIAL_COMPONENTS_STATE__\s*=\s*\[' def _real_extract(self, url): playlist_id = self._match_id(url) ...
Use the webpage title. Or just set title=None
'url': 'https://www.hytale.com/news/2019/11/hytale-graphics-update', 'info_dict': { 'id': 'hytale-graphics-update', 'title': 'Hytale graphics update', }, 'playlist_count': 2, }] def _real_initialize(self): media_webpage = self._download_webpage( ...
@@ -0,0 +1,62 @@ +from re import findall + +from .common import InfoExtractor +from ..utils import traverse_obj + + +class HytaleIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/20\d\d/(?:0?[1-9]|1[0-2])/(?P<id>[a-z0-9-]+)' + _TESTS = [{ + 'url': 'https://hytale.com/news/2021/07/summ...
yt_dlp/extractor/hytale.py
26
Python
0.143
suggestion
45
38
34
false
[extractor/hytale] Add extractor
4,326
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
videos_ids_and_titles = {} media_webpage = self._download_webpage(self._MEDIA_PAGE_URL, 'media', fatal=False) if media_webpage: clips_json = traverse_obj( self._search_json(self._MEDIA_START_PATTERN, media_webpage, 'clips json', 'me...
```suggestion ``` Not needed
import re from .common import InfoExtractor from ..utils import traverse_obj class HytaleIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/\d+/\d+/(?P<id>[a-z0-9-]+)' _TESTS = [{ 'url': 'https://hytale.com/news/2021/07/summer-2021-development-update', 'info_dict': { ...
@@ -0,0 +1,62 @@ +from re import findall + +from .common import InfoExtractor +from ..utils import traverse_obj + + +class HytaleIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?hytale\.com/news/20\d\d/(?:0?[1-9]|1[0-2])/(?P<id>[a-z0-9-]+)' + _TESTS = [{ + 'url': 'https://hytale.com/news/2021/07/summ...
yt_dlp/extractor/hytale.py
26
Python
0.429
suggestion
30
29
59
false
[extractor/hytale] Add extractor
4,326
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
import re import time import urllib.parse from yt_dlp import InfoExtractor from yt_dlp.aes import aes_cbc_encrypt from yt_dlp.compat import compat_ord, compat_str from yt_dlp.utils import bytes_to_intlist, random_user_agent class WeTvBaseIE(InfoExtractor): _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#...
```suggestion from .common import InfoExtractor from ..aes import aes_cbc_encrypt from ..compat import compat_ord from ..utils import bytes_to_intlist, random_user_agent ``` 1. Use relative imports 2. Don't use `compat_str` but `str`
import re import time from .common import InfoExtractor from ..aes import aes_cbc_encrypt from ..utils import bytes_to_intlist, determine_ext, intlist_to_bytes, int_or_none, traverse_obj class WeTvBaseIE(InfoExtractor): _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' def _get_ckey(self, v...
@@ -0,0 +1,198 @@ +import re +import time +import urllib.parse + +from yt_dlp import InfoExtractor +from yt_dlp.aes import aes_cbc_encrypt +from yt_dlp.compat import compat_ord, compat_str +from yt_dlp.utils import bytes_to_intlist, random_user_agent
yt_dlp/extractor/wetv.py
8
Python
0.857
refactor
240
33
33
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
elyse0
formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) else: formats.append({ 'url': f"{video_format['url']}{video_response['fn']}?vkey={video_response['fvkey']}", 'width': video_response.get('vw'), ...
```suggestion video_id, series_id = self._match_valid_url(url).group('id', 'series_id') ```
formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) else: formats.append({ 'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}', 'width': video_width, '...
@@ -0,0 +1,198 @@ +import re +import time +import urllib.parse + +from yt_dlp import InfoExtractor +from yt_dlp.aes import aes_cbc_encrypt +from yt_dlp.compat import compat_ord, compat_str +from yt_dlp.utils import bytes_to_intlist, random_user_agent + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https?...
yt_dlp/extractor/wetv.py
26
Python
0.714
suggestion
101
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
elyse0
def _real_extract(self, url): video_id, series_id = self._match_valid_url(url).group('id', 'series_id') webpage = self._download_webpage(url, video_id) formats, subtitles = [], {} for video_format, subtitle_format in (('mp4', 'srt'), ('hls', 'vtt')): api_response = self...
```suggestion _VALID_URL = WeTvBaseIE._VALID_URL_BASE + r'/(?P<id>\w+)(?:-[^?#]+)?/?(?:[?#]|$)' ``` should fix tests
return subtitles def _real_extract(self, url): video_id, series_id = self._match_valid_url(url).group('id', 'series_id') webpage = self._download_webpage(url, video_id) formats, subtitles = [], {} for video_format, subtitle_format, video_quality in (('mp4', 'srt', ''), ('hl...
@@ -0,0 +1,197 @@ +import re +import time +import urllib.parse + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..compat import compat_ord +from ..utils import bytes_to_intlist, random_user_agent + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:...
yt_dlp/extractor/wetv.py
26
Python
0.786
suggestion
123
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
}] def _extract_video_formats_and_subtitles(self, video_id, api_response): video_response = api_response['vl']['vi'][0] formats, subtitles = [], {} for video_format in video_response['ul']['ui']: if video_format.get('hls'): fmts, subs = self._extract_m3u8_fo...
I think subtitle should not fatal
}) return formats, subtitles def _extract_video_subtitles(self, api_response, subtitles_format): subtitles = {} for subtitle in traverse_obj(api_response, ('sfl', 'fi')): subtitles.setdefault(subtitle['lang'].lower(), []).append({ 'url': subtitle...
@@ -0,0 +1,228 @@ +import re +import time +import urllib.parse + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..compat import compat_ord +from ..utils import bytes_to_intlist, int_or_none, random_user_agent, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https...
yt_dlp/extractor/wetv.py
26
Python
0.143
suggestion
33
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
HobbyistDev
elyse0
'id': 'v0040pr89t9', 'ext': 'mp4', 'title': 'EP1: Cute Programmer', 'description': 'md5:e87beab3bf9f392d6b9e541a63286343', 'thumbnail': 'http://puui.wetvinfo.com/vcover_hz_pic/0/air11ooo2rdsdi31630998533838/0', 'series': 'Cute Programmer', ...
This line still fatal, you want to make this not fatal right ?
}, { 'url': 'https://wetv.vip/en/play/lcxgwod5hapghvw-WeTV-PICK-A-BOO/i0042y00lxp-Zhao-Lusi-Describes-The-First-Experiences-She-Had-In-Who-Rules-The-World-%7C-WeTV-PICK-A-BOO', 'md5': '71133f5c2d5d6cad3427e1b010488280', 'info_dict': { 'id': 'i0042y00lxp', 'ext': 'mp4'...
@@ -0,0 +1,228 @@ +import re +import time +import urllib.parse + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..compat import compat_ord +from ..utils import bytes_to_intlist, int_or_none, random_user_agent, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https...
yt_dlp/extractor/wetv.py
26
Python
0.214
question
62
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
HobbyistDev
elyse0
from .common import InfoExtractor from ..aes import aes_cbc_encrypt from ..compat import compat_ord from ..utils import bytes_to_intlist, int_or_none, random_user_agent, traverse_obj class WeTvBaseIE(InfoExtractor): _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' def _get_ckey(self, video_...
shouldn't this be `self.get_param('http_headers')['User-Agent']`?
from ..aes import aes_cbc_encrypt from ..utils import bytes_to_intlist, determine_ext, intlist_to_bytes, int_or_none, traverse_obj class WeTvBaseIE(InfoExtractor): _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' def _get_ckey(self, video_id, url, app_version, platform): ua = self.g...
@@ -0,0 +1,228 @@ +import re +import time +import urllib.parse + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..compat import compat_ord +from ..utils import bytes_to_intlist, int_or_none, random_user_agent, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https...
yt_dlp/extractor/wetv.py
26
Python
0.429
question
65
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'', video_id, str(int(time.time())), 'mg3c3b04ba', app_version, '0000000000000000', # guid platform, url[:48], random_user_agent().lower()[:48], # user_agent ''[:48], # referer 'Mozilla...
why so complicated? Untested, but it looks like this is what u r trying to do: ```py def _get_ckey(self, video_id, url, app_version, platform): ua = self.get_param('http_headers')['User-Agent'] payload = (f'{video_id}|{int(time.time())}|mg3c3b04ba|{app_version}|0000000000000000|' ...
'whitespace') return intlist_to_bytes(ciphertext_int_bytes).hex() def _get_video_api_response(self, video_url, video_id, series_id, subtitle_format, video_format, video_quality): app_version = '3.5.57' platform = '4830201' ckey = self._get_ckey(video_id, video_url, app...
@@ -0,0 +1,228 @@ +import re +import time +import urllib.parse + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..compat import compat_ord +from ..utils import bytes_to_intlist, int_or_none, random_user_agent, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https...
yt_dlp/extractor/wetv.py
26
Python
0.857
question
727
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'description': 'md5:e87beab3bf9f392d6b9e541a63286343', }, 'playlist_count': 30, }, { 'url': 'https://wetv.vip/en/play/u37kgfnfzs73kiu-You-Are-My-Glory', 'info_dict': { 'id': 'u37kgfnfzs73kiu', 'title': 'You Are My Glory', 'description':...
This looks like it should use playlist_from_matches
import re import time from .common import InfoExtractor from ..aes import aes_cbc_encrypt from ..utils import bytes_to_intlist, determine_ext, intlist_to_bytes, int_or_none, traverse_obj class WeTvBaseIE(InfoExtractor): _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' def _get_ckey(self, v...
@@ -0,0 +1,228 @@ +import re +import time +import urllib.parse + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..compat import compat_ord +from ..utils import bytes_to_intlist, int_or_none, random_user_agent, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https...
yt_dlp/extractor/wetv.py
26
Python
0.286
suggestion
51
27
210
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'url': 'https://wetv.vip/en/play/lcxgwod5hapghvw-WeTV-PICK-A-BOO/i0042y00lxp-Zhao-Lusi-Describes-The-First-Experiences-She-Had-In-Who-Rules-The-World-%7C-WeTV-PICK-A-BOO', 'md5': '71133f5c2d5d6cad3427e1b010488280', 'info_dict': { 'id': 'i0042y00lxp', 'ext': 'mp4', ...
@pukkandan, does it make sense to use `video_width` as quality value? Or it's a bad idea?
'url': 'https://wetv.vip/en/play/lcxgwod5hapghvw-WeTV-PICK-A-BOO/i0042y00lxp-Zhao-Lusi-Describes-The-First-Experiences-She-Had-In-Who-Rules-The-World-%7C-WeTV-PICK-A-BOO', 'md5': '71133f5c2d5d6cad3427e1b010488280', 'info_dict': { 'id': 'i0042y00lxp', 'ext': 'mp4', ...
@@ -107,20 +107,23 @@ class WeTvEpisodeIE(WeTvBaseIE): def _extract_video_formats_and_subtitles(self, api_response, video_id, video_quality): video_response = api_response['vl']['vi'][0] + video_width = video_response.get('vw') + video_height = video_response.get('vh') formats, ...
yt_dlp/extractor/wetv.py
26
Python
0.429
question
89
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
elyse0
elyse0
app_version = '3.5.57' platform = '4830201' ckey = self._get_ckey(video_id, video_url, app_version, platform) query = { 'vid': video_id, 'cid': series_id, 'cKey': ckey, 'encryptVer': '8.1', 'spcaptiontype': '1' if subtitle_form...
```suggestion return self._search_json(r'QZOutputJson=', self._download_webpage( 'https://play.wetv.vip/getvinfo', video_id, query=query), 'api_response', video_id) ```
app_version = '3.5.57' platform = '4830201' ckey = self._get_ckey(video_id, video_url, app_version, platform) query = { 'vid': video_id, 'cid': series_id, 'cKey': ckey, 'encryptVer': '8.1', 'spcaptiontype': '1' if subtitle_form...
@@ -0,0 +1,211 @@ +import re +import time + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..utils import bytes_to_intlist, intlist_to_bytes, int_or_none, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' + + def _g...
yt_dlp/extractor/wetv.py
26
Python
0.714
suggestion
191
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
def _extract_video_subtitles(self, api_response, subtitles_format): subtitles = {} for subtitle in traverse_obj(api_response, ('sfl', 'fi')): subtitles[subtitle['lang'].lower()] = [{ 'url': subtitle['url'], 'ext': subtitles_format, 'protoc...
```suggestion self._merge_subtitles(subs, native_subtitles, target=subtitles) ```
def _extract_video_subtitles(self, api_response, subtitles_format): subtitles = {} for subtitle in traverse_obj(api_response, ('sfl', 'fi')): subtitles.setdefault(subtitle['lang'].lower(), []).append({ 'url': subtitle['url'], 'ext': subtitles_format, ...
@@ -0,0 +1,211 @@ +import re +import time + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..utils import bytes_to_intlist, intlist_to_bytes, int_or_none, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' + + def _g...
yt_dlp/extractor/wetv.py
26
Python
0.571
suggestion
95
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'episode': 'Episode 0', 'episode_number': 0, 'duration': 442, }, }] def _extract_video_formats_and_subtitles(self, api_response, video_id, video_quality): video_response = api_response['vl']['vi'][0] video_width = video_response.get('vw') vide...
```suggestion 'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}', ```
'episode': 'Episode 0', 'episode_number': 0, 'duration': 442, }, }] def _extract_video_formats_and_subtitles(self, api_response, video_id, video_quality): video_response = api_response['vl']['vi'][0] video_width = video_response.get('vw') vide...
@@ -0,0 +1,211 @@ +import re +import time + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..utils import bytes_to_intlist, intlist_to_bytes, int_or_none, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' + + def _g...
yt_dlp/extractor/wetv.py
26
Python
0.714
suggestion
125
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
video_format.get('url') + traverse_obj(video_format, ('hls', 'pname')), video_id, 'mp4', fatal=False) for f in fmts: f['width'] = video_width f['height'] = video_height formats.extend(fmts) self._merge_subtitle...
```suggestion subtitles.setdefault(subtitle['lang'].lower(), []).append({ 'url': subtitle['url'], 'ext': subtitles_format, 'protocol': 'm3u8_native' if subtitles_format == 'vtt' else 'http' }) ```
video_format['url'] + video_format['hls']['pname'], video_id, 'mp4', fatal=False) for f in fmts: f['width'] = video_width f['height'] = video_height formats.extend(fmts) self._merge_subtitles(subs, target=subtit...
@@ -0,0 +1,211 @@ +import re +import time + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..utils import bytes_to_intlist, intlist_to_bytes, int_or_none, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' + + def _g...
yt_dlp/extractor/wetv.py
26
Python
0.786
suggestion
274
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
fmts, subs = self._extract_m3u8_formats_and_subtitles( video_format.get('url') + traverse_obj(video_format, ('hls', 'pname')), video_id, 'mp4', fatal=False) for f in fmts: f['width'] = video_width f['height'] = video_height ...
Are you sure about the protocol? In general, not all vtt is hls
fmts, subs = self._extract_m3u8_formats_and_subtitles( video_format['url'] + video_format['hls']['pname'], video_id, 'mp4', fatal=False) for f in fmts: f['width'] = video_width f['height'] = video_height formats...
@@ -0,0 +1,211 @@ +import re +import time + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..utils import bytes_to_intlist, intlist_to_bytes, int_or_none, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' + + def _g...
yt_dlp/extractor/wetv.py
26
Python
0.214
suggestion
63
51
51
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
_TESTS = [{ 'url': 'https://wetv.vip/play/air11ooo2rdsdi3-Cute-Programmer', 'info_dict': { 'id': 'air11ooo2rdsdi3', 'title': 'Cute Programmer', 'description': 'md5:e87beab3bf9f392d6b9e541a63286343', }, 'playlist_count': 30, }, { 'url':...
```suggestion or [f'/{series_id}/{episode["vid"]}' for episode in webpage_metadata.get('videoList')]) ```
'url': 'https://wetv.vip/play/air11ooo2rdsdi3-Cute-Programmer', 'info_dict': { 'id': 'air11ooo2rdsdi3', 'title': 'Cute Programmer', 'description': 'md5:e87beab3bf9f392d6b9e541a63286343', }, 'playlist_count': 30, }, { 'url': 'https://wetv.vi...
@@ -0,0 +1,211 @@ +import re +import time + +from .common import InfoExtractor +from ..aes import aes_cbc_encrypt +from ..utils import bytes_to_intlist, intlist_to_bytes, int_or_none, traverse_obj + + +class WeTvBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https?://(?:www\.)?wetv\.vip/(?:[^?#]+/)?play' + + def _g...
yt_dlp/extractor/wetv.py
26
Python
0.714
suggestion
132
32
30
false
[wetv] Add extractor
4,330
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'duration': 455, 'tags': [], } }, { 'url': 'https://cellebrite.com/en/how-to-lawfully-collect-the-maximum-amount-of-data-from-android-devices/', 'info_dict': { 'id': '29018255', 'ext': 'mp4', 'duration': 134, 'tags': [],...
```suggestion formats = [{'url': url} for url in traverse_obj(json_data, ('mp4', ..., 'url')) or []] subtitles = {} for url in traverse_obj(json_data, ('hls', ..., 'url')) or []: ``` The headers from the main infodict will be automatically used for each format
'duration': 455, 'tags': [], } }, { 'url': 'https://cellebrite.com/en/how-to-lawfully-collect-the-maximum-amount-of-data-from-android-devices/', 'info_dict': { 'id': '29018255', 'ext': 'mp4', 'duration': 134, 'tags': [],...
@@ -0,0 +1,70 @@ +from .common import InfoExtractor +from ..utils import traverse_obj + + +class CellebriteIE(InfoExtractor): + _VALID_URL = r'https?://cellebrite\.com/(?:\w+)?/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://cellebrite.com/en/collect-data-from-android-devices-with-cellebrite-ufed/', + ...
yt_dlp/extractor/cellebrite.py
26
Python
0.857
suggestion
293
51
51
false
[extractor/cellebrite] Add extractor
4,333
yt-dlp/yt-dlp
132,642
Python
pukkandan
HobbyistDev
}] def _get_formats_and_subtitles(self, json_data, display_id): formats, subtitles = [], {} mp4_url = traverse_obj(json_data, ('mp4', ..., 'url')) hls_url = traverse_obj(json_data, ('hls', ..., 'url')) for url_ in mp4_url or []: formats.append({'url': url_, 'http_h...
too strict. Is this not enough? ```suggestion player_uuid = self._search_regex( r'<img\s[^>]*\bdata-uuid\s*=\s*"([^"\?]+)', webpage, 'player UUID') ```
}] def _get_formats_and_subtitles(self, json_data, display_id): formats = [{'url': url} for url in traverse_obj(json_data, ('mp4', ..., 'url')) or []] subtitles = {} for url in traverse_obj(json_data, ('hls', ..., 'url')) or []: fmt, sub = self._extract_m3u8_formats_and_sub...
@@ -0,0 +1,70 @@ +from .common import InfoExtractor +from ..utils import traverse_obj + + +class CellebriteIE(InfoExtractor): + _VALID_URL = r'https?://cellebrite\.com/(?:\w+)?/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://cellebrite.com/en/collect-data-from-android-devices-with-cellebrite-ufed/', + ...
yt_dlp/extractor/cellebrite.py
26
Python
0.714
suggestion
175
43
37
false
[extractor/cellebrite] Add extractor
4,333
yt-dlp/yt-dlp
132,642
Python
pukkandan
HobbyistDev
import math from .common import InfoExtractor class XimalayaBaseIE(InfoExtractor): _GEO_COUNTRIES = ['CN'] class XimalayaIE(XimalayaBaseIE): IE_NAME = 'ximalaya' IE_DESC = '喜马拉雅FM' _VALID_URL = r'https?://(?:www\.|m\.)?ximalaya\.com/sound/(?P<id>[0-9]+)' _TESTS = [ { 'url': ...
The other URL pattern still opens in browser. So it should continue to work in yt-dlp
import math from .common import InfoExtractor from ..utils import traverse_obj, try_call, InAdvancePagedList class XimalayaBaseIE(InfoExtractor): _GEO_COUNTRIES = ['CN'] class XimalayaIE(XimalayaBaseIE): IE_NAME = 'ximalaya' IE_DESC = '喜马拉雅FM' _VALID_URL = r'https?://(?:www\.|m\.)?ximalaya\.com/(:?...
@@ -11,11 +10,10 @@ class XimalayaBaseIE(InfoExtractor): class XimalayaIE(XimalayaBaseIE): IE_NAME = 'ximalaya' IE_DESC = '喜马拉雅FM' - _VALID_URL = r'https?://(?:www\.|m\.)?ximalaya\.com/(?P<uid>[0-9]+)/sound/(?P<id>[0-9]+)' - _USER_URL_FORMAT = '%s://www.ximalaya.com/zhubo/%i/' + _VALID_URL = r'https...
yt_dlp/extractor/ximalaya.py
13
Python
0.286
suggestion
85
38
38
false
[extractor/Ximalaya] fix Ximalaya
4,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
lockmatrix
'Unable to download info file') formats = [] for bps, k in ((24, 'play_path_32'), (64, 'play_path_64')): if audio_info.get(k): formats.append({ 'url': audio_info[k], 'abr': bps, ...
```suggestion audio_description = try_call( lambda: audio_info['intro'].replace('\r\n\r\n\r\n ', '\n').replace('\r\n', '\n')) ```
'Downloading info json %s' % audio_info_file, 'Unable to download info file') formats = [{ 'format_id': f'{bps}k', 'url': audio_info[k], 'abr': bps, 'vcodec': 'none' } for b...
@@ -136,30 +102,19 @@ def _real_extract(self, url): audio_uploader_id = audio_info.get('uid') - if is_m: - audio_description = self._html_search_regex(r'(?s)<section\s+class=["\']content[^>]+>(.+?)</section>', - webpage, 'audio_descri...
yt_dlp/extractor/ximalaya.py
26
Python
0.786
suggestion
152
51
51
false
[extractor/Ximalaya] fix Ximalaya
4,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
lockmatrix
errnote='Unable to get album info') title = self._html_search_regex(r'<h1 class="title dC_">([^<]+)</h1>', webpage, 'title', fatal=False) return self.playlist_result(self._entries(playlist_id), playlist_id, title) de...
feels like it should be a pagedlist
import math from .common import InfoExtractor from ..utils import traverse_obj, try_call, InAdvancePagedList class XimalayaBaseIE(InfoExtractor): _GEO_COUNTRIES = ['CN'] class XimalayaIE(XimalayaBaseIE): IE_NAME = 'ximalaya' IE_DESC = '喜马拉雅FM' _VALID_URL = r'https?://(?:www\.|m\.)?ximalaya\.com/(:?...
@@ -201,29 +146,27 @@ def _real_extract(self, url): note='Download album page for %s' % playlist_id, errnote='Unable to get album info') - title = self._html_search_regex(r'detailContent_title[^>]*><h1(?:[^>]+)?>([^<]+)</h1>', ...
yt_dlp/extractor/ximalaya.py
26
Python
0.143
suggestion
35
27
161
false
[extractor/Ximalaya] fix Ximalaya
4,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
lockmatrix
'width': 180, 'height': 180 } ], 'categories': ['人文'], 'duration': 93, 'view_count': int, 'like_count': int, } } ] def _real_extract(self, url)...
```suggestion 'format_id': f'{bps}k', ```
'width': 180, 'height': 180 } ], 'categories': ['人文'], 'duration': 93, 'view_count': int, 'like_count': int, } } ] def _real_extract(self, url)...
@@ -52,76 +52,45 @@ class XimalayaIE(XimalayaBaseIE): 'uploader_url': 'http://www.ximalaya.com/zhubo/61425525/', 'title': '261.唐诗三百首.卷八.送孟浩然之广陵.李白', 'description': "contains:《送孟浩然之广陵》\n作者:李白\n故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。", + 'thumbnail': r're:^http...
yt_dlp/extractor/ximalaya.py
26
Python
0.571
suggestion
63
51
51
false
[extractor/Ximalaya] fix Ximalaya
4,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
lockmatrix
], 'categories': ['人文'], 'duration': 93, 'view_count': int, 'like_count': int, } } ] def _real_extract(self, url): scheme = 'https' if url.startswith('https') else 'http' audio_id = self._match_...
```suggestion ``` unnecessary
], 'categories': ['人文'], 'duration': 93, 'view_count': int, 'like_count': int, } } ] def _real_extract(self, url): scheme = 'https' if url.startswith('https') else 'http' audio_id = self._match_...
@@ -52,76 +52,45 @@ class XimalayaIE(XimalayaBaseIE): 'uploader_url': 'http://www.ximalaya.com/zhubo/61425525/', 'title': '261.唐诗三百首.卷八.送孟浩然之广陵.李白', 'description': "contains:《送孟浩然之广陵》\n作者:李白\n故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。", + 'thumbnail': r're:^http...
yt_dlp/extractor/ximalaya.py
26
Python
0.429
suggestion
31
51
51
false
[extractor/Ximalaya] fix Ximalaya
4,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
lockmatrix
'id': '5534601', }, 'playlist_mincount': 323, }] def _real_extract(self, url): self.scheme = scheme = 'https' if url.startswith('https') else 'http' mobj = self._match_valid_url(url) uid, playlist_id = mobj.group('uid'), mobj.group('id') webpage = s...
The point of paged list is that it is lazy! Don't unpack it...
def _real_extract(self, url): playlist_id = self._match_id(url) first_page = self._fetch_page(playlist_id, 1) page_count = math.ceil(first_page['trackTotalCount'] / first_page['pageSize']) entries = InAdvancePagedList( lambda idx: self._get_entries(self._fetch_page(play...
@@ -201,29 +148,27 @@ def _real_extract(self, url): note='Download album page for %s' % playlist_id, errnote='Unable to get album info') - title = self._html_search_regex(r'detailContent_title[^>]*><h1(?:[^>]+)?>([^<]+)</h1>', ...
yt_dlp/extractor/ximalaya.py
26
Python
0.214
suggestion
62
40
26
false
[extractor/Ximalaya] fix Ximalaya
4,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
lockmatrix
webpage = self._download_webpage(self._TEMPLATE_URL % (scheme, uid, playlist_id), playlist_id, note='Download album page for %s' % playlist_id, errnote='Unable to get album info') title = self._html_search_regex(r'<h1 cla...
use `self._proto_relative_url` to set the scheme and drop self.scheme
import math from .common import InfoExtractor from ..utils import traverse_obj, try_call, InAdvancePagedList class XimalayaBaseIE(InfoExtractor): _GEO_COUNTRIES = ['CN'] class XimalayaIE(XimalayaBaseIE): IE_NAME = 'ximalaya' IE_DESC = '喜马拉雅FM' _VALID_URL = r'https?://(?:www\.|m\.)?ximalaya\.com/(:?...
@@ -201,29 +148,27 @@ def _real_extract(self, url): note='Download album page for %s' % playlist_id, errnote='Unable to get album info') - title = self._html_search_regex(r'detailContent_title[^>]*><h1(?:[^>]+)?>([^<]+)</h1>', ...
yt_dlp/extractor/ximalaya.py
26
Python
0.429
suggestion
69
29
161
false
[extractor/Ximalaya] fix Ximalaya
4,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
lockmatrix
note='Download album page for %s' % playlist_id, errnote='Unable to get album info') title = self._html_search_regex(r'<h1 class="title dC_">([^<]+)</h1>', webpage, 'title', fatal=False) ...
title and id should be non-fatal
import math from .common import InfoExtractor from ..utils import traverse_obj, try_call, InAdvancePagedList class XimalayaBaseIE(InfoExtractor): _GEO_COUNTRIES = ['CN'] class XimalayaIE(XimalayaBaseIE): IE_NAME = 'ximalaya' IE_DESC = '喜马拉雅FM' _VALID_URL = r'https?://(?:www\.|m\.)?ximalaya\.com/(:?...
@@ -201,29 +148,27 @@ def _real_extract(self, url): note='Download album page for %s' % playlist_id, errnote='Unable to get album info') - title = self._html_search_regex(r'detailContent_title[^>]*><h1(?:[^>]+)?>([^<]+)</h1>', ...
yt_dlp/extractor/ximalaya.py
26
Python
0.143
suggestion
32
28
161
false
[extractor/Ximalaya] fix Ximalaya
4,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
lockmatrix
if thumbnail.endswith('/404_processing_{width}x{height}.png'): is_live, thumbnail = True, None else: is_live = False for p in ('width', 'height'): thumbnail = thumbnail.replace('{%s}' % p, '0') return { 'id'...
No need to sort. Core code should handle it
if thumbnail.endswith('/404_processing_{width}x{height}.png'): is_live, thumbnail = True, None else: is_live = False for p in ('width', 'height'): thumbnail = thumbnail.replace('{%s}' % p, '0') return { 'id'...
@@ -383,10 +437,41 @@ def _extract_info_gql(self, info, item_id): 'was_live': True, } + def _extract_storyboard(self, item_id, storyboard_json_url, duration): + spec = list(self._download_json(storyboard_json_url, item_id, "Downloading storyboard metadata JSON") or []) + # sort ...
yt_dlp/extractor/twitch.py
26
Python
0.286
style
43
51
51
false
[extractor/twitch] Storyboards for Twitch VODs
4,342
yt-dlp/yt-dlp
132,642
Python
pukkandan
ftk
is_live = None if thumbnail: if thumbnail.endswith('/404_processing_{width}x{height}.png'): is_live, thumbnail = True, None else: is_live = False for p in ('width', 'height'): thumbnail = thumbnail.replace('{%s}'...
1. why cast to list? 2. Use single quotes 3. Must be non-fatal ```suggestion spec = self._download_json(storyboard_json_url, item_id, 'Downloading storyboard metadata JSON', fatal=False) or [] ```
is_live = None if thumbnail: if thumbnail.endswith('/404_processing_{width}x{height}.png'): is_live, thumbnail = True, None else: is_live = False for p in ('width', 'height'): thumbnail = thumbnail.replace('{%s}'...
@@ -383,10 +437,41 @@ def _extract_info_gql(self, info, item_id): 'was_live': True, } + def _extract_storyboard(self, item_id, storyboard_json_url, duration): + spec = list(self._download_json(storyboard_json_url, item_id, "Downloading storyboard metadata JSON") or [])
yt_dlp/extractor/twitch.py
26
Python
1
suggestion
209
51
51
false
[extractor/twitch] Storyboards for Twitch VODs
4,342
yt-dlp/yt-dlp
132,642
Python
pukkandan
ftk
} for path in images], } def _real_extract(self, url): vod_id = self._match_id(url) video = self._download_info(vod_id) info = self._extract_info_gql(video, vod_id) access_token = self._download_access_token(vod_id, 'video', 'id') formats = self...
```suggestion if video.get('storyboard') and info.get('duration'): ``` or, even better imo, you could just have: ```py formats.extend(self._extract_storyboard(vod_id, video.get('storyboard'), info.get('duration'))) ``` and handle the None case in _extract_storyboard
'fragments': [{ 'url': urljoin(base, path), 'duration': fragment_duration, } for path in images], } def _real_extract(self, url): vod_id = self._match_id(url) video = self._download_info(vod_id) info = self...
@@ -403,6 +488,10 @@ def _real_extract(self, url): })), vod_id, 'mp4', entry_protocol='m3u8_native') + # extract storyboard + if video.get('storyboard') is not None and info.get('duration') is not None:
yt_dlp/extractor/twitch.py
26
Python
1
refactor
281
51
51
false
[extractor/twitch] Storyboards for Twitch VODs
4,342
yt-dlp/yt-dlp
132,642
Python
pukkandan
ftk
return { 'id': vod_id, 'title': info.get('title') or 'Untitled Broadcast', 'description': info.get('description'), 'duration': int_or_none(info.get('lengthSeconds')), 'thumbnail': thumbnail, 'uploader': try_get(info, lambda x: x['owner']['...
```suggestion images = s.get('images') if not (images and count): continue ```
return { 'id': vod_id, 'title': info.get('title') or 'Untitled Broadcast', 'description': info.get('description'), 'duration': int_or_none(info.get('lengthSeconds')), 'thumbnail': thumbnail, 'uploader': try_get(info, lambda x: x['owner']['...
@@ -383,10 +437,41 @@ def _extract_info_gql(self, info, item_id): 'was_live': True, } + def _extract_storyboard(self, item_id, storyboard_json_url, duration): + spec = list(self._download_json(storyboard_json_url, item_id, "Downloading storyboard metadata JSON") or []) + # sort ...
yt_dlp/extractor/twitch.py
26
Python
0.714
suggestion
122
51
51
false
[extractor/twitch] Storyboards for Twitch VODs
4,342
yt-dlp/yt-dlp
132,642
Python
pukkandan
ftk
set_version_info(final_file, version) def parse_options(): # Compatibility with older arguments opts = sys.argv[1:] if opts[0:1] in (['32'], ['64']): if ARCH != opts[0]: raise Exception(f'{opts[0]}bit executable cannot be built on a {ARCH}bit system') opts = opts[1:] re...
```suggestion '' if MACHINE in ('x86_64', 'amd64') else 'x86' if ('i' in MACHINE and '86' in MACHINE) else MACHINE ``` The and syntax is good for short conditions but is unreadable when it's this complex
] print(f'Running PyInstaller with {opts}') run_pyinstaller(opts) set_version_info(final_file, version) def parse_options(): # Compatibility with older arguments opts = sys.argv[1:] if opts[0:1] in (['32'], ['64']): ARCH = platform.architecture()[0][:2] if ARCH != opts[0]:...
@@ -65,7 +65,7 @@ def exe(onedir): name = '_'.join(filter(None, ( 'yt-dlp', {'win32': '', 'darwin': 'macos'}.get(OS_NAME, OS_NAME), - ARCH == '32' and 'x86' + ('i' in MACHINE and '86' in MACHINE and 'x86') or (MACHINE != 'x86_64' and MACHINE != 'amd64' and MACHINE)
pyinst.py
26
Python
0.786
suggestion
214
51
51
false
make pyinst.py build name more PEP425 compatible
4,355
yt-dlp/yt-dlp
132,642
Python
pukkandan
odo2063
set_version_info(final_file, version) def parse_options(): # Compatibility with older arguments opts = sys.argv[1:] if opts[0:1] in (['32'], ['64']): if ARCH != opts[0]: raise Exception(f'{opts[0]}bit executable cannot be built on a {ARCH}bit system') opts = opts[1:] re...
I think it makes sense to put this in a function/global var so that it can be reused below
] print(f'Running PyInstaller with {opts}') run_pyinstaller(opts) set_version_info(final_file, version) def parse_options(): # Compatibility with older arguments opts = sys.argv[1:] if opts[0:1] in (['32'], ['64']): ARCH = platform.architecture()[0][:2] if ARCH != opts[0]:...
@@ -65,7 +65,7 @@ def exe(onedir): name = '_'.join(filter(None, ( 'yt-dlp', {'win32': '', 'darwin': 'macos'}.get(OS_NAME, OS_NAME), - ARCH == '32' and 'x86' + '' if MACHINE in ('x86_64', 'amd64') else 'x86' if ('i' in MACHINE and '86' in MACHINE) else MACHINE
pyinst.py
26
Python
0.286
suggestion
90
51
51
false
make pyinst.py build name more PEP425 compatible
4,355
yt-dlp/yt-dlp
132,642
Python
pukkandan
odo2063
return title = source.get('title') if not title: return files = source.get('files') if not isinstance(files, dict): return format_urls = set() formats = [] for format_id in ('mobile', 'des...
```suggestion return { 'title': title, 'formats': formats, 'thumbnail': files.get('thumbnail'), ```
return title = source.get('title') if not title: return files = source.get('files') if not isinstance(files, dict): return format_urls = set() formats = [] for format_id in ('mobile', 'des...
@@ -72,31 +70,29 @@ def extract_entry(source): if not format_url or format_url in format_urls: continue format_urls.add(format_url) - m3u8_url = urljoin(self._LIVE_URL, format_url) formats.extend(self._extract_m3u8_formats( - ...
yt_dlp/extractor/philharmoniedeparis.py
26
Python
0.714
suggestion
164
43
42
false
Philharmonie
4,367
yt-dlp/yt-dlp
132,642
Python
pukkandan
sqrtNOT
'appVersion': '3.27.1' }, headers={ 'Authorization': f'bearer {self._get_device_token()}', })['token'] return AbemaTVBaseIE._MEDIATOKEN def _call_api(self, endpoint, video_id, query=None, note='Downloading JSON metadata'): return self._downlo...
```suggestion if traverse_obj(jsonld, '@type') != 'BreadcrumbList': continue trav = traverse_obj(jsonld, ('itemListElement', ..., 'name')) if trav: return trav ``` what does `trav` mean?
'appVersion': '3.27.1' }, headers={ 'Authorization': f'bearer {self._get_device_token()}', })['token'] return self._MEDIATOKEN def _call_api(self, endpoint, video_id, query=None, note='Downloading JSON metadata'): return self._download_json( ...
@@ -284,10 +223,82 @@ def _get_media_token(self, invalidate=False, to_show=True): 'appId': 'tv.abema', 'appVersion': '3.27.1' }, headers={ - 'Authorization': 'bearer ' + self._get_device_token() + 'Authorization': f'bearer {self._get_device_to...
yt_dlp/extractor/abematv.py
26
Python
0.929
question
261
51
51
false
[extractor/AbemaTVTitle] Implement paging
4,376
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
h = hmac.new( binascii.unhexlify(self.HKEY), (license_response['cid'] + self.ie._DEVICE_ID).encode('utf-8'), digestmod=hashlib.sha256) enckey = bytes_to_intlist(h.digest()) return intlist_to_bytes(aes_ecb_decrypt(encvideokey, enckey)) def abematv_license...
any reason to make this a static method?
h = hmac.new( binascii.unhexlify(self.HKEY), (license_response['cid'] + self.ie._DEVICE_ID).encode('utf-8'), digestmod=hashlib.sha256) enckey = bytes_to_intlist(h.digest()) return intlist_to_bytes(aes_ecb_decrypt(encvideokey, enckey)) def abematv_license...
@@ -145,76 +146,14 @@ def abematv_license_open(self, url): class AbemaTVBaseIE(InfoExtractor): - def _extract_breadcrumb_list(self, webpage, video_id): - for jld in re.finditer( - r'(?is)</span></li></ul><script[^>]+type=(["\']?)application/ld\+json\1[^>]*>(?P<json_ld>.+?)</script>', - ...
yt_dlp/extractor/abematv.py
26
Python
0.071
question
40
51
51
false
[extractor/AbemaTVTitle] Implement paging
4,376
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
return AbemaTVBaseIE._USERTOKEN AbemaTVBaseIE._DEVICE_ID = str(uuid.uuid4()) aks = self._generate_aks(AbemaTVBaseIE._DEVICE_ID) user_data = self._download_json( 'https://api.abema.io/v1/users', None, note='Authorizing', data=json.dumps({ 'devi...
I prefer to use the class name only when necessary. Like: ```py if not invalidate and self._MEDIATOKEN: return self._MEDIATOKEN AbemaTVBaseIE._MEDIATOKEN = self._download_json( ``` But if you prefer to use `AbemaTVBaseIE` everywhere, that's fine
return self._USERTOKEN AbemaTVBaseIE._DEVICE_ID = str(uuid.uuid4()) aks = self._generate_aks(self._DEVICE_ID) user_data = self._download_json( 'https://api.abema.io/v1/users', None, note='Authorizing', data=json.dumps({ 'deviceId': self._DEVIC...
@@ -248,33 +187,33 @@ def mix_twist(nonce): return base64.urlsafe_b64encode(tmp).rstrip(b'=').decode('utf-8') def _get_device_token(self): - if self._USERTOKEN: - return self._USERTOKEN + if AbemaTVBaseIE._USERTOKEN: + return AbemaTVBaseIE._USERTOKEN - self._...
yt_dlp/extractor/abematv.py
26
Python
0.857
suggestion
281
51
51
false
[extractor/AbemaTVTitle] Implement paging
4,376
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
//mediapolis(?:vod)?\.rai\.it/relinker/relinkerServlet\.htm\? (?:(?!\1).)*\bcont=(?:(?!\1).)+)\1 ''', webpage, 'relinker URL', group='url')) relinker_info = self._extract_relinker_info( urljoin(url, relinker_url), video_id) sel...
```suggestion _VALID_URL = rf'https?://(www\.)?rainews\.it/[^?#]+-(?P<id>{RaiBaseIE._UUID_RE})(?:-[^/?#]+)?\.html' ```
r'''(?x) (?: var\s+videoURL| mediaInfo\.mediaUri )\s*=\s* ([\'"]) (?P<url> (?:https?:)? //mediapolis(?:vod)?\.rai\.it/relinker/relinkerServlet\.htm\? ...
@@ -735,3 +699,67 @@ def _real_extract(self, url): info.update(relinker_info) return info + + +class RaiNewsIE(RaiIE): + _VALID_URL = r'https?://(www\.)?rainews\.it/.+?-(?P<id>%s)(?:-.+?)?\.html' % RaiBaseIE._UUID_RE
yt_dlp/extractor/rai.py
26
Python
0.714
suggestion
124
51
51
false
[rai] Rainews fix #3911
4,380
yt-dlp/yt-dlp
132,642
Python
pukkandan
nixxo
} }, { # old content with fallback method to extract media urls 'url': 'https://www.rainews.it/dl/rainews/media/Weekend-al-cinema-da-Hollywood-arriva-il-thriller-di-Tate-Taylor-La-ragazza-del-treno-1632c009-c843-4836-bb65-80c33084a64b.html', 'info_dict': { 'id': '1632c009...
```suggestion relinker_url = traverse_obj(player_data, 'mediapolis', 'content_url') ```
'ext': 'mp4', 'title': 'Puntata del 29/05/2022', 'duration': 1589, 'upload_date': '20220529', 'uploader': 'rainews', } }, { # old content with fallback method to extract media urls 'url': 'https://www.rainews.it/dl/rainews/media/Wee...
@@ -735,3 +699,67 @@ def _real_extract(self, url): info.update(relinker_info) return info + + +class RaiNewsIE(RaiIE): + _VALID_URL = r'https?://(www\.)?rainews\.it/.+?-(?P<id>%s)(?:-.+?)?\.html' % RaiBaseIE._UUID_RE + _TESTS = [{ + # new rainews player (#3911) + 'url': 'https://...
yt_dlp/extractor/rai.py
26
Python
0.571
suggestion
97
51
51
false
[rai] Rainews fix #3911
4,380
yt-dlp/yt-dlp
132,642
Python
pukkandan
nixxo
'thumbnail': r're:^https?://.*\.png$', 'duration': 833, 'upload_date': '20161103' }, 'expected_warnings': ['unable to extract player_data'], }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url,...
```suggestion except ExtractorError as e: raise ExtractorError('Relinker URL not found', cause=e) ```
'info_dict': { 'id': '1632c009-c843-4836-bb65-80c33084a64b', 'ext': 'mp4', 'title': 'Weekend al cinema, da Hollywood arriva il thriller di Tate Taylor "La ragazza del treno"', 'description': 'I film in uscita questa settimana.', 'thumbnail': r're:^http...
@@ -735,3 +699,67 @@ def _real_extract(self, url): info.update(relinker_info) return info + + +class RaiNewsIE(RaiIE): + _VALID_URL = r'https?://(www\.)?rainews\.it/.+?-(?P<id>%s)(?:-.+?)?\.html' % RaiBaseIE._UUID_RE + _TESTS = [{ + # new rainews player (#3911) + 'url': 'https://...
yt_dlp/extractor/rai.py
26
Python
0.929
refactor
132
42
43
false
[rai] Rainews fix #3911
4,380
yt-dlp/yt-dlp
132,642
Python
pukkandan
nixxo
}, 'expected_warnings': ['unable to extract player_data'], }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) player_data = self._search_json( r'<rainews-player\s*data=\'', webpage, 'player_data',...
```suggestion relinker_info = self._extract_relinker_info(urljoin(url, relinker_url), video_id) ```
'title': 'Weekend al cinema, da Hollywood arriva il thriller di Tate Taylor "La ragazza del treno"', 'description': 'I film in uscita questa settimana.', 'thumbnail': r're:^https?://.*\.png$', 'duration': 833, 'upload_date': '20161103' }, 'expe...
@@ -735,3 +699,67 @@ def _real_extract(self, url): info.update(relinker_info) return info + + +class RaiNewsIE(RaiIE): + _VALID_URL = r'https?://(www\.)?rainews\.it/.+?-(?P<id>%s)(?:-.+?)?\.html' % RaiBaseIE._UUID_RE + _TESTS = [{ + # new rainews player (#3911) + 'url': 'https://...
yt_dlp/extractor/rai.py
26
Python
0.786
refactor
109
39
40
false
[rai] Rainews fix #3911
4,380
yt-dlp/yt-dlp
132,642
Python
pukkandan
nixxo
track_info = player_data.get('track_info') relinker_url = player_data.get('mediapolis') or player_data.get('content_url') or None if not relinker_url: # fallback on old implementation for some old content try: return self._extract_from_content_id(video_id...
```suggestion return { 'id': video_id, 'title': track_info.get('title') or self._og_search_title(webpage), 'upload_date': unified_strdate(track_info.get('date')), 'uploader': strip_or_none(track_info.get('editor') or None), **relinker_info ...
webpage = self._download_webpage(url, video_id) player_data = self._search_json( r'<rainews-player\s*data=\'', webpage, 'player_data', video_id, transform_source=clean_html, fatal=False) track_info = player_data.get('track_info') relinker_url = traverse_obj(playe...
@@ -735,3 +699,67 @@ def _real_extract(self, url): info.update(relinker_info) return info + + +class RaiNewsIE(RaiIE): + _VALID_URL = r'https?://(www\.)?rainews\.it/.+?-(?P<id>%s)(?:-.+?)?\.html' % RaiBaseIE._UUID_RE + _TESTS = [{ + # new rainews player (#3911) + 'url': 'https://...
yt_dlp/extractor/rai.py
26
Python
0.786
suggestion
329
27
28
false
[rai] Rainews fix #3911
4,380
yt-dlp/yt-dlp
132,642
Python
pukkandan
nixxo
) class PatreonBaseIE(InfoExtractor): # XXX: should user-supplied user agent should override request user-agents? USER_AGENT = 'Patreon/7.6.28' def _call_api(self, ep, item_id, query=None, headers=None, fatal=True, note=None): if headers is None: headers = {} if 'User-Agent' n...
You can de-indent this a level with an early raise
) class PatreonBaseIE(InfoExtractor): USER_AGENT = 'Patreon/7.6.28 (Android; Android 11; Scale/2.10)' def _call_api(self, ep, item_id, query=None, headers=None, fatal=True, note=None): if headers is None: headers = {} if 'User-Agent' not in headers: headers['User-Agent...
@@ -7,17 +8,44 @@ from ..utils import ( clean_html, determine_ext, + ExtractorError, int_or_none, KNOWN_EXTENSIONS, mimetype2ext, parse_iso8601, str_or_none, + traverse_obj, try_get, url_or_none, ) -class PatreonIE(InfoExtractor): +class PatreonBaseIE(InfoExtract...
yt_dlp/extractor/patreon.py
26
Python
0.214
suggestion
50
51
51
false
[extractor/patreon] Fix and improve extractors
4,398
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
try: return self._download_json( f'https://www.patreon.com/api/{ep}', item_id, note='Downloading API JSON' if not note else note, query=query, fatal=fatal, headers=headers) except ExtractorError as e: if isinstance(e.cause, HTTPErro...
Do make sure that the md5 changed because of actual change in site and not because the description extraction is now broken
try: return self._download_json( f'https://www.patreon.com/api/{ep}', item_id, note='Downloading API JSON' if not note else note, query=query, fatal=fatal, headers=headers) except ExtractorError as e: if not isinstance(e.cause, HTT...
@@ -26,12 +54,15 @@ class PatreonIE(InfoExtractor): 'id': '743933', 'ext': 'mp3', 'title': 'Episode 166: David Smalley of Dogma Debate', - 'description': 'md5:713b08b772cd6271b9f3906683cfacdf', + 'description': 'md5:34d207dd29aa90e24f1b3f58841b81c7',
yt_dlp/extractor/patreon.py
26
Python
0.429
bug
123
51
51
false
[extractor/patreon] Fix and improve extractors
4,398
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
# handle Vimeo embeds if try_get(attributes, lambda x: x['embed']['provider']) == 'Vimeo': embed_html = try_get(attributes, lambda x: x['embed']['html']) v_url = url_or_none(compat_urllib_parse_unquote( self._search_regex(r'(https(?:%3A%2F%2F|://)player\.vimeo\.co...
Maybe vimeo's _extract_url should be used?
} elif i_type == 'user': user_attributes = i.get('attributes') if user_attributes: info.update({ 'uploader': user_attributes.get('full_name'), 'uploader_id': str_or_none(i.get('id')), ...
@@ -147,60 +196,155 @@ def _real_extract(self, url): 'uploader_url': user_attributes.get('url'), }) - if not info.get('url'): - # handle Vimeo embeds - if try_get(attributes, lambda x: x['embed']['provider']) == 'Vimeo': - embed...
yt_dlp/extractor/patreon.py
26
Python
0.143
refactor
42
51
51
false
[extractor/patreon] Fix and improve extractors
4,398
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
if post_file: name = post_file.get('name') ext = determine_ext(name) if ext in KNOWN_EXTENSIONS: return { **info, 'ext': ext, 'url': post_file['url'], } elif name == 'video...
Is there any reason to think this will break?
if try_get(attributes, lambda x: x['embed']['provider']) == 'Vimeo': embed_html = try_get(attributes, lambda x: x['embed']['html']) v_url = url_or_none(compat_urllib_parse_unquote( self._search_regex(r'(https(?:%3A%2F%2F|://)player\.vimeo\.com.+app_id(?:=|%3D)+\d+)', embe...
@@ -147,60 +196,155 @@ def _real_extract(self, url): 'uploader_url': user_attributes.get('url'), }) - if not info.get('url'): - # handle Vimeo embeds - if try_get(attributes, lambda x: x['embed']['provider']) == 'Vimeo': - embed...
yt_dlp/extractor/patreon.py
26
Python
0.071
bug
45
51
51
false
[extractor/patreon] Fix and improve extractors
4,398
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
'only_matching': True }, { 'url': 'https://www.patreon.com/m/5932659', 'only_matching': True }] @classmethod def suitable(cls, url): return False if PatreonIE.suitable(url) else super(PatreonCampaignIE, cls).suitable(url) def _entries(self, campaign_id): cur...
Unrelated to this PR: since most overrides for `suitable` follows this pattern, should we have an internal mechanism for this?
'info_dict': { 'title': 'Not Just Bikes', 'channel_follower_count': int, 'id': '4767637', 'channel_id': '4767637', 'channel_url': 'https://www.patreon.com/notjustbikes', 'description': 'md5:595c6e7dca76ae615b1d38c298a287a1', 'ag...
@@ -147,60 +196,155 @@ def _real_extract(self, url): 'uploader_url': user_attributes.get('url'), }) - if not info.get('url'): - # handle Vimeo embeds - if try_get(attributes, lambda x: x['embed']['provider']) == 'Vimeo': - embed...
yt_dlp/extractor/patreon.py
26
Python
0.571
question
126
51
51
false
[extractor/patreon] Fix and improve extractors
4,398
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
params = { 'fields[campaign]': 'show_audio_post_download_links,name,url', 'fields[post]': 'current_user_can_view,embed,image,is_paid,post_file,published_at,patreon_url,url,post_type,thumbnail_url,title', 'filter[campaign_id]': campaign_id, 'filter[is_draft]': 'fal...
use `.group(a, b)` for clarity
'thumbnail': r're:^https?://.*$', }, 'playlist_mincount': 71 }, { 'url': 'https://www.patreon.com/dissonancepod/posts', 'only_matching': True }, { 'url': 'https://www.patreon.com/m/5932659', 'only_matching': True }] @classmethod def suitab...
@@ -227,7 +371,36 @@ def _entries(self, campaign_id, user_id): def _real_extract(self, url): - user_id = self._match_id(url) - webpage = self._download_webpage(url, user_id, headers={'Cookie': '.'}) - campaign_id = self._search_regex(r'https://www.patreon.com/api/campaigns/(\d+)/?', webpag...
yt_dlp/extractor/patreon.py
26
Python
0.286
suggestion
30
51
51
false
[extractor/patreon] Fix and improve extractors
4,398
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
import itertools from urllib.error import HTTPError from .common import InfoExtractor from .vimeo import VimeoIE from ..compat import compat_urllib_parse_unquote from ..utils import ( clean_html, determine_ext, ExtractorError, int_or_none, KNOWN_EXTENSIONS, mimetype2ext, parse_iso8601, ...
The urls are same but id/name is different b/w uploader and channel?
'fields[campaign]': 'name,summary,url,patron_count,creation_count,is_nsfw,avatar_photo_url', 'include': 'creator' } campaign_response = self._call_api( f'campaigns/{campaign_id}', campaign_id, note='Downloading campaign info', fatal=False, que...
@@ -227,7 +371,36 @@ def _entries(self, campaign_id, user_id): def _real_extract(self, url): - user_id = self._match_id(url) - webpage = self._download_webpage(url, user_id, headers={'Cookie': '.'}) - campaign_id = self._search_regex(r'https://www.patreon.com/api/campaigns/(\d+)/?', webpag...
yt_dlp/extractor/patreon.py
26
Python
0.214
question
68
407
33
false
[extractor/patreon] Fix and improve extractors
4,398
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
self._sort_formats(formats) return { 'id': internal_id, 'title': '%s Episode %s – %s' % ( episode_response.get('season_title'), episode_response.get('episode'), episode_response.get('title')), 'description': try_get(episode_response, lambda x: x['desc...
```suggestion lang: [{ 'url': subtitle_data.get('url'), 'ext': subtitle_data.get('format') }] for lang, subtitle_data in get_streams('subtitles') ```
self._sort_formats(formats) return { 'id': internal_id, 'title': '%s Episode %s – %s' % ( episode_response.get('season_title'), episode_response.get('episode'), episode_response.get('title')), 'description': try_get(episode_response, lambda x: x['desc...
@@ -872,19 +852,29 @@ def _real_extract(self, url): return { 'id': internal_id, - 'title': '%s Episode %s – %s' % (episode_response.get('season_title'), episode_response.get('episode'), episode_response.get('title')), - 'description': episode_response.get('description').rep...
yt_dlp/extractor/crunchyroll.py
26
Python
0.786
suggestion
226
51
51
false
Crunchyroll missing thumbnail fix
4,405
yt-dlp/yt-dlp
132,642
Python
pukkandan
Burve
HistoryTopicIE, HistoryPlayerIE, BiographyIE, ) from .afreecatv import ( AfreecaTVIE, AfreecaTVLiveIE, AfreecaTVUserIE, ) from .airmozilla import AirMozillaIE from .aljazeera import AlJazeeraIE from .alphaporno import AlphaPornoIE from .amara import AmaraIE from .alura import ( AluraIE, ...
```suggestion from .angel import AngelIE ```
HistoryTopicIE, HistoryPlayerIE, BiographyIE, ) from .afreecatv import ( AfreecaTVIE, AfreecaTVLiveIE, AfreecaTVUserIE, ) from .airmozilla import AirMozillaIE from .aljazeera import AlJazeeraIE from .alphaporno import AlphaPornoIE from .amara import AmaraIE from .alura import ( AluraIE, ...
@@ -60,6 +60,9 @@ AmericasTestKitchenIE, AmericasTestKitchenSeasonIE, ) +from .angel import ( + AngelIE +)
yt_dlp/extractor/_extractors.py
26
Python
0.429
suggestion
46
51
51
false
[angel] Add extractor
4,410
yt-dlp/yt-dlp
132,642
Python
pukkandan
Juhmer-Tena
from yt_dlp.utils import url_or_none from .common import InfoExtractor import re class AngelIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[a-zA-Z\-]+)/episode/(?P<id>[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12})/season-(?P<season_number>[0-9]+)/episode-(?P<episode_number>[0-9]+)/(?...
```suggestion import re from .common import InfoExtractor from ..utils import url_or_none ```
import re from .common import InfoExtractor from ..utils import url_or_none, merge_dicts class AngelIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[^/?#]+)/episode/(?P<id>[\w-]+)/season-(?P<season_number>\d+)/episode-(?P<episode_number>\d+)/(?P<title>[^/?#]+)' _TESTS = [{ ...
@@ -0,0 +1,50 @@ +from yt_dlp.utils import url_or_none +from .common import InfoExtractor +import re
yt_dlp/extractor/angel.py
3
Python
0.643
refactor
99
28
28
false
[angel] Add extractor
4,410
yt-dlp/yt-dlp
132,642
Python
pukkandan
Juhmer-Tena
from yt_dlp.utils import url_or_none from .common import InfoExtractor import re class AngelIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[a-zA-Z\-]+)/episode/(?P<id>[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12})/season-(?P<season_number>[0-9]+)/episode-(?P<episode_number>[0-9]+)/(?...
Can be simplified to ```suggestion _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[^/?#]+)/episode/(?P<id>[\w-]+)/season-(?P<season_number>[0-9]+)/episode-(?P<episode_number>[0-9]+)/(?P<title>[^/?#]+)' ```
import re from .common import InfoExtractor from ..utils import url_or_none, merge_dicts class AngelIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[^/?#]+)/episode/(?P<id>[\w-]+)/season-(?P<season_number>\d+)/episode-(?P<episode_number>\d+)/(?P<title>[^/?#]+)' _TESTS = [{ ...
@@ -0,0 +1,50 @@ +from yt_dlp.utils import url_or_none +from .common import InfoExtractor +import re + + +class AngelIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[a-zA-Z\-]+)/episode/(?P<id>[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12})/season-(?P<season_number>[0-9]+)/episode-(?P<e...
yt_dlp/extractor/angel.py
7
Python
0.786
suggestion
227
32
32
false
[angel] Add extractor
4,410
yt-dlp/yt-dlp
132,642
Python
pukkandan
Juhmer-Tena
'description': 'Two brothers struggle with their tax debts to Rome while a woman in the Red Quarter wrestles with her demons.', 'thumbnail': r're:^https?://images.angelstudios.com/.*\.jpeg$' } }] def _real_extract(self, url): video_id = self._match_id(url) webpag...
Don't cherrypick from json_ld ```suggestion json_ld = self._search_json_ld(webpage, video_id) formats, subtitles = self._extract_m3u8_formats_and_subtitles( json_ld.pop('url'), video_id, note='Downloading HD m3u8 information') return merge_info(json_ld, { 'id': ...
'ext': 'mp4', 'title': 'The Chosen Season 1, Episode 1: I Have Called You By Name', 'description': 'md5:aadfb4827a94415de5ff6426e6dee3be', 'thumbnail': r're:^https?://images.angelstudios.com/image/upload/angel-app/.*$', 'duration': 3276.0 } }] ...
@@ -0,0 +1,50 @@ +from yt_dlp.utils import url_or_none +from .common import InfoExtractor +import re + + +class AngelIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[a-zA-Z\-]+)/episode/(?P<id>[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12})/season-(?P<season_number>[0-9]+)/episode-(?P<e...
yt_dlp/extractor/angel.py
26
Python
0.857
refactor
834
27
33
false
[angel] Add extractor
4,410
yt-dlp/yt-dlp
132,642
Python
pukkandan
Juhmer-Tena
'id': '8dfb714d-bca5-4812-8125-24fb9514cd10', 'ext': 'mp4', 'title': 'The Chosen S1 E1: I Have Called You By Name', 'description': 'Two brothers struggle with their tax debts to Rome while a woman in the Red Quarter wrestles with her demons.', 'thumbnail': r'r...
```suggestion } for item in json_ld.get('thumbnails') or [] if url_or_none(item.get('url'))], ``` Also, is the if condition needed
'md5': 'e4774bad0a5f0ad2e90d175cafdb797d', 'info_dict': { 'id': '8dfb714d-bca5-4812-8125-24fb9514cd10', 'ext': 'mp4', 'title': 'The Chosen Season 1, Episode 1: I Have Called You By Name', 'description': 'md5:aadfb4827a94415de5ff6426e6dee3be', '...
@@ -0,0 +1,50 @@ +from yt_dlp.utils import url_or_none +from .common import InfoExtractor +import re + + +class AngelIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[a-zA-Z\-]+)/episode/(?P<id>[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12})/season-(?P<season_number>[0-9]+)/episode-(?P<e...
yt_dlp/extractor/angel.py
26
Python
0.714
suggestion
145
30
36
false
[angel] Add extractor
4,410
yt-dlp/yt-dlp
132,642
Python
pukkandan
Juhmer-Tena
'info_dict': { 'id': '8dfb714d-bca5-4812-8125-24fb9514cd10', 'ext': 'mp4', 'title': 'The Chosen S1 E1: I Have Called You By Name', 'description': 'Two brothers struggle with their tax debts to Rome while a woman in the Red Quarter wrestles with her demons.', ...
```suggestion 'url': re.sub(r'(/upload)/.+(/angel-app/.+)', r'\1\2.jpeg', item['url']) ```
'url': 'https://www.angel.com/watch/the-chosen/episode/8dfb714d-bca5-4812-8125-24fb9514cd10/season-1/episode-1/i-have-called-you-by-name', 'md5': 'e4774bad0a5f0ad2e90d175cafdb797d', 'info_dict': { 'id': '8dfb714d-bca5-4812-8125-24fb9514cd10', 'ext': 'mp4', 'ti...
@@ -0,0 +1,50 @@ +from yt_dlp.utils import url_or_none +from .common import InfoExtractor +import re + + +class AngelIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?angel\.com/watch/(?P<series>[a-zA-Z\-]+)/episode/(?P<id>[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12})/season-(?P<season_number>[0-9]+)/episode-(?P<e...
yt_dlp/extractor/angel.py
26
Python
0.714
suggestion
108
31
37
false
[angel] Add extractor
4,410
yt-dlp/yt-dlp
132,642
Python
pukkandan
Juhmer-Tena
}, }, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Чере...
No need, the underlying network handling when using `_download_webpage` etc. will handle cookies for you. Pretty sure this is redundant anyways. We will get these cookies from the webpage download below. So you should be able to move this access token download to after that and it should work. ```py def _real_...
}, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортат...
@@ -1,49 +1,62 @@ from .common import InfoExtractor -from ..utils import int_or_none, parse_duration, parse_iso8601 +import urllib.request +from ..utils import int_or_none, parse_duration, parse_iso8601, sanitized_Request class NovaPlayIE(InfoExtractor): _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\...
yt_dlp/extractor/novaplay.py
26
Python
1
refactor
585
51
49
false
[extractor/NovaPlay] Fix extractor and update tests
4,415
yt-dlp/yt-dlp
132,642
Python
coletdjnz
Bojidarist
'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортата - тази вечер по NOVA (22.07.2022)', 'alt_title': 'ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi', ...
```suggestion video_id, headers={ 'x-flipps-user-agent': 'Flipps/75/9.7', 'x-flipps-version': '2022-05-17', 'Authorization': f'Bearer {access_token}' })[0]['links']['play']['href'] ```
'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортата - тази вечер по NOVA (22.07.2022)', 'alt_title': 'ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi', ...
@@ -6,44 +6,49 @@ class NovaPlayIE(InfoExtractor): _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)' _TESTS = [ { - 'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677', - 'md5': 'b1127a84e61bed1632b7c2ca9cbb4153', + 'url': 'https://pla...
yt_dlp/extractor/novaplay.py
26
Python
0.857
security
262
41
46
false
[extractor/NovaPlay] Fix extractor and update tests
4,415
yt-dlp/yt-dlp
132,642
Python
pukkandan
Bojidarist
'upload_date': '20220722', 'thumbnail': 'https://nbg-img.fite.tv/img/606627_460x260.jpg', 'description': '29 сек', 'view_count': False }, }, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07...
```suggestion _access_token = None ```
'upload_date': '20220722', 'thumbnail': 'https://nbg-img.fite.tv/img/606627_460x260.jpg', 'description': '29 сек', 'view_count': False }, }, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07...
@@ -6,44 +6,55 @@ class NovaPlayIE(InfoExtractor): _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)' _TESTS = [ { - 'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677', - 'md5': 'b1127a84e61bed1632b7c2ca9cbb4153', + 'url': 'https://pla...
yt_dlp/extractor/novaplay.py
26
Python
0.429
suggestion
44
51
51
false
[extractor/NovaPlay] Fix extractor and update tests
4,415
yt-dlp/yt-dlp
132,642
Python
pukkandan
Bojidarist
}, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортат...
```suggestion self._access_token = self._download_json( 'https://play.nova.bg/api/client', None, note='Fetching access token')['accessToken'] ```
}, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортат...
@@ -6,44 +6,54 @@ class NovaPlayIE(InfoExtractor): _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)' _TESTS = [ { - 'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677', - 'md5': 'b1127a84e61bed1632b7c2ca9cbb4153', + 'url': 'https://pla...
yt_dlp/extractor/novaplay.py
26
Python
0.714
suggestion
176
49
49
false
[extractor/NovaPlay] Fix extractor and update tests
4,415
yt-dlp/yt-dlp
132,642
Python
pukkandan
Bojidarist
{ 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортата - тази ве...
```suggestion elf._access_token = self._access_token or self._download_json( 'https://play.nova.bg/api/client', None, note='Fetching access token')['accessToken'] ```
{ 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортата - тази ве...
@@ -6,44 +6,55 @@ class NovaPlayIE(InfoExtractor): _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)' _TESTS = [ { - 'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677', - 'md5': 'b1127a84e61bed1632b7c2ca9cbb4153', + 'url': 'https://pla...
yt_dlp/extractor/novaplay.py
26
Python
0.714
suggestion
193
49
48
false
[extractor/NovaPlay] Fix extractor and update tests
4,415
yt-dlp/yt-dlp
132,642
Python
pukkandan
Bojidarist
}, }, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Чере...
```suggestion self._access_token = self._access_token or self._download_json( ```
}, }, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Чере...
@@ -6,44 +6,54 @@ class NovaPlayIE(InfoExtractor): _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)' _TESTS = [ { - 'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677', - 'md5': 'b1127a84e61bed1632b7c2ca9cbb4153', + 'url': 'https://pla...
yt_dlp/extractor/novaplay.py
26
Python
0.571
suggestion
91
50
50
false
[extractor/NovaPlay] Fix extractor and update tests
4,415
yt-dlp/yt-dlp
132,642
Python
pukkandan
Bojidarist
}, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортат...
```suggestion self._access_token = self._access_token or self._download_json( 'https://play.nova.bg/api/client', None, note='Fetching access token')['accessToken'] ```
}, { 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609', 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3', 'info_dict': { 'id': '606609', 'ext': 'mp4', 'title': 'Черешката на тортат...
@@ -6,44 +6,54 @@ class NovaPlayIE(InfoExtractor): _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)' _TESTS = [ { - 'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677', - 'md5': 'b1127a84e61bed1632b7c2ca9cbb4153', + 'url': 'https://pla...
yt_dlp/extractor/novaplay.py
26
Python
0.714
suggestion
190
49
49
false
[extractor/NovaPlay] Fix extractor and update tests
4,415
yt-dlp/yt-dlp
132,642
Python
pukkandan
Bojidarist
'thumbnail': 'https://i.ytimg.com/vi_webp/9kQ2GtvDV3s/maxresdefault.webp', 'duration': 263, 'like_count': int, }, }, ] def _real_extract(self, url): video_id = self._match_id(url) video_url = f'https://www.youtube.com/watch?v={video_id}' retur...
`apiurl` can defined directly in data
'channel_follower_count': int, 'uploader_id': 'UCJFZiqLMntJufDCHc6bQixg', 'availability': 'public', 'thumbnail': 'https://i.ytimg.com/vi_webp/9kQ2GtvDV3s/maxresdefault.webp', 'duration': 263, 'like_count': int, }, }, { 'url': 'h...
@@ -0,0 +1,64 @@ +from .common import InfoExtractor +from .youtube import YoutubeIE + + +class HolodexIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.|staging\.)?holodex\.net/watch/(?P<id>\w+)' + _TESTS = [{ + # Youtube + 'url': 'https://holodex.net/watch/9kQ2GtvDV3s', + 'md5': 'be5ffce2...
yt_dlp/extractor/holodex.py
26
Python
0.214
suggestion
38
35
51
false
Add support for holodex
4,434
yt-dlp/yt-dlp
132,642
Python
HobbyistDev
sqrtNOT
'channel': 'hololive ホロライブ - VTuber Group', 'categories': ['Music'], 'uploader': 'hololive ホロライブ - VTuber Group', 'channel_follower_count': int, 'uploader_id': 'UCJFZiqLMntJufDCHc6bQixg', 'availability': 'public', 'thumbnail': 'https://...
Add a test for the other URL pattern. Also add one test (either video/playlist) for `staging.` only_matching tests are fine for these
'upload_date': '20200406', 'uploader_url': 'http://www.youtube.com/channel/UCJFZiqLMntJufDCHc6bQixg', 'view_count': int, 'channel': 'hololive ホロライブ - VTuber Group', 'categories': ['Music'], 'uploader': 'hololive ホロライブ - VTuber Group', '...
@@ -0,0 +1,56 @@ +from .common import InfoExtractor +from .youtube import YoutubeIE +from ..utils import traverse_obj + + +class HolodexIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.|staging\.)?holodex\.net/watch/(?P<id>\w+)' + _TESTS = [{ + 'url': 'https://holodex.net/watch/9kQ2GtvDV3s', + '...
yt_dlp/extractor/holodex.py
26
Python
0.5
suggestion
136
33
51
false
Add support for holodex
4,434
yt-dlp/yt-dlp
132,642
Python
pukkandan
sqrtNOT
from .common import InfoExtractor from .youtube import YoutubeIE from ..utils import traverse_obj class HolodexIE(InfoExtractor): _VALID_URL = r'^(?!.*?playlist)https?://(?:www\.|staging\.)?holodex\.net/watch/(?P<id>\w+)' _TESTS = [{ 'url': 'https://holodex.net/watch/9kQ2GtvDV3s', 'md5': 'be5f...
```suggestion _VALID_URL = r'https?://(?:www\.|staging\.)?holodex\.net/watch/(?P<id>\w+)(?!\?playlist=)' ``` Isn't this better?
from .common import InfoExtractor from .youtube import YoutubeIE from ..utils import traverse_obj class HolodexIE(InfoExtractor): _VALID_URL = r'''(?x)https?://(?:www\.|staging\.)?holodex\.net/(?: api/v2/playlist/(?P<playlist>\d+)| watch/(?P<id>\w+)(?:\?(?:[^#]+&)?playlist=(?P<playlist2>\d...
@@ -4,7 +4,7 @@ class HolodexIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.|staging\.)?holodex\.net/watch/(?P<id>\w+)' + _VALID_URL = r'^(?!.*?playlist)https?://(?:www\.|staging\.)?holodex\.net/watch/(?P<id>\w+)'
yt_dlp/extractor/holodex.py
7
Python
0.786
question
134
32
32
false
Add support for holodex
4,434
yt-dlp/yt-dlp
132,642
Python
pukkandan
sqrtNOT
duration = int_or_none(moment.get('durationMilliseconds'), 1000) name = str_or_none(moment.get('description')) if start_time is None or duration is None: self.report_warning(f'Important chapter information missing for chapter {name}', item_id) continu...
1. Moments+chapters should be a single function 2. Due to some core improvements, the endtime calculation is now unnecessary 3. The comments are not needed ```py def _extract_chapters(self, info, item_id): if not info.get('moments'): game = traverse_obj(info, ('game', 'displayName')) ...
return for moment in info['moments']: start_time = int_or_none(moment.get('positionMilliseconds'), 1000) duration = int_or_none(moment.get('durationMilliseconds'), 1000) name = str_or_none(moment.get('description')) if start_time is None or duration ...
@@ -407,6 +442,20 @@ def _extract_moments(self, info, item_id): 'title': name, } + # Logical chapters + # if category didn't change, the only chapter is the category, spanning the whole stream + def _extract_chapters(self, info, item_id): + chapters = list(self._extract...
yt_dlp/extractor/twitch.py
26
Python
0.857
refactor
477
51
51
false
Extend chapter extraction for single chapter VODs
4,453
yt-dlp/yt-dlp
132,642
Python
pukkandan
mpeter50
thumbnails.append({ 'url': thumbnail_url, 'preference': quality_key(thumbnail_id), }) return { 'id': info['_id'], 'title': info.get('title') or 'Untitled Broadcast', 'description': info.get('description')...
```suggestion for moment in info['moments']: ``` since the other cases are already handled
thumbnails.append({ 'url': thumbnail_url, 'preference': quality_key(thumbnail_id), }) return { 'id': info['_id'], 'title': info.get('title') or 'Untitled Broadcast', 'description': info.get('description')...
@@ -392,7 +425,13 @@ def _extract_info(self, info): 'was_live': True, } - def _extract_moments(self, info, item_id): + def _extract_chapters(self, info, item_id): + if not info.get('moments'): + game = traverse_obj(info, ('game', 'displayName')) + if game: + ...
yt_dlp/extractor/twitch.py
26
Python
0.857
suggestion
101
51
51
false
Extend chapter extraction for single chapter VODs
4,453
yt-dlp/yt-dlp
132,642
Python
pukkandan
mpeter50
'info_dict': { 'id': '4759', 'title': '아이키의 떰즈업', }, 'playlist_mincount': 101, }, { 'url': 'https://now.naver.com/s/now.4759?shareHightlight=26601461#highlight=', 'info_dict': { 'id': '4759', 'title': '아이키의 떰즈업', }, ...
```suggestion page_size = 15 ``` I can see it is being set to a constant...
'info_dict': { 'id': '4759', 'title': '아이키의 떰즈업', }, 'playlist_mincount': 101, }, { 'url': 'https://now.naver.com/s/now.4759?shareHightlight=26601461#highlight=', 'info_dict': { 'id': '4759', 'title': '아이키의 떰즈업', }, ...
@@ -326,39 +328,41 @@ def _extract_replay(self, show_id, replay_id): }, self._extract_video_info(replay_id, vod_info['video_id'], in_key)) def _extract_show_replays(self, show_id): - page = 0 + page_size = 15 # page_size is now a fixed unchangeable value
yt_dlp/extractor/naver.py
26
Python
0.571
suggestion
86
51
51
false
[extractor/NaverNow] Fix for site/endpoint changes
4,457
yt-dlp/yt-dlp
132,642
Python
pukkandan
ping
in_key = self._download_json(f'{self._API_URL}/shows/now.{show_id}/vod/{replay_id}/inkey', replay_id)['inKey'] return merge_dicts({ 'id': f'{show_id}-{replay_id}', 'title': traverse_obj(vod_info, ('episode', 'title')), 'timestamp': unified_timestamp(traverse_obj(vod_i...
```suggestion page_size = 10 ```
in_key = self._download_json(f'{self._API_URL}/shows/now.{show_id}/vod/{replay_id}/inkey', replay_id)['inKey'] return merge_dicts({ 'id': f'{show_id}-{replay_id}', 'title': traverse_obj(vod_info, ('episode', 'title')), 'timestamp': unified_timestamp(traverse_obj(vod_i...
@@ -326,39 +328,41 @@ def _extract_replay(self, show_id, replay_id): }, self._extract_video_info(replay_id, vod_info['video_id'], in_key)) def _extract_show_replays(self, show_id): - page = 0 + page_size = 15 # page_size is now a fixed unchangeable value + page = 1 while T...
yt_dlp/extractor/naver.py
26
Python
0.429
suggestion
42
51
51
false
[extractor/NaverNow] Fix for site/endpoint changes
4,457
yt-dlp/yt-dlp
132,642
Python
pukkandan
ping
continue if f.get('format') == 'Thumbnail': entry['thumbnails'].append({ 'id': f['name'], 'url': 'https://archive.org/download/' + identifier + '/' + f['name'], 'width': int_or_none(f.get('width')), ...
```suggestion 'format_note': f.get('source') }) ```
'filesize': int_or_none(f.get('size'))}) extension = (f['name'].rsplit('.', 1) + [None])[1] # We don't want to skip private formats if the user has access to them, # however without access to an account with such privileges we can't implement/test this. ...
@@ -216,17 +301,24 @@ def _real_extract(self, url): 'filesize': int_or_none(f.get('size'))}) extension = (f['name'].rsplit('.', 1) + [None])[1] - if extension in KNOWN_EXTENSIONS: + + # We don't want to skip private formats if the user has access to them, + ...
yt_dlp/extractor/archiveorg.py
26
Python
0.571
suggestion
90
51
51
false
[extractor/archiveorg] Fix handling of formats
4,461
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
url_or_none, urlhandle_detect_ext, ) class ArchiveOrgIE(InfoExtractor): IE_NAME = 'archive.org' IE_DESC = 'archive.org video and audio' _VALID_URL = r'https?://(?:www\.)?archive\.org/(?:details|embed)/(?P<id>[^?#]+)(?:[?].*)?$' _TESTS = [{ 'url': 'http://archive.org/details/XD300-23_68...
Not strictly related to this PR. But I don't think track makes sense for a lot of these tests. If you agree, remove it from tests. Having broken tests is better than wrong tests
url_or_none, urlhandle_detect_ext, ) class ArchiveOrgIE(InfoExtractor): IE_NAME = 'archive.org' IE_DESC = 'archive.org video and audio' _VALID_URL = r'https?://(?:www\.)?archive\.org/(?:details|embed)/(?P<id>[^?#]+)(?:[?].*)?$' _TESTS = [{ 'url': 'http://archive.org/details/XD300-23_68...
@@ -49,6 +49,11 @@ class ArchiveOrgIE(InfoExtractor): 'upload_date': '20100315', 'creator': 'SRI International', 'uploader': 'laura@archive.org', + 'thumbnail': r're:https://archive\.org/download/.*\.jpg', + 'release_year': 1968, + 'display_id': 'X...
yt_dlp/extractor/archiveorg.py
26
Python
0.429
bug
177
51
51
false
[extractor/archiveorg] Fix handling of formats
4,461
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
'ext': 'm4s', 'uploader': '骨头゛', 'uploader_id': '165511', 'timestamp': 1583222426, 'title': '大学路上的绊脚石', 'upload_date': '20200303', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$', 'duration': 12.167, 'cid': '157...
Why are we updating this? As far as I know this works fine 🤔
if json.get('message') and str(json['code']) != json['message']: errmsg = f'{kwargs.get("errnote", "Unable to download JSON metadata")}: {self.IE_NAME} said: {json["message"]}' else: errmsg = kwargs.get('errnote', 'Unable to download JSON metadata'...
@@ -754,14 +862,34 @@ class BiliBiliPlayerIE(InfoExtractor): _VALID_URL = r'https?://player\.bilibili\.com/player\.html\?.*?\baid=(?P<id>\d+)' _TEST = { 'url': 'http://player.bilibili.com/player.html?aid=92494333&cid=157926707&page=1', - 'only_matching': True, + 'info_dict': { + ...
yt_dlp/extractor/bilibili.py
26
Python
0.214
question
61
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
'page_count': page_data['pageCount'], 'page_size': page_data['pageSize'], 'entry_count': page_data['totalSize'], 'title': None } def _get_entries(self, page_data, **kwargs): for entry in page_data.get('data', []): yield self.url_result(f'h...
```python mid, sid = self._match_valid_url(url).group('mid', 'sid') ```
'info_dict': { 'id': '2142762_57445', 'title': '《底特律 变人》' }, 'playlist_mincount': 31, }] def _real_extract(self, url): mid, sid = self._match_valid_url(url).group('mid', 'sid') playlist_id = f'{mid}_{sid}' def fetch_page(page_idx): ...
@@ -502,39 +503,146 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.571
suggestion
73
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
'_type': 'url_transparent', 'url': smuggle_url(episode['webplay_url'], {'no_bangumi_tip': 1}), 'ie_key': BiliBiliIE.ie_key(), 'timestamp': parse_iso8601(episode.get('update_time'), delimiter=' '), 'episode': episode.get('index_title'), 'episode_num...
If it's a Base extractor you shouldn't have _real_extract, you can rename it to _extract_playlist and later call it Also, usually you pre-declare the functions that you use, so that _real_extract is at the bottom
'_type': 'url_transparent', 'url': smuggle_url(episode['webplay_url'], {'no_bangumi_tip': 1}), 'ie_key': BiliBiliIE.ie_key(), 'timestamp': parse_iso8601(episode.get('update_time'), delimiter=' '), 'episode': episode.get('index_title'), 'episode_num...
@@ -502,39 +503,146 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.5
refactor
216
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
self.page_idx_start = 1 def _real_extract(self, url): playlist_id = self._match_id(url) metadata, pagedlist = self._extract_internal(playlist_id) return self.playlist_result(pagedlist, playlist_id, metadata['title']) def _extract_internal(self, playlist_id, **kwargs): ...
I would merge _fetch_page and _get_metadata into one, but this is about the order i was talking about ```python def _fetch_page(): .... def _get_metadata(): .... def _get_entries(): .... def _extract_internal(): .... ```
metadata = get_metadata(first_page) paged_list = InAdvancePagedList( lambda idx: get_entries(fetch_page(idx) if idx > 1 else first_page), metadata['page_count'], metadata['page_size']) return metadata, paged_list class BilibiliSpaceVideoIE(BilibiliSpaceBaseIE): _V...
@@ -502,39 +503,146 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.857
refactor
258
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
'page_size': page_data['pageSize'], 'entry_count': page_data['totalSize'], 'title': None } def _get_entries(self, page_data, **kwargs): for entry in page_data.get('data', []): yield self.url_result(f'https://www.bilibili.com/audio/au{entry["id"]}', ...
```python video_id = f'{mid}_{sid}' ```
'id': '2142762_57445', 'title': '《底特律 变人》' }, 'playlist_mincount': 31, }] def _real_extract(self, url): mid, sid = self._match_valid_url(url).group('mid', 'sid') playlist_id = f'{mid}_{sid}' def fetch_page(page_idx): return self._down...
@@ -502,39 +503,146 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.429
suggestion
41
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
# Sometimes this API returns a JSONP response season_info = self._download_json( 'http://bangumi.bilibili.com/jsonp/seasoninfo/%s.ver' % bangumi_id, bangumi_id, transform_source=strip_jsonp)['result'] entries = [{ '_type': 'url_transparent', 'url...
I think you can use ```python def _real_initialize(self): ```
# Sometimes this API returns a JSONP response season_info = self._download_json( 'http://bangumi.bilibili.com/jsonp/seasoninfo/%s.ver' % bangumi_id, bangumi_id, transform_source=strip_jsonp)['result'] entries = [{ '_type': 'url_transparent', 'url...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.643
suggestion
67
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
playlist_id, note=f'Downloading page {page_idx}', query={'mid': mid, 'season_id': sid, 'page_num': page_idx, 'page_size': 30} )['data'] def _get_metadata(self, page_data, **kwargs): page_size = page_dat...
```suggestion mid, sid = self._match_valid_url(url).group('mid', 'sid') video_id = f'{mid}_{sid}' metadata, paged_list = self._extract_internal(video_id, mid=mid, sid=sid) return self.playlist_result(paged_list, video_id, metadata['title']) ```
BiliBiliIE, entry['bvid']) metadata, paged_list = self._extract_playlist(fetch_page, get_metadata, get_entries) return self.playlist_result(paged_list, playlist_id, metadata['title']) class BilibiliCategoryIE(InfoExtractor): IE_NAME = 'Bilibili category extra...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.857
refactor
283
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
entries = [{ '_type': 'url_transparent', 'url': smuggle_url(episode['webplay_url'], {'no_bangumi_tip': 1}), 'ie_key': BiliBiliIE.ie_key(), 'timestamp': parse_iso8601(episode.get('update_time'), delimiter=' '), 'episode': episode.get('index_title'), ...
You can remove `**kwargs` from all `_get_metadata` functions
entries = [{ '_type': 'url_transparent', 'url': smuggle_url(episode['webplay_url'], {'no_bangumi_tip': 1}), 'ie_key': BiliBiliIE.ie_key(), 'timestamp': parse_iso8601(episode.get('update_time'), delimiter=' '), 'episode': episode.get('index_title'), ...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.429
suggestion
60
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
lambda idx: self._get_entries(self._fetch_page(playlist_id, idx, **kwargs) if idx else first_page, **kwargs), metadata['page_count'], metadata['page_size']) return metadata, pagedlist def _extract_playlist(self, url): playlist_id = self._match_id(url) metadata, page...
```suggestion return self._download_json( 'https://api.bilibili.com/x/space/arc/search', playlist_id, note=f'Downloading page {page_idx}', query={'mid': playlist_id, 'pn': page_idx, 'jsonp': 'jsonp'})['data'] ```
'playlist_mincount': 178, }] def _real_extract(self, url): playlist_id, is_video_url = self._match_valid_url(url).group('id', 'video') if not is_video_url: self.to_screen('A channel URL was given. Only the channel\'s videos will be downloaded. ' 'T...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
248
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
yield self.url_result(f'https://www.bilibili.com/video/{entry["bvid"]}', BiliBiliIE.ie_key(), entry['bvid']) def _real_extract(self, url): mobj = self._match_valid_url(url) if not mobj.group('video'): self.to_screen(f'{url} may have multiple...
```suggestion return self._download_json( 'https://api.bilibili.com/audio/music-service/web/song/upper', playlist_id, note=f'Downloading page {page_idx}', query={'uid': playlist_id, 'pn': page_idx, 'ps': 30, 'order': 1, 'jsonp': 'jsonp'})['data'] ```
}] def _real_extract(self, url): playlist_id = self._match_id(url) def fetch_page(page_idx): return self._download_json( 'https://api.bilibili.com/audio/music-service/web/song/upper', playlist_id, note=f'Downloading page {page_idx}', ...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
299
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
def _get_entries(self, page_data, **kwargs): for entry in page_data.get('data', []): yield self.url_result(f'https://www.bilibili.com/audio/au{entry["id"]}', BilibiliAudioIE.ie_key(), entry['id']) def _real_extract(self, url): return self._extract_p...
```suggestion return self._download_json( 'https://api.bilibili.com/x/polymer/space/seasons_archives_list', playlist_id, note=f'Downloading page {page_idx}', query={'mid': mid, 'season_id': sid, 'page_num': page_idx, 'page_size': 30})['data'] ```
def _real_extract(self, url): mid, sid = self._match_valid_url(url).group('mid', 'sid') playlist_id = f'{mid}_{sid}' def fetch_page(page_idx): return self._download_json( 'https://api.bilibili.com/x/polymer/space/seasons_archives_list', playlist_...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
295
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
self.page_idx_start = 1 def _fetch_page(self, playlist_id, page_idx, **kwargs): raise NotImplementedError('This method must be implemented by subclasses') def _get_metadata(self, page_data, **kwargs): raise NotImplementedError('This method must be implemented by subclasses') def _...
```suggestion playlist_id = self._match_id(url) metadata, paged_list = self._extract_internal(playlist_id) return self.playlist_result(paged_list, playlist_id, metadata['title']) ```
metadata = get_metadata(first_page) paged_list = InAdvancePagedList( lambda idx: get_entries(fetch_page(idx) if idx > 1 else first_page), metadata['page_count'], metadata['page_size']) return metadata, paged_list class BilibiliSpaceVideoIE(BilibiliSpaceBaseIE): _V...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.857
refactor
212
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
'http://bangumi.bilibili.com/jsonp/seasoninfo/%s.ver' % bangumi_id, bangumi_id, transform_source=strip_jsonp)['result'] entries = [{ '_type': 'url_transparent', 'url': smuggle_url(episode['webplay_url'], {'no_bangumi_tip': 1}), 'ie_key': BiliBiliIE.ie...
I think you can take the query as an argument and avoid using **kwargs
'http://bangumi.bilibili.com/jsonp/seasoninfo/%s.ver' % bangumi_id, bangumi_id, transform_source=strip_jsonp)['result'] entries = [{ '_type': 'url_transparent', 'url': smuggle_url(episode['webplay_url'], {'no_bangumi_tip': 1}), 'ie_key': BiliBiliIE.ie...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.286
suggestion
70
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
'ie_key': BiliBiliIE.ie_key(), 'timestamp': parse_iso8601(episode.get('update_time'), delimiter=' '), 'episode': episode.get('index_title'), 'episode_number': int_or_none(episode.get('index')), } for episode in season_info['episodes']] entries = sorted(en...
You can remove `**kwargs` from all `_get_entries` functions
'ie_key': BiliBiliIE.ie_key(), 'timestamp': parse_iso8601(episode.get('update_time'), delimiter=' '), 'episode': episode.get('index_title'), 'episode_number': int_or_none(episode.get('index')), } for episode in season_info['episodes']] entries = sorted(en...
@@ -502,39 +503,148 @@ def _real_extract(self, url): season_info.get('bangumi_title'), season_info.get('evaluate')) -class BilibiliChannelIE(InfoExtractor): - _VALID_URL = r'https?://space.bilibili\.com/(?P<id>\d+)' - _API_URL = "https://api.bilibili.com/x/space/arc/search?mid=%s&pn=%d&jsonp=json...
yt_dlp/extractor/bilibili.py
26
Python
0.429
suggestion
59
51
51
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix
import base64 import hashlib import itertools import functools import math import re from .common import InfoExtractor, SearchInfoExtractor from ..compat import ( compat_parse_qs, compat_urlparse, compat_urllib_parse_urlparse ) from ..utils import ( ExtractorError, filter_dict, float_or_none, ...
I think we usually put classes at the top of the list
import base64 import hashlib import itertools import functools import math import re from .common import InfoExtractor, SearchInfoExtractor from ..compat import ( compat_parse_qs, compat_urlparse, compat_urllib_parse_urlparse ) from ..utils import ( ExtractorError, InAdvancePagedList, OnDemandP...
@@ -14,22 +14,23 @@ from ..utils import ( ExtractorError, filter_dict, - int_or_none, float_or_none, + int_or_none, + InAdvancePagedList, mimetype2ext, + OnDemandPagedList, + parse_count,
yt_dlp/extractor/bilibili.py
22
Python
0.214
suggestion
53
47
47
false
[extractor/bilibili] add BilibiliSpaceAudioIE, add BilibiliSpacePlaylistIE
4,468
yt-dlp/yt-dlp
132,642
Python
elyse0
lockmatrix