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
# coding: utf-8 from __future__ import unicode_literals import re from urllib.parse import ( parse_qs, urlparse, ) from .common import InfoExtractor from ..utils import ( clean_html, determine_ext, ExtractorError, extract_attributes, get_element_by_class, get_element_html_by_id, HE...
```suggestion parse_qs, unescapeHTML, ```
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( clean_html, determine_ext, ExtractorError, extract_attributes, get_element_by_class, get_element_html_by_id, HEADRequest, parse_qs, unescapeHTML, unified_ti...
@@ -0,0 +1,177 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + parse_qs, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + clean_html, + determine_ext, + ExtractorError, + extract_attributes, + get_element_by_class, ...
yt_dlp/extractor/megatvcom.py
16
Python
0.571
security
52
41
41
false
[extractor/megatvcom] Add new extractor
1,980
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
class Ant1NewsGrBaseIE(InfoExtractor): @staticmethod def _scale_thumbnails_to_max_width(formats, thumbnails, url_width_re): _keys = ('width', 'height') max_dimensions = max( [tuple(format.get(k) or 0 for k in _keys) for format in formats], default=(0, 0)) if not m...
```suggestion formats, subs = (self._extract_m3u8_formats_and_subtitles(source, video_id, 'mp4') if determine_ext(source) == 'm3u8' else ([{'url': source}], {})) ```
class Ant1NewsGrBaseIE(InfoExtractor): def _download_and_extract_api_data(self, video_id, netloc, cid=None): url = f'{self.http_scheme()}//{netloc}{self._API_PATH}' info = self._download_json(url, video_id, query={'cid': cid or video_id}) try: source = info['url'] except ...
@@ -0,0 +1,164 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + HEADRequest, + ExtractorError, + determine_ext, + merge_dicts, + unescapeHTML, +) + + +class Ant1NewsGrBaseIE(InfoExtractor): + @s...
yt_dlp/extractor/ant1newsgr.py
26
Python
0.857
refactor
201
51
51
false
[extractor/ant1newsgr] Add new extractor
1,982
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
from .common import InfoExtractor from ..utils import ( HEADRequest, ExtractorError, determine_ext, merge_dicts, unescapeHTML, ) class Ant1NewsGrBaseIE(InfoExtractor): @staticmethod def _scale_thumbnails_to_max_width(formats, thumbnails, url_width_re): _keys = ('width', 'height') ...
You can make this a common function
from .common import InfoExtractor from ..utils import ( HEADRequest, ExtractorError, determine_ext, scale_thumbnails_to_max_format_width, unescapeHTML, ) class Ant1NewsGrBaseIE(InfoExtractor): def _download_and_extract_api_data(self, video_id, netloc, cid=None): url = f'{self.http_sch...
@@ -0,0 +1,164 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + HEADRequest, + ExtractorError, + determine_ext, + merge_dicts, + unescapeHTML, +) + + +class Ant1NewsGrBaseIE(InfoExtractor): + @s...
yt_dlp/extractor/ant1newsgr.py
26
Python
0.071
suggestion
35
51
51
false
[extractor/ant1newsgr] Add new extractor
1,982
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
default=(0, 0)) if not max_dimensions[0]: return thumbnails return [ merge_dicts( {'url': re.sub(url_width_re, str(max_dimensions[0]), thumbnail['url'])}, dict(zip(_keys, max_dimensions)), thumbnail) for thumbnail in thumbna...
```suggestion 'title': info.get('title'), ``` due to some recent changes, this is now more appropriate
except KeyError: raise ExtractorError('no source found for %s' % video_id) formats, subs = (self._extract_m3u8_formats_and_subtitles(source, video_id, 'mp4') if determine_ext(source) == 'm3u8' else ([{'url': source}], {})) self._sort_formats(formats) ...
@@ -0,0 +1,164 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + HEADRequest, + ExtractorError, + determine_ext, + merge_dicts, + unescapeHTML, +) + + +class Ant1NewsGrBaseIE(InfoExtractor): + @s...
yt_dlp/extractor/ant1newsgr.py
26
Python
0.786
suggestion
117
51
51
false
[extractor/ant1newsgr] Add new extractor
1,982
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')): self.report_warning(msg, video_id) elif isinstance(msg, ExtractorError): raise msg else: raise ExtractorError(msg, expected=expected, video_id=video_id) # Methods for ...
```suggestion matches = variadic(matches) ```
self.report_warning(msg) else: raise GeoRestrictedError(msg, countries=countries) def raise_no_formats(self, msg, expected=False, video_id=None): if expected and ( self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')): sel...
@@ -1134,8 +1134,15 @@ def url_result(url, ie=None, video_id=None, video_title=None, *, url_transparent 'url': url, } - def playlist_from_matches(self, matches, playlist_id=None, playlist_title=None, getter=None, ie=None, **kwargs): - urls = (self.url_result(self._proto_relative_url(m)...
yt_dlp/extractor/common.py
26
Python
0.571
suggestion
55
51
51
false
[extractor/ant1newsgr] Add new extractor
1,982
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
raise msg else: raise ExtractorError(msg, expected=expected, video_id=video_id) # Methods for following #608 @staticmethod def url_result(url, ie=None, video_id=None, video_title=None, *, url_transparent=False, **kwargs): """Returns a URL that points to a page that s...
video_kwargs doesn't make sense here. The title of all the videos on the page should be forced to be the same!?
def raise_no_formats(self, msg, expected=False, video_id=None): if expected and ( self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')): self.report_warning(msg, video_id) elif isinstance(msg, ExtractorError): raise msg else: ...
@@ -1134,8 +1134,15 @@ def url_result(url, ie=None, video_id=None, video_title=None, *, url_transparent 'url': url, } - def playlist_from_matches(self, matches, playlist_id=None, playlist_title=None, getter=None, ie=None, **kwargs): - urls = (self.url_result(self._proto_relative_url(m)...
yt_dlp/extractor/common.py
26
Python
0.429
question
111
51
51
false
[extractor/ant1newsgr] Add new extractor
1,982
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
}, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) info = self._search_json_ld(webpage, video_id, expected_type='NewsArticle') embed_urls = list(Ant1NewsGrEmbedIE._extract_urls(webpage)) if not embed...
make sense to move this inside extract_urls
IE_NAME = 'ant1newsgr:embed' IE_DESC = 'ant1news.gr embedded videos' _BASE_PLAYER_URL_RE = r'(?:https?:)?//(?:[a-zA-Z0-9\-]+\.)?(?:antenna|ant1news)\.gr/templates/pages/player' _VALID_URL = rf'{_BASE_PLAYER_URL_RE}\?([^#]+&)?cid=(?P<id>[^#&]+)' _API_PATH = '/news/templates/data/jsonPlayer' _TES...
@@ -0,0 +1,164 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + HEADRequest, + ExtractorError, + determine_ext, + merge_dicts, + unescapeHTML, +) + + +class Ant1NewsGrBaseIE(InfoExtractor): + @s...
yt_dlp/extractor/ant1newsgr.py
26
Python
0.143
refactor
43
51
39
false
[extractor/ant1newsgr] Add new extractor
1,982
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
'thumbnail': url_or_none(e.get('thumbnailUrl') or e.get('thumbnailURL')), 'duration': parse_duration(e.get('duration')), 'timestamp': unified_timestamp(e.get('uploadDate')), # author can be an instance of 'Organization' or 'Person' types. #...
```suggestion def traverse_json_ld(json_ld, at_top_level=True): for e in json_ld: if at_top_level and '@context' not in e: continue if at_top_level and set(e.keys()) == {'@context', '@graph'}: traverse_json_ld(variadic(e['...
'thumbnail': url_or_none(e.get('thumbnailUrl') or e.get('thumbnailURL')), 'duration': parse_duration(e.get('duration')), 'timestamp': unified_timestamp(e.get('uploadDate')), # author can be an instance of 'Organization' or 'Person' types. #...
@@ -1452,8 +1452,16 @@ def extract_video_object(e): }) extract_interaction_statistic(e) - for e in json_ld: - if '@context' in e: + def traverse_json_ld(json_ld, info, at_top_level=True): + for e in json_ld: + if at_top_level and '@context' ...
yt_dlp/extractor/common.py
26
Python
1
suggestion
683
51
51
false
[extractor/common] Tweak JSON-LD extraction to support default implicit graph
1,983
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
'device_platform': 'android', 'resolution': '1080*1920', 'dpi': 420, 'os_version': '10', 'os_api': '29', 'carrier_region': 'US', 'sys_region': 'US', 'region': 'US', 'app_name': self._APP_NAME, 'app_la...
```suggestion if webpage_cookies.get('sid_tt'): self._set_cookie(self._API_HOSTNAME, 'sid_tt', webpage_cookies['sid_tt'].value) ``` _get_cookies alreays returns a dict
'device_platform': 'android', 'resolution': '1080*1920', 'dpi': 420, 'os_version': '10', 'os_api': '29', 'carrier_region': 'US', 'sys_region': 'US', 'region': 'US', 'app_name': self._APP_NAME, 'app_la...
@@ -68,6 +69,9 @@ def _call_api(self, ep, query, video_id, fatal=True, 'cp': 'cbfhckdckkde1', } self._set_cookie(self._API_HOSTNAME, 'odin_tt', ''.join(random.choice('0123456789abcdef') for _ in range(160))) + webpage_cookies = self._get_cookies(self._WEBPAGE_HOST) + if webp...
yt_dlp/extractor/tiktok.py
26
Python
0.714
suggestion
191
51
51
false
[TikTok] Pass cookies to mobile API
1,994
yt-dlp/yt-dlp
132,642
Python
pukkandan
MinePlayersPE
display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) next_data = self._search_nextjs_data(webpage, display_id) episode = next_data['props']['pageProps']['episode'] id = episode['id'] title = (episode.get('title') or self._o...
```suggestion app_slug = (self._html_search_regex( '<script\\s+src=["\']/_next/static/([a-zA-Z0-9_]+)/_', webpage, 'app slug', fatal=False) # this sometimes works, but sometimes seems to lag changes in the actual urls used. or next_data.get('buildId')...
webpage = self._download_webpage(url, display_id) next_data = self._search_nextjs_data(webpage, display_id) episode = next_data['props']['pageProps']['episode'] id = episode['id'] title = (episode.get('title') or self._og_search_title(webpage, fatal=False) ...
@@ -0,0 +1,123 @@ +# coding: utf-8 +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + float_or_none, + int_or_none +) + + +class CallinIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' + _TESTS = [{ + 'url': 'https://www.calli...
yt_dlp/extractor/callin.py
26
Python
0.857
suggestion
326
51
51
false
[callin] Add extractor
2,000
yt-dlp/yt-dlp
132,642
Python
pukkandan
foghawk
# coding: utf-8 from .common import InfoExtractor from ..utils import ( traverse_obj, float_or_none, int_or_none ) class CallinIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' _TESTS = [{ 'url': 'https://www.callin.com/episode/the-title-ix-regi...
url should not be in test defenition ```suggestion ```
# coding: utf-8 from .common import InfoExtractor from ..utils import ( traverse_obj, float_or_none, int_or_none ) class CallinIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' _TESTS = [{ 'url': 'https://www.callin.com/episode/the-title-ix-regi...
@@ -0,0 +1,123 @@ +# coding: utf-8 +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + float_or_none, + int_or_none +) + + +class CallinIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' + _TESTS = [{ + 'url': 'https://www.calli...
yt_dlp/extractor/callin.py
17
Python
0.643
suggestion
56
42
42
false
[callin] Add extractor
2,000
yt-dlp/yt-dlp
132,642
Python
pukkandan
foghawk
# coding: utf-8 from .common import InfoExtractor from ..utils import ( traverse_obj, float_or_none, int_or_none ) class CallinIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' _TESTS = [{ 'url': 'https://www.callin.com/episode/the-title-ix-regi...
is this stable to be part of test? Otherwise, use a regex (`'re:https:\\...'`)
# coding: utf-8 from .common import InfoExtractor from ..utils import ( traverse_obj, float_or_none, int_or_none ) class CallinIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' _TESTS = [{ 'url': 'https://www.callin.com/episode/the-title-ix-regi...
@@ -0,0 +1,123 @@ +# coding: utf-8 +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + float_or_none, + int_or_none +) + + +class CallinIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' + _TESTS = [{ + 'url': 'https://www.calli...
yt_dlp/extractor/callin.py
20
Python
0.429
question
78
45
45
false
[callin] Add extractor
2,000
yt-dlp/yt-dlp
132,642
Python
pukkandan
foghawk
or next_data.get('buildId') ) show_slug = traverse_obj(episode, ('show', 'linkObj', 'resourceUrl')) if app_slug and show_slug and '/' in show_slug: show_slug = show_slug.rsplit('/', 1)[1] show_json_url = f'https://www.callin.com/_next/data/{app_slug}/show/{sho...
```suggestion episode_number = next( (len(episode_list) - i for (i, e) in enumerate(episode_list) if e.get('id') == id), None) ```
show_json = self._download_json(show_json_url, display_id, fatal=False) host = (traverse_obj(show_json, ('pageProps', 'show', 'hosts', 0)) or traverse_obj(episode, ('speakers', 0))) host_nick = traverse_obj(host, ('linkObj', 'resourceUrl')) host_nick = host_nick.rsp...
@@ -0,0 +1,123 @@ +# coding: utf-8 +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + float_or_none, + int_or_none +) + + +class CallinIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' + _TESTS = [{ + 'url': 'https://www.calli...
yt_dlp/extractor/callin.py
26
Python
0.714
suggestion
166
51
43
false
[callin] Add extractor
2,000
yt-dlp/yt-dlp
132,642
Python
pukkandan
foghawk
host_nick = traverse_obj(host, ('linkObj', 'resourceUrl')) host_nick = host_nick.rsplit('/', 1)[1] if (host_nick and '/' in host_nick) else None cast = list(filter(None, [ self.try_get_user_name(u) for u in traverse_obj(episode, (('speakers', 'callerTags'), ...)) or [] ...
Why is channel and series the same?
episode_list = traverse_obj(show_json, ('pageProps', 'show', 'episodes')) or [] episode_number = next( (len(episode_list) - i for (i, e) in enumerate(episode_list) if e.get('id') == id), None) return { 'id': id, 'display_id': display_id, ...
@@ -0,0 +1,123 @@ +# coding: utf-8 +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + float_or_none, + int_or_none +) + + +class CallinIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' + _TESTS = [{ + 'url': 'https://www.calli...
yt_dlp/extractor/callin.py
26
Python
0.071
question
35
40
31
false
[callin] Add extractor
2,000
yt-dlp/yt-dlp
132,642
Python
pukkandan
foghawk
def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) next_data = self._search_nextjs_data(webpage, display_id) episode = next_data['props']['pageProps']['episode'] id = episode['id'] title = (episode.get('...
```suggestion app_slug = (self._html_search_regex( '<script\\s+src=["\']/_next/static/([a-zA-Z0-9_]+)/_', webpage, 'app slug', fatal=False) or next_data.get('buildId')) ```
def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) next_data = self._search_nextjs_data(webpage, display_id) episode = next_data['props']['pageProps']['episode'] id = episode['id'] title = (episode.get('t...
@@ -0,0 +1,120 @@ +# coding: utf-8 +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + float_or_none, + int_or_none +) + + +class CallinIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' + _TESTS = [{ + 'url': 'https://www.calli...
yt_dlp/extractor/callin.py
26
Python
0.786
suggestion
208
51
51
false
[callin] Add extractor
2,000
yt-dlp/yt-dlp
132,642
Python
pukkandan
foghawk
or self._og_search_title(webpage, fatal=False) or self._html_search_regex('<title>(.*?)</title>', webpage, 'title')) url = episode['m3u8'] formats = self._extract_m3u8_formats(url, display_id, ext='ts') self._sort_formats(formats) show = traverse_obj(ep...
```suggestion host = (traverse_obj(show_json, ('pageProps', 'show', 'hosts', 0)) or traverse_obj(episode, ('speakers', 0))) ```
or self._html_search_regex('<title>(.*?)</title>', webpage, 'title')) url = episode['m3u8'] formats = self._extract_m3u8_formats(url, display_id, ext='ts') self._sort_formats(formats) show = traverse_obj(episode, ('show', 'title')) show_id = traverse_obj(episode...
@@ -0,0 +1,120 @@ +# coding: utf-8 +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + float_or_none, + int_or_none +) + + +class CallinIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)' + _TESTS = [{ + 'url': 'https://www.calli...
yt_dlp/extractor/callin.py
26
Python
0.714
suggestion
154
51
51
false
[callin] Add extractor
2,000
yt-dlp/yt-dlp
132,642
Python
pukkandan
foghawk
in_options = True else: in_options = False if in_options: if line.lstrip().startswith('-'): split = re.split(r'\s{2,}', line.lstrip()) # Description string may start with `-` as well. If there is # only one ...
u can use regex to simplify this
def move_sections(readme): MOVE_TAG_TEMPLATE = '<!-- MANPAGE: MOVE "%s" SECTION HERE -->' sections = re.findall(rf'(?m)^{re.escape(MOVE_TAG_TEMPLATE) % "(.+)"}$', readme) for section_name in sections: move_tag = MOVE_TAG_TEMPLATE % section_name if readme.count(move_tag) > 1: r...
@@ -43,6 +48,46 @@ def main(): outf.write(readme) +def filter_excluded_sections(readme): + EXCLUDED_SECTION_BEGIN_STRING = '<!-- BEGIN EXCLUDE FROM MANPAGE -->' + EXCLUDED_SECTION_END_STRING = '<!-- END EXCLUDE FROM MANPAGE -->' + ret = [] + in_section = False + for line in readme.split('\n'...
devscripts/prepare_manpage.py
26
Python
0.143
refactor
32
30
47
false
[docs] improve format of manpage
2,003
yt-dlp/yt-dlp
132,642
Python
pukkandan
iw0nderhow
#!/usr/bin/env python3 from __future__ import unicode_literals import io import optparse import os.path import re ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) README_FILE = os.path.join(ROOT_DIR, 'README.md') PREFIX = r'''%yt-dlp(1) # NAME youtube\-dl \- download videos from youtube.com o...
same. just str.replace or re.sub can do this
sections = re.findall(rf'(?sm)(^# {re.escape(section_name)}.+?)(?=^# )', readme) if len(sections) < 1: raise Exception(f'The section {section_name} does not exist') elif len(sections) > 1: raise Exception(f'There are multiple occurrences of section {section_name}, this i...
@@ -43,6 +48,46 @@ def main(): outf.write(readme) +def filter_excluded_sections(readme): + EXCLUDED_SECTION_BEGIN_STRING = '<!-- BEGIN EXCLUDE FROM MANPAGE -->' + EXCLUDED_SECTION_END_STRING = '<!-- END EXCLUDE FROM MANPAGE -->' + ret = [] + in_section = False + for line in readme.split('\n'...
devscripts/prepare_manpage.py
26
Python
0.143
suggestion
44
81
37
false
[docs] improve format of manpage
2,003
yt-dlp/yt-dlp
132,642
Python
pukkandan
iw0nderhow
parser.error('Expected an output filename') outfile, = args with io.open(README_FILE, encoding='utf-8') as f: readme = f.read() readme = re.sub(r'(?s)^.*?(?=# DESCRIPTION)', '', readme) readme = re.sub(r'\s+yt-dlp \[OPTIONS\] URL \[URL\.\.\.\]', '', readme) readme = filter_exclude...
```suggestion rf'(?s){re.escape(EXCLUDED_SECTION_BEGIN_STRING)}.+?{re.escape(EXCLUDED_SECTION_END_STRING)}\n' ``` do `re.escape` when putting literal string inside regex
parser.error('Expected an output filename') outfile, = args with io.open(README_FILE, encoding='utf-8') as f: readme = f.read() readme = filter_excluded_sections(readme) readme = move_sections(readme) readme = filter_options(readme) with io.open(outfile, 'w', encoding='utf-8'...
@@ -43,6 +49,33 @@ def main(): outf.write(readme) +def filter_excluded_sections(readme): + EXCLUDED_SECTION_BEGIN_STRING = '<!-- MANPAGE: BEGIN EXCLUDED SECTION -->' + EXCLUDED_SECTION_END_STRING = '<!-- MANPAGE: END EXCLUDED SECTION -->' + return re.sub( + '(?s)%s.+?%s\n' % (EXCLUDED_SECTI...
devscripts/prepare_manpage.py
26
Python
0.714
security
180
51
51
false
[docs] improve format of manpage
2,003
yt-dlp/yt-dlp
132,642
Python
pukkandan
iw0nderhow
'playlist_mincount': 50 }] def _real_extract(self, url): username, story_id = self._match_valid_url(url).groups() story_info_url = f'{username}/{story_id}/?__a=1' if username == 'highlights' else f'{username}/?__a=1' story_info = self._download_json(f'https://www.instagram.com/...
```suggestion videos = traverse_obj(videos, (f'highlight:{story_id}', 'items'), (str(user_id), 'items')) ```
'playlist_mincount': 50 }] def _real_extract(self, url): username, story_id = self._match_valid_url(url).groups() story_info_url = f'{username}/{story_id}/?__a=1' if username == 'highlights' else f'{username}/?__a=1' story_info = self._download_json(f'https://www.instagram.com/...
@@ -533,3 +533,80 @@ def _query_vars_for(data): 'tag_name': data['entry_data']['TagPage'][0]['graphql']['hashtag']['name'] } + + +class InstagramStoryIE(InstagramBaseIE): + _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/]+)/(?P<id>\d+)' + IE_NAME = 'ins...
yt_dlp/extractor/instagram.py
26
Python
0.786
suggestion
118
51
51
false
[Instagram] Add story/highlight extractor
2,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
formats = [] if isinstance(video_info, list): video_info = video_info[0] vcodec = video_info.get('video_codec') dash_manifest_raw = video_info.get('video_dash_manifest') videos_list = video_info.get('video_versions') if not (dash_ma...
```suggestion thumbnails = [{ 'url': thumbnail.get('url'), 'width': thumbnail.get('width'), 'height': thumbnail.get('height') } for thumbnail in traverse_obj(video_info, ('image_versions2', 'candidates')) or []] ```
formats = [] if isinstance(video_info, list): video_info = video_info[0] vcodec = video_info.get('video_codec') dash_manifest_raw = video_info.get('video_dash_manifest') videos_list = video_info.get('video_versions') if not (dash_ma...
@@ -533,3 +533,80 @@ def _query_vars_for(data): 'tag_name': data['entry_data']['TagPage'][0]['graphql']['hashtag']['name'] } + + +class InstagramStoryIE(InstagramBaseIE): + _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/]+)/(?P<id>\d+)' + IE_NAME = 'ins...
yt_dlp/extractor/instagram.py
26
Python
0.786
suggestion
293
39
36
false
[Instagram] Add story/highlight extractor
2,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
# For fields playlist_index, playlist_autonumber and autonumber convert all occurrences # of %(field)s to %(field)0Nd for backward compatibility field_size_compat_map = { 'playlist_index': number_of_digits(info_dict.get('_last_playlist_index') or 0), 'playlist_autonumber'...
shouldn't this be `.*?` like `default`? And the above line should be `[^|&)]`
# For fields playlist_index, playlist_autonumber and autonumber convert all occurrences # of %(field)s to %(field)0Nd for backward compatibility field_size_compat_map = { 'playlist_index': number_of_digits(info_dict.get('_last_playlist_index') or 0), 'playlist_autonumber'...
@@ -1056,6 +1056,7 @@ def prepare_outtmpl(self, outtmpl, info_dict, sanitize=None): (?P<maths>(?:{math_op}{math_field})*) (?:>(?P<strf_format>.+?))? (?P<alternate>(?<!\\),[^|)]+)? + (?:\&(?P<replacement>.+?))?
yt_dlp/YoutubeDL.py
26
Python
0.429
suggestion
78
51
51
false
Add replacement output template via `&`
2,012
yt-dlp/yt-dlp
132,642
Python
pukkandan
PilzAdam
value = operator(value, multiplier * offset) except (TypeError, ZeroDivisionError): return None operator = None # Datetime formatting if mdict['strf_format']: value = strftime_or_none(value, m...
```suggestion value, replacement, default = None, None, na ```
try: value = operator(value, multiplier * offset) except (TypeError, ZeroDivisionError): return None operator = None # Datetime formatting if mdict['strf_format']: value = ...
@@ -1115,10 +1116,12 @@ def create_key(outer_mobj): mobj = re.match(INTERNAL_FORMAT_RE, key) initial_field = mobj.group('fields').split('.')[-1] if mobj else '' value, default = None, na + replacement = None
yt_dlp/YoutubeDL.py
26
Python
0.643
suggestion
76
51
51
false
Add replacement output template via `&`
2,012
yt-dlp/yt-dlp
132,642
Python
pukkandan
PilzAdam
def create_key(outer_mobj): if not outer_mobj.group('has_key'): return outer_mobj.group(0) key = outer_mobj.group('key') mobj = re.match(INTERNAL_FORMAT_RE, key) initial_field = mobj.group('fields').split('.')[-1] if mobj else '' value...
```suggestion value = default if value is None else value if replacement is None else replacement ```
raise TypeError(f'Object of type {type(obj).__name__} is not JSON serializable') def create_key(outer_mobj): if not outer_mobj.group('has_key'): return outer_mobj.group(0) key = outer_mobj.group('key') mobj = re.match(INTERNAL_FORMAT_RE, key) ...
@@ -1128,6 +1131,7 @@ def create_key(outer_mobj): if fmt == 's' and value is not None and key in field_size_compat_map.keys(): fmt = '0{:d}d'.format(field_size_compat_map[key]) + value = replacement if replacement is not None and value is not None else value value...
yt_dlp/YoutubeDL.py
26
Python
0.786
suggestion
115
51
51
false
Add replacement output template via `&`
2,012
yt-dlp/yt-dlp
132,642
Python
pukkandan
PilzAdam
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( extract_attributes, ExtractorError, get_element_by_class, ) class SteamIE(InfoExtractor): _VALID_URL = r"""(?x) https?://store\.steampowered\.com/ (agecheck/)? (?...
Why is this being removed? It appears such URL patterns are still valid on the website
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( extract_attributes, ExtractorError, get_element_by_class, ) class SteamIE(InfoExtractor): _VALID_URL = r"""(?x) https?://(?:store\.steampowered|steamcommunity)\.com/ (?:agech...
@@ -18,30 +17,31 @@ class SteamIE(InfoExtractor): (?P<urltype>video|app)/ #If the page is only for videos or for a game (?P<gameID>\d+)/? (?P<videoID>\d*)(?P<extra>\??) # For urltype == video we sometimes get the videoID - | - https?://(?:www\.)?steamcommunity\.com/s...
yt_dlp/extractor/steam.py
22
Python
0.286
question
86
47
47
false
[Steam] Fix extractor
2,029
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
} } ], 'info_dict': { 'id': '105600', 'title': 'Terraria', }, 'params': { 'playlistend': 2, } }, { 'url': 'https://store.steampowered.com/app/271590/Grand_Theft_Auto_V/', 'info_dict': { ...
```suggestion playlist_id = self._match_valid_url(url).group('gameID') ``` what ae the other groups in the VALID_URL for?
'thumbnail': r're:^https://cdn\.[^\.]+\.steamstatic\.com', 'n_entries': 2, } } ], 'info_dict': { 'id': '105600', 'title': 'Terraria', }, 'params': { 'playlistend': 2, } }, ...
@@ -53,96 +53,62 @@ class SteamIE(InfoExtractor): 'playlistend': 2, } }, { - 'url': 'http://steamcommunity.com/sharedfiles/filedetails/?id=242472205', + 'url': 'https://store.steampowered.com/app/271590/Grand_Theft_Auto_V/', 'info_dict': { - 'id': 'X8kpJBlzD2...
yt_dlp/extractor/steam.py
26
Python
0.714
question
134
51
51
false
[Steam] Fix extractor
2,029
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
} ], 'info_dict': { 'id': '105600', 'title': 'Terraria', }, 'params': { 'playlistend': 2, } }, { 'url': 'https://store.steampowered.com/app/271590/Grand_Theft_Auto_V/', 'info_dict': { 'id': '256757115...
```suggestion video_url = self._VIDEO_PAGE_TEMPLATE % playlist_id ```
'n_entries': 2, } } ], 'info_dict': { 'id': '105600', 'title': 'Terraria', }, 'params': { 'playlistend': 2, } }, { 'url': 'https://store.steampowered.com/app/271590/Grand_Theft_Auto_V/...
@@ -53,96 +53,62 @@ class SteamIE(InfoExtractor): 'playlistend': 2, } }, { - 'url': 'http://steamcommunity.com/sharedfiles/filedetails/?id=242472205', + 'url': 'https://store.steampowered.com/app/271590/Grand_Theft_Auto_V/', 'info_dict': { - 'id': 'X8kpJBlzD2...
yt_dlp/extractor/steam.py
26
Python
0.571
suggestion
79
51
51
false
[Steam] Fix extractor
2,029
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
movie = extract_attributes(movie) if not movie_id: continue entry = { 'id': movie_id, 'title': f'{playlist_title} video {movie_id}', } formats = [] if movie: entry['thumbnail'] = movie...
```suggestion self._sort_formats(formats) entry['formats'] = formats ```
videos = re.findall(r'(<div[^>]+id=[\'"]highlight_movie_(\d+)[\'"][^>]+>)', webpage) entries = [] playlist_title = get_element_by_class('apphub_AppName', webpage) for movie, movie_id in videos: if not movie: continue movie = extract_attributes(movi...
@@ -53,96 +53,62 @@ class SteamIE(InfoExtractor): 'playlistend': 2, } }, { - 'url': 'http://steamcommunity.com/sharedfiles/filedetails/?id=242472205', + 'url': 'https://store.steampowered.com/app/271590/Grand_Theft_Auto_V/', 'info_dict': { - 'id': 'X8kpJBlzD2...
yt_dlp/extractor/steam.py
26
Python
0.571
suggestion
99
27
43
false
[Steam] Fix extractor
2,029
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
continue if idx == 0: last_chapter = { 'start_time': part.get('startOffset') or 0, 'end_time': part.get('endOffset'), } last_chapter.update({'title': part['name']} if part.get(...
why is this so complicated? (untested) ```py def extract_chapter_information(e): chapters = [{ 'title': part.get('name'), 'start_time': part.get('startOffset'), 'end_time': part.get('endOffset'), } for part in (e.get('hasPart') or [...
for idx, (last_c, current_c, next_c) in enumerate(zip( [{'end_time': 0}] + chapters, chapters, chapters[1:])): current_c['end_time'] = current_c['end_time'] or next_c['start_time'] current_c['start_time'] = current_c['start_time'] or last_c['end_time'] ...
@@ -1428,6 +1428,39 @@ def extract_interaction_statistic(e): continue info[count_key] = interaction_count + def extract_chapter_information(e): + chapters = [] + last_chapter = {} + if not e.get('hasPart'): + return + ...
yt_dlp/extractor/common.py
26
Python
1
bug
1,080
51
51
false
[common] Extract chapters from JSON-LD
2,031
yt-dlp/yt-dlp
132,642
Python
pukkandan
iw0nderhow
def warning(self, message, only_once=False): if self._ydl: self._ydl.report_warning(message, only_once) def error(self, message): if self._ydl: self._ydl.report_error(message) def load_cookies(cookie_file, browser_specification, ydl): cookie_jars = [] if browse...
do not change public functions' signature ```suggestion def extract_cookies_from_browser(browser_name, profile=None, logger=YDLLogger(), keyring=None): ```
if self._ydl: self._ydl.to_screen(f'[Cookies] {message}') def warning(self, message, only_once=False): if self._ydl: self._ydl.report_warning(message, only_once) def error(self, message): if self._ydl: self._ydl.report_error(message) def load_cooki...
@@ -87,13 +82,13 @@ def load_cookies(cookie_file, browser_specification, ydl): return _merge_cookie_jars(cookie_jars) -def extract_cookies_from_browser(browser_name, profile=None, logger=YDLLogger()): +def extract_cookies_from_browser(browser_name, profile=None, keyring=None, logger=YDLLogger()):
yt_dlp/cookies.py
26
Python
0.786
refactor
158
51
51
false
Fixed Gnome keyring support
2,032
yt-dlp/yt-dlp
132,642
Python
pukkandan
mbway
return _LinuxDesktopEnvironment.OTHER def _choose_linux_keyring(logger): """ https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/key_storage_util_linux.cc SelectBackend """ desktop_environment = _get_linux_desktop_environment(os.environ) logger.debu...
is this guarenteed to be present in relevent systems?
else: if 'GNOME_DESKTOP_SESSION_ID' in env: return _LinuxDesktopEnvironment.GNOME elif 'KDE_FULL_SESSION' in env: return _LinuxDesktopEnvironment.KDE else: return _LinuxDesktopEnvironment.OTHER def _choose_linux_keyring(logger): """ https://chrom...
@@ -577,42 +602,183 @@ def parse_safari_cookies(data, jar=None, logger=YDLLogger()): return jar -def _get_linux_keyring_password(browser_keyring_name): - password = keyring.get_password('{} Keys'.format(browser_keyring_name), - '{} Safe Storage'.format(browser_keyring_name...
yt_dlp/cookies.py
26
Python
0.214
question
53
51
51
false
Fixed Gnome keyring support
2,032
yt-dlp/yt-dlp
132,642
Python
pukkandan
mbway
compat_b64decode, compat_cookiejar_Cookie, ) from .utils import ( expand_path, Popen, YoutubeDLCookieJar, ) try: import sqlite3 SQLITE_AVAILABLE = True except ImportError: # although sqlite3 is part of the standard library, it is possible to compile python without # sqlite support. ...
might be best to capture all Exception as we did for keyring
compat_b64decode, compat_cookiejar_Cookie, ) from .utils import ( expand_path, Popen, YoutubeDLCookieJar, ) try: import sqlite3 SQLITE_AVAILABLE = True except ImportError: # although sqlite3 is part of the standard library, it is possible to compile python without # sqlite support. ...
@@ -31,19 +32,13 @@ try: - import keyring - KEYRING_AVAILABLE = True - KEYRING_UNAVAILABLE_REASON = f'due to unknown reasons{bug_reports_message()}' + import secretstorage + SECRETSTORAGE_AVAILABLE = True except ImportError: - KEYRING_AVAILABLE = False - KEYRING_UNAVAILABLE_REASON = ( - ...
yt_dlp/cookies.py
26
Python
0.357
suggestion
60
51
51
false
Fixed Gnome keyring support
2,032
yt-dlp/yt-dlp
132,642
Python
pukkandan
mbway
like_count: Number of positive ratings of the video dislike_count: Number of negative ratings of the video repost_count: Number of reposts of the video average_rating: Average rating give by users, the scale used depends on the webpage comment_count: Number of comments on the video comme...
```suggestion should allow to get the same result again. (It will be set ```
like_count: Number of positive ratings of the video dislike_count: Number of negative ratings of the video repost_count: Number of reposts of the video average_rating: Average rating give by users, the scale used depends on the webpage comment_count: Number of comments on the video comme...
@@ -294,7 +294,7 @@ class InfoExtractor(object): the video uploader age_limit: Age restriction for the video, as an integer (years) webpage_url: The URL to the video webpage, if given to yt-dlp it - should allow to get the same resul...
yt_dlp/extractor/common.py
26
Python
0.643
suggestion
98
51
51
false
Fix some typos.
2,033
yt-dlp/yt-dlp
132,642
Python
pukkandan
Unit193
# coding: utf-8 import requests from .common import InfoExtractor from .vimeo import VHXEmbedIE class DropoutIE(InfoExtractor): _LOGIN_URL = 'https://www.dropout.tv/login' _NETRC_MACHINE = 'dropout' _VALID_URL = r'https?://(?:www\.)?dropout\.tv/videos/(?P<id>.+)' _TESTS = [{ 'url': 'https://w...
remove dependency and use `self._download_json`, `self._download_webpage` etc. Look at other extractors for example
# coding: utf-8 from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( clean_html, ExtractorError, get_element_by_class, get_element_by_id, get_elements_by_class, int_or_none, join_nonempty, unified_strdate, urlencode_postdata, ) class DropoutIE(InfoE...
@@ -0,0 +1,93 @@ +# coding: utf-8 +import requests
yt_dlp/extractor/dropout.py
2
Python
0.571
refactor
116
27
27
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
'info_dict': { 'id': '1915774', 'display_id': 'misfits-magic-holiday-special', 'ext': 'mp4', 'title': 'Misfits & Magic Holiday Special', 'description': 'The magical misfits spend Christmas break at Gowpenny, with an unwelcome visitor.', 're...
cookies are automatically handled
class DropoutIE(InfoExtractor): _LOGIN_URL = 'https://www.dropout.tv/login' _NETRC_MACHINE = 'dropout' _VALID_URL = r'https?://(?:www\.)?dropout\.tv/(?:[^/]+/)*videos/(?P<id>[^/]+)/?$' _TESTS = [ { 'url': 'https://www.dropout.tv/game-changer/season:2/videos/yes-or-no', ...
@@ -0,0 +1,93 @@ +# coding: utf-8 +import requests +from .common import InfoExtractor +from .vimeo import VHXEmbedIE + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _NETRC_MACHINE = 'dropout' + + _VALID_URL = r'https?://(?:www\.)?dropout\.tv/videos/(?P<id>.+)' + _TESTS =...
yt_dlp/extractor/dropout.py
26
Python
0.214
suggestion
33
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
'info_dict': { 'id': '1915774', 'display_id': 'misfits-magic-holiday-special', 'ext': 'mp4', 'title': 'Misfits & Magic Holiday Special', 'description': 'The magical misfits spend Christmas break at Gowpenny, with an unwelcome visitor.', 're...
remove all these unnecessary comments. The code is self-explainatory here
class DropoutIE(InfoExtractor): _LOGIN_URL = 'https://www.dropout.tv/login' _NETRC_MACHINE = 'dropout' _VALID_URL = r'https?://(?:www\.)?dropout\.tv/(?:[^/]+/)*videos/(?P<id>[^/]+)/?$' _TESTS = [ { 'url': 'https://www.dropout.tv/game-changer/season:2/videos/yes-or-no', ...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.286
suggestion
73
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
}] def _get_authenticity_token(self): signin_page = self._download_webpage(self._LOGIN_URL, video_id=self.display_id, note='Getting authenticity token') authenticity_token = self._html_search_regex( r'name=["\']authenticity_token["\'] val...
```suggestion response = self._download_webpage( self._LOGIN_URL, video_id=None, note='Logging in', data=urlencode_postdata({ 'email': username, 'password': password, 'authenticity_token': self._get_authenticity_token(), 'utf8': True }))...
'ext': 'mp4', 'title': 'Yes or No', 'description': 'Ally, Brennan, and Zac are asked a simple question, but is there a correct answer?', 'release_date': '20200508', 'thumbnail': 'https://vhx.imgix.net/chuncensoredstaging/assets/351e3f24-c4a...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.857
security
325
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
def _get_authenticity_token(self): signin_page = self._download_webpage(self._LOGIN_URL, video_id=self.display_id, note='Getting authenticity token') authenticity_token = self._html_search_regex( r'name=["\']authenticity_token["\'] value=["\']...
```suggestion user_has_subscription = self._search_regex(r'user_has_subscription:\s+["\'](.+?)["\']', ```
'description': 'Ally, Brennan, and Zac are asked a simple question, but is there a correct answer?', 'release_date': '20200508', 'thumbnail': 'https://vhx.imgix.net/chuncensoredstaging/assets/351e3f24-c4a3-459a-8b79-dc80f1e5b7fd.jpg', 'series': 'Game Chang...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.786
suggestion
115
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
return authenticity_token def _login(self): # Get & check username and password username, password = self._get_login_info() if not (username and password): self.raise_login_required() # Make POST login request payload = { 'email': username, ...
```suggestion if user_has_subscription.lower() == 'true': return response self._logout() self.raise_login_required('Incorrect username/password, or account is not subscribed') ```
'episode_number': 6, 'episode': 'Yes or No', 'duration': 1180, 'uploader_id': 'user80538407', 'uploader_url': 'https://vimeo.com/user80538407', 'uploader': 'OTT Videos' }, 'expected_warnings': ['Ignor...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.857
bug
220
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
self.raise_login_required() # Make POST login request payload = { 'email': username, 'password': password, 'authenticity_token': self._get_authenticity_token(), 'utf8': True } response = self._download_webpage(self._LOGIN_URL, ...
You can't set video-specific data to instance variable. This should just be a local var
}, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'] }, { 'url': 'https://www.dropout.tv/dimension-20-fantasy-high/season:1/videos/episode-1', 'note': 'Episode in a series (missing release_date)', 'md5': '712caf7c191f1...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.286
suggestion
87
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
# Make POST login request payload = { 'email': username, 'password': password, 'authenticity_token': self._get_authenticity_token(), 'utf8': True } response = self._download_webpage(self._LOGIN_URL, video_id=self.display_id, ...
move login to `_real_initialize`
}, { 'url': 'https://www.dropout.tv/dimension-20-fantasy-high/season:1/videos/episode-1', 'note': 'Episode in a series (missing release_date)', 'md5': '712caf7c191f1c47c8f1879520c2fa5c', 'info_dict': { 'id': '320562', 'displ...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.286
suggestion
32
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
note='Logging in', data=urlencode_postdata(payload)) # Make sure login was successful user_has_subscription = self._html_search_regex(r'user_has_subscription: ["\'](.+?)["\']', response, 'success') ...
both should be `_search_regex`. See the diff b/w `_html_search_regex` and `_search_regex`
'ext': 'mp4', 'title': 'The Beginning Begins', 'description': 'The cast introduces their PCs, including a neurotic elf, a goblin PI, and a corn-worshipping cleric.', 'thumbnail': 'https://vhx.imgix.net/chuncensoredstaging/assets/4421ed0d-f630-4c88-9004-525...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.429
suggestion
89
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
user_has_subscription = self._html_search_regex(r'user_has_subscription: ["\'](.+?)["\']', response, 'success') if str(user_has_subscription).lower() == 'true': return response else: self._logout() self.r...
```suggestion title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title').split(' - ')[0] ``` since title is mandatory. But are you sure the actual title can never have a ` - ` in it? `remove_end` may be more appropriate
'thumbnail': 'https://vhx.imgix.net/chuncensoredstaging/assets/4421ed0d-f630-4c88-9004-5251b2b8adfa.jpg', 'series': 'Dimension 20: Fantasy High', 'season_number': 1, 'season': 'Season 1', 'episode_number': 1, 'episode': 'The...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.857
suggestion
249
49
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
def _logout(self): self._download_webpage(self._LOGOUT_URL, self.display_id, note='Logging out') def _real_extract(self, url): self.display_id = self._match_id(url) self._login() # Get webpage and embed_url, and log out webpage = self._download_webpage(url, self.displ...
`utils.get_element_by_attribute`
'uploader_id': 'user80538407', 'uploader_url': 'https://vimeo.com/user80538407', 'uploader': 'OTT Videos' }, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'] }, { 'url': 'https://www.dropout.tv...
@@ -0,0 +1,104 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.214
suggestion
32
42
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
'md5': 'c30fa18999c5880d156339f13c953a26', 'info_dict': { 'id': '1915774', 'display_id': 'misfits-magic-holiday-special', 'ext': 'mp4', 'title': 'Misfits & Magic Holiday Special', 'description': 'The magical misfits spend Christmas break at Gow...
remove `id` from this function. You are calling it once anyways that too with `None` hardcoded. ```suggestion def _login(self): ```
class DropoutIE(InfoExtractor): _LOGIN_URL = 'https://www.dropout.tv/login' _NETRC_MACHINE = 'dropout' _VALID_URL = r'https?://(?:www\.)?dropout\.tv/(?:[^/]+/)*videos/(?P<id>[^/]+)/?$' _TESTS = [ { 'url': 'https://www.dropout.tv/game-changer/season:2/videos/yes-or-no', ...
@@ -0,0 +1,101 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.786
suggestion
139
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
Ashish0804
ghost
'uploader_url': 'https://vimeo.com/user80538407', 'uploader': 'OTT Videos' }, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'] }] def _get_authenticity_token(self, id: str): signin_page = self._download_webpage(self._LOGIN_URL, video_id...
```suggestion response = self._download_webpage(self._LOGIN_URL, None, ```
'md5': '5e000fdfd8d8fa46ff40456f1c2af04a', 'info_dict': { 'id': '738153', 'display_id': 'yes-or-no', 'ext': 'mp4', 'title': 'Yes or No', 'description': 'Ally, Brennan, and Zac are asked a simple question, but is ther...
@@ -0,0 +1,101 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.571
suggestion
84
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
Ashish0804
ghost
signin_page = self._download_webpage(self._LOGIN_URL, video_id=id, note='Getting authenticity token') authenticity_token = self._html_search_regex( r'name=["\']authenticity_token["\'] value=["\'](.+?)["\']', signin_page, 'authenticity_...
```suggestion self._logout() ```
'release_date': '20200508', 'thumbnail': 'https://vhx.imgix.net/chuncensoredstaging/assets/351e3f24-c4a3-459a-8b79-dc80f1e5b7fd.jpg', 'series': 'Game Changer', 'season_number': 2, 'season': 'Season 2', 'episode_number': 6, ...
@@ -0,0 +1,101 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.429
suggestion
42
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
Ashish0804
ghost
def _login(self, id: str): username, password = self._get_login_info() if not (username and password): self.raise_login_required() payload = { 'email': username, 'password': password, 'authenticity_token': self._get_authenticity_token(id), ...
```suggestion def _logout(self): self._download_webpage(self._LOGOUT_URL, None, note='Logging out') ```
'duration': 1180, 'uploader_id': 'user80538407', 'uploader_url': 'https://vimeo.com/user80538407', 'uploader': 'OTT Videos' }, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'] }, { ...
@@ -0,0 +1,101 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.714
suggestion
118
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
Ashish0804
ghost
self.raise_login_required() payload = { 'email': username, 'password': password, 'authenticity_token': self._get_authenticity_token(id), 'utf8': True } response = self._download_webpage(self._LOGIN_URL, video_id=id, ...
```suggestion self._login() ```
'uploader': 'OTT Videos' }, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'] }, { 'url': 'https://www.dropout.tv/dimension-20-fantasy-high/season:1/videos/episode-1', 'note': 'Episode in a series (missing release_...
@@ -0,0 +1,101 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import urlencode_postdata + + +class DropoutIE(InfoExtractor): + _LOGIN_URL = 'https://www.dropout.tv/login' + _LOGOUT_URL = 'https://www.dropout.tv/logout' + _NETRC_MACHINE = 'dropout' + + _VA...
yt_dlp/extractor/dropout.py
26
Python
0.429
suggestion
41
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
Ashish0804
ghost
} response = self._download_webpage(self._LOGIN_URL, None, note='Logging in', data=urlencode_postdata(payload)) user_has_subscription = self._search_regex(r'user_has_subscription: ["\'](.+?)["\']', resp...
```suggestion display_id = self._match_id(url) try: self._login(display_id) webpage = self._download_webpage(url, display_id, note='Downloading video webpage') finally: self._download_webpage('https://www.dropout.tv/logout', display_id, note='Logging out...
} }, { 'url': 'https://www.dropout.tv/dimension-20-fantasy-high', 'note': 'Multi-season series with the season not in the url', 'playlist_count': 17, 'info_dict': { 'id': 'dimension-20-fantasy-high-season-1', 'ti...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.786
suggestion
422
51
46
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
if user_has_subscription.lower() == 'true': return response self._logout() if user_has_subscription.lower() == 'false': self.raise_login_required('Account is not subscribed') else: self.raise_login_required('Incorrect username/password') def _logo...
```suggestion watch_info = get_element_by_id('watch-info', webpage) or '' ```
'info_dict': { 'id': 'dimension-20-fantasy-high-season-1', 'title': 'Dimension 20 Fantasy High - Season 1' } }, { 'url': 'https://www.dropout.tv/dimension-20-shriek-week', 'note': 'Single-season series', 'playlis...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.571
suggestion
87
51
40
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
def _logout(self): self._download_webpage(self._LOGOUT_URL, None, note='Logging out') def _real_extract(self, url): try: self._login() webpage = self._download_webpage(url, None, note='Downloading video webpage') finally: self._logout() embed...
```suggestion release_date = unified_strdate(self._search_regex( r'data-meta-field-name=["\']release_dates["\'] data-meta-field-value=["\'](.+?)["\']', watch_info, 'release_date', fatal=False)) ```
'playlist_count': 4, 'info_dict': { 'id': 'dimension-20-shriek-week-season-1', 'title': 'Dimension 20 Shriek Week - Season 1' } } ] def _real_extract(self, url): season_id = self._match_id(url) season_title = season_id....
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.786
suggestion
233
51
32
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
embed_url = self._search_regex(r'embed_url: ["\'](.+?)["\']', webpage, 'embed_url') display_id = self._match_id(url) id = self._search_regex(r'embed.vhx.tv/videos/(.+?)\?', embed_url, 'id') description = self._html_search_meta('description', webpage, display_name='description', fatal=Fa...
```suggestion season_episode = (get_element_by_class('site-font-secondary-color', first_text) or '').strip() season = self._search_regex(r'Season (\d+),', season_episode, 'season', default=None) episode = self._search_regex(r'Episode (\d+)', season_episode, 'episode', default=None) ```
# coding: utf-8 from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( clean_html, ExtractorError, get_element_by_class, get_element_by_id, get_elements_by_class, int_or_none, join_nonempty, unified_strdate, urlencode_postdata, ) class DropoutIE(InfoE...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.786
suggestion
314
44
213
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
# not what's actually in the element (inside is something like "15Dec2021", which # is much harder to parse than "2021-12-15") series = clean_html(get_element_by_class('series-title', watch_info)) first_text = get_element_by_class('text', watch_info) season_episode = get_element_...
```suggestion 'season_number': int_or_none(season), 'episode_number': int_or_none(episode), ``` `season` will be auto-generated
# coding: utf-8 from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( clean_html, ExtractorError, get_element_by_class, get_element_by_id, get_elements_by_class, int_or_none, join_nonempty, unified_strdate, urlencode_postdata, ) class DropoutIE(InfoE...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.714
suggestion
155
29
213
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
watch_info, 'release_date', default=None) # TODO Really, this should be `fatal=False`, but that angers the tester release_date = release_date.replace('-', '') if release_date else None # utils.get_element_by_attribute is not used because we want data-meta-field-value, # not what's a...
a lot of these can be inlined here
# coding: utf-8 from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( clean_html, ExtractorError, get_element_by_class, get_element_by_id, get_elements_by_class, int_or_none, join_nonempty, unified_strdate, urlencode_postdata, ) class DropoutIE(InfoE...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.071
suggestion
34
32
213
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
'info_dict': { 'id': 'dimension-20-fantasy-high:season-1', 'title': 'Dimension 20 Fantasy High - Season 1' } }, { 'url': 'https://www.dropout.tv/dimension-20-fantasy-high', 'note': 'Multi-season series with the season not in...
try to fix this if possible, though not necessarily in scope of this PR
_VALID_URL = r'https?://(?:www\.)?dropout\.tv/(?:[^/]+/)*videos/(?P<id>[^/]+)/?$' _TESTS = [ { 'url': 'https://www.dropout.tv/game-changer/season:2/videos/yes-or-no', 'note': 'Episode in a series', 'md5': '5e000fdfd8d8fa46ff40456f1c2af04a', 'info_dict': {...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.214
suggestion
71
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
'id': 'dimension-20-fantasy-high:season-1', 'title': 'Dimension 20 Fantasy High - Season 1' } }, { 'url': 'https://www.dropout.tv/dimension-20-shriek-week', 'note': 'Single-season series', 'playlist_count': 4, 'i...
```suggestion entries = [self.url_result( self._search_regex(r'<a href=["\']([^>]+?)["\'] class=["\']browse-item-link["\']', item, 'item_url'), ie=DropoutIE.ie_key()) for item in items] ```
'ext': 'mp4', 'title': 'Yes or No', 'description': 'Ally, Brennan, and Zac are asked a simple question, but is there a correct answer?', 'release_date': '20200508', 'thumbnail': 'https://vhx.imgix.net/chuncensoredstaging/assets/351e3f24-c4a...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.786
suggestion
225
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
season_title = season_id.replace('-', ' ').title() webpage = self._download_webpage(url, season_id) items = get_elements_by_class('js-collection-item', webpage) entries = [] for item in items: url = self._search_regex(r'a href=["\'](.+?)["\'] class=["\']browse-item-l...
```suggestion seasons = (get_element_by_class('select-dropdown-wrapper', webpage) or '').strip().replace('\n', '') current_season = self._search_regex(r'<option\s(?:[^>]+?)\bselected>\s*([^<]+?)\s*</option>', seasons, 'current_season', default='') ...
{ 'url': 'https://www.dropout.tv/dimension-20-fantasy-high/season:1/videos/episode-1', 'note': 'Episode in a series (missing release_date)', 'md5': '712caf7c191f1c47c8f1879520c2fa5c', 'info_dict': { 'id': '320562', 'display_id': 'ep...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
1
suggestion
578
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
signin_page = self._download_webpage(self._LOGIN_URL, None, note='Getting authenticity token') authenticity_token = self._html_search_regex( r'name=["\']authenticity_token["\'] value=["\'](.+?)["\']', signin_page, 'authenticity_token')...
```suggestion ``` handled by finally
r'Season (\d+),', season_episode or '', 'season', default=None)), 'release_date': unified_strdate(self._search_regex( r'data-meta-field-name=["\']release_dates["\'] data-meta-field-value=["\'](.+?)["\']', watch_info, 'release date', default=None)), } ...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.571
suggestion
38
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
}, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'] } ] def _get_authenticity_token(self): signin_page = self._download_webpage(self._LOGIN_URL, None, note='Getting authenticity token') authe...
```suggestion def _login(self, display_id): username, password = self._get_login_info() if not (username and password): self.raise_login_required() payload = { 'email': username, 'password': password, 'authenticity_token': self._get_a...
'description': self._html_search_meta('description', webpage, fatal=False), 'thumbnail': thumbnail.split('?')[0] if thumbnail else None, # Ignore crop/downscale 'series': clean_html(get_element_by_class('series-title', watch_info)), 'episode_number': episode_number, ...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.857
security
600
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
# coding: utf-8 from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( urlencode_postdata, get_element_by_id, get_element_by_class, get_elements_by_class, clean_html ) class DropoutSeasonIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropout\.tv/(?P<id>[^\/...
please move this below the video IE
# coding: utf-8 from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( clean_html, ExtractorError, get_element_by_class, get_element_by_id, get_elements_by_class, int_or_none, join_nonempty, unified_strdate, urlencode_postdata, ) class DropoutIE(InfoE...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor):
yt_dlp/extractor/dropout.py
13
Python
0.143
refactor
35
38
38
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
'ext': 'mp4', 'title': 'Misfits & Magic Holiday Special', 'description': 'The magical misfits spend Christmas break at Gowpenny, with an unwelcome visitor.', 'release_date': '20211215', 'thumbnail': 'https://vhx.imgix.net/chuncensoredstagin...
```suggestion self.raise_login_required(method='password') ```
r'Episode (\d+)', season_episode or '', 'episode', default=None)) return { '_type': 'url_transparent', 'ie_key': VHXEmbedIE.ie_key(), 'url': embed_url, 'id': self._search_regex(r'embed.vhx.tv/videos/(.+?)\?', embed_url, 'id'), 'display_id'...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.571
suggestion
76
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
signin_page, 'authenticity_token') return authenticity_token def _login(self): username, password = self._get_login_info() if not (username and password): self.raise_login_required() payload = { 'email': username, 'password': password...
should be ExtractorError since user gave credentials already
} class DropoutSeasonIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropout\.tv/(?P<id>[^\/$&?#]+)(?:/?$|/season:[0-9]+/?$)' _TESTS = [ { 'url': 'https://www.dropout.tv/dimension-20-fantasy-high/season:1', 'note': 'Multi-season series with the season in the url', ...
@@ -0,0 +1,233 @@ +# coding: utf-8 +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + urlencode_postdata, + get_element_by_id, + get_element_by_class, + get_elements_by_class, + clean_html +) + + +class DropoutSeasonIE(InfoExtractor): + _VALID_URL = r'https?://(...
yt_dlp/extractor/dropout.py
26
Python
0.429
security
60
51
51
false
[dropout] Added extractor
2,045
yt-dlp/yt-dlp
132,642
Python
pukkandan
ghost
""" Extracts a relative time from string and converts to dt object e.g. 'streamed 6 days ago', '5 seconds ago (edited), updated today' """ mobj = re.search(r'(?P<start>today|yesterday|now)|(?P<time>\d+)\s*(?P<unit>microsecond|second|minute|hour|day|week|month|year)s?\s*ago', rela...
the latter regex here by @MinePlayersPE is probably a bit overkill currently I am assuming the language is always en_US, otherwise for other english dialects such as en_GB we'd need to set `day_first=False` in `unified_timestamp`
""" Extract thumbnails from thumbnails dict @param path_list: path list to level that contains 'thumbnails' key """ thumbnails = [] for path in path_list or [()]: for thumbnail in traverse_obj(data, (*variadic(path), 'thumbnails', ...), default=[]): ...
@@ -686,6 +698,13 @@ def _extract_time_text(self, renderer, *path_list): timestamp = None if isinstance(dt, datetime.datetime): timestamp = calendar.timegm(dt.timetuple()) + + if timestamp is None: + timestamp = ( + unified_timestamp(text) or unified_times...
yt_dlp/extractor/youtube.py
26
Python
0.571
suggestion
232
51
51
false
[youtube:tab] Extract view count, playlist count and last updated for playlists
2,069
yt-dlp/yt-dlp
132,642
Python
coletdjnz
coletdjnz
lambda x: x['thumbnailRenderer']['playlistVideoThumbnailRenderer']['thumbnail']['thumbnails'], list) or []) thumbnails = [] for t in thumbnails_list: if not isinstance(t, dict): continue thumbnail_url = url_...
wonder if its worth removing time_text being returned. only used in comments in which that isn't supposed to be used anyways.
title = renderer.get('title') description = renderer.get('description', '') playlist_id = channel_id tags = renderer.get('keywords', '').split() thumbnails = ( self._extract_thumbnails(renderer, 'avatar') or self._extract_thumbnails( ...
@@ -3625,12 +3642,14 @@ def _extract_from_tabs(self, item_id, ytcfg, data, tabs): }) if playlist_id is None: playlist_id = item_id + + view_count = self._get_count(primary_sidebar_renderer, ['stats', 1]) if title is None: - title = ( - try_get...
yt_dlp/extractor/youtube.py
26
Python
0.429
suggestion
125
51
51
false
[youtube:tab] Extract view count, playlist count and last updated for playlists
2,069
yt-dlp/yt-dlp
132,642
Python
coletdjnz
coletdjnz
'url': thumbnail_url, 'width': int_or_none(t.get('width')), 'height': int_or_none(t.get('height')), }) if playlist_id is None: playlist_id = item_id view_count = self._get_count(primary_sidebar_renderer, ['stats', 1]) if ti...
TODO: create a new field of some kind for the date/timestamp of when video/playlist is updated on the site
playlist_stats = traverse_obj(primary_sidebar_renderer, 'stats') last_updated_unix, _ = self._extract_time_text(playlist_stats, 2) if title is None: title = self._get_text(data, ('header', 'hashtagHeaderRenderer', 'hashtag')) or playlist_id title += format_field(selected_tab...
@@ -3640,10 +3659,10 @@ def _extract_from_tabs(self, item_id, ytcfg, data, tabs): 'uploader_url': channel_url, 'thumbnails': thumbnails, 'tags': tags, + 'view_count': view_count, + 'availability': self._extract_availability(data), + 'last_updated_d...
yt_dlp/extractor/youtube.py
26
Python
0.357
suggestion
106
51
51
false
[youtube:tab] Extract view count, playlist count and last updated for playlists
2,069
yt-dlp/yt-dlp
132,642
Python
coletdjnz
coletdjnz
'http://www.bilibili.tv/video/av%s/' % video_id, ie=BiliBiliIE.ie_key(), video_id=video_id) class BiliIntlBaseIE(InfoExtractor): _API_URL = 'https://api.bilibili.tv/intl/gateway' def _call_api(self, endpoint, *args, **kwargs): return self._download_json(self._API_URL + endpoin...
```suggestion sub_data = self._download_json( sub_url, ep_id, errnote='Unable to download subtitles', fatal=False, note='Downloading subtitles%s' % f' for {sub["lang"]}' if sub.get('lang') else '') ```
'http://www.bilibili.tv/video/av%s/' % video_id, ie=BiliBiliIE.ie_key(), video_id=video_id) class BiliIntlBaseIE(InfoExtractor): _API_URL = 'https://api.bilibili.tv/intl/gateway' def _call_api(self, endpoint, *args, **kwargs): return self._download_json(self._API_URL + endpoin...
@@ -722,40 +723,51 @@ def _real_extract(self, url): class BiliIntlBaseIE(InfoExtractor): - _API_URL = 'https://api.bili{}/intl/gateway{}' + _API_URL = 'https://api.bilibili.tv/intl/gateway' - def _call_api(self, type, endpoint, id): - return self._download_json(self._API_URL.format(type, endpoint...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
249
51
51
false
[BiliIntl] Fix extractor
2,077
yt-dlp/yt-dlp
132,642
Python
pukkandan
MinePlayersPE
'only_matching': True, }] @staticmethod def _extract_embed_url(webpage): mobj = re.search( r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?instagram\.com/p/[^/]+/embed.*?)\1', webpage) if mobj: return mobj.group('url') blockquote...
Do we lose metadata with this? If so, explain that in the warning. If not, warning isn't needed
'url': 'https://www.instagram.com/marvelskies.fc/reel/CWqAgUZgCku/', 'only_matching': True, }] @staticmethod def _extract_embed_url(webpage): mobj = re.search( r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?instagram\.com/p/[^/]+/embed.*?)\1', webpa...
@@ -293,7 +293,9 @@ def _real_extract(self, url): video_id, url = self._match_valid_url(url).group('id', 'url') webpage, urlh = self._download_webpage_handle(url, video_id) if 'www.instagram.com/accounts/login' in urlh.geturl(): - self.raise_login_required('You need to log in to ac...
yt_dlp/extractor/instagram.py
26
Python
0.214
question
95
51
51
false
[Instagram] Try bypassing login wall with embed page
2,095
yt-dlp/yt-dlp
132,642
Python
pukkandan
MinePlayersPE
# the rest, including the query param, is just to keep parity with the website form_data = { 'bid': broadcaster_id, 'type': 'live', 'player_type': 'html5', 'stream_type': 'common', 'mode': 'landing', 'from_api': 0, } ...
if this is not done then mark this PR as draft, else remove this
if stream_info.get('view_url'): formats.append({ 'format_id': quality_str, 'url': update_url_query(stream_info['view_url'], {'aid': aid}), 'ext': 'mp4', 'protocol': 'm3u8', 'quality': quality...
@@ -380,3 +383,177 @@ def _real_extract(self, url): }) return info + + +class AfreecaTVLiveIE(AfreecaTVIE): + ''' + Extractor for live streams on AfreecaTV. + + Outstanding issues: + - when a streamer's connection drops for some period of time (roughly, more than 30 seconds + ...
yt_dlp/extractor/afreecatv.py
26
Python
0.286
refactor
64
51
27
false
[afreecatv] Add support for livestreams
2,097
yt-dlp/yt-dlp
132,642
Python
Ashish0804
wlritchi
_STREAM_KEY_TYPES = [ 'common', 'mobileweb', 'chromecast', ] _QUALITIES = [ 'sd', 'hd', 'hd2k', 'original', ] def _real_extract(self, url): match = self._match_valid_url(url) broadcaster_id = match.group('id') broadcast...
try to minimize the required fields
'type': 'aid', 'quality': quality_str, }), note=f'Downloading access token for {quality_str} stream', errnote=f'Unable to download access token for {quality_str} stream') aid = traverse_obj(aid_response, ('CHANNEL', 'AID...
@@ -380,3 +383,177 @@ def _real_extract(self, url): }) return info + + +class AfreecaTVLiveIE(AfreecaTVIE): + ''' + Extractor for live streams on AfreecaTV. + + Outstanding issues: + - when a streamer's connection drops for some period of time (roughly, more than 30 seconds + ...
yt_dlp/extractor/afreecatv.py
26
Python
0.071
suggestion
35
51
45
false
[afreecatv] Add support for livestreams
2,097
yt-dlp/yt-dlp
132,642
Python
Ashish0804
wlritchi
'title': channel_info.get('TITLE'), 'uploader': channel_info.get('BJNICK'), 'uploader_id': channel_info.get('BJID'), 'formats': formats, } # try for a little bit of extra metadata try: station_info = self._download_json( ...
no need for this to be in try-except block. Just let it be `None` if extraction failed
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_xpath from ..utils import ( date_from_str, determine_ext, ExtractorError, int_or_none, qualities, traverse_obj, unified_strdate, unified_timestamp, update...
@@ -380,3 +383,177 @@ def _real_extract(self, url): }) return info + + +class AfreecaTVLiveIE(AfreecaTVIE): + ''' + Extractor for live streams on AfreecaTV. + + Outstanding issues: + - when a streamer's connection drops for some period of time (roughly, more than 30 seconds + ...
yt_dlp/extractor/afreecatv.py
26
Python
0.429
bug
87
29
480
false
[afreecatv] Add support for livestreams
2,097
yt-dlp/yt-dlp
132,642
Python
Ashish0804
wlritchi
stream_info = self._download_json( stream_info_url, broadcast_no, query={ 'return_type': cdn, 'use_cors': True, 'cors_origin_url': 'play.afreecatv.com', ...
remove try-except here aswell. set `fatal=False` for api requests and then use `.get` or `try_get` to get the fields. As of making sure shit is not appended to formats, make a check for all the necessary keys and only append if they are not None
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_xpath from ..utils import ( date_from_str, determine_ext, ExtractorError, int_or_none, qualities, traverse_obj, unified_strdate, unified_timestamp, update...
@@ -380,3 +382,147 @@ def _real_extract(self, url): }) return info + + +class AfreecaTVLiveIE(AfreecaTVIE): + ''' + Extractor for live streams on AfreecaTV. + + Outstanding issues: + - when a streamer's connection drops for some period of time (roughly, more than 30 seconds + ...
yt_dlp/extractor/afreecatv.py
26
Python
0.643
style
249
49
480
false
[afreecatv] Add support for livestreams
2,097
yt-dlp/yt-dlp
132,642
Python
Ashish0804
wlritchi
'uploader': uploader, 'uploader_id': uploader_id, 'duration': duration, 'thumbnail': thumbnail, } if determine_ext(video_url) == 'm3u8': info['formats'] = self._extract_m3u8_formats( video_url, video_id, 'mp4', entry_protocol='...
Add tests for the other URL patterns. `only_matching` tests are sufficient
'uploader': uploader, 'uploader_id': uploader_id, 'duration': duration, 'thumbnail': thumbnail, } if determine_ext(video_url) == 'm3u8': info['formats'] = self._extract_m3u8_formats( video_url, video_id, 'mp4', entry_protocol='...
@@ -380,3 +384,90 @@ def _real_extract(self, url): }) return info + + +class AfreecaTVLiveIE(AfreecaTVIE): + + IE_NAME = 'afreecatv:live' + _VALID_URL = r'https?://play\.afreeca(?:tv)?\.com(?::\d+)?/(?P<id>[^/]+)(?:/(?P<bno>\d+))?'
yt_dlp/extractor/afreecatv.py
26
Python
0.357
suggestion
74
51
51
false
[afreecatv] Add support for livestreams
2,097
yt-dlp/yt-dlp
132,642
Python
pukkandan
wlritchi
'age_limit': 15, }, 'skip': True, }, { 'url': 'https://sketch.pixiv.net/@8aki/lives/3553803162487249670', 'info_dict': { 'id': '3553803162487249670', 'title': '原稿', 'uploader': '8aki', 'uploader_id': '8aki', 'age...
pretty sure this isn't needed. The next line should automatically raise the same error. Unless this is `expected=True`?
'age_limit': 15, 'timestamp': 1640347640, }, 'skip': True, }, { 'url': 'https://sketch.pixiv.net/@8aki/lives/3553803162487249670', 'info_dict': { 'id': '1593420639479156945', 'title': 'おまけ本作業(リョナ有)', 'uploader': 'おぶい / Obui'...
@@ -0,0 +1,118 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + ExtractorError, + unified_timestamp, +) + + +class PixivSketchBaseIE(InfoExtractor): + def _call_api(self, video_id, path, referer): + response = s...
yt_dlp/extractor/pixivsketch.py
26
Python
0.714
question
119
51
51
false
[PixivSketch] add support for sketch.pixiv.net
2,104
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( traverse_obj, ExtractorError, unified_timestamp, ) class PixivSketchBaseIE(InfoExtractor): def _call_api(self, video_id, path, referer): response = self._download_json(f'https://ske...
This can be modified like this to better be inline with the vars and it's working ```suggestion response = self._download_json(f'https://sketch.pixiv.net/api/{path}{video_id}.json', video_id, headers={ ```
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, traverse_obj, unified_timestamp, ) class PixivSketchBaseIE(InfoExtractor): def _call_api(self, video_id, path, referer, note='Downloading JSON metadata'): response =...
@@ -0,0 +1,118 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + ExtractorError, + unified_timestamp, +) + + +class PixivSketchBaseIE(InfoExtractor): + def _call_api(self, video_id, path, referer): + response = s...
yt_dlp/extractor/pixivsketch.py
14
Python
0.857
suggestion
217
39
39
false
[PixivSketch] add support for sketch.pixiv.net
2,104
yt-dlp/yt-dlp
132,642
Python
Ashish0804
Lesmiscore
class PixivSketchUserIE(PixivSketchBaseIE): IE_NAME = 'pixiv:sketch:user' _VALID_URL = r'https?://sketch\.pixiv\.net/@(?P<id>[a-zA-Z0-9_-]+)/?' _TESTS = [{ 'url': 'https://sketch.pixiv.net/@nuhutya', 'only_matching': True, }, { 'url': 'https://sketch.pixiv.net/@namahyou', ...
u can make additional requests here if needed
class PixivSketchUserIE(PixivSketchBaseIE): IE_NAME = 'pixiv:sketch:user' _VALID_URL = r'https?://sketch\.pixiv\.net/@(?P<id>[a-zA-Z0-9_-]+)/?' _TESTS = [{ 'url': 'https://sketch.pixiv.net/@nuhutya', 'only_matching': True, }, { 'url': 'https://sketch.pixiv.net/@namahyou', ...
@@ -0,0 +1,118 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + ExtractorError, + unified_timestamp, +) + + +class PixivSketchBaseIE(InfoExtractor): + def _call_api(self, video_id, path, referer): + response = s...
yt_dlp/extractor/pixivsketch.py
26
Python
0.071
suggestion
45
30
34
false
[PixivSketch] add support for sketch.pixiv.net
2,104
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( traverse_obj, ExtractorError, unified_timestamp, ) class PixivSketchBaseIE(InfoExtractor): def _call_api(self, video_id, path, referer): response = self._download_json(f'https://ske...
```suggestion ExtractorError, traverse_obj, unified_timestamp, ```
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, traverse_obj, unified_timestamp, ) class PixivSketchBaseIE(InfoExtractor): def _call_api(self, video_id, path, referer, note='Downloading JSON metadata'): response =...
@@ -0,0 +1,118 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + ExtractorError, + unified_timestamp,
yt_dlp/extractor/pixivsketch.py
8
Python
0.786
refactor
82
33
33
false
[PixivSketch] add support for sketch.pixiv.net
2,104
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( traverse_obj, ExtractorError, unified_timestamp, ) class PixivSketchBaseIE(InfoExtractor): def _call_api(self, video_id, path, referer): response = self._download_json(f'https://sketch.pixiv.net/ap...
these tests doesnt seem to have ever been actually run!?
from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, traverse_obj, unified_timestamp, ) class PixivSketchBaseIE(InfoExtractor): def _call_api(self, video_id, path, referer, note='Downloading JSON metadata'): response = self._download_...
@@ -0,0 +1,118 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + ExtractorError, + unified_timestamp, +) + + +class PixivSketchBaseIE(InfoExtractor): + def _call_api(self, video_id, path, referer): + response = s...
yt_dlp/extractor/pixivsketch.py
26
Python
0.214
question
56
51
51
false
[PixivSketch] add support for sketch.pixiv.net
2,104
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
'url': 'https://sketch.pixiv.net/@namahyou', 'only_matching': True, }, { 'url': 'https://sketch.pixiv.net/@8aki', 'only_matching': True, }] @classmethod def suitable(cls, url): return super(PixivSketchUserIE, cls).suitable(url) and not PixivSketchIE.suitable(url)...
```suggestion try: self._call_api(user_id, 'users/current.json', url, 'Investigating reason for request failure') except ExtractorError as ex: if ex.cause and ex.cause.code == 401: raise ExtractorError(f'Please log in, or use direct link l...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, traverse_obj, unified_timestamp, ) class PixivSketchBaseIE(InfoExtractor): def _call_api(self, video_id, path, referer, note='Downloading JSON metadata'): response =...
@@ -0,0 +1,126 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + unified_timestamp, +) + + +class PixivSketchBaseIE(InfoExtractor): + def _call_api(self, video_id, path, referer, note='Downloading JSON...
yt_dlp/extractor/pixivsketch.py
26
Python
1
bug
489
29
123
false
[PixivSketch] add support for sketch.pixiv.net
2,104
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
_TESTS = [{ 'url': 'https://sketch.pixiv.net/@nuhutya', 'only_matching': True, }, { 'url': 'https://sketch.pixiv.net/@namahyou', 'only_matching': True, }, { 'url': 'https://sketch.pixiv.net/@8aki', 'only_matching': True, }] @classmethod def suitab...
```suggestion self.raise_login_required(f'Please log in, or use direct link like https://sketch.pixiv.net/@{user_id}/1234567890', method='cookies') raise ExtractorError('This user is offline', expected=True) ```
_TESTS = [{ 'url': 'https://sketch.pixiv.net/@nuhutya', 'only_matching': True, }, { 'url': 'https://sketch.pixiv.net/@namahyou', 'only_matching': True, }, { 'url': 'https://sketch.pixiv.net/@8aki', 'only_matching': True, }] @classmethod def suitab...
@@ -0,0 +1,122 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, + unified_timestamp, +) + + +class PixivSketchBaseIE(InfoExtractor): + def _call_api(self, video_id, path, referer, note='Downloading JSON...
yt_dlp/extractor/pixivsketch.py
26
Python
1
refactor
246
29
29
false
[PixivSketch] add support for sketch.pixiv.net
2,104
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
def get_element_by_attribute(attribute, value, html, escape_value=True, return_content=True): retval = get_elements_by_attribute(attribute, value, html, escape_value, return_content) return retval[0] if retval else None def get_elements_by_class(class_name, html, return_content=True): """Return the conte...
The tests are green again, but this regex does not match such an element: ```html <div id="player_div_id" data-kwik_image="https://www.megatv.com/wp-content/uploads/2021/10/ΠΕΙΡΑΙΑΣ-1024x450.jpg" data-share_url="https://www.megatv.com/2021/10/23/egkainia-gia-ti-nea-skini-omega-tou-dimotikou-theatrou...
def get_element_by_class(class_name, html): """Return the content of the first tag with the specified class in the passed HTML document""" retval = get_elements_by_class(class_name, html) return retval[0] if retval else None def get_element_html_by_class(class_name, html): """Return the html of the fi...
@@ -410,54 +410,126 @@ def xpath_attr(node, xpath, key, name=None, fatal=False, default=NO_DEFAULT): return n.attrib[key] -def get_element_by_id(id, html): - """Return the content of the tag with the specified ID in the passed HTML document""" - return get_element_by_attribute('id', id, html) +def get_el...
yt_dlp/utils.py
26
Python
0.786
suggestion
1,308
51
51
false
[utils] Improve parsing for nested HTML elements
2,129
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
def get_element_by_id(id, html, return_content=True): """Return the content or the tag with the specified ID in the passed HTML document""" return get_element_by_attribute('id', id, html, return_content=return_content) def get_element_by_class(class_name, html, return_content=True): """Return the content...
changing return value entirely based on an argument is generally bad practice. Better to have separate functions for it. Maybe `get_element_html_by_class` etc. You can have a `get_elements_text_and_html_by_attribute` that returns `text, whole` over which everything else can be wrapped
def get_element_by_id(id, html): """Return the content of the tag with the specified ID in the passed HTML document""" return get_element_by_attribute('id', id, html) def get_element_html_by_id(id, html): """Return the html of the tag with the specified ID in the passed HTML document""" return get_el...
@@ -410,54 +410,126 @@ def xpath_attr(node, xpath, key, name=None, fatal=False, default=NO_DEFAULT): return n.attrib[key] -def get_element_by_id(id, html): - """Return the content of the tag with the specified ID in the passed HTML document""" - return get_element_by_attribute('id', id, html) +def get_el...
yt_dlp/utils.py
26
Python
0.643
suggestion
285
51
51
false
[utils] Improve parsing for nested HTML elements
2,129
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
def get_elements_html_by_attribute(*args, **kwargs): """Return the html of the tag with the specified attribute in the passed HTML document""" return [whole for _, whole in get_elements_text_and_html_by_attribute(*args, **kwargs)] def get_elements_text_and_html_by_attribute(attribute, value, html, escape_val...
don't name a group `_`. It's confusing
def get_elements_html_by_attribute(*args, **kwargs): """Return the html of the tag with the specified attribute in the passed HTML document""" return [whole for _, whole in get_elements_text_and_html_by_attribute(*args, **kwargs)] def get_elements_text_and_html_by_attribute(attribute, value, html, escape_val...
@@ -415,49 +415,161 @@ def get_element_by_id(id, html): return get_element_by_attribute('id', id, html) +def get_element_html_by_id(id, html): + """Return the html of the tag with the specified ID in the passed HTML document""" + return get_element_html_by_attribute('id', id, html) + + def get_element_b...
yt_dlp/utils.py
26
Python
0.214
suggestion
38
51
51
false
[utils] Improve parsing for nested HTML elements
2,129
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
def __exit__(self, *_): self.close() def close(self): # handle_endtag does not return upon raising HTMLBreakOnClosingTagException, # so data remains buffered; we no longer have any interest in it, thus # override this method to discard it pass def handle_starttag(se...
Shouldn't this be `get_element_text_and_html_by_tag`? since that's how the other functions are named
self.close() def close(self): # handle_endtag does not return upon raising HTMLBreakOnClosingTagException, # so data remains buffered; we no longer have any interest in it, thus # override this method to discard it pass def handle_starttag(self, tag, _): self.ta...
@@ -415,49 +415,161 @@ def get_element_by_id(id, html): return get_element_by_attribute('id', id, html) +def get_element_html_by_id(id, html): + """Return the html of the tag with the specified ID in the passed HTML document""" + return get_element_html_by_attribute('id', id, html) + + def get_element_b...
yt_dlp/utils.py
26
Python
0.571
suggestion
100
51
51
false
[utils] Improve parsing for nested HTML elements
2,129
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
if program_guid: entries.append(embed_url) continue video_id = embed_qs.get('id', [None])[0] if not video_id: continue urlh = ie._request_webpage( embed_url, video_id, note='Following embed URL redirect') ...
Tautologous since `len([]) != 1`?
program_guid = _program_guid(embed_qs) if program_guid: entries.append(embed_url) continue video_id = embed_qs.get('id', [None])[0] if not video_id: continue urlh = ie._request_webpage( embed_url,...
@@ -160,6 +197,25 @@ def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_para video.attrib['src'] = re.sub(r'(https?://vod05)t(-mediaset-it\.akamaized\.net/.+?.mpd)\?.+', r'\1\2', video.attrib['src']) return super(MediasetIE, self)._parse_smil_formats(smil, smil_url, video_...
yt_dlp/extractor/mediaset.py
26
Python
0.214
question
33
51
51
false
[mediaset] fix #2149
2,158
yt-dlp/yt-dlp
132,642
Python
dirkf
nixxo
https?:// (?:(?:www|static3)\.)?mediasetplay\.mediaset\.it/ (?: (?:fiction|programmi-tv|serie-tv)/(?:.+?/)? (?:[a-z]+)_SE(?P<id>\d{12}) ...
It's `playlist_mincount` (as I remembered when a test unexpectedly succeeded with `playlist_min_count`).
'info_dict': { 'id': '100013375', 'title': 'I servizi', }, 'playlist_mincount': 50, }] _BY_SUBBRAND = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{%s}&sort=:publishInfo_lastPublished|desc,tvSeason...
@@ -310,23 +342,23 @@ class MediasetShowIE(MediasetIE): 'id': '000000002763', 'title': 'Le Iene', }, - 'playlist_count': 7, + 'playlist_count_min': 7,
yt_dlp/extractor/mediaset.py
26
Python
0.5
suggestion
104
51
37
false
[mediaset] fix #2149
2,158
yt-dlp/yt-dlp
132,642
Python
dirkf
nixxo
# get all manifest urls and remove duplicates manifests = [f.get('manifest_url') for f in tp_formats] manifests = list(dict.fromkeys(filter(None, manifests))) # return original formats if not DRM manifest is found if len(manifests) != 1 or ( len(manifests) == 1 a...
Although it doesn't help to acquire any media, it could be good to prioritise geo-blocking errors over missing formats, etc: Here: ``` first_e = geo_e = None ``` At l.240 below, after `first_e = e` (and `GeoRestrictedError` has to be imported): ``` if not geo_e and isinstance(e, GeoRestri...
def _check_drm_formats(self, tp_formats, video_id): has_nondrm, drm_manifest = False, '' for f in tp_formats: if '_sampleaes/' in (f.get('manifest_url') or ''): drm_manifest = drm_manifest or f['manifest_url'] f['has_drm'] = True if not f.get('...
@@ -226,6 +226,7 @@ def _real_extract(self, url): first_e = None
yt_dlp/extractor/mediaset.py
26
Python
1
refactor
611
51
51
false
[mediaset] fix #2149
2,158
yt-dlp/yt-dlp
132,642
Python
dirkf
nixxo
# TODO: fixup ISM+none manifest URLs has_drm = False for f in ('MPEG4', 'M3U'): try: tp_formats, tp_subtitles = self._extract_theplatform_smil( update_url_query('http://link.theplatform.%s/s/%s' % (self._TP_TLD, tp_path), { ...
Most of the time, you dont need to raise DRM error manually. leave the formats with DRM in the format list with a key `has_drm=True`. Then the core program will automatically raise the appropriate error. With appropriate changes to `_check_drm_formats` (see my other comment), this should simplify to ```py ...
tp_formats, tp_subtitles = self._extract_theplatform_smil( update_url_query('http://link.theplatform.%s/s/%s' % (self._TP_TLD, tp_path), { 'mbr': 'true', 'formats': f, 'assetTypes': asset_type, ...
@@ -179,13 +237,24 @@ def _real_extract(self, url): 'assetTypes': asset_type, }), guid, 'Downloading %s SMIL data' % (f.split('+')[0])) except ExtractorError as e: + if not geo_e and isinstance(e, GeoRestrictedError): + geo_e =...
yt_dlp/extractor/mediaset.py
26
Python
1
refactor
482
51
51
false
[mediaset] fix #2149
2,158
yt-dlp/yt-dlp
132,642
Python
pukkandan
nixxo
'thumbnail': thumbnail, }) if feed_data.get('programType') == 'episode': info.update({ 'episode_number': int_or_none( feed_data.get('tvSeasonEpisodeNumber')), 'season_number': int_or_none( ...
```suggestion _VALID_URL = r'(?x)https?://(?:www\.)?\w+\.mediaset\.it/video/[\w-]+_(?P<id>\d{5,})\.s?html?' ```
'series': feed_data.get('mediasetprogram$brandTitle'), }) info.update({ 'id': guid, 'formats': formats, 'subtitles': subtitles, }) return info class MediasetShowIE(MediasetIE): _VALID_URL = r'''(?x) ...
@@ -218,6 +294,29 @@ def _real_extract(self, url): return info +class MediasetClipIE(MediasetIE): + _VALID_URL = r'''(?x) + https?:// + (?:www\.)?\w+\.mediaset\.it/ + video/[\w-]+_(?P<id>\d{5,})\.s?html? + '''
yt_dlp/extractor/mediaset.py
26
Python
0.714
suggestion
117
51
51
false
[mediaset] fix #2149
2,158
yt-dlp/yt-dlp
132,642
Python
pukkandan
nixxo
entries.append(embed_url) return entries def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_params=None, transform_rtmp_url=None): for video in smil.findall(self._xpath_ns('.//video', namespace)): video.attrib['src'] = re.sub(r'(https?://vod05)t(...
```py def _check_drm_formats(self, tp_formats, video_id): has_nondrm, drm_manifest = False, '' for f in tp_formats: if '_sampleaes/' in f.get('manifest_url'): drm_manifest = drm_manifest or f['manifest_url'] f['has_drm'] = True if not f....
entries.append(embed_url) return entries def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_params=None, transform_rtmp_url=None): for video in smil.findall(self._xpath_ns('.//video', namespace)): video.attrib['src'] = re.sub(r'(https?://vod05)t(...
@@ -160,17 +198,37 @@ def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_para video.attrib['src'] = re.sub(r'(https?://vod05)t(-mediaset-it\.akamaized\.net/.+?.mpd)\?.+', r'\1\2', video.attrib['src']) return super(MediasetIE, self)._parse_smil_formats(smil, smil_url, video...
yt_dlp/extractor/mediaset.py
26
Python
0.857
refactor
682
51
51
false
[mediaset] fix #2149
2,158
yt-dlp/yt-dlp
132,642
Python
pukkandan
nixxo
self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id, note='Downloading video webpage') next_json = self._search_regex( r'id=\"__NEXT_DATA__\"\s+type=\"application\/json\"\s*[^>]+>\s*(?P<next_data>[^<]+)', webpage, 'next data', group='next_...
```suggestion if next_json: next_data = self._parse_json(next_json, video_id) status = traverse_obj(next_data, ('props', 'pageProps', 'statusCode'), expected_type=int) or 0 video_data = traverse_obj(next_data, ('props', 'pageProps', 'itemInfo', 'itemStruct'), expected_typ...
self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id, note='Downloading video webpage') next_json = self._search_regex( r'id=\"__NEXT_DATA__\"\s+type=\"application\/json\"\s*[^>]+>\s*(?P<next_data>[^<]+)', webpage, 'next data', group='next_...
@@ -415,20 +416,30 @@ def _real_extract(self, url): # If we only call once, we get a 403 when downlaoding the video. self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id, note='Downloading video webpage') - json_string = self._search_regex( - ...
yt_dlp/extractor/tiktok.py
26
Python
1
refactor
1,062
51
51
false
[TikTok] Fix extraction for sigi-based webpages
2,164
yt-dlp/yt-dlp
132,642
Python
pukkandan
MinePlayersPE
} streamInfo { dashUrl hlsUrl url } tags { tag { name } } restrictedReason id''', track_id, username, slug) if not cloudcast: raise ExtractorError('Track not found', expected=True) if cloudcast['restrictedReason']: ...
```suggestion reason = cloudcast.get('restrictedReason') if reason == 'tracklist': raise ExtractorError('Track unavailable in your country due to licensing restrictions', expected=True) elif reason == 'repeat_play': raise ExtractorError('You have reached your play li...
} streamInfo { dashUrl hlsUrl url } tags { tag { name } } restrictedReason id''', track_id, username, slug) if not cloudcast: raise ExtractorError('Track not found', expected=True) reason = cloudcast.get('restrictedReason') ...
@@ -125,7 +126,22 @@ def _real_extract(self, url): tag { name } - }''', track_id, username, slug) + } + restrictedReason + id''', track_id, username, slug) + + if not cloudcast: + raise ExtractorError('Track not found', expected=True) + + if cloudcast['restric...
yt_dlp/extractor/mixcloud.py
26
Python
1
refactor
454
51
51
false
[mixcloud] add restriction detection
2,169
yt-dlp/yt-dlp
132,642
Python
pukkandan
liamengland1
return ms_info mpd_duration = parse_duration(mpd_doc.get('mediaPresentationDuration')) formats, subtitles = [], {} stream_numbers = collections.defaultdict(int) for period in mpd_doc.findall(_add_ns('Period')): period_duration = parse_duration(period.get('duratio...
this is fine. The audio/video content_type is only used for creating format_id. If there is video+sub (or audio+sub), it makes sense to label it as video/audio and not as sub
return ms_info mpd_duration = parse_duration(mpd_doc.get('mediaPresentationDuration')) formats, subtitles = [], {} stream_numbers = collections.defaultdict(int) for period in mpd_doc.findall(_add_ns('Period')): period_duration = parse_duration(period.get('duratio...
@@ -2712,11 +2712,17 @@ def extract_Initialization(source): mime_type = representation_attrib['mimeType'] content_type = representation_attrib.get('contentType', mime_type.split('/')[0]) - codecs = representation_attrib.get('codecs', '') + ...
yt_dlp/extractor/common.py
26
Python
0.571
style
174
51
51
false
Recognise timed-text codecs in DASH manifests (stpp and wvtt)
2,174
yt-dlp/yt-dlp
132,642
Python
pukkandan
fstirlitz
parts = full_codec.split('.') codec = parts[0].replace('0', '') if codec in ('avc1', 'avc2', 'avc3', 'avc4', 'vp9', 'vp8', 'hev1', 'hev2', 'h263', 'h264', 'mp4v', 'hvc1', 'av1', 'theora', 'dvh1', 'dvhe'): if not vcodec: vcodec = '.'.join(parts[:4]...
In hindsight, I probably should have gone with `scodec` instead of `tcodec`. FFmpeg uses `s` for subtitle streams and `t` for attachments. We could probably still change it now with impunity, before anyone started depending on it…
parts = full_codec.split('.') codec = parts[0].replace('0', '') if codec in ('avc1', 'avc2', 'avc3', 'avc4', 'vp9', 'vp8', 'hev1', 'hev2', 'h263', 'h264', 'mp4v', 'hvc1', 'av1', 'theora', 'dvh1', 'dvhe'): if not vcodec: vcodec = '.'.join(parts[:4]...
@@ -3213,13 +3213,17 @@ def parse_codecs(codecs_str): elif codec in ('flac', 'mp4a', 'opus', 'vorbis', 'mp3', 'aac', 'ac-3', 'ec-3', 'eac3', 'dtsc', 'dtse', 'dtsh', 'dtsl'): if not acodec: acodec = full_codec + elif codec in ('stpp', 'wvtt',): + if not tcodec: + ...
yt_dlp/utils.py
26
Python
0.643
suggestion
233
51
51
false
Recognise timed-text codecs in DASH manifests (stpp and wvtt)
2,174
yt-dlp/yt-dlp
132,642
Python
fstirlitz
fstirlitz
def _call_webtools_api(self, host: str, path: str, item_id: str, query=None, note='Downloading webtools API JSON', fatal=False): # webtools docs: https://webtools.msvdn.net/ return self._download_json( urljoin(self._get_webtools_base_url(host), path), item_id, query=query, note=note, fa...
```suggestion description = traverse_obj(content_info, 'longDescription', 'shortDescription', expected_type=str) ``` get_all isnt applicable here
def _call_webtools_api(self, host: str, path: str, item_id: str, query=None, note='Downloading webtools API JSON', fatal=False): # webtools docs: https://webtools.msvdn.net/ return self._download_json( urljoin(self._get_webtools_base_url(host), path), item_id, query=query, note=note, fa...
@@ -0,0 +1,222 @@ +# coding: utf-8 +import re + +from .common import InfoExtractor + +from ..utils import ( + int_or_none, + js_to_json, + parse_duration, + traverse_obj, + try_get, + urljoin +) + + +class MainStreamingIE(InfoExtractor): + _VALID_URL = r'https?://(?:webtools-?)?(?P<host>[A-Za-z0-9-...
yt_dlp/extractor/mainstreaming.py
26
Python
0.857
suggestion
156
51
51
false
[MainStreaming] Add extractor
2,180
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
video_id = content_info.get('contentID') or video_id title = content_info.get('title') description = traverse_obj( content_info, 'longDescription', 'shortDescription', expected_type=str, get_all=False) is_live = was_live = False if content_info.get('drmEnabled'): ...
```suggestion live_status = 'was_live' ``` similar elsewhere would be simpler. You can also pass this directly in the infodict
video_id = content_info.get('contentID') or video_id title = content_info.get('title') description = traverse_obj(content_info, 'longDescription', 'shortDescription', expected_type=str) live_status = 'not_live' if content_info.get('drmEnabled'): self.report_drm(video_...
@@ -0,0 +1,222 @@ +# coding: utf-8 +import re + +from .common import InfoExtractor + +from ..utils import ( + int_or_none, + js_to_json, + parse_duration, + traverse_obj, + try_get, + urljoin +) + + +class MainStreamingIE(InfoExtractor): + _VALID_URL = r'https?://(?:webtools-?)?(?P<host>[A-Za-z0-9-...
yt_dlp/extractor/mainstreaming.py
26
Python
0.714
suggestion
145
51
51
false
[MainStreaming] Add extractor
2,180
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
music_info, ('matched_song', 'author'), ('matched_pgc_sound', 'author'), 'author', expected_type=str) is_generic_og_trackname = music_info.get('is_original_sound') and music_info.get('title') == 'original sound - %s' % music_info.get('owner_handle') if is_generic_og_trackname: m...
should this be subs, or automatic_captions?
music_info, ('matched_song', 'title'), ('matched_pgc_sound', 'title'), expected_type=str) contained_music_author = traverse_obj( music_info, ('matched_song', 'author'), ('matched_pgc_sound', 'author'), 'author', expected_type=str) is_generic_og_trackname = music_info.get('is_ori...
@@ -218,6 +238,7 @@ def extract_addr(addr, add_meta={}): 'artist': music_author, 'timestamp': int_or_none(aweme_detail.get('create_time')), 'formats': formats, + 'subtitles': subtitles,
yt_dlp/extractor/tiktok.py
26
Python
0.143
question
43
51
51
false
[TikTok] Extract auto captions
2,185
yt-dlp/yt-dlp
132,642
Python
pukkandan
MinePlayersPE
self._remove_duplicate_formats(formats) auth_cookie = self._get_cookies(self._WEBPAGE_HOST).get('sid_tt') if auth_cookie: for f in formats: self._set_cookie(compat_urllib_parse_urlparse(f['url']).hostname, 'sid_tt', auth_cookie.value) self._sort_formats(forma...
Move to `_get_automatic_captions`, tten call `extract_automatic_captions` (or `_get_subtitles`+`extract_subtitles`). This way, the extra requests are made only if subs are requested
'format_id': 'play_addr_h264', 'format_note': 'Direct video', 'vcodec': 'h264', })) if video_info.get('play_addr_bytevc1'): formats.extend(extract_addr(video_info['play_addr_bytevc1'], { 'format_id': 'play_addr_bytevc1', ...
@@ -171,6 +172,25 @@ def extract_addr(addr, add_meta={}): self._set_cookie(compat_urllib_parse_urlparse(f['url']).hostname, 'sid_tt', auth_cookie.value) self._sort_formats(formats, ('quality', 'codec', 'size', 'br')) + # TODO: Extract text positioning info + subtitles = {} + ...
yt_dlp/extractor/tiktok.py
26
Python
0.571
refactor
181
51
51
false
[TikTok] Extract auto captions
2,185
yt-dlp/yt-dlp
132,642
Python
pukkandan
MinePlayersPE
'id': content_id, 'duration': duration, 'formats': formats, 'subtitles': self._extract_subtitles(ptmd), } def _extract_player(self, webpage, video_id, fatal=True): return self._parse_json( self._search_regex( r'(?s)data-zdf...
```suggestion 'chapters': list, ``` should be sufficient
'id': content_id, 'duration': duration, 'formats': formats, 'subtitles': self._extract_subtitles(ptmd), } def _extract_player(self, webpage, video_id, fatal=True): return self._parse_json( self._search_regex( r'(?s)data-zdf...
@@ -136,18 +136,18 @@ def _extract_player(self, webpage, video_id, fatal=True): class ZDFIE(ZDFBaseIE): _VALID_URL = r'https?://www\.zdf\.de/(?:[^/]+/)*(?P<id>[^/?#&]+)\.html' _TESTS = [{ - # Same as https://www.3sat.de/film/ab-18/10-wochen-sommer-108.html - 'url': 'https://www.zdf.de/dokumenta...
yt_dlp/extractor/zdf.py
26
Python
0.643
suggestion
71
51
51
false
[zdf] add chapter extraction
2,198
yt-dlp/yt-dlp
132,642
Python
pukkandan
iw0nderhow
if layouts: for layout_key, layout_url in layouts.items(): layout_url = url_or_none(layout_url) if not layout_url: continue thumbnail = { 'url': layout_url, 'format_id': layout_key, ...
```suggestion chapter_marks = t.get('streamAnchorTag') or [] chapter_marks.append({'anchorOffset': int_or_none(t.get('duration'))}) chapters = [{ 'start_time': chap.get('anchorOffset'), 'end_time': next_chap.get('anchorOffset'), 'title': chap.get('anchor...
if layouts: for layout_key, layout_url in layouts.items(): layout_url = url_or_none(layout_url) if not layout_url: continue thumbnail = { 'url': layout_url, 'format_id': layout_key, ...
@@ -234,12 +240,23 @@ def _extract_entry(self, url, player, content, video_id): }) thumbnails.append(thumbnail) + chapters = [] + chapter_marks = t.get('streamAnchorTag') + if chapter_marks: + for chap, next_chap in zip(chapter_marks, chapter_marks...
yt_dlp/extractor/zdf.py
26
Python
0.786
suggestion
405
51
51
false
[zdf] add chapter extraction
2,198
yt-dlp/yt-dlp
132,642
Python
pukkandan
iw0nderhow