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
opencast\.informatik\.kit\.edu| electures\.uni-muenster\.de| oc-presentation\.ltcc\.tuwien\.ac\.at| medien\.ph-noe\.ac\.at| oc-video\.ruhr-uni-bochum\.de| ...
path is not used anywhere...just remove it from the signature.
_INSTANCES_RE = r'''(?: opencast\.informatik\.kit\.edu| electures\.uni-muenster\.de| oc-presentation\.ltcc\.tuwien\.ac\.at| medien\.ph-noe\.ac\.at| oc-video\.ruhr-uni-bochum\.d...
@@ -0,0 +1,251 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + ExtractorError, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r''...
yt_dlp/extractor/opencast.py
26
Python
0.286
suggestion
62
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
'info_dict': { 'id': 'ed063cd5-72c8-46b5-a60a-569243edcea8', 'ext': 'mp4', 'title': '11 - Kryptographie - 24.11.2015', 'thumbnail': r're:^https?://.*\.jpg$', 'timestamp': 1606208400, 'upload_date': '20201124', }, } def _rea...
why not combine all these and do ```suggestion video = self._call_api(host, video_id, '', note='Downloading video JSON')['search-results']['result']['mediapackage'] ```
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, ExtractorError, int_or_none, parse_iso8601, traverse_obj, variadic, ) class OpencastBaseIE(InfoExtractor): _INSTANCES_RE = r'''(?: ...
@@ -0,0 +1,251 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + ExtractorError, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r''...
yt_dlp/extractor/opencast.py
26
Python
0.714
suggestion
179
51
178
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
'title': '11 - Kryptographie - 24.11.2015', 'thumbnail': r're:^https?://.*\.jpg$', 'timestamp': 1606208400, 'upload_date': '20201124', }, } def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) host = mobj.group('host') ...
```suggestion return self._parse_mediapackage(video) ```
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, ExtractorError, int_or_none, parse_iso8601, traverse_obj, variadic, ) class OpencastBaseIE(InfoExtractor): _INSTANCES_RE = r'''(?: ...
@@ -0,0 +1,251 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + ExtractorError, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r''...
yt_dlp/extractor/opencast.py
26
Python
0.571
suggestion
66
51
178
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
result_obj.update({'title': title}) series = video.get('seriestitle') if series is not None: result_obj.update({'series': series}) season_id = video.get('series') if season_id is not None: result_obj.update({'season_id': season_id}) creator ...
formatting for this is sus. Idk why isn't the linter catching this 🤔
'info_dict': { 'id': 'ed063cd5-72c8-46b5-a60a-569243edcea8', 'ext': 'mp4', 'title': '11 - Kryptographie - 24.11.2015', 'thumbnail': r're:^https?://.*\.jpg$', 'timestamp': 1606208400, 'upload_date': '20201124', ...
@@ -0,0 +1,251 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + ExtractorError, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r''...
yt_dlp/extractor/opencast.py
26
Python
0.214
style
69
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
'title': 'Kryptographie - WiSe 15/16', }, 'playlist_mincount': 28, }, { 'url': 'https://oc-video.ruhr-uni-bochum.de/engage/ui/index.html?e=1&p=1&epFrom=b1a54262-3684-403f-9731-8e77c3766f9a', 'info_dict': { 'id': 'b1a54262-36...
again combining all these to ```suggestion result_list = self._call_api(host, video_id, '', note='Downloading video JSON')['search-results']['result'] ```
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, ExtractorError, int_or_none, parse_iso8601, traverse_obj, variadic, ) class OpencastBaseIE(InfoExtractor): _INSTANCES_RE = r'''(?: ...
@@ -0,0 +1,251 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + ExtractorError, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r''...
yt_dlp/extractor/opencast.py
26
Python
0.714
suggestion
166
42
178
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
'playlist_mincount': 8, }, ] def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) host = mobj.group('host') video_id = mobj.group('id') api_json = self._call_api(host, video_id, '', note='Downloading video JSON') search_results = api_...
Do something like this (the formatting is off in the suggestion so make sure to run flake8 on this) ```suggestion entries = [ self._parse_mediapackage(episode['mediapackage']) for episode in result_list if episode.get('mediapackage')] ```
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, ExtractorError, int_or_none, parse_iso8601, traverse_obj, variadic, ) class OpencastBaseIE(InfoExtractor): _INSTANCES_RE = r'''(?: ...
@@ -0,0 +1,251 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + ExtractorError, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r''...
yt_dlp/extractor/opencast.py
26
Python
0.786
suggestion
277
32
178
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
mobj = re.match(self._VALID_URL, url) host = mobj.group('host') video_id = mobj.group('id') api_json = self._call_api(host, video_id, '', note='Downloading video JSON') search_results = api_json.get('search-results', {}) if 'result' not in search_results: ra...
```suggestion return self.playlist_result(entries, playlist_id=video_id, playlist_title=try_get(entries, lambda x:x[0]['series'])) ``` Can further be "improved" by doing traverse_obj and going to next entry until series is not found but i personally don't like importing stuff just for such things
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, ExtractorError, int_or_none, parse_iso8601, traverse_obj, variadic, ) class OpencastBaseIE(InfoExtractor): _INSTANCES_RE = r'''(?: ...
@@ -0,0 +1,251 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + ExtractorError, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r''...
yt_dlp/extractor/opencast.py
26
Python
0.786
suggestion
308
27
178
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
self._sort_formats(formats) result_obj = {'formats': formats} result_obj.update({'id': video_id}) title = video.get('title') if title is not None: result_obj.update({'title': title}) series = video.get('seriestitle') if series is not None: ...
```suggestion return { 'id': video_id, 'formats': formats, 'title': video.get('title'), 'series': video.get('seriestitle'), 'season_id': video.get('series'), 'creator': traverse_obj(video, ('creators', 'creator')), 'time...
https?://(?P<host>%s)/paella/ui/watch.html\?.*? id=(?P<id>%s) ''' % (OpencastBaseIE._INSTANCES_RE, OpencastBaseIE._UUID_RE) _API_BASE = 'https://%s/search/episode.json?id=%s' _TESTS = [ { 'url': 'https://oc-video1.ruhr-uni-bochum....
@@ -0,0 +1,230 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.929
suggestion
482
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
bwildenhain
result_obj.update({'id': video_id}) title = video.get('title') if title is not None: result_obj.update({'title': title}) series = video.get('seriestitle') if series is not None: result_obj.update({'series': series}) season_id = video.get('series...
depending on your intention, ```suggestion 'thumbnails': [{'url': x} for x in traverse_obj(video, ('attachments', 'attachment', ..., 'url'), default=[])], ``` or ```suggestion 'thumbnail': traverse_obj(video, ('attachments', 'attachment', ..., 'url'), get_all=False), ``` Also, do not app...
_TESTS = [ { 'url': 'https://oc-video1.ruhr-uni-bochum.de/paella/ui/watch.html?id=ed063cd5-72c8-46b5-a60a-569243edcea8', 'md5': '554c8e99a90f7be7e874619fcf2a3bc9', 'info_dict': { 'id': 'ed063cd5-72c8-46b5-a60a-569243edcea8', 'ext': 'mp4', ...
@@ -0,0 +1,230 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.786
suggestion
351
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
bwildenhain
formats = [] for track in tracks: href = track['url'] ext = determine_ext(href, None) track_obj = {'url': href} transport = track.get('transport') if transport == 'DASH' or ext == 'mpd': formats.extend(self._extract_mpd_forma...
```suggestion m_obj = re.match(r'(?:rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)', href) ``` also I'd prefer to add a group for extension extraction (I won't force you unless the maintainer says the same)
raise ExtractorError('Video id was not found') formats = [] for track in variadic(traverse_obj(video, ('media', 'track')) or []): href = track.get('url') if href is None: continue ext = determine_ext(href, None) transport = tr...
@@ -0,0 +1,230 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.857
refactor
234
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
bwildenhain
track_obj.update({'format_note': track.get('transport')}) if transport == 'RTMP': m_obj = re.search(r'^(?:rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)$', href) if not m_obj: continue ...
```suggestion track_obj.update({ 'abr': int_or_none(audio_info.get('bitrate'), 1000), 'asr': int_or_none(audio_info.get('samplingrate')), 'acodec': traverse_obj(audio_info, ('encoder', 'type')), }) ``` ...
track_obj = { 'url': href, 'ext': ext, 'format_note': track.get('transport'), 'resolution': traverse_obj(track, ('video', 'resolution')), 'fps': int_or_none(traverse_obj(track, ('video', 'framerate'))), ...
@@ -0,0 +1,230 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + parse_resolution, + int_or_none, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.929
suggestion
390
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
bwildenhain
opencast\.hs-osnabrueck\.de| video[0-9]+\.virtuos\.uni-osnabrueck\.de| opencast\.uni-koeln\.de| media\.opencast\.hochschule-rhein-waal\.de| matterhorn\.dce\.harvard\.edu| ...
shouldn't be fatal. use .get and only append if it exists
opencast\.hawk\.de:8080| opencast\.hs-osnabrueck\.de| video[0-9]+\.virtuos\.uni-osnabrueck\.de| opencast\.uni-koeln\.de| media\.opencast\.hochschule-rhein-waal\.de| ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + int_or_none, + traverse_obj, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.286
suggestion
58
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
formats.extend(self._extract_f4m_formats(href, video_id, f4m_id='hds', fatal=False)) elif transport == 'SMOOTH': formats.extend(self._extract_ism_formats(href, video_id, ism_id='smooth', fatal=False)) elif ext == 'smil': formats.extend(self._extrac...
is it really safe to use `1000` as default here?
elif transport == 'HDS' or ext == 'f4m': formats.extend(self._extract_f4m_formats(href, video_id, f4m_id='hds', fatal=False)) elif transport == 'SMOOTH': formats.extend(self._extract_ism_formats(href, video_id, ism_id='smooth', fatal=False)) elif ext =...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + int_or_none, + traverse_obj, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.286
question
48
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
if not m_obj: continue track_obj.update( { 'app': m_obj.group('app'), 'ext': m_obj.group('ext'), 'play_path': m_obj.grou...
same Don't use any random int as default
'format_note': track.get('transport'), 'resolution': traverse_obj(track, ('video', 'resolution')), 'fps': int_or_none(traverse_obj(track, ('video', 'framerate'))), 'vbr': int_or_none(traverse_obj(track, ('video', 'bitrate')), scale=1000), ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + int_or_none, + traverse_obj, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.143
suggestion
41
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
''' % ( OpencastBaseIE._INSTANCES_RE, OpencastBaseIE._UUID_RE, ) _API_BASE = 'https://%s/search/episode.json?id=%s' _TESTS = [ { 'url': 'https://oc-video1.ruhr-uni-bochum.de/paella/ui/watch.html?id=ed063cd5-72c8-46b5-a60a-569243edcea8', '...
```suggestion host, video_id = self._match_valid_url(url).groups() ```
'info_dict': { 'id': 'ed063cd5-72c8-46b5-a60a-569243edcea8', 'ext': 'mp4', 'title': '11 - Kryptographie - 24.11.2015', 'thumbnail': r're:^https?://.*\.jpg$', 'timestamp': 1606208400, 'upload_date': '20201124', ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + int_or_none, + traverse_obj, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.571
suggestion
84
51
51
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
_API_BASE = 'https://%s/search/episode.json?sid=%s' _TESTS = [ { 'url': 'https://oc-video1.ruhr-uni-bochum.de/engage/ui/index.html?epFrom=cf68a4a1-36b1-4a53-a6ba-61af5705a0d0', 'info_dict': { 'id': 'cf68a4a1-36b1-4a53-a6ba-61af5705a0d0', 'title':...
```suggestion host, video_id = self._match_valid_url(url).groups() ```
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, ExtractorError, int_or_none, parse_iso8601, traverse_obj, variadic, ) class OpencastBaseIE(InfoExtractor): _INSTANCES_RE = r'''(?: ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + parse_iso8601, + int_or_none, + traverse_obj, + try_get, +) + + +class OpencastBaseIE(InfoExtractor): + _INSTANCES_RE = r'''(?: + ...
yt_dlp/extractor/opencast.py
26
Python
0.571
suggestion
80
39
178
false
[OpenCast] Add extractor
1,905
yt-dlp/yt-dlp
132,642
Python
Ashish0804
bwildenhain
new_f['height'] = height formats.append(new_f) def _real_extract(self, url): video_id = self._match_id(url) video_info = self._download_json('https://services.radio-canada.ca/ott/cbc-api/v2/assets/' + video_id, video_id) email, password = self._get_l...
```suggestion formats.extend(self._find_secret_formats(formats, video_id)) ``` (see the other suggestions)
def _real_extract(self, url): video_id = self._match_id(url) video_info = self._download_json('https://services.radio-canada.ca/ott/cbc-api/v2/assets/' + video_id, video_id) email, password = self._get_login_info() if email and password: claims_token = self._get_claims_t...
@@ -335,6 +371,7 @@ def _real_extract(self, url): formats = self._extract_m3u8_formats(m3u8_url, video_id, m3u8_id='hls') self._remove_duplicate_formats(formats) + self._find_secret_formats(formats, video_id)
yt_dlp/extractor/cbc.py
26
Python
0.714
security
117
51
51
false
[CBC Gem] Support 1080p shows
1,913
yt-dlp/yt-dlp
132,642
Python
pukkandan
DavidSkrundz
url = re.sub('(Manifest\\(.*?),format=[\\w-]+(.*?\\))', '\\1\\2', base_url) base_f = copy.deepcopy(f) break # Download and parse the secret xml secret_xml = self._download_xml(url, video_id, note='Downloading secret XML', fatal=False) if not secre...
```suggestion """ Find a valid video url and convert it to the secret variant """ base_format = next((f for f in formats if f.get('height')), None) if not base_format: return base_url = re.sub(r'(Manifest\(.*?),filter=[\w-]+(.*?\))', r'\1\2', base_format['url']) ...
url = re.sub(r'(Manifest\(.*?),format=[\w-]+(.*?\))', r'\1\2', base_url) secret_xml = self._download_xml(url, video_id, note='Downloading secret XML', fatal=False) if not secret_xml: return for child in secret_xml: if child.attrib.get('Type') != 'video': ...
@@ -313,6 +314,41 @@ def _real_initialize(self): return self._claims_token = self._downloader.cache.load(self._NETRC_MACHINE, 'claims_token') + def _find_secret_formats(self, formats, video_id): + # Find a valid video url and convert it to the secret variant + url = "" + ...
yt_dlp/extractor/cbc.py
26
Python
0.929
security
1,365
51
51
false
[CBC Gem] Support 1080p shows
1,913
yt-dlp/yt-dlp
132,642
Python
pukkandan
DavidSkrundz
if not base_format: return base_url = re.sub(r'(Manifest\(.*?),filter=[\w-]+(.*?\))', r'\1\2', base_format['url']) url = re.sub(r'(Manifest\(.*?),format=[\w-]+(.*?\))', r'\1\2', base_url) secret_xml = self._download_xml(url, video_id, note='Downloading secret XML', fatal=Fa...
```suggestion **base_format, 'format_id': join_nonempty('sec', height), 'url': re.sub(r'(QualityLevels\()\d+(\))', fr'\1{bitrate}\2', base_url), 'width': int_or_none(video_quality.attrib.get('MaxWidth')), 'tbr': bit...
base_format = next((f for f in formats if f.get('vcodec') != 'none'), None) if not base_format: return base_url = re.sub(r'(Manifest\(.*?),filter=[\w-]+(.*?\))', r'\1\2', base_format['url']) url = re.sub(r'(Manifest\(.*?),format=[\w-]+(.*?\))', r'\1\2', base_url) se...
@@ -313,6 +314,37 @@ def _real_initialize(self): return self._claims_token = self._downloader.cache.load(self._NETRC_MACHINE, 'claims_token') + def _find_secret_formats(self, formats, video_id): + """ Find a valid video url and convert it to the secret variant """ + base_format ...
yt_dlp/extractor/cbc.py
26
Python
0.786
suggestion
378
51
51
false
[CBC Gem] Support 1080p shows
1,913
yt-dlp/yt-dlp
132,642
Python
pukkandan
DavidSkrundz
def claims_token_expired(self): exp = self._get_claims_token_expiry() if exp - time.time() < 10: # It will expire in less than 10 seconds, or has already expired return True return False def claims_token_valid(self): return self._claims_token is not None ...
I don't understand why this is the selection criteria
def claims_token_expired(self): exp = self._get_claims_token_expiry() if exp - time.time() < 10: # It will expire in less than 10 seconds, or has already expired return True return False def claims_token_valid(self): return self._claims_token is not None...
@@ -313,6 +314,37 @@ def _real_initialize(self): return self._claims_token = self._downloader.cache.load(self._NETRC_MACHINE, 'claims_token') + def _find_secret_formats(self, formats, video_id): + """ Find a valid video url and convert it to the secret variant """ + base_format ...
yt_dlp/extractor/cbc.py
26
Python
0.214
suggestion
53
51
51
false
[CBC Gem] Support 1080p shows
1,913
yt-dlp/yt-dlp
132,642
Python
pukkandan
DavidSkrundz
'timestamp': 1544669941, }, 'params': { # m3u8 download 'skip_download': True, }, } BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s' def _real_extract(self, url): display_id = self._match_...
```suggestion description = (traverse_obj(player_config, ('movie', 'description')) or self._html_search_meta(['description', 'og:description'], webpage)) ```
'timestamp': 1544669941, }, 'params': { # m3u8 download 'skip_download': True, }, } BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s' def _real_extract(self, url): display_id = self._match_...
@@ -28,22 +29,31 @@ class NTVCoJpCUIE(InfoExtractor): 'skip_download': True, }, } + BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s' def _real_extract(self, url): display_id = self._match_id(url) webpage = self._d...
yt_dlp/extractor/ntvcojp.py
26
Python
0.714
suggestion
191
36
35
false
[ntvcojp] fix extractor
1,915
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) nuxt_data = self._search_nuxt_data(webpage, video_id) parent = { 'title': nuxt_data.get('title'), 'descripion': nuxt_data.get('description'), ...
id should be fatal or since this is a playlist, append only if id exists. also just use `str` instead of `compat_str` so it's not a lazy backport to ytdl 😈
_TESTS = [{ 'url': 'https://skeb.jp/@riiru_wm/works/10', 'info_dict': { 'id': '466853', 'title': '内容はおまかせします! by 姫ノ森りぃる@一周年', 'descripion': 'md5:1ec50901efc3437cfbfe3790468d532d', 'uploader': '姫ノ森りぃる@一周年', 'uploader_id': 'riiru_wm', ...
@@ -0,0 +1,63 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError, determine_ext, ext2mimetype, traverse_obj +from ..compat import compat_str + + +class SkebIE(InfoExtractor): + _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)...
yt_dlp/extractor/skeb.py
26
Python
0.571
suggestion
157
51
51
false
[skeb] add support for skeb.jp
1,916
yt-dlp/yt-dlp
132,642
Python
Ashish0804
Lesmiscore
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ExtractorError, determine_ext, ext2mimetype, traverse_obj from ..compat import compat_str class SkebIE(InfoExtractor): _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)' def _real_extract(se...
same with this. u can add these both to the above if statement something like ```py if mimetype != 'image/gif' and mimetype.partition('/')[0] != 'video' and not vid_url and not item.get('id'): continue ```
'tags': nuxt_data.get('tag_list'), } entries = [] for item in nuxt_data.get('previews') or []: vid_url = item.get('url') given_ext = traverse_obj(item, ('information', 'extension')) preview_ext = determine_ext(vid_url, default_ext=None) ...
@@ -0,0 +1,63 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError, determine_ext, ext2mimetype, traverse_obj +from ..compat import compat_str + + +class SkebIE(InfoExtractor): + _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)...
yt_dlp/extractor/skeb.py
26
Python
0.929
suggestion
222
64
51
false
[skeb] add support for skeb.jp
1,916
yt-dlp/yt-dlp
132,642
Python
Ashish0804
Lesmiscore
} entries = [] for item in nuxt_data.get('previews') or []: vid_url = item.get('url') given_ext = traverse_obj(item, ('information', 'extension')) mimetype = ext2mimetype(given_ext) if mimetype != 'image/gif' and mimetype.partition('/')[0] != 'vid...
any reason to prefer the ext from the url over given_ext especially when u are already using this given_ext to determine mine type and then skip based on it?
'url': r're:https://skeb.+', 'ext': 'vtt' }] }, 'width': 720, 'height': 405, 'duration': 313, 'fps': 30, 'ext': 'mp4', }, }, { 'url': 'https://skeb.jp/@furukawa_nob/works/3...
@@ -0,0 +1,63 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError, determine_ext, ext2mimetype, traverse_obj +from ..compat import compat_str + + +class SkebIE(InfoExtractor): + _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)...
yt_dlp/extractor/skeb.py
26
Python
0.571
question
157
40
51
false
[skeb] add support for skeb.jp
1,916
yt-dlp/yt-dlp
132,642
Python
Ashish0804
Lesmiscore
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ExtractorError, determine_ext, ext2mimetype, traverse_obj from ..compat import compat_str class SkebIE(InfoExtractor): _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)' def _real_extract(se...
```suggestion nuxt_data = self._search_nuxt_data(self._download_webpage(url, video_id), video_id) ``` webpage is never used anywhere else?
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj class SkebIE(InfoExtractor): _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)' _TESTS = [{ 'url': 'https://skeb.jp/@riiru_wm/wo...
@@ -0,0 +1,63 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError, determine_ext, ext2mimetype, traverse_obj +from ..compat import compat_str + + +class SkebIE(InfoExtractor): + _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)...
yt_dlp/extractor/skeb.py
15
Python
0.786
question
149
40
40
false
[skeb] add support for skeb.jp
1,916
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
mimetype = ext2mimetype(given_ext) if mimetype != 'image/gif' and mimetype.partition('/')[0] != 'video': continue entries.append({ **parent, 'id': compat_str(item.get('id')), 'url': vid_url, 'thumbnail': ...
Are you sure about this? If a new entry gets added to the URL, it shouldn't cause the id of the existing entry to change PS: Also, this is wrong. Should be `entries[0]['id'] = ...`
'duration': 313, 'fps': 30, 'ext': 'mp4', }, }, { 'url': 'https://skeb.jp/@furukawa_nob/works/3', 'info_dict': { 'id': '489408', 'title': 'いつもお世話になってお... by 古川ノブ@音楽とVlo...', 'descripion': 'md5:5adc2e41d06d33b558bf7b1faeb...
@@ -0,0 +1,63 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError, determine_ext, ext2mimetype, traverse_obj +from ..compat import compat_str + + +class SkebIE(InfoExtractor): + _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)...
yt_dlp/extractor/skeb.py
26
Python
0.571
bug
185
34
51
false
[skeb] add support for skeb.jp
1,916
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
**parent, 'id': compat_str(item.get('id')), 'url': vid_url, 'thumbnail': item.get('poster_url'), 'subtitles': { 'jpn': [{ 'url': item.get('vtt_url'), 'ext': 'vtt', ...
Reminder to self: check if `multi_video` is suitable once tests are added
}, { 'url': 'https://skeb.jp/@furukawa_nob/works/3', 'info_dict': { 'id': '489408', 'title': 'いつもお世話になってお... by 古川ノブ@音楽とVlo...', 'descripion': 'md5:5adc2e41d06d33b558bf7b1faeb7b9c2', 'uploader': '古川ノブ@音楽とVlogのVtuber', 'uploader_id': 'furuka...
@@ -0,0 +1,63 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError, determine_ext, ext2mimetype, traverse_obj +from ..compat import compat_str + + +class SkebIE(InfoExtractor): + _VALID_URL = r'https?://skeb\.jp/@[^/]+/works/(?P<id>\d+)...
yt_dlp/extractor/skeb.py
26
Python
0.357
suggestion
73
30
51
false
[skeb] add support for skeb.jp
1,916
yt-dlp/yt-dlp
132,642
Python
pukkandan
Lesmiscore
self._sort_formats(formats) for f in formats: f.setdefault('http_headers', {}).update(headers) for text_track in json_data.get('text_tracks', []): if text_track.get('kind') != 'captions': continue text_track_url = url_or_none(text_track.get(...
this will fail if poster is `None` A better way would be to assign poster_url to this and then run the rest of the code only if poster_url exists
self.report_drm(video_id) self._sort_formats(formats) for f in formats: f.setdefault('http_headers', {}).update(headers) for text_track in json_data.get('text_tracks', []): if text_track.get('kind') != 'captions': continue te...
@@ -577,6 +577,22 @@ def build_format_id(kind): if duration is not None and duration <= 0: is_live = True + common_res = ["160x90", "320x180", "480x270", "640x360", "768x432", "1024x576", "1280x720", "1366x768", "1920x1080"] + thumbnails = [] + if '640x360' in json_data.get(...
yt_dlp/extractor/brightcove.py
26
Python
0.571
bug
146
51
51
false
[TVer/brightcove]added support for higher resolution thumbnail extraction
1,929
yt-dlp/yt-dlp
132,642
Python
Ashish0804
YuenSzeHong
and sources and num_drm_sources == len(sources)): self.report_drm(video_id) self._sort_formats(formats) for f in formats: f.setdefault('http_headers', {}).update(headers) for text_track in json_data.get('text_tracks', []): if text_tr...
makes more sense to do ```py common_res = [(160, 90), (320, 180), ...] ```
elif (not self.get_param('allow_unplayable_formats') and sources and num_drm_sources == len(sources)): self.report_drm(video_id) self._sort_formats(formats) for f in formats: f.setdefault('http_headers', {}).update(headers) for text_...
@@ -577,6 +577,22 @@ def build_format_id(kind): if duration is not None and duration <= 0: is_live = True + common_res = ["160x90", "320x180", "480x270", "640x360", "768x432", "1024x576", "1280x720", "1366x768", "1920x1080"]
yt_dlp/extractor/brightcove.py
26
Python
0.571
suggestion
85
51
51
false
[TVer/brightcove]added support for higher resolution thumbnail extraction
1,929
yt-dlp/yt-dlp
132,642
Python
pukkandan
YuenSzeHong
continue text_track_url = url_or_none(text_track.get('src')) if not text_track_url: continue lang = (str_or_none(text_track.get('srclang')) or str_or_none(text_track.get('label')) or 'en').lower() subtitles.setdefault(la...
much easier to do `re.sub(r'\d+x\d+', ...)` on `dict_get(json_data, ('poster', 'thumbnail')`
if text_track.get('kind') != 'captions': continue text_track_url = url_or_none(text_track.get('src')) if not text_track_url: continue lang = (str_or_none(text_track.get('srclang')) or str_or_none(text_track.get('label'))...
@@ -577,6 +577,22 @@ def build_format_id(kind): if duration is not None and duration <= 0: is_live = True + common_res = ["160x90", "320x180", "480x270", "640x360", "768x432", "1024x576", "1280x720", "1366x768", "1920x1080"] + thumbnails = [] + if '640x360' in json_data.get(...
yt_dlp/extractor/brightcove.py
26
Python
0.357
suggestion
92
51
51
false
[TVer/brightcove]added support for higher resolution thumbnail extraction
1,929
yt-dlp/yt-dlp
132,642
Python
pukkandan
YuenSzeHong
continue lang = (str_or_none(text_track.get('srclang')) or str_or_none(text_track.get('label')) or 'en').lower() subtitles.setdefault(lang, []).append({ 'url': text_track_url, }) is_live = False duration = float_or_...
~~enumerate the for loop and use that index here~~ Preference isn't needed since we know all resolutions You can also get rid of append all-together. Like this: ```py base_url = dict_get(json_data, ('poster', 'thumbnail') thumbnails = [{ 'url': re.sub(re.sub(r'\d+x\d+', f'{w}x{h}', base_url), 'width': ...
if not text_track_url: continue lang = (str_or_none(text_track.get('srclang')) or str_or_none(text_track.get('label')) or 'en').lower() subtitles.setdefault(lang, []).append({ 'url': text_track_url, }) is_live =...
@@ -577,6 +577,22 @@ def build_format_id(kind): if duration is not None and duration <= 0: is_live = True + common_res = ["160x90", "320x180", "480x270", "640x360", "768x432", "1024x576", "1280x720", "1366x768", "1920x1080"] + thumbnails = [] + if '640x360' in json_data.get(...
yt_dlp/extractor/brightcove.py
26
Python
0.857
suggestion
394
51
51
false
[TVer/brightcove]added support for higher resolution thumbnail extraction
1,929
yt-dlp/yt-dlp
132,642
Python
pukkandan
YuenSzeHong
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor class FujiTVFODPlus7IE(InfoExtractor): _VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/[0-9a-z]{4}/(?P<id>[0-9a-z]+)' _BASE_URL = 'http://i.fod.fujitv.co.jp/' _BITRATE_MAP = { 800: (640, 360), 1200...
why does this doesn't have any tests?
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor class FujiTVFODPlus7IE(InfoExtractor): _VALID_URL = r'https?://i\.fod\.fujitv\.co\.jp/plus7/web/[0-9a-z]{4}/(?P<id>[0-9a-z]+)' _BASE_URL = 'http://i.fod.fujitv.co.jp/' _BITRATE_MAP = { 300: (320, 180), ...
@@ -5,19 +5,19 @@ class FujiTVFODPlus7IE(InfoExtractor): - _VALID_URL = r'https?://i\.fod\.fujitv\.co\.jp/plus7/web/[0-9a-z]{4}/(?P<id>[0-9a-z]+)' + _VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/[0-9a-z]{4}/(?P<id>[0-9a-z]+)'
yt_dlp/extractor/fujitv.py
8
Python
0.071
question
37
33
33
false
[TVer/brightcove]added support for higher resolution thumbnail extraction
1,929
yt-dlp/yt-dlp
132,642
Python
Ashish0804
YuenSzeHong
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor class FujiTVFODPlus7IE(InfoExtractor): _VALID_URL = r'https?://i\.fod\.fujitv\.co\.jp/title/[0-9a-z]{4}/(?P<id>[0-9a-z]+)' _BASE_URL = 'http://i.fod.fujitv.co.jp/' _BITRATE_MAP = { 300: (320, 180), 8...
```suggestion _VALID_URL = r'https?://i\.fod\.fujitv\.co\.jp/plus7/web/[0-9a-z]{4}/(?P<id>[0-9a-z]+)' ```
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor class FujiTVFODPlus7IE(InfoExtractor): _VALID_URL = r'https?://i\.fod\.fujitv\.co\.jp/plus7/web/[0-9a-z]{4}/(?P<id>[0-9a-z]+)' _BASE_URL = 'http://i.fod.fujitv.co.jp/' _BITRATE_MAP = { 300: (320, 180), ...
@@ -5,7 +5,7 @@ class FujiTVFODPlus7IE(InfoExtractor): - _VALID_URL = r'https?://i\.fod\.fujitv\.co\.jp/plus7/web/[0-9a-z]{4}/(?P<id>[0-9a-z]+)' + _VALID_URL = r'https?://i\.fod\.fujitv\.co\.jp/title/[0-9a-z]{4}/(?P<id>[0-9a-z]+)'
yt_dlp/extractor/fujitv.py
8
Python
0.714
suggestion
111
33
33
false
[TVer/brightcove]added support for higher resolution thumbnail extraction
1,929
yt-dlp/yt-dlp
132,642
Python
pukkandan
YuenSzeHong
item['is_interview'] = 1 else: item['is_interview'] = 0 stream_href = item.get('_links').get('streams').get('href') self.debug_out("JSON URL: " + 'https:' + stream_href) test_dict = self._download_json('https:' + str...
trimming title is done on users' own responsibility, not extractor
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,202 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.286
refactor
66
51
144
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
else: title = (item.get('name_composer') if item.get('name_composer') else 'unknown composer') + ' - ' + item.get('title', "unknown title") key = item.get('id') duration = item.get('duration_total') # avoid ...
absence of key must be represented as `None` value, not `"missing description"` also, these two ifs can be merged ```suggestion description = test_dict.get('short_description') or item.get('short_description') if description: entries[-1]['description'] = descri...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,202 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.786
suggestion
330
51
144
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
import json from yt_dlp.extractor.common import InfoExtractor from yt_dlp.compat import ( compat_HTTPError, ) from yt_dlp.utils import ( ExtractorError, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = r'https?://(?:www\.)?dig...
I can see you never actually ran the test
from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = r'https?://(?:www\.)?digitalconcerthall\.com/(?P<language>[a-z]+)/concert/(?P<id>[0-9]+)' ...
@@ -0,0 +1,202 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.071
suggestion
41
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
ExtractorError, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = r'https?://(?:www\.)?digitalconcerthall\.com/(?P<language>[a-z]+)/concert/(?P<id>[0-9]+)' _LOGIN_URL = 'https://www.digitalconcerthall.com/en/login' _OAUTH_URL...
```suggestion _TESTS = [{ 'url': 'https://www.digitalconcerthall.com/en/concert/53785', 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', 'info_dict': { 'id': '53785', 'language': 'en', 'ext': 'mp4', 'title...
class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = r'https?://(?:www\.)?digitalconcerthall\.com/(?P<language>[a-z]+)/concert/(?P<id>[0-9]+)' _OAUTH_URL = 'https://api.digitalconcerthall.com/v2/oauth2/token' _ACCESS_TOKEN = None _NETRC_MACHINE = 'digita...
@@ -0,0 +1,202 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.857
suggestion
442
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
# coding: utf-8 from __future__ import unicode_literals import re import json from yt_dlp.extractor.common import InfoExtractor from yt_dlp.compat import ( compat_HTTPError, ) from yt_dlp.utils import ( ExtractorError, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'Digi...
inline this variable. it's used only once
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,202 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
21
Python
0.143
suggestion
41
46
46
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
# coding: utf-8 from __future__ import unicode_literals import re import json from yt_dlp.extractor.common import InfoExtractor from yt_dlp.compat import ( compat_HTTPError, ) from yt_dlp.utils import ( ExtractorError, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'Digi...
inline vars that are only ever used once
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
24
Python
0.143
suggestion
40
49
49
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
'grant_type': 'device', 'device_vendor': 'unknown', 'device_model': 'unknown', 'app_id': 'dch.webapp', 'app_distributor': 'berlinphil', 'app_version': '1.0.0', 'client_secret': self._CLIENT_SECRET, } try: tok...
unnecessary comment. The `note` of the download_json self-documents what is happening
'affiliate': 'none', 'grant_type': 'device', 'device_vendor': 'unknown', 'app_id': 'dch.webapp', 'app_version': '1.0.0', 'client_secret': '2ySLN+2Fwb', }), headers={ 'Content-Type': 'application/x...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.357
suggestion
85
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
# coding: utf-8 from __future__ import unicode_literals import re import json from yt_dlp.extractor.common import InfoExtractor from yt_dlp.compat import ( compat_HTTPError, ) from yt_dlp.utils import ( ExtractorError, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'Digi...
use relative imports, like `from ..utils import (`
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import (
yt_dlp/extractor/digitalconcerthall.py
12
Python
0.429
suggestion
50
37
37
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
raise ExtractorError('Unable to obtain token: ' + msg) self.debug_out("token_response: " + json.dumps(token_response)) self._ACCCESS_TOKEN = token_response.get('access_token') # now login data = { 'grant_type': 'password', 'username': username, ...
repeated code. This should probably be a function
except ExtractorError: self.raise_login_required(msg='Login info incorrect') def _real_initialize(self): self._login() def _entries(self, items, language, **kwargs): for item in items: video_id = item['id'] stream_info = self._download_json( ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.143
suggestion
49
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
'password': password, } try: self._download_json( self._OAUTH_URL, None, 'Logging in', data=urlencode_postdata(data), headers={ 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': self._LOGIN_URL,...
use `_match_valid_url` instead of `re.match`
for item in items: video_id = item['id'] stream_info = self._download_json( self._proto_relative_url(item['_links']['streams']['href']), video_id, headers={ 'Accept': 'application/json', 'Authorization': f'Bearer {self._ACCESS_TOKEN...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.286
suggestion
44
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 401: resp = self._parse_json(e.cause.read().decode(), None, fatal=False) if resp: error = resp.get('extra_info') or resp.get('error_description') or resp.get('error') if error...
```suggestion f'https://api.digitalconcerthall.com/v2/concert/{video_id}', video_id, headers={'Accept': 'application/json', ``` use of f-string is allowed in yt-dlp
self._sort_formats(formats) yield { 'id': video_id, 'title': item.get('title'), 'composer': item.get('name_composer'), 'url': m3u8_url, 'formats': formats, 'duration': item.get('duration_total'), ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.786
suggestion
192
51
49
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
MAX_TITLE_LENGTH = 128 language, video_id = re.match(self._VALID_URL, url).groups() if not language: language = 'en' self.debug_out("url: " + url + " video_id: " + video_id + " language: " + language) webpage = self._download_webpage(url, video_id) playlist_ti...
replace this with `traverse_obj` invocation. read contribution guidelines for how
'chapters': [{ 'start_time': chapter.get('time'), 'end_time': try_get(chapter, lambda x: x['time'] + x['duration']), 'title': chapter.get('text'), } for chapter in item['cuepoints']] if item.get('cuepoints') else None, ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.429
suggestion
81
51
37
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
self._download_json( self._OAUTH_URL, None, 'Logging in', data=urlencode_postdata(data), headers={ 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': self._LOGIN_URL, 'Authorization': 'Bearer ' + self._A...
remove all of these debug statements
self._proto_relative_url(item['_links']['streams']['href']), video_id, headers={ 'Accept': 'application/json', 'Authorization': f'Bearer {self._ACCESS_TOKEN}', 'Accept-Language': language }) m3u8_url = traverse_obj(...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.286
bug
36
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
'Content-Type': 'application/x-www-form-urlencoded', 'Referer': self._LOGIN_URL, 'Authorization': 'Bearer ' + self._ACCCESS_TOKEN }) except ExtractorError as e: msg = 'Unable to login' if isinstance(e.cause, comp...
```suggestion playlist_title = (self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title') or self._og_search_title(webpage)) ``` using `\` is not prefered
'Accept-Language': language }) m3u8_url = traverse_obj( stream_info, ('channel', lambda x: x.startswith('vod_mixed'), 'stream', 0, 'url'), get_all=False) formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native', fatal=Fals...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.857
suggestion
201
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
username, password = self._get_login_info() if username is None: if self._LOGIN_REQUIRED: raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True) return # first get JWT token data = { 'affilia...
(not a actual review) is the error response (JSON i guess) guaranteed to be within ASCII range? (in other words, are non-english languages like french or german never returned here?)
def _login(self): username, password = self._get_login_info() if not username: self.raise_login_required() token_response = self._download_json( self._OAUTH_URL, None, 'Obtaining token', errnote='Unable to obtain token', data=urlencode_postdata({ ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.5
suggestion
182
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
teridon
resp = self._parse_json(e.cause.read().decode(), None, fatal=False) if resp: error = resp.get('extra_info') or resp.get('error_description') or resp.get('error') if error: msg += ': ' + error raise ExtractorError...
```suggestion vid_info_dict = self._download_json( f'https://api.digitalconcerthall.com/v2/concert/{video_id}', video_id, headers={ 'Accept': 'application/json', 'Accept-Language': language }) ``` Also, change the var name to something else. We use ...
yield { 'id': video_id, 'title': item.get('title'), 'composer': item.get('name_composer'), 'url': m3u8_url, 'formats': formats, 'duration': item.get('duration_total'), 'timestamp': traverse_obj(i...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.857
refactor
412
51
48
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
def _real_extract(self, url): MAX_TITLE_LENGTH = 128 language, video_id = re.match(self._VALID_URL, url).groups() if not language: language = 'en' self.debug_out("url: " + url + " video_id: " + video_id + " language: " + language) webpage = self._download_webpage(...
why? just check `embed_type` where this is used
**kwargs, 'chapters': [{ 'start_time': chapter.get('time'), 'end_time': try_get(chapter, lambda x: x['time'] + x['duration']), 'title': chapter.get('text'), } for chapter in item['cuepoints']] if item.get('cuepoi...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.429
question
47
51
38
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
MAX_TITLE_LENGTH = 128 language, video_id = re.match(self._VALID_URL, url).groups() if not language: language = 'en' self.debug_out("url: " + url + " video_id: " + video_id + " language: " + language) webpage = self._download_webpage(url, video_id) playlist_ti...
Is this supposed to be fatal or not? If it is, just use []. Else use try_get/traverse_obj
'chapters': [{ 'start_time': chapter.get('time'), 'end_time': try_get(chapter, lambda x: x['time'] + x['duration']), 'title': chapter.get('text'), } for chapter in item['cuepoints']] if item.get('cuepoints') else None, ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.286
question
89
51
37
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
# embed_type should be either 'work' or 'interview' # 'work' will be an array of one or more works for item in embedded.get(embed_type): if embed_type == 'interview': item['is_interview'] = 1 else: item['is_inter...
Don't try to be smart with titles. The test case should just give `Kirill Petrenko conducts Mendelssohn and Shostakovich` because that is the title in the webpage. The artist and other data should be populated in appropriate fields. Also, dont use `unknown ...`
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.643
suggestion
261
51
144
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
# use playlist description for video description by default # but if the video has a description, use it description = test_dict.get('short_description') or item.get('short_description') if description: entries[-1]['description'] = desc...
```suggestion chapters = [{ 'start_time': chapter.get('time'), 'end_time': try_get(chapter, lambda x: x['time'] + x['duration']), 'title': chapter.get('text'), } for chapter in item.get('cuepoints') or [...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.786
suggestion
544
35
144
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
title = "Interview - " + item.get('title', "unknown interview title") else: title = (item.get('name_composer') if item.get('name_composer') else 'unknown composer') + ' - ' + item.get('title', "unknown title") key = item...
put all this data in the dict before appending to entries
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.214
suggestion
57
51
144
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
first_chapter = 1 for chapter in item.get('cuepoints'): start_time = chapter.get('time') # Often, the first chapter does not start at zero. In this case, # insert an intro chapter so that first chapter is th...
entries should actually be a paged list
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.143
suggestion
39
28
144
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
pukkandan
teridon
username, password = self._get_login_info() if username is None: if self._LOGIN_REQUIRED: raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True) return # first get JWT token data = { 'affilia...
no need to use try-except Just set `Unable to obtain token` as errnote in download_json
def _login(self): username, password = self._get_login_info() if not username: self.raise_login_required() token_response = self._download_json( self._OAUTH_URL, None, 'Obtaining token', errnote='Unable to obtain token', data=urlencode_postdata({ ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.429
suggestion
88
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Ashish0804
teridon
data = { 'affiliate': 'none', 'grant_type': 'device', 'device_vendor': 'unknown', 'device_model': 'unknown', 'app_id': 'dch.webapp', 'app_distributor': 'berlinphil', 'app_version': '1.0.0', 'client_secret': self._CLI...
no need to print this to screen.
self._OAUTH_URL, None, 'Obtaining token', errnote='Unable to obtain token', data=urlencode_postdata({ 'affiliate': 'none', 'grant_type': 'device', 'device_vendor': 'unknown', 'app_id': 'dch.webapp', 'app_version': '1...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.071
suggestion
32
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Ashish0804
teridon
key = item.get('id') duration = item.get('duration_total') # avoid filenames that exceed filesystem limits title = (title[:MAX_TITLE_LENGTH] + '..') if len(title) > MAX_TITLE_LENGTH else title # append the duration in minutes to the title ...
```suggestion for chapter in item['cuepoints'] or []: ```
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, parse_resolution, traverse_obj, try_get, urlencode_postdata, ) class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = ...
@@ -0,0 +1,201 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.compat import ( + compat_HTTPError, +) + +from yt_dlp.utils import ( + ExtractorError, + urlencode_postdata, +) + + +class DigitalConcertHallIE...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.571
suggestion
79
51
144
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Ashish0804
teridon
class DigitalConcertHallIE(InfoExtractor): IE_DESC = 'DigitalConcertHall extractor' _VALID_URL = r'https?://(?:www\.)?digitalconcerthall\.com/(?P<language>[a-z]+)/concert/(?P<id>[0-9]+)' _OAUTH_URL = 'https://api.digitalconcerthall.com/v2/oauth2/token' _ACCESS_TOKEN = 'none' _NETRC_MACHINE = 'digit...
return is not needed here afaik. also use `self.raise_login_required` instead of ExtractorError
_VALID_URL = r'https?://(?:www\.)?digitalconcerthall\.com/(?P<language>[a-z]+)/concert/(?P<id>[0-9]+)' _OAUTH_URL = 'https://api.digitalconcerthall.com/v2/oauth2/token' _ACCESS_TOKEN = None _NETRC_MACHINE = 'digitalconcerthall' _TESTS = [{ 'note': 'Playlist with only one video', 'url...
@@ -0,0 +1,156 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..compat import ( + compat_HTTPError, +) + +from ..utils import ( + ExtractorError, + parse_resolution, + traverse_obj, + try_get, + urlencode_postdata, +) + + +class DigitalConcertHa...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.571
refactor
96
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Ashish0804
teridon
'id': '53201-1', 'ext': 'mp4', 'title': 'Kurt Weill - [Magic Night]', 'thumbnail': r're:^https?://images.digitalconcerthall.com/cms/thumbnails.*\.jpg$', 'upload_date': '20210624', 'timestamp': 1624548600, }, 'params': {'skip_downloa...
Are you sure all these are necessary? did u try minimizing them?
'title': '[Magic Night]', 'thumbnail': r're:^https?://images.digitalconcerthall.com/cms/thumbnails.*\.jpg$', 'upload_date': '20210624', 'timestamp': 1624548600, 'duration': 2798, 'album_artist': 'Members of the Berliner Philharmoniker / Simon Rössl...
@@ -0,0 +1,156 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..compat import ( + compat_HTTPError, +) + +from ..utils import ( + ExtractorError, + parse_resolution, + traverse_obj, + try_get, + urlencode_postdata, +) + + +class DigitalConcertHa...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.214
question
65
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Ashish0804
teridon
'upload_date': '20210624', 'timestamp': 1624548600, }, 'params': {'skip_download': 'm3u8'}, }] def _login(self): username, password = self._get_login_info() if username is None: raise ExtractorError('No login info available, needed for using %...
```suggestion self._ACCESS_TOKEN = token_response['access_token'] ```
'duration': 2798, 'album_artist': 'Members of the Berliner Philharmoniker / Simon Rössler', }, 'params': {'skip_download': 'm3u8'}, }, { 'note': 'Concert with several works and an interview', 'url': 'https://www.digitalconcerthall.com/en/concert/53785', ...
@@ -0,0 +1,156 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..compat import ( + compat_HTTPError, +) + +from ..utils import ( + ExtractorError, + parse_resolution, + traverse_obj, + try_get, + urlencode_postdata, +) + + +class DigitalConcertHa...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.571
suggestion
79
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Ashish0804
teridon
'client_secret': '2ySLN+2Fwb', }), headers={ 'Content-Type': 'application/x-www-form-urlencoded', }) self._ACCESS_TOKEN = token_response.get('access_token') try: self._download_json( self._OAUTH_URL, None...
this try-except is not really needed imo. This a single static request which can be easily debugged so no point in being extra verbose and providing the error message from the api.
self._OAUTH_URL, None, 'Obtaining token', errnote='Unable to obtain token', data=urlencode_postdata({ 'affiliate': 'none', 'grant_type': 'device', 'device_vendor': 'unknown', 'app_id': 'dch.webapp', 'app_version': '1...
@@ -0,0 +1,156 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..compat import ( + compat_HTTPError, +) + +from ..utils import ( + ExtractorError, + parse_resolution, + traverse_obj, + try_get, + urlencode_postdata, +) + + +class DigitalConcertHa...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.5
bug
181
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Ashish0804
teridon
'Content-Type': 'application/x-www-form-urlencoded', 'Referer': 'https://www.digitalconcerthall.com/en/login', 'Authorization': 'Bearer ' + self._ACCESS_TOKEN }) except ExtractorError as e: msg = 'Unable to login' ...
```suggestion thumbnail_url = (self._html_search_regex(r'(https?://images\.digitalconcerthall\.com/cms/thumbnails/.*\.jpg)', ```
self._download_json( self._OAUTH_URL, None, note='Logging in', errnote='Unable to login', data=urlencode_postdata({ 'grant_type': 'password', 'username': username, 'password': password, }), headers={ ...
@@ -0,0 +1,156 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..compat import ( + compat_HTTPError, +) + +from ..utils import ( + ExtractorError, + parse_resolution, + traverse_obj, + try_get, + urlencode_postdata, +) + + +class DigitalConcertHa...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.714
suggestion
138
51
51
false
add support for digitalconcerthall.com
1,931
yt-dlp/yt-dlp
132,642
Python
Ashish0804
teridon
'id': '2502343', 'ext': 'mp4', 'title': 'Under The Night', 'description': 'md5:d2b8ca816579ae8a7bf28bfff8cefc8a', 'duration': 2583, 'view_count': int, 'average_rating': 0, 'age_limit': 14, 'genre': 'Action, Sci-F...
this should be different from any of the tests. Leave the old one here
'id': '2510064', 'ext': 'mp4', 'title': 'Touch Football', 'description': 'md5:cfbb513cf5de41e8b56d7ab756cff4df', 'duration': 1398, 'view_count': int, 'average_rating': 0, 'age_limit': 17, 'genre': 'Comedy', ...
@@ -23,32 +23,35 @@ class CrackleIE(InfoExtractor): _VALID_URL = r'(?:crackle:|https?://(?:(?:www|m)\.)?(?:sony)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)' _TESTS = [{ - # geo restricted to CA - 'url': 'https://www.crackle.com/andromeda/2502343', + # Crackle is available in ...
yt_dlp/extractor/crackle.py
26
Python
0.286
suggestion
72
51
51
false
[crackle] Always look for non-DRM formats
1,938
yt-dlp/yt-dlp
132,642
Python
Ashish0804
raleeper
from .common import InfoExtractor from ..utils import ( traverse_obj, unified_strdate, ) class NateIE(InfoExtractor): _VALID_URL = r'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)' _TESTS = [{ 'url': 'https://tv.nate.com/clip/1848976', 'info_dict': { 'id': '1848976', ...
aren't they expected to be string value? :thinking:
import itertools from .common import InfoExtractor from ..utils import ( int_or_none, str_or_none, traverse_obj, unified_strdate, ) class NateIE(InfoExtractor): _VALID_URL = r'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)' _TESTS = [{ 'url': 'https://tv.nate.com/clip/1848976', ...
@@ -0,0 +1,159 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + unified_strdate, +) + + +class NateIE(InfoExtractor): + _VALID_URL = r'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)' + + _TESTS = [{ + 'url': 'https:...
yt_dlp/extractor/nate.py
26
Python
0.214
suggestion
51
51
51
false
[NateTV] Add extractor(s)
1,950
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
Ashish0804
_TESTS = [{ 'url': 'https://tv.nate.com/clip/1848976', 'info_dict': { 'id': '1848976', 'ext': 'mp4', 'title': '[결승 오프닝 타이틀] 2018 LCK 서머 스플릿 결승전 kt Rolster VS Griffin', 'description': 'md5:e1b79a7dcf0d8d586443f11366f50e6f', 'thumbnail': 'htt...
`thumbnail` can change, no? just do a regex match
_VALID_URL = r'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)' _TESTS = [{ 'url': 'https://tv.nate.com/clip/1848976', 'info_dict': { 'id': '1848976', 'ext': 'mp4', 'title': '[결승 오프닝 타이틀] 2018 LCK 서머 스플릿 결승전 kt Rolster VS Griffin', 'description': 'md5:...
@@ -0,0 +1,119 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import itertools + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + unified_strdate, +) + + +class NateIE(InfoExtractor): + _VALID_URL = r'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)' + + _TESTS = [{ + ...
yt_dlp/extractor/nate.py
26
Python
0.286
suggestion
49
51
51
false
[NateTV] Add extractor(s)
1,950
yt-dlp/yt-dlp
132,642
Python
pukkandan
Ashish0804
'age_limit': 15, 'duration': 201, 'uploader': '옷소매 붉은 끝동', 'channel': '옷소매 붉은 끝동', 'channel_id': '27987', 'uploader_id': '27987', 'tags': 'count:20', }, 'params': {'skip_download': True} }] _QUALITY = { ...
set `height`, not `resolution`. Also, u forgot `_sort_formats`
'thumbnail': r're:^https?://.*\.jpg', 'upload_date': '20211204', 'age_limit': 15, 'duration': 201, 'uploader': '옷소매 붉은 끝동', 'channel': '옷소매 붉은 끝동', 'channel_id': '27987', 'uploader_id': '27987', 'tags': 'count:20...
@@ -0,0 +1,119 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import itertools + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + unified_strdate, +) + + +class NateIE(InfoExtractor): + _VALID_URL = r'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)' + + _TESTS = [{ + ...
yt_dlp/extractor/nate.py
26
Python
0.357
style
62
51
51
false
[NateTV] Add extractor(s)
1,950
yt-dlp/yt-dlp
132,642
Python
pukkandan
Ashish0804
'34': '720p', '33': '480p', '32': '360p', '31': '270p', } def _real_extract(self, url): id = self._match_id(url) video_data = self._download_json(f'https://tv.nate.com/api/v1/clip/{id}', id) formats = [{ 'url': f_url, 'resolution':...
`str_or_none` to handle None correctly
'36': 2160, '35': 1080, '34': 720, '33': 480, '32': 360, '31': 270, } def _real_extract(self, url): id = self._match_id(url) video_data = self._download_json(f'https://tv.nate.com/api/v1/clip/{id}', id) formats = [{ 'format_id'...
@@ -0,0 +1,119 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import itertools + +from .common import InfoExtractor +from ..utils import ( + traverse_obj, + unified_strdate, +) + + +class NateIE(InfoExtractor): + _VALID_URL = r'https?://tv\.nate\.com/clip/(?P<id>[0-9]+)' + + _TESTS = [{ + ...
yt_dlp/extractor/nate.py
26
Python
0.357
suggestion
38
51
51
false
[NateTV] Add extractor(s)
1,950
yt-dlp/yt-dlp
132,642
Python
pukkandan
Ashish0804
}, { 'url': 'https://www.sonyliv.com/music-videos/yeh-un-dinon-ki-baat-hai-1000018779', 'only_matching': True, }] _GEO_COUNTRIES = ['IN'] _AUTH_TOKEN = None _HEADERS = {} _LOGIN_HINT = 'Use "--username <mobile_number>" to login using otp or "--username token" and "--password <use...
line too long. Use `'''` or even better `json.dumps`
}, { 'url': 'https://www.sonyliv.com/music-videos/yeh-un-dinon-ki-baat-hai-1000018779', 'only_matching': True, }] _GEO_COUNTRIES = ['IN'] _HEADERS = {} _LOGIN_HINT = 'Use "--username <mobile_number>" to login using OTP or "--username token --password <auth_token>" to login using auth...
@@ -56,17 +59,54 @@ class SonyLIVIE(InfoExtractor): 'only_matching': True, }] _GEO_COUNTRIES = ['IN'] - _TOKEN = None + _AUTH_TOKEN = None + _HEADERS = {} + _LOGIN_HINT = 'Use "--username <mobile_number>" to login using otp or "--username token" and "--password <user_token>" to login usin...
yt_dlp/extractor/sonyliv.py
26
Python
0.429
refactor
52
51
51
false
[SonyLiv]Add otp login support
1,959
yt-dlp/yt-dlp
132,642
Python
pukkandan
Ashish0804
def _call_api(self, version, path, video_id): try: return self._download_json( 'https://apiv2.sonyliv.com/AGL/%s/A/ENG/WEB/%s' % (version, path), video_id, headers=self._HEADERS)['resultObj'] except ExtractorError as e: if isinstance(e.cause, c...
unreachable code? since login throws error in this case
raise ExtractorError(otp_request_json['message'], expected=True) return otp_verify_json['resultObj']['accessToken'] def _call_api(self, version, path, video_id): try: return self._download_json( 'https://apiv2.sonyliv.com/AGL/%s/A/ENG/WEB/%s' % (version, path...
@@ -76,7 +116,15 @@ def _call_api(self, version, path, video_id): raise def _real_initialize(self): - self._TOKEN = self._call_api('1.4', 'ALL/GETTOKEN', None) + self._HEADERS['security_token'] = self._call_api('1.4', 'ALL/GETTOKEN', None) + username, password = self._get_login_...
yt_dlp/extractor/sonyliv.py
26
Python
0.357
suggestion
56
51
51
false
[SonyLiv]Add otp login support
1,959
yt-dlp/yt-dlp
132,642
Python
pukkandan
Ashish0804
'episode_number': 1, 'release_year': 2016, }, 'params': { 'skip_download': True, }, }, { 'url': 'https://www.sonyliv.com/movies/tahalka-1000050121?watch=true', 'only_matching': True, }, { 'url': 'https://www.sonyliv.com/clip/jig...
```suggestion _LOGIN_HINT = 'Use "--username <mobile_number>" to login using OTP or "--username token --password <user_token>" to login using auth token' ```
'episode_number': 1, 'release_year': 2016, }, 'params': { 'skip_download': True, }, }, { 'url': 'https://www.sonyliv.com/movies/tahalka-1000050121?watch=true', 'only_matching': True, }, { 'url': 'https://www.sonyliv.com/clip/jig...
@@ -56,17 +59,54 @@ class SonyLIVIE(InfoExtractor): 'only_matching': True, }] _GEO_COUNTRIES = ['IN'] - _TOKEN = None + _AUTH_TOKEN = None + _HEADERS = {} + _LOGIN_HINT = 'Use "--username <mobile_number>" to login using otp or "--username token" and "--password <user_token>" to login usin...
yt_dlp/extractor/sonyliv.py
26
Python
0.786
security
163
51
51
false
[SonyLiv]Add otp login support
1,959
yt-dlp/yt-dlp
132,642
Python
pukkandan
Ashish0804
def _call_api(self, version, path, video_id): try: return self._download_json( 'https://apiv2.sonyliv.com/AGL/%s/A/ENG/WEB/%s' % (version, path), video_id, headers=self._HEADERS)['resultObj'] except ExtractorError as e: if isinstance(e.cause, ...
```suggestion self._HEADERS['authorization'] = self._login(username, password) ``` why have a separate `_AUTH_TOKEN`
def _call_api(self, version, path, video_id): try: return self._download_json( 'https://apiv2.sonyliv.com/AGL/%s/A/ENG/WEB/%s' % (version, path), video_id, headers=self._HEADERS)['resultObj'] except ExtractorError as e: if isinstance(e.cause, c...
@@ -76,7 +120,13 @@ def _call_api(self, version, path, video_id): raise def _real_initialize(self): - self._TOKEN = self._call_api('1.4', 'ALL/GETTOKEN', None) + self._HEADERS['security_token'] = self._call_api('1.4', 'ALL/GETTOKEN', None) + username, password = self._get_login_...
yt_dlp/extractor/sonyliv.py
26
Python
0.786
security
131
51
51
false
[SonyLiv]Add otp login support
1,959
yt-dlp/yt-dlp
132,642
Python
pukkandan
Ashish0804
def _login(self, username, password): if len(username) == 10 and username.isdigit() and self._AUTH_TOKEN is None: self.report_login() data = '''{"mobileNumber":"%s","channelPartnerID":"MSMIND","country":"IN","timestamp":"%s", "otpSize":6,"loginType":"REGISTERORSIGNIN","i...
```py def _login(self, username, password): if username == 'token' and len(password) > 1198: return password elif len(username) != 10 or not username.isdigit(): raise ExtractorError(f'Invalid username/password; {self._LOGIN_HINT}') ... return otp_verify...
def _login(self, username, password): if username.lower() == 'token' and len(password) > 1198: return password elif len(username) != 10 or not username.isdigit(): raise ExtractorError(f'Invalid username/password; {self._LOGIN_HINT}') self.report_login() data ...
@@ -56,17 +59,58 @@ class SonyLIVIE(InfoExtractor): 'only_matching': True, }] _GEO_COUNTRIES = ['IN'] - _TOKEN = None + _AUTH_TOKEN = None + _HEADERS = {} + _LOGIN_HINT = 'Use "--username <mobile_number>" to login using OTP or "--username token --password <auth_token>" to login using auth...
yt_dlp/extractor/sonyliv.py
26
Python
1
refactor
358
51
51
false
[SonyLiv]Add otp login support
1,959
yt-dlp/yt-dlp
132,642
Python
pukkandan
Ashish0804
import urllib.parse from copy import copy from .common import InfoExtractor from .extractors import BrightcoveNewIE from ..utils import int_or_none class ToggoIE(InfoExtractor): IE_NAME = 'toggo' _VALID_URL = r'https?://(?:www\.)?toggo\.de/[\w-]+/folge/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://...
Import from brightcove.py directly
from .common import InfoExtractor from ..utils import int_or_none, parse_qs class ToggoIE(InfoExtractor): IE_NAME = 'toggo' _VALID_URL = r'https?://(?:www\.)?toggo\.de/[\w-]+/folge/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://www.toggo.de/weihnachtsmann--co-kg/folge/ein-geschenk-fuer-zwei', ...
@@ -0,0 +1,87 @@ +import urllib.parse +from copy import copy + +from .common import InfoExtractor +from .extractors import BrightcoveNewIE
yt_dlp/extractor/toggo.py
5
Python
0.071
suggestion
34
30
30
false
[toggo] Add extractor
1,961
yt-dlp/yt-dlp
132,642
Python
Lesmiscore
ghost
}, }, { # new BV video id format 'url': 'https://www.bilibili.com/video/BV1JE411F741', 'only_matching': True, }, { # Anthology 'url': 'https://www.bilibili.com/video/BV1bK411W797', 'info_dict': { 'id': 'BV1bK411W797', 'title': '物语中的...
there is no longer any anthology in the tests?
'skip_download': True, }, }, { # new BV video id format 'url': 'https://www.bilibili.com/video/BV1JE411F741', 'only_matching': True, }, { # Anthology 'url': 'https://www.bilibili.com/video/BV1bK411W797', 'info_dict': { 'id': 'BV1bK4...
@@ -80,42 +79,20 @@ class BiliBiliIE(InfoExtractor): }, 'skip': 'Geo-restricted to China', }, { - # Title with double quotes 'url': 'http://www.bilibili.com/video/av8903802/', 'info_dict': { - 'id': '8903802', - 'title': '阿滴英文|英文歌分享#6 "Closer', + ...
yt_dlp/extractor/bilibili.py
26
Python
0.071
question
46
51
51
false
[Bilibili] Add 8k support
1,964
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
urlencode_postdata, url_or_none, OnDemandPagedList ) class BiliBiliIE(InfoExtractor): _VALID_URL = r'''(?x) https?:// (?:(?:www|bangumi)\.)? bilibili\.(?:tv|com)/ (?: (?: ...
```suggestion 'id': '1074402', ```
urlencode_postdata, url_or_none, OnDemandPagedList ) class BiliBiliIE(InfoExtractor): _VALID_URL = r'''(?x) https?:// (?:(?:www|bangumi)\.)? bilibili\.(?:tv|com)/ (?: (?: ...
@@ -52,16 +52,14 @@ class BiliBiliIE(InfoExtractor): 'url': 'http://www.bilibili.com/video/av1074402/', 'md5': '5f7d29e1a2872f3df0cf76b1f87d3788', 'info_dict': { - 'id': '1074402', - 'ext': 'flv', + 'id': '1074402_part1',
yt_dlp/extractor/bilibili.py
26
Python
0.429
suggestion
48
51
51
false
[Bilibili] Add 8k support
1,964
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
'upload_date': '20140420', 'description': 'md5:ce18c2a2d2193f0df2917d270f2e5923', 'timestamp': 1398012678, }, }, { # Tested in BiliBiliBangumiIE 'url': 'http://bangumi.bilibili.com/anime/1869/play#40062', 'only_matching': True, }, { # b...
```suggestion 'id': '8903802', ```
'upload_date': '20140420', 'description': 'md5:ce18c2a2d2193f0df2917d270f2e5923', 'timestamp': 1398012678, }, }, { # Tested in BiliBiliBangumiIE 'url': 'http://bangumi.bilibili.com/anime/1869/play#40062', 'only_matching': True, }, { # b...
@@ -82,42 +80,20 @@ class BiliBiliIE(InfoExtractor): }, 'skip': 'Geo-restricted to China', }, { - # Title with double quotes 'url': 'http://www.bilibili.com/video/av8903802/', 'info_dict': { - 'id': '8903802', + 'id': '8903802_part1',
yt_dlp/extractor/bilibili.py
26
Python
0.429
suggestion
48
51
51
false
[Bilibili] Add 8k support
1,964
yt-dlp/yt-dlp
132,642
Python
pukkandan
u-spec-png
self._extract_api_data(video, video_id) for video in videos ] return self.playlist_result(videos, video_id) def _extract_api_data(self, video, video_id): if video.get('error_code') == 'contentGeoblocked': self.raise_geo_restricted(countries=video['geo_loc...
```suggestion thumbnails = [{ 'id': image.get('id'), 'url': append_image_url(image['url']), 'width': 960, 'height': 540, } for image in video.get('images') or [] if image.get('url')] ```
self.raise_geo_restricted(countries=video['geo_locations']) formats, subs = [], {} for format_id, format_url in video['source'].items(): ext = determine_ext(format_url) if ext == 'm3u8': formats_, subs_ = self._extract_m3u8_formats_and_subtitles( ...
@@ -0,0 +1,280 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + urlencode, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + int_or_none, + smuggle_url, + try_get, + unescapeHTML,...
yt_dlp/extractor/glomex.py
26
Python
0.786
suggestion
257
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
if not videos: raise ExtractorError('no videos found for %s' % video_id) if len(videos) == 1: return self._extract_api_data(videos[0], video_id) # assume some kind of playlist videos = [ self._extract_api_data(video, video_id) for video in ...
add this to `thumbnails`. You shouldnt return both separately
raise ExtractorError('no videos found for %s' % video_id) videos = [self._extract_api_data(video, video_id) for video in videos] return videos[0] if len(videos) == 1 else self.playlist_result(videos, video_id) def _extract_api_data(self, video, video_id): if video.get('error_cod...
@@ -0,0 +1,280 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + urlencode, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + int_or_none, + smuggle_url, + try_get, + unescapeHTML,...
yt_dlp/extractor/glomex.py
26
Python
0.429
suggestion
61
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
'title': video.get('title'), 'description': video.get('description'), 'thumbnail': thumbnail, 'thumbnails': thumbnails, 'duration': int_or_none(video.get('clip_duration')), 'timestamp': video.get('created_at'), } def _extract_formats_a...
```suggestion format['language'] = options['language'] ```
return { 'id': video.get('clip_id') or video_id, 'title': video.get('title'), 'description': video.get('description'), 'thumbnails': thumbnails, 'duration': int_or_none(video.get('clip_duration')), 'timestamp': video.get('created_at'), ...
@@ -0,0 +1,280 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + urlencode, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + int_or_none, + smuggle_url, + try_get, + unescapeHTML,...
yt_dlp/extractor/glomex.py
26
Python
0.571
suggestion
76
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
if not cls.suitable(url): continue yield cls._smuggle_origin_url(url, origin_url) elif html_tag: if html_tag == "div" and not glomex_player: continue if not video_id_html or not integration_html: ...
```suggestion video_id, integration = self._match_valid_url(url).group('id', 'integration') ```
# coding: utf-8 from __future__ import unicode_literals import re import urllib.parse from .common import InfoExtractor from ..utils import ( determine_ext, ExtractorError, int_or_none, parse_qs, smuggle_url, unescapeHTML, unsmuggle_url, ) class GlomexBaseIE(InfoExtractor): _DEFAULT_...
@@ -0,0 +1,280 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + urlencode, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + int_or_none, + smuggle_url, + try_get, + unescapeHTML,...
yt_dlp/extractor/glomex.py
26
Python
0.714
suggestion
105
29
231
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
yield cls._smuggle_origin_url(url, origin_url) elif html_tag: if html_tag == "div" and not glomex_player: continue if not video_id_html or not integration_html: continue yield cls.build_player_url(video_i...
```suggestion return self._download_and_extract_api_data(video_id, integration, origin_url) ```
# coding: utf-8 from __future__ import unicode_literals import re import urllib.parse from .common import InfoExtractor from ..utils import ( determine_ext, ExtractorError, int_or_none, parse_qs, smuggle_url, unescapeHTML, unsmuggle_url, ) class GlomexBaseIE(InfoExtractor): _DEFAULT_...
@@ -0,0 +1,280 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + urlencode, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + int_or_none, + smuggle_url, + try_get, + unescapeHTML,...
yt_dlp/extractor/glomex.py
26
Python
0.786
refactor
105
27
231
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
_TEST = { 'url': 'https://video.glomex.com/sport/v-cb24uwg77hgh-nach-2-0-sieg-guardiola-mit-mancity-vor-naechstem-titel', 'md5': 'cec33a943c4240c9cb33abea8c26242e', 'info_dict': { 'id': 'v-cb24uwg77hgh', 'ext': 'mp4', 'title': 'md5:38a90cedcfadd72982c81ac...
```suggestion return self.url_result( GlomexEmbedIE.build_player_url(video_id, self._INTEGRATION_ID, url), GlomexEmbedIE.ie_key(), video_id) ```
GlomexEmbedIE.build_player_url(video_id, self._INTEGRATION_ID, url), GlomexEmbedIE.ie_key(), video_id) class GlomexEmbedIE(GlomexBaseIE): IE_NAME = 'glomex:embed' IE_DESC = 'Glomex embedded videos' _BASE_PLAYER_URL = '//player.glomex.com/integration/1/iframe-player.html' _BASE_...
@@ -0,0 +1,280 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + urlencode, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + int_or_none, + smuggle_url, + try_get, + unescapeHTML,...
yt_dlp/extractor/glomex.py
26
Python
0.714
suggestion
180
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
format['language'] = options.get('language') self._sort_formats(formats) return formats, subs class GlomexIE(GlomexBaseIE): IE_NAME = 'glomex' IE_DESC = 'Glomex videos' _VALID_URL = r'https?://video\.glomex\.com/[^/]+/(?P<id>v-[^-]+)' # Hard-coded integration ID for vid...
```suggestion _TESTS = [{ 'url': 'https://video.glomex.com/sport/v-cb24uwg77hgh-nach-2-0-sieg-guardiola-mit-mancity-vor-naechstem-titel', 'md5': 'cec33a943c4240c9cb33abea8c26242e', 'info_dict': { 'id': 'v-cb24uwg77hgh', 'ext': 'mp4', 'title': 'md5:3...
'title': 'md5:38a90cedcfadd72982c81acf13556e0c', 'description': 'md5:1ea6b6caff1443fcbbba159e432eedb8', 'duration': 29600, 'timestamp': 1619895017, 'upload_date': '20210501', }, }] def _real_extract(self, url): video_id = self._match_i...
@@ -0,0 +1,280 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + urlencode, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + int_or_none, + smuggle_url, + try_get, + unescapeHTML,...
yt_dlp/extractor/glomex.py
26
Python
0.786
suggestion
588
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
return self._download_json( self._API_URL, video_id, 'Downloading %s JSON' % video_id_type, 'Unable to download %s JSON' % video_id_type, query=query) def _download_and_extract_api_data(self, video_id, integration, current_url): api_data = self._downl...
```suggestion info['formats'], info['subtitles'] = self._extract_formats_and_subs(video, video_id) ``` why do u split lines like that, it does not help readability at all, but only hurts
self._API_URL, video_id, 'Downloading %s JSON' % video_id_type, 'Unable to download %s JSON' % video_id_type, query=query) def _download_and_extract_api_data(self, video_id, integration, current_url): api_data = self._download_api_data(video_id, integration, ...
@@ -0,0 +1,280 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from urllib.parse import ( + urlencode, + urlparse, +) + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + int_or_none, + smuggle_url, + try_get, + unescapeHTML,...
yt_dlp/extractor/glomex.py
26
Python
0.786
refactor
199
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
return self.playlist_from_matches( videopress_urls, video_id, video_title, ie=VideoPressIE.ie_key()) # Look for Rutube embeds rutube_urls = RutubeIE._extract_urls(webpage) if rutube_urls: return self.playlist_from_matches( rutube_urls, vid...
Can you add tests? Preferably one for each type of embed we try to detect
if videa_urls: return self.playlist_from_matches(videa_urls, video_id, video_title, ie=VideaIE.ie_key()) # Look for 20 minuten embeds twentymin_urls = TwentyMinutenIE._extract_urls(webpage) if twentymin_urls: return self.playlist_from_matches( twe...
@@ -3410,6 +3411,12 @@ def _real_extract(self, url): return self.playlist_from_matches( rutube_urls, video_id, video_title, ie=RutubeIE.ie_key()) + # Look for Glomex embeds + glomex_urls = list(GlomexEmbedIE._extract_urls(webpage, url)) + if glomex_urls: + ...
yt_dlp/extractor/generic.py
26
Python
0.429
suggestion
73
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
'params': {'skip_download': 'm3u8'}, }, { 'url': 'https://player.glomex.com/integration/1/iframe-player.html?origin=fullpage&integrationId=19syy24xjn1oqlpc&playlistId=rl-vcb49w1fb592p&playlistIndex=0', 'info_dict': { 'id': 'rl-vcb49w1fb592p', }, 'playlist_count': ...
I simplified the regex a bit. Not entirely sure nothing is broken due to lack of tests. Please confirm
'title': 'md5:35647293513a6c92363817a0fb0a7961', }, }, { 'url': 'https://player.glomex.com/integration/1/iframe-player.html?origin=fullpage&integrationId=19syy24xjn1oqlpc&playlistId=rl-vcb49w1fb592p&playlistIndex=0', 'info_dict': { 'id': 'rl-vcb49w1fb592p', },...
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.357
bug
102
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
formats, subs = [], {} for format_id, format_url in video['source'].items(): ext = determine_ext(format_url) if ext == 'm3u8': formats_, subs_ = self._extract_m3u8_formats_and_subtitles( format_url, video_id, 'mp4', m3u8_id=format_id, ...
This compressed code is very hard to read.
formats, subs = [], {} for format_id, format_url in video['source'].items(): ext = determine_ext(format_url) if ext == 'm3u8': formats_, subs_ = self._extract_m3u8_formats_and_subtitles( format_url, video_id, 'mp4', m3u8_id=format_id, ...
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.071
suggestion
42
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
'url': 'https://video.glomex.com/sport/v-cb24uwg77hgh-nach-2-0-sieg-guardiola-mit-mancity-vor-naechstem-titel', 'md5': 'cec33a943c4240c9cb33abea8c26242e', 'info_dict': { 'id': 'v-cb24uwg77hgh', 'ext': 'mp4', 'title': 'md5:38a90cedcfadd72982c81acf13556e0c', ...
`_VALID_URL` would match anything in the integration version field, rather than `1`, which is hard-coded in `_BASE_PLAYER_URL`. It is also does not capture `integration` parameter. Capturing a second parameter, allowing other parameters and arbitrary order considerably complicates things, so I understand you opted t...
_TESTS = [{ 'url': 'https://video.glomex.com/sport/v-cb24uwg77hgh-nach-2-0-sieg-guardiola-mit-mancity-vor-naechstem-titel', 'md5': 'cec33a943c4240c9cb33abea8c26242e', 'info_dict': { 'id': 'v-cb24uwg77hgh', 'ext': 'mp4', 'title': 'md5:38a90cedcfadd72982c81a...
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.857
refactor
628
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
def _real_extract(self, url): video_id = self._match_id(url) return self.url_result( GlomexEmbedIE.build_player_url(video_id, self._INTEGRATION_ID, url), GlomexEmbedIE.ie_key(), video_id) class GlomexEmbedIE(GlomexBaseIE): IE_NAME = 'glomex:embed' IE_DESC = 'Glomex...
Is `m3u8` a special value? Or does it also serve as a comment? Actually I think there is no reason for `skip_download` in this case, so I would rather remove this.
def _real_extract(self, url): video_id = self._match_id(url) return self.url_result( GlomexEmbedIE.build_player_url(video_id, self._INTEGRATION_ID, url), GlomexEmbedIE.ie_key(), video_id) class GlomexEmbedIE(GlomexBaseIE): IE_NAME = 'glomex:embed' IE_DESC = 'Glomex...
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.571
refactor
166
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
'url': 'https://player.glomex.com/integration/1/iframe-player.html?origin=fullpage&integrationId=19syy24xjn1oqlpc&playlistId=rl-vcb49w1fb592p&playlistIndex=0', 'info_dict': { 'id': 'rl-vcb49w1fb592p', }, 'playlist_count': 100, }, { 'url': 'https://player.glomex.co...
This actually documents all three integration methods we try to match here, thus such a comment should either be at the top of the regex, or precede it...
}, { 'url': 'https://player.glomex.com/integration/1/iframe-player.html?origin=fullpage&integrationId=19syy24xjn1oqlpc&playlistId=rl-vcb49w1fb592p&playlistIndex=0', 'info_dict': { 'id': 'rl-vcb49w1fb592p', }, 'playlist_count': 100, }, { 'url': 'https://player....
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.429
suggestion
154
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
query_string = urllib.parse.urlencode({ 'playlistId': video_id, 'integrationId': integration, }) return cls._smuggle_origin_url(f'https:{cls._BASE_PLAYER_URL}?{query_string}', origin_url) @classmethod def _extract_urls(cls, webpage, origin_url): EMBED_RE ...
Previously there was a comment explaining how `_VALID_URL` is simplified for matching in the context of an iframe src attribute value. I think this in-line is harder to understand. The comment about `_VALID_URL` integration version matching also applies here.
def build_player_url(cls, video_id, integration, origin_url=None): query_string = urllib.parse.urlencode({ 'playlistId': video_id, 'integrationId': integration, }) return cls._smuggle_origin_url(f'https:{cls._BASE_PLAYER_URL}?{query_string}', origin_url) @classme...
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.571
suggestion
262
51
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
<iframe[^>]+?src=(?P<_q1>%(quot_re)s)(?P<url>%(url_re)s)(?P=_q1)| # https://docs.glomex.com/publisher/video-player-integration/javascript-api/ <(?P<html_tag>glomex-player|div)(?: data-integration-id=(?P<_q2>%(quot_re)s)(?P<integration_html>(?:(?!(?P=_q2)).)+)(?P=_q2)|...
I used the long list of variables assigned from match groups to precisely avoid the verbose dict access syntax afterwards.
# in comparison with _VALID_URL: # * make the scheme optional # * simplify the query string part; after extracting iframe src, the URL will be matched again VALID_SRC = rf'(?:https?:)?{cls._BASE_PLAYER_URL_RE}\?(?:(?!(?P=_q1)).)+' # https://docs.glomex.com/publisher/video-player...
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.429
suggestion
122
46
51
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
data-playlist-id=(?P<_q3>%(quot_re)s)(?P<id_html>(?:(?!(?P=_q3)).)+)(?P=_q3)| data-glomex-player=(?P<_q4>%(quot_re)s)(?P<glomex_player>true)(?P=_q4)| [^>]*? )+>| # naive parsing of inline scripts for hard-coded integration parameters <(...
So this hard-codes https scheme, despite the fact that we have the scheme used in `origin_url` -- I recall your objection to this.
# https://docs.glomex.com/publisher/video-player-integration/javascript-api/ EMBED_RE = r'''(?x)(?: <iframe[^>]+?src=(?P<_q1>%(quot_re)s)(?P<url>%(url_re)s)(?P=_q1)| <(?P<html_tag>glomex-player|div)(?: data-integration-id=(?P<_q2>%(quot_re)s)(?P<integration_html>...
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.571
suggestion
130
42
48
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
data-glomex-player=(?P<_q4>%(quot_re)s)(?P<glomex_player>true)(?P=_q4)| [^>]*? )+>| # naive parsing of inline scripts for hard-coded integration parameters <(?P<script_tag>script)[^<]*?>(?: (?P<_stjs1>dataset\.)?integrationId\s*(?(_stjs...
So this now only validates the presence of `playlistId` parameter; `integrationId` is deferred to extraction.
# https://docs.glomex.com/publisher/video-player-integration/javascript-api/ EMBED_RE = r'''(?x)(?: <iframe[^>]+?src=(?P<_q1>%(quot_re)s)(?P<url>%(url_re)s)(?P=_q1)| <(?P<html_tag>glomex-player|div)(?: data-integration-id=(?P<_q2>%(quot_re)s)(?P<integration_html>(...
@@ -0,0 +1,224 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + ExtractorError, + int_or_none, + parse_qs, + smuggle_url, + unescapeHTML, + unsmuggle_url, +) + + +class Glome...
yt_dlp/extractor/glomex.py
26
Python
0.571
refactor
109
41
47
false
[extractor/glomex] Add new extractor
1,979
yt-dlp/yt-dlp
132,642
Python
zmousm
zmousm
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, HEADRequest, unescapeHTML, unified_timestamp, ) class MegaT...
I'm not sure the base class is even needed here. Personally, I think it's better to have it be a module level function since `self` is never actually used
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_timestamp, ) class MegaTVComBaseIE(InfoExtractor): _PLAYER_DIV_...
@@ -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
26
Python
0.571
suggestion
154
51
51
false
[extractor/megatvcom] Add new extractor
1,980
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
def _real_extract(self, url): video_id, display_id = self._match_valid_url(url).group('id', 'slug') _is_article = video_id is None webpage = self._download_webpage(url, video_id or display_id) if _is_article: video_id = self._search_regex( r'<article[^>]*...
did u mean this? ```suggestion formats, subs = [{'url': source}], {} ```
_is_article = video_id is None webpage = self._download_webpage(url, video_id or display_id) if _is_article: video_id = self._search_regex( r'<article[^>]*\sid=["\']Article_(\d+)["\']', webpage, 'article id') player_attrs = self._extract_player_attrs(webpage) ...
@@ -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
26
Python
0.571
suggestion
87
51
51
false
[extractor/megatvcom] Add new extractor
1,980
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
@classmethod def _extract_urls(cls, webpage): for mobj in cls._EMBED_RE.finditer(webpage): yield unescapeHTML(mobj.group('url')) def _match_canonical_url(self, webpage): LINK_RE = r'''(?x) <link(?: rel=(?P<_q1>["'])(?P<canonical>canonical)(?P=_q1)| ...
```suggestion video_id = parse_qs(canonical_url)['p'][0] ``` import `parse_qs` from utils
yield unescapeHTML(mobj.group('url')) def _match_canonical_url(self, webpage): LINK_RE = r'''(?x) <link(?: rel=(?P<_q1>["'])(?P<canonical>canonical)(?P=_q1)| href=(?P<_q2>["'])(?P<href>(?:(?!(?P=_q2)).)+)(?P=_q2)| [^>]*? )+> ''' ...
@@ -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
26
Python
0.714
suggestion
100
36
32
false
[extractor/megatvcom] Add new extractor
1,980
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
# 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 import urllib.parse ```
# 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, +)
yt_dlp/extractor/megatvcom.py
8
Python
0.429
suggestion
39
33
33
false
[extractor/megatvcom] Add new extractor
1,980
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm
def _match_canonical_url(self, webpage): LINK_RE = r'''(?x) <link(?: rel=(?P<_q1>["'])(?P<canonical>canonical)(?P=_q1)| href=(?P<_q2>["'])(?P<href>(?:(?!(?P=_q2)).)+)(?P=_q2)| [^>]*? )+> ''' for mobj in re.finditer(LINK_RE, webpage): ...
```suggestion # Defer to megatvcom as the metadata extracted from the embeddable page some # times are slightly different, for the same video ``` this is the only part that is non-obvious from the code
<link(?: rel=(?P<_q1>["'])(?P<canonical>canonical)(?P=_q1)| href=(?P<_q2>["'])(?P<href>(?:(?!(?P=_q2)).)+)(?P=_q2)| [^>]*? )+> ''' for mobj in re.finditer(LINK_RE, webpage): canonical, href = mobj.group('canonical', 'href') if c...
@@ -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
26
Python
0.857
refactor
221
32
28
false
[extractor/megatvcom] Add new extractor
1,980
yt-dlp/yt-dlp
132,642
Python
pukkandan
zmousm