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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
def _entries(self, id):
headers = {
'referer': 'https://crowdbunker.com/',
'origin': 'https://crowdbunker.com',
'accept': 'application/json, text/plain, */*',
}
channel_json = self._download_json(f'https://api.divulg.org/organization/{id}/posts',
... | ```suggestion
for page in itertools.count():
channel_json = self._download_json(
f'https://api.divulg.org/organization/{id}/posts', id, headers=headers,
query={'after': last} if last else {}, note=f'Downloading Page {page}')
for item in channel_json.g... | # coding: utf-8
from __future__ import unicode_literals
import itertools
from .common import InfoExtractor
from ..utils import (
int_or_none,
try_get,
unified_strdate,
)
class CrowdBunkerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?crowdbunker\.com/v/(?P<id>[^/?#$&]+)'
_TESTS = [{
... | @@ -0,0 +1,127 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import urllib
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ try_get,
+ unified_strdate,
+)
+
+
+class CrowdBunkerIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?crowdbunker\.com/v/(?P<id>[^/?... | yt_dlp/extractor/crowdbunker.py | 26 | Python | 0.786 | suggestion | 677 | 31 | 114 | false | [CrowdBunker] Add extractors | 2,407 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
},
'params': {'skip_download': True}
}]
def _real_extract(self, url):
id = self._match_id(url)
video_json = self._download_json(f'https://lnk.lt/api/video/video-config/{id}', id)['videoInfo']
formats, subtitles = [], {}
if video_json.get('videoUrl'):
... | fyi, this is same as
```suggestion
'thumbnail': format_field(video_json, 'posterImage', 'https://lnk.lt/all-images/%s'),
``` | 'episode': 'Episode 16'
},
'params': {'skip_download': True}
}]
def _real_extract(self, url):
id = self._match_id(url)
video_json = self._download_json(f'https://lnk.lt/api/video/video-config/{id}', id)['videoInfo']
formats, subtitles = [], {}
if vide... | @@ -85,3 +86,85 @@ def _real_extract(self, url):
'timestamp': parse_iso8601(video_info.get('airDate')),
'view_count': int_or_none(video_info.get('viewsCount')),
}
+
+
+class LnkIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?lnk\.lt/[^/]+/(?P<id>\d+)'
+
+ _TESTS = [{
+ ... | yt_dlp/extractor/lnkgo.py | 26 | Python | 0.714 | suggestion | 140 | 32 | 33 | false | [LnkIE] Add extractor | 2,408 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
short_video_id = self._html_search_regex(r'<video [^>]*data-id="(.+?)"',
webpage, 'short video ID')
srcs = self._download_json(
f'https://{self._DO... | ```suggestion
short_video_id = self._html_search_regex(r'<video [^>]*data-id="(.+?)"', webpage, 'short video ID')
srcs = self._download_json(
f'https://{self._DOMAIN}/v-alt/{short_video_id}', video_id,
note='Downloading list of source files')
formats = [{
... | video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
short_video_id = self._html_search_regex(r'<video [^>]*data-id="(.+?)"', webpage, 'short video ID')
srcs = self._download_json(
f'https://{self._DOMAIN}/v-alt/{short_video_id}', video_id,
... | @@ -0,0 +1,92 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import remove_end
+
+
+class PeekVidsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?peekvids\.com/
+ (?:(?:[^/?#]+/){2}|embed/?\?(?:[^#]*&)?v=)
+ (?P<id>... | yt_dlp/extractor/peekvids.py | 26 | Python | 0.857 | suggestion | 814 | 51 | 51 | false | [peekvids] add new extractor | 2,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | schn0sch |
'title': 'Dane Jones - Cute redhead with perfect tits with Mini Vamp',
'age_limit': 18,
},
}]
_DOMAIN = 'www.peekvids.com'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
short_video_id = s... | ```suggestion
webpage, 'video title', default=None), ' - PeekVids')
``` | 'title': 'Dane Jones - Cute redhead with perfect tits with Mini Vamp',
'age_limit': 18,
},
}]
_DOMAIN = 'www.peekvids.com'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
short_video_id = s... | @@ -0,0 +1,85 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import remove_end
+
+
+class PeekVidsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?peekvids\.com/
+ (?:(?:[^/?#]+/){2}|embed/?\?(?:[^#]*&)?v=)
+ (?P<id>... | yt_dlp/extractor/peekvids.py | 26 | Python | 0.571 | suggestion | 85 | 51 | 51 | false | [peekvids] add new extractor | 2,414 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | schn0sch |
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
data_json = self._parse_json(self._html_search_regex(
r'data-video-player\s?=\s?"({[^"]+})">', webpage, 'data'), display_id, js_to_json)
ld_json = self... | why not just
```py
return merge_dicts(ld_json, {
'id': data_json['id'],
'display_id': display_id,
'title': data_json.get('headline'),
'duration': data_json.get('duration'),
'thumbnail': data_json.get('image'),
'formats': formats,
... | 'upload_date': '20210518'
},
'params': {'skip_download': True}
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
data_json = self._parse_json(self._html_search_regex(
r'data-video-p... | @@ -0,0 +1,50 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import js_to_json
+
+
+class NewsyIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?newsy\.com/stories/(?P<id>[^/?#$&]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.newsy.com/storie... | yt_dlp/extractor/newsy.py | 26 | Python | 0.786 | suggestion | 371 | 27 | 28 | false | [Newsy] Add extractor | 2,416 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
def _cancel_all_tasks(loop):
to_cancel = compat_asyncio_all_tasks(loop)
if not to_cancel:
return
for task in to_cancel:
task.cancel()
loop.run_until_complete(
asyncio.tasks.gather(*to_cancel, loop=loop, return_exceptions=True))
for task in to_cancel:
if task.canc... | ```suggestion
"""Wraps websockets module to use in non-async scopes"""
``` |
def __exit__(self, type, value, traceback):
try:
return self.run_with_loop(self.conn.__aexit__(type, value, traceback), self.loop)
finally:
self.loop.close()
self.r_cancel_all_tasks(self.loop)
# taken from https://github.com/python/cpython/blob/3.9/Lib/async... | @@ -5298,3 +5301,75 @@ def all_args(self):
def parse_args(self):
return self._parser.parse_args(list(self.all_args))
+
+
+# taken from https://github.com/python/cpython/blob/3.9/Lib/asyncio/runners.py with modifications
+def run_with_loop(main, loop):
+ if asyncio.events._get_running_loop() is not No... | yt_dlp/utils.py | 26 | Python | 0.643 | suggestion | 80 | 51 | 48 | false | [utils] WebSockets wrapper for non-async functions | 2,417 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
try:
compat_Match = re.Match
except AttributeError:
compat_Match = type(re.compile('').match(''))
try:
compat_asyncio_run = asyncio.run # >= 3.7
except AttributeError:
def compat_asyncio_run(coro):
try:
loop = asyncio.get_event_loop()
except RuntimeError:
loo... | ```suggestion
try: # >= 3.7
asyncio.tasks.all_tasks
except AttributeError:
asyncio.tasks.all_tasks = asyncio.tasks.Task.all_tasks
```
I was thinking of doing it this way. On one hand, we are mutating a standard library. But we are also only adding a new function, and this makes removing the compat code w... |
try:
compat_Match = re.Match
except AttributeError:
compat_Match = type(re.compile('').match(''))
try:
compat_asyncio_run = asyncio.run # >= 3.7
except AttributeError:
def compat_asyncio_run(coro):
try:
loop = asyncio.get_event_loop()
except RuntimeError:
loo... | @@ -133,6 +133,16 @@ def compat_asyncio_run(coro):
asyncio.run = compat_asyncio_run
+try: # <= 3.6
+ compat_asyncio_all_tasks = asyncio.tasks.Task.all_tasks
+except AttributeError: # > 3.7
+ compat_asyncio_all_tasks = asyncio.tasks.all_tasks | yt_dlp/compat.py | 26 | Python | 0.929 | question | 367 | 51 | 51 | false | [utils] WebSockets wrapper for non-async functions | 2,417 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
@property
def all_args(self):
for config in reversed(self.configs):
yield from config.all_args
yield from self.own_args or []
def parse_args(self):
return self._parser.parse_args(list(self.all_args))
# taken from https://github.com/python/cpython/blob/3.9/Lib/asyncio/r... | there is already a limited `compat_asyncio_run` function. It can be modified with this full definition | def all_args(self):
for config in reversed(self.configs):
yield from config.all_args
yield from self.own_args or []
def parse_args(self):
return self._parser.parse_args(list(self.all_args))
class WebSocketsWrapper():
"""Wraps websockets module to use in non-async scope... | @@ -5298,3 +5301,75 @@ def all_args(self):
def parse_args(self):
return self._parser.parse_args(list(self.all_args))
+
+
+# taken from https://github.com/python/cpython/blob/3.9/Lib/asyncio/runners.py with modifications
+def run_with_loop(main, loop):
+ if asyncio.events._get_running_loop() is not No... | yt_dlp/utils.py | 26 | Python | 0.5 | suggestion | 102 | 51 | 51 | false | [utils] WebSockets wrapper for non-async functions | 2,417 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
for idx, opt in enumerate(opts):
if opt in PRIVATE_OPTS and idx + 1 < len(opts):
opts[idx + 1] = 'PRIVATE'
return opts
def append_config(self, *args, label=None):
config = type(self)(self._parser, label)
config._loaded_paths = self._loaded_paths
i... | shouldn't we throw a custom error before this if websockets is not found? | if opt in PRIVATE_OPTS and idx + 1 < len(opts):
opts[idx + 1] = 'PRIVATE'
return opts
def append_config(self, *args, label=None):
config = type(self)(self._parser, label)
config._loaded_paths = self._loaded_paths
if config.init(*args):
self.co... | @@ -5298,3 +5301,75 @@ def all_args(self):
def parse_args(self):
return self._parser.parse_args(list(self.all_args))
+
+
+# taken from https://github.com/python/cpython/blob/3.9/Lib/asyncio/runners.py with modifications
+def run_with_loop(main, loop):
+ if asyncio.events._get_running_loop() is not No... | yt_dlp/utils.py | 26 | Python | 0.429 | question | 73 | 51 | 51 | false | [utils] WebSockets wrapper for non-async functions | 2,417 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
url, extra_headers=headers, ping_interval=None,
close_timeout=float('inf'), loop=self.loop, ping_timeout=float('inf'))
def __enter__(self):
self.pool = self.run_with_loop(self.conn.__aenter__(), self.loop)
return self
def send(self, *args):
self.rrun_with_loop(s... | ```suggestion
raise ValueError(f'a coroutine was expected, got {main!r}')
``` | url, extra_headers=headers, ping_interval=None,
close_timeout=float('inf'), loop=self.loop, ping_timeout=float('inf'))
def __enter__(self):
self.pool = self.run_with_loop(self.conn.__aenter__(), self.loop)
return self
def send(self, *args):
self.run_with_loop(se... | @@ -5298,3 +5300,71 @@ def all_args(self):
def parse_args(self):
return self._parser.parse_args(list(self.all_args))
+
+
+class WebSocketsWrapper():
+ """Wraps websockets module to use in non-async scopes"""
+
+ def __init__(self, url, headers=None):
+ self.loop = asyncio.events.new_event_l... | yt_dlp/utils.py | 26 | Python | 0.714 | suggestion | 91 | 51 | 51 | false | [utils] WebSockets wrapper for non-async functions | 2,417 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
'title': 'ef - a tale of memories Original Soundtrack 2 ~fortissimo~',
'release_year': 2008,
'thumbnail': 'https://www.musicdex.org/storage/album/2rSHkyYBYfB7sbvElpEyTMcUn6toY7AohOgJuDlE.jpg',
},
}]
def _real_extract(self, url):
id = self._match_id(url)
... | can't this be:
```suggestion
class MusicdexPageIE(MusicdexBaseIE):
``` | 'view_count': int,
'artist': ['TENMON & Eiichiro Yanagi / minori'],
'title': 'ef - a tale of memories Original Soundtrack 2 ~fortissimo~',
'release_year': 2008,
'thumbnail': 'https://www.musicdex.org/storage/album/2rSHkyYBYfB7sbvElpEyTMcUn6toY7AohOgJuDlE.jpg',... | @@ -0,0 +1,164 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ date_from_str,
+ format_field,
+ try_get,
+ unified_strdate,
+)
+
+
+class MusicdexBaseIE(InfoExtractor):
+ def _return_info(self, track_json, album_json, id):
+ ... | yt_dlp/extractor/musicdex.py | 26 | Python | 0.571 | suggestion | 73 | 51 | 51 | false | [Musicdex] Add extractors | 2,421 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Ashish0804 |
# coding: utf-8
from .common import InfoExtractor
class VimmStreamIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?vimm\.tv/(?:c/)?(?P<id>[0-9a-z-]+)$'
_TESTS = [{
'url': 'https://www.vimm.tv/c/calimeatwagon',
'info_dict': {
'id': 'calimeatwagon',
'ext': 'mp4',
... | Leave the class name as-is. Add IE_NAME/IE_DESC if needed | # coding: utf-8
from .common import InfoExtractor
class VimmIE(InfoExtractor):
IE_NAME = 'Vimm:stream'
_VALID_URL = r'https?://(?:www\.)?vimm\.tv/(?:c/)?(?P<id>[0-9a-z-]+)$'
_TESTS = [{
'url': 'https://www.vimm.tv/c/calimeatwagon',
'info_dict': {
'id': 'calimeatwagon',
... | @@ -2,8 +2,8 @@
from .common import InfoExtractor
-class VimmIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?vimm\.tv/c/(?P<id>[0-9a-z-]+)'
+class VimmStreamIE(InfoExtractor): | yt_dlp/extractor/vimm.py | 5 | Python | 0.214 | suggestion | 57 | 30 | 30 | false | [Vimm] add recording extractor | 2,441 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
video_info = page_data['curVideoInfo']
# bid 0 as an initial format checker
dash_paths = self._parse_json(PhantomJSwrapper(self).get(
url, html='<!DOCTYPE html>', video_id=video_id, note2='Executing signature code', jscode=self._DASH_JS % {
'tvid': video_info['tvId']... | too unwieldy imo. Best to split traverse_obj into new line |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
self._update_bid_tags(webpage, video_id)
next_props = self._search_nextjs_data(webpage, video_id)['props']
page_data = next_props['initialState']['play']
vid... | @@ -571,17 +578,39 @@ def _real_extract(self, url):
page_data = next_props['initialState']['play']
video_info = page_data['curVideoInfo']
+ uid = traverse_obj(
+ self._parse_json(
+ self._get_cookie('I00002', '{}'), video_id, transform_source=compat_urllib_parse_unqu... | yt_dlp/extractor/iqiyi.py | 26 | Python | 0.214 | suggestion | 58 | 51 | 51 | false | [iq.com] Add VIP support | 2,444 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
if not dash_path:
self.report_warning(f'Unknown format id: {bid}. It is currently not being extracted')
continue
format_data = traverse_obj(self._download_json(
urljoin('https://cache-video.iq.com', dash_path), video_id,
note=f'Down... | ```suggestion
self.report_warning('This preview video is limited%s' % format_field(preview_time, template='to %s seconds')
``` | # bid 0 as an initial format checker
dash_paths = self._parse_json(PhantomJSwrapper(self).get(
url, html='<!DOCTYPE html>', video_id=video_id, note2='Executing signature code', jscode=self._DASH_JS % {
'tvid': video_info['tvId'],
'vid': video_info['vid'],
... | @@ -590,9 +619,10 @@ def _real_extract(self, url):
urljoin('https://cache-video.iq.com', dash_paths['0']), video_id,
note='Downloading initial video format info', errnote='Unable to download initial video format info')['data']
- preview_time = traverse_obj(initial_format_data, ('boss_... | yt_dlp/extractor/iqiyi.py | 26 | Python | 0.714 | suggestion | 140 | 51 | 51 | false | [iq.com] Add VIP support | 2,444 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
'dpi': 420,
'os_version': '10',
'os_api': '29',
'carrier_region': 'US',
'sys_region': 'US',
'region': 'US',
'app_name': self._APP_NAME,
'app_language': 'en',
'language': 'en',
'timezone_name': 'Americ... | I would have gone with a single args like `tiktok:version=20.9.3,293`. But this is fine too. Either way, document it in readme | 'dpi': 420,
'os_version': '10',
'os_api': '29',
'carrier_region': 'US',
'sys_region': 'US',
'region': 'US',
'app_name': self._APP_NAME,
'app_language': 'en',
'language': 'en',
'timezone_name': 'Americ... | @@ -73,16 +85,41 @@ def _call_api(self, ep, query, video_id, fatal=True,
'as': 'a1qwert123',
'cp': 'cbfhckdckkde1',
}
- self._set_cookie(self._API_HOSTNAME, 'odin_tt', ''.join(random.choice('0123456789abcdef') for _ in range(160)))
- webpage_cookies = self._get_cookies(s... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.5 | suggestion | 126 | 51 | 51 | false | [TikTok] Iterate through app versions | 2,449 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
'mcc_mnc': '310260',
'is_my_cn': 0,
'aid': self._AID,
'ssmix': 'a',
'as': 'a1qwert123',
'cp': 'cbfhckdckkde1',
}
def _call_api(self, ep, query, video_id, fatal=True,
note='Downloading API JSON', errnote='Unable to dow... | ```suggestion
for count, (app_version, manifest_app_version) in enumerate(self._APP_VERSIONS, start=1):
``` | 'mcc_mnc': '310260',
'is_my_cn': 0,
'aid': self._AID,
'ssmix': 'a',
'as': 'a1qwert123',
'cp': 'cbfhckdckkde1',
}
def _call_api(self, ep, query, video_id, fatal=True,
note='Downloading API JSON', errnote='Unable to dow... | @@ -73,16 +85,41 @@ def _call_api(self, ep, query, video_id, fatal=True,
'as': 'a1qwert123',
'cp': 'cbfhckdckkde1',
}
- self._set_cookie(self._API_HOSTNAME, 'odin_tt', ''.join(random.choice('0123456789abcdef') for _ in range(160)))
- webpage_cookies = self._get_cookies(s... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.714 | suggestion | 117 | 51 | 51 | false | [TikTok] Iterate through app versions | 2,449 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
'id': video_id,
'title': title,
'description': content.get('description'),
'thumbnail': content.get('thumbnail'),
'timestamp': timestamp,
'duration': int_or_none(content.get('duration')),
'series': content.get('program_title'),
... | proly not the best but this is more compact and what i prefer tbh
```suggestion
_VALID_URL = r'https?://(?:www\.)?yandex\.ru/video/preview/(?:\?.*filmId=)?(?P<id>\d+)'
``` | return {
'id': video_id,
'title': title,
'description': content.get('description'),
'thumbnail': content.get('thumbnail'),
'timestamp': timestamp,
'duration': int_or_none(content.get('duration')),
'series': content.get('program_... | @@ -148,6 +148,40 @@ def _real_extract(self, url):
}
+class YandexVideoPreviewIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://
+ (?:
+ yandex\.ru/video/preview(?:/?\?.*?filmId=|/)
+ )
+ ... | yt_dlp/extractor/yandexvideo.py | 26 | Python | 0.786 | suggestion | 178 | 51 | 51 | false | [YandexVideoPreview] Add extractor for yandex video preview urls | 2,500 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | KiberInfinity |
class YandexVideoPreviewIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
(?:
yandex\.ru/video/preview(?:/?\?.*?filmId=|/)
)
(?P<id>\d+)
'''
_TESTS = [{ # Odnoklassniki... | Add info for atleast one of the test | }
class YandexVideoPreviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?yandex\.ru/video/preview(?:/?\?.*?filmId=|/)(?P<id>\d+)'
_TESTS = [{ # Odnoklassniki
'url': 'https://yandex.ru/video/preview/?filmId=10682852472978372885&text=summer',
'info_dict': {
'id': '1352... | @@ -148,6 +148,40 @@ def _real_extract(self, url):
}
+class YandexVideoPreviewIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://
+ (?:
+ yandex\.ru/video/preview(?:/?\?.*?filmId=|/)
+ )
+ ... | yt_dlp/extractor/yandexvideo.py | 26 | Python | 0.071 | suggestion | 36 | 51 | 51 | false | [YandexVideoPreview] Add extractor for yandex video preview urls | 2,500 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | KiberInfinity |
(?P<id>\d+)
'''
_TESTS = [{ # Odnoklassniki
'url': 'https://yandex.ru/video/preview/?filmId=10682852472978372885&text=summer',
'only_matching': True,
}, { # youtube
'url': 'https://yandex.ru/video/preview/?filmId=4479424425337895262&source=ma... | ```suggestion
return self.url_result(data_json['video']['url'])
``` | 'id': '1352565459459',
'ext': 'mp4',
'like_count': int,
'upload_date': '20191202',
'age_limit': 0,
'duration': 196,
'thumbnail': 'https://i.mycdn.me/videoPreview?id=544866765315&type=37&idx=13&tkn=TY5qjLYZHxpmcnK8U2LgzYkgmaU&fn=external... | @@ -148,6 +148,40 @@ def _real_extract(self, url):
}
+class YandexVideoPreviewIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://
+ (?:
+ yandex\.ru/video/preview(?:/?\?.*?filmId=|/)
+ )
+ ... | yt_dlp/extractor/yandexvideo.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | [YandexVideoPreview] Add extractor for yandex video preview urls | 2,500 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | KiberInfinity |
yandex\.ru/video/preview(?:/?\?.*?filmId=|/)
)
(?P<id>\d+)
'''
_TESTS = [{ # Odnoklassniki
'url': 'https://yandex.ru/video/preview/?filmId=10682852472978372885&text=summer',
'only_matching': True,
},... | Use `self._search_regex` and pass any decoding function to the `transform` of `_parse_json` | 'url': 'https://yandex.ru/video/preview/?filmId=10682852472978372885&text=summer',
'info_dict': {
'id': '1352565459459',
'ext': 'mp4',
'like_count': int,
'upload_date': '20191202',
'age_limit': 0,
'duration': 196,
'thumb... | @@ -148,6 +148,40 @@ def _real_extract(self, url):
}
+class YandexVideoPreviewIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://
+ (?:
+ yandex\.ru/video/preview(?:/?\?.*?filmId=|/)
+ )
+ ... | yt_dlp/extractor/yandexvideo.py | 26 | Python | 0.429 | suggestion | 91 | 51 | 51 | false | [YandexVideoPreview] Add extractor for yandex video preview urls | 2,500 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | KiberInfinity |
timestamp = (int_or_none(content.get('release_date'))
or int_or_none(content.get('release_date_ut'))
or int_or_none(content.get('start_time')))
season = content.get('season') or {}
return {
'id': video_id,
'title': title,
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?yandex\.ru/video/preview(?:/?\?.*?filmId=|/)(?P<id>\d+)'
```
This is more correct, no? | timestamp = (int_or_none(content.get('release_date'))
or int_or_none(content.get('release_date_ut'))
or int_or_none(content.get('start_time')))
season = content.get('season') or {}
return {
'id': video_id,
'title': title,
... | @@ -149,16 +150,22 @@ def _real_extract(self, url):
class YandexVideoPreviewIE(InfoExtractor):
- _VALID_URL = r'''(?x)
- https?://
- (?:
- yandex\.ru/video/preview(?:/?\?.*?filmId=|/)
- )
- (?P<id>... | yt_dlp/extractor/yandexvideo.py | 26 | Python | 0.714 | question | 141 | 51 | 51 | false | [YandexVideoPreview] Add extractor for yandex video preview urls | 2,500 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | KiberInfinity |
'age_limit': 0,
'duration': 196,
'thumbnail': 'https://i.mycdn.me/videoPreview?id=544866765315&type=37&idx=13&tkn=TY5qjLYZHxpmcnK8U2LgzYkgmaU&fn=external_8',
'uploader_id': '481054701571',
'title': 'LOFT - summer, summer, summer HD',
'manifest_stre... | ```suggestion
data_raw = self._search_regex(r'window.Ya.__inline_params__\s*=\s*JSON.parse\(\'([^"]+?\\u0022video\\u0022:[^"]+?})\'\);', webpage, 'data_raw')
``` | 'age_limit': 0,
'duration': 196,
'thumbnail': 'https://i.mycdn.me/videoPreview?id=544866765315&type=37&idx=13&tkn=TY5qjLYZHxpmcnK8U2LgzYkgmaU&fn=external_8',
'uploader_id': '481054701571',
'title': 'LOFT - summer, summer, summer HD',
'manifest_stre... | @@ -148,6 +149,45 @@ def _real_extract(self, url):
}
+class YandexVideoPreviewIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?yandex\.ru/video/preview/?(?:\?.*?filmId=|)(?P<id>\d+)'
+ _TESTS = [{ # Odnoklassniki
+ 'url': 'https://yandex.ru/video/preview/?filmId=10682852472978372885&tex... | yt_dlp/extractor/yandexvideo.py | 26 | Python | 0.714 | suggestion | 171 | 51 | 51 | false | [YandexVideoPreview] Add extractor for yandex video preview urls | 2,500 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | KiberInfinity |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class FujiTVFODPlus7IE(InfoExtractor):
_VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/'
# _BITRATE_MAP = {
# 300: (320, 180)... | Don't leave commented code. If it's not used, delete it. If it's stuff to fix, mark PR as draft | # coding: utf-8
from __future__ import unicode_literals
from ..utils import HEADRequest
from .common import InfoExtractor
class FujiTVFODPlus7IE(InfoExtractor):
_VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/'
_TESTS = [{
... | @@ -5,44 +5,67 @@
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 = {
- 300: (320, 180),
- 800: (640, 360),
- 1200: (1280, 720),
- 2000: (1280, 72... | yt_dlp/extractor/fujitv.py | 17 | Python | 0.286 | suggestion | 95 | 42 | 42 | false | Fujitv premium info extract | 2,505 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | YuenSzeHong |
_VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/'
_TESTS = [{
'url': 'https://fod.fujitv.co.jp/title/5d40/5d40110076',
'info_dict': {
'id': '5d40110076',
'ext': 'mp4',
'titl... | ```suggestion
self.report_warning(f'The token cookie is needed to extract video metadata. {self._LOGIN_HINTS["cookies"]}')
``` | _VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/'
_TESTS = [{
'url': 'https://fod.fujitv.co.jp/title/5d40/5d40110076',
'info_dict': {
'id': '5d40110076',
'ext': 'mp4',
'titl... | @@ -5,44 +5,48 @@
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 = {
- 300: (320, 180),
- 800: (640, 360),
- 1200: (1280, 720),
- 2000: (1280, 72... | yt_dlp/extractor/fujitv.py | 26 | Python | 0.786 | refactor | 140 | 46 | 46 | false | Fujitv premium info extract | 2,505 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | YuenSzeHong |
self._download_webpage(url, video_id)
json_info = {}
token = self._get_cookies(url).get('CT')
if token:
json_info = self._download_json('https://fod-sp.fujitv.co.jp/apps/api/episode/detail/?ep_id=%s&is_premium=false' % video_id, video_id, headers={'x-authorization': f'Bearer ... | ```suggestion
'thumbnail': f'{self._BASE_URL}img/program/{series_id}/episode/{video_id}_a.jpg',
``` | self._request_webpage(HEADRequest(url), video_id)
json_info = {}
token = self._get_cookies(url).get('CT')
if token:
json_info = self._download_json('https://fod-sp.fujitv.co.jp/apps/api/episode/detail/?ep_id=%s&is_premium=false' % video_id, video_id, headers={'x-authorization... | @@ -5,44 +5,48 @@
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 = {
- 300: (320, 180),
- 800: (640, 360),
- 1200: (1280, 720),
- 2000: (1280, 72... | yt_dlp/extractor/fujitv.py | 26 | Python | 0.714 | suggestion | 113 | 28 | 28 | false | Fujitv premium info extract | 2,505 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | YuenSzeHong |
'ext': 'mp4',
'title': '#1318 『まる子、まぼろしの洋館を見る』の巻',
'series': 'ちびまる子ちゃん',
'series_id': '5d40',
'description': 'md5:b3f51dbfdda162ac4f789e0ff4d65750',
'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40110076_a.jpg',
},
... | ```suggestion
formats, subtitles = [], {}
src_json = self._download_json(f'{self._BASE_URL}abrjson_v2/tv_android/{video_id}', video_id)
for src in src_json['video_selector']:
if not src.get('url'):
continue
fmt, subs = self._extract_m3u8_formats_and_... | 'ext': 'mp4',
'title': '#1318 『まる子、まぼろしの洋館を見る』の巻',
'series': 'ちびまる子ちゃん',
'series_id': '5d40',
'description': 'md5:b3f51dbfdda162ac4f789e0ff4d65750',
'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40110076_a.jpg',
},
... | @@ -5,44 +5,48 @@
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 = {
- 300: (320, 180),
- 800: (640, 360),
- 1200: (1280, 720),
- 2000: (1280, 72... | yt_dlp/extractor/fujitv.py | 26 | Python | 0.857 | refactor | 460 | 39 | 39 | false | Fujitv premium info extract | 2,505 | 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/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/'
_TESTS = [{
'url': 'https://fod.fuj... | check if a `HEADRequest` is sufficient | # coding: utf-8
from __future__ import unicode_literals
from ..utils import HEADRequest
from .common import InfoExtractor
class FujiTVFODPlus7IE(InfoExtractor):
_VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/'
_TESTS = [{
... | @@ -5,44 +5,48 @@
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 = {
- 300: (320, 180),
- 800: (640, 360),
- 1200: (1280, 720),
- 2000: (1280, 72... | yt_dlp/extractor/fujitv.py | 26 | Python | 0.214 | suggestion | 38 | 51 | 51 | false | Fujitv premium info extract | 2,505 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | YuenSzeHong |
# coding: utf-8
from __future__ import unicode_literals
from urllib.request import Request
from .common import InfoExtractor
class FujiTVFODPlus7IE(InfoExtractor):
_VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/'
_TESTS = ... | ```suggestion
self._request_webpage(HEADRequest(url), video_id)
```
import `HEADRequest` from utils | # coding: utf-8
from __future__ import unicode_literals
from ..utils import HEADRequest
from .common import InfoExtractor
class FujiTVFODPlus7IE(InfoExtractor):
_VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/'
_TESTS = [{
... | @@ -1,48 +1,52 @@
# coding: utf-8
from __future__ import unicode_literals
-
+from urllib.request import Request
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.... | yt_dlp/extractor/fujitv.py | 26 | Python | 0.714 | suggestion | 110 | 51 | 51 | false | Fujitv premium info extract | 2,505 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | YuenSzeHong |
'locale': traverse_obj(initial_state, ('localization', 'locale'))
}
episode_response = self._download_json(
api_domain + '/cms/v2' + bucket + '/episodes/' + internal_id, display_id,
note='Retrieving episode metadata',
query=params)
stream_response ... | Either document the configuration args in README or imo just take it from crunchyroll
```suggestion
requested_languages = self._configuration_arg('language', ie_key=CrunchyrollIE.ie_key())
```
same for subs | 'Key-Pair-Id': policy_response['cms']['key_pair_id']
}
locale = traverse_obj(initial_state, ('localization', 'locale'))
if locale:
params['locale'] = locale
episode_response = self._download_json(
f'{api_domain}/cms/v2{bucket}/episodes/{internal_id}', ... | @@ -733,13 +736,111 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
- episode_data = self._parse_json(
- s... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.786 | suggestion | 218 | 51 | 51 | false | [crunchyroll:beta] Add self-contained support for crunchyroll beta for logged in users | 2,506 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
for stream in streams.values():
format_id = join_nonempty(
stream_type,
'audio-%s' % stream_response.get('audio_locale'),
stream.get('hardsub_locale') and 'hardsub-%s' % stream.get('hardsub_locale'))
... | All these fields are available elsewhere. Imo, best to just do
```suggestion
'title': episode_response.get('title'),
```
Not mandatory though
If u don't do that, remove the `+` either using fstrings/format/%s |
formats = []
for stream_type, streams in stream_response.get('streams', {}).items():
if stream_type not in requested_formats:
continue
for stream in streams.values():
hardsub_lang = stream.get('hardsub_locale') or ''
if hardsub_lan... | @@ -733,13 +736,111 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
- episode_data = self._parse_json(
- s... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.857 | suggestion | 228 | 51 | 51 | false | [crunchyroll:beta] Add self-contained support for crunchyroll beta for logged in users | 2,506 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
'url': 'https://beta.crunchyroll.com/watch/GY2P1Q98Y/to-the-future',
'info_dict': {
'id': '696363',
'ext': 'mp4',
'timestamp': 1459610100,
'description': 'md5:a022fbec4fbb023d43631032c91ed64b',
'uploader': 'Toei Animation',
'title':... | This is a problem. The same video will have different archive entry depending on whether cookies were used or not | _TESTS = [{
'url': 'https://beta.crunchyroll.com/watch/GY2P1Q98Y/to-the-future',
'info_dict': {
'id': '696363',
'ext': 'mp4',
'timestamp': 1459610100,
'description': 'md5:a022fbec4fbb023d43631032c91ed64b',
'uploader': 'Toei Animation',
... | @@ -733,13 +736,111 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
- episode_data = self._parse_json(
- s... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.429 | suggestion | 113 | 51 | 51 | false | [crunchyroll:beta] Add self-contained support for crunchyroll beta for logged in users | 2,506 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
hardsub_preference = qualities((requested_hardsubs or ['', traverse_obj(initial_state, ('localization', 'locale')) or ''])[::-1])
formats = []
for stream_type, streams in stream_response.get('streams', {}).items():
if stream_type in ('adaptive_hls'):
for stream in st... | same as
```py
streams = stream_response['streams']['adaptive_hls']
for stream in streams.values():
...
```
Or, if you want to add more keys to `adaptive_hls`
```py
for stream_type, streams in stream_response['streams']:
if stream_type not in ('adaptive_hls', ):
continue... | }]
requested_hardsubs = [('' if val == 'none' else val) for val in (self._configuration_arg('hardsub') or ['none'])]
hardsub_preference = qualities(requested_hardsubs[::-1])
requested_formats = self._configuration_arg('format') or ['adaptive_hls']
formats = []
for s... | @@ -733,13 +736,111 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
- episode_data = self._parse_json(
- s... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 1 | bug | 531 | 51 | 51 | false | [crunchyroll:beta] Add self-contained support for crunchyroll beta for logged in users | 2,506 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
'width': thumbnail_data.get('width'),
'height': thumbnail_data.get('height'),
})
subtitles = {}
for lang, subtitle_data in stream_response.get('subtitles').items():
subtitles[lang] = [{
'url': subtitle_data.get('url'),
... | the point of using `.get` is to make extraction non-fatal in case the key doesn't exist. But now `None` is being passed to `_extract_m3u8_formats`, which is fatal | thumbnails = []
for thumbnails_data in traverse_obj(episode_response, ('images', 'thumbnail')):
for thumbnail_data in thumbnails_data:
thumbnails.append({
'url': thumbnail_data.get('source'),
'width': thumbnail_data.get('width'),
... | @@ -733,13 +736,111 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
- episode_data = self._parse_json(
- s... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.571 | refactor | 162 | 51 | 51 | false | [crunchyroll:beta] Add self-contained support for crunchyroll beta for logged in users | 2,506 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
for thumbnail_data in thumbnails_data:
thumbnails.append({
'url': thumbnail_data.get('source'),
'width': thumbnail_data.get('width'),
'height': thumbnail_data.get('height'),
})
subtitles = {}
for lang... | ```suggestion
format_id = join_nonempty(
stream_type,
format_field(stream_response, 'audio_locale', 'audio-%s'),
format_field(stream_response, 'hardsub_locale', 'hardsub-%s'))
``` | episode_response['playback'], display_id,
note='Retrieving stream info')
thumbnails = []
for thumbnails_data in traverse_obj(episode_response, ('images', 'thumbnail')):
for thumbnail_data in thumbnails_data:
thumbnails.append({
'ur... | @@ -733,13 +736,111 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
- episode_data = self._parse_json(
- s... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.929 | suggestion | 276 | 51 | 51 | false | [crunchyroll:beta] Add self-contained support for crunchyroll beta for logged in users | 2,506 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
},
'params': {'skip_download': 'm3u8'},
'expected_warnings': ['Unable to download XML']
}]
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
... | ```suggestion
f'{api_domain}/auth/v1/token', display_id,
```
etc | 'upload_date': '20160402',
},
'params': {'skip_download': 'm3u8'},
'expected_warnings': ['Unable to download XML']
}]
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._d... | @@ -733,13 +736,111 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
- episode_data = self._parse_json(
- s... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.571 | security | 79 | 51 | 51 | false | [crunchyroll:beta] Add self-contained support for crunchyroll beta for logged in users | 2,506 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
note='Retrieving stream info')
thumbnails = []
for thumbnails_data in traverse_obj(episode_response, ('images', 'thumbnail')):
for thumbnail_data in thumbnails_data:
thumbnails.append({
'url': thumbnail_data.get('source'),
... | ```suggestion
for stream in streams.values():
audio_lang = stream_response.get('audio_locale') or ''
hardsub_lang = stream_response.get('hardsub_locale') or ''
if (requested_languages and audio_lang.lower() not in requested_languages
... | query=params)
if episode_response.get('is_premium_only') and not episode_response.get('playback'):
raise ExtractorError('This video is for premium members only.', expected=True)
stream_response = self._download_json(
episode_response['playback'], display_id,
... | @@ -733,13 +736,111 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE):
def _real_extract(self, url):
lang, internal_id, display_id = self._match_valid_url(url).group('lang', 'internal_id', 'id')
webpage = self._download_webpage(url, display_id)
- episode_data = self._parse_json(
- s... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.786 | suggestion | 508 | 51 | 51 | false | [crunchyroll:beta] Add self-contained support for crunchyroll beta for logged in users | 2,506 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
'id': '20831',
'ext': 'mp4',
'description': 'Gefühle pur: Schaut euch die ungeschnittene Version von Stefans Liebesbeweis an die Moderationsgrazie von Welt, Verona Feldbusch, an.',
'title': 'Raabigramm Verona Feldbusch',
'thumbnail': r're:.*\.jpg',
... | ```suggestion
for group in self._search_regex(r'/myspass2009/\d+/(\d+)/(\d+)/(\d+)/', video_url, 'myspass', group=(1,2,3), default=[]):
``` | 'description': 'Gefühle pur: Schaut euch die ungeschnittene Version von Stefans Liebesbeweis an die Moderationsgrazie von Welt, Verona Feldbusch, an.',
'title': 'Raabigramm Verona Feldbusch',
'thumbnail': r're:.*\.jpg',
'episode_number': 6,
'episode': 'Raabigr... | @@ -13,33 +13,77 @@
class MySpassIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?myspass\.de/([^/]+/)*(?P<id>\d+)'
- _TEST = {
+ _VALID_URL = r'https?://(?:www\.)?myspass\.de/(?:[^/]+/)*(?P<id>\d+)/?[^/]*$'
+ _TESTS = [{
'url': 'http://www.myspass.de/myspass/shows/tvshows/absolute-mehrh... | yt_dlp/extractor/myspass.py | 26 | Python | 0.714 | suggestion | 149 | 45 | 40 | false | [MySpass] fix video url processing | 2,510 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
)
class CrunchyrollBaseIE(InfoExtractor):
_LOGIN_URL = 'https://www.crunchyroll.com/welcome/login'
_NETRC_MACHINE = 'crunchyroll'
def _call_rpc_api(self, method, video_id, note=None, data=None):
data = data or {}
data['req'] = 'RpcApi' + method
data = compat_urllib_parse_urlencode... | ```suggestion
upsell_response = self._download_json(
f'{self._API_BASE}/get_upsell_data.0.json', None, 'Getting session id',
``` | )
class CrunchyrollBaseIE(InfoExtractor):
_LOGIN_URL = 'https://www.crunchyroll.com/welcome/login'
_API_BASE = 'https://api.crunchyroll.com'
_NETRC_MACHINE = 'crunchyroll'
def _call_rpc_api(self, method, video_id, note=None, data=None):
data = data or {}
data['req'] = 'RpcApi' + metho... | @@ -62,50 +60,33 @@ def _login(self):
username, password = self._get_login_info()
if username is None:
return
-
- login_page = self._download_webpage(
- self._LOGIN_URL, None, 'Downloading login page')
-
- def is_logged(webpage):
- return 'href="/logout... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.714 | suggestion | 151 | 51 | 51 | false | [crunchyroll] Login support | 2,530 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
video_id, note, fatal=False, data=data, headers={
'Content-Type': 'application/x-www-form-urlencoded',
})
def _login(self):
username, password = self._get_login_info()
if username is None:
return
if self._get_cookies(self._LOGIN_URL).get('... | ```suggestion
f'{self._API_BASE}/login.1.json', None, 'Logging in',
``` | 'https://www.crunchyroll.com/xml/',
video_id, note, fatal=False, data=data, headers={
'Content-Type': 'application/x-www-form-urlencoded',
})
def _login(self):
username, password = self._get_login_info()
if username is None:
return
... | @@ -62,50 +60,33 @@ def _login(self):
username, password = self._get_login_info()
if username is None:
return
-
- login_page = self._download_webpage(
- self._LOGIN_URL, None, 'Downloading login page')
-
- def is_logged(webpage):
- return 'href="/logout... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.571 | suggestion | 85 | 51 | 51 | false | [crunchyroll] Login support | 2,530 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
)
from ..utils import (
ExtractorError,
bytes_to_intlist,
extract_attributes,
float_or_none,
format_field,
intlist_to_bytes,
int_or_none,
join_nonempty,
lowercase_escape,
merge_dicts,
qualities,
remove_end,
sanitized_Request,
traverse_obj,
try_get,
xpath_t... | ```suggestion
_LOGIN_URL = 'https://www.crunchyroll.com/welcome/login'
_API_BASE = 'https://api.crunchyroll.com'
``` | )
from ..utils import (
ExtractorError,
bytes_to_intlist,
extract_attributes,
float_or_none,
format_field,
intlist_to_bytes,
int_or_none,
join_nonempty,
lowercase_escape,
merge_dicts,
qualities,
remove_end,
sanitized_Request,
traverse_obj,
try_get,
xpath_t... | @@ -44,8 +43,7 @@
class CrunchyrollBaseIE(InfoExtractor):
- _LOGIN_URL = 'https://www.crunchyroll.com/login'
- _LOGIN_FORM = 'login_form'
+ _LOGIN_URL = 'https://www.crunchyroll.com/welcome/login' | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.714 | suggestion | 127 | 51 | 51 | false | [crunchyroll] Login support | 2,530 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tejing1 |
'https://cloudac.mildom.com/nonolive/gappserv/guest/h5init', 'initialization',
note='Downloading guest token', init=True)['guest_id'] or None,
lambda x: x._get_cookies('https://www.mildom.com').get('gid').value,
lambda x: x._get_cookies('https://m.... | ```suggestion
note='Downloading live metadata', query={'user_id': video_id, '__platform': 'web'})
```
same everywhere | if self._GUEST_ID:
return self._GUEST_ID
self._GUEST_ID = try_get(
self, (
lambda x: x._call_api(
'https://cloudac.mildom.com/nonolive/gappserv/guest/h5init', 'initialization',
note='Downloading guest token', init=True)['gue... | @@ -102,7 +108,7 @@ def _real_extract(self, url):
enterstudio = self._call_api(
'https://cloudac.mildom.com/nonolive/gappserv/live/enterstudio', video_id,
- note='Downloading live metadata', query={'user_id': video_id})
+ note='Downloading live metadata', query={'user_id': ... | yt_dlp/extractor/mildom.py | 26 | Python | 0.786 | suggestion | 132 | 51 | 51 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
servers = self._call_api(
'https://cloudac.mildom.com/nonolive/gappserv/live/liveserver', result_video_id,
note='Downloading live server list', query={
'user_id': video_id,
'live_server_type': 'hls',
'__platform': "web",
})
... | ```suggestion
timestamp = float_or_none(enterstudio.get('live_start_ms'), scale=1000)
``` | uploader = try_get(
enterstudio, (
lambda x: self._html_search_meta('twitter:title', webpage),
lambda x: x['loginname'],
), compat_str)
servers = self._call_api(
'https://cloudac.mildom.com/nonolive/gappserv/live/liveserver', result_vi... | @@ -144,10 +151,13 @@ def _real_extract(self, url):
self._sort_formats(formats)
+ timestamp = try_get(enterstudio['live_start_ms'], compat_numeric_types) | yt_dlp/extractor/mildom.py | 26 | Python | 0.571 | suggestion | 99 | 51 | 51 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
# coding: utf-8
from __future__ import unicode_literals
import base64
from datetime import datetime
import itertools
import json
from .common import InfoExtractor
from ..utils import (
std_headers,
update_url_query,
random_uuidv4,
try_get,
)
from ..compat import (
compat_str,
compat_numeric_ty... | Why not just add `__platform` here
```py
def _call_api(self, url, video_id, query=None, note='Downloading JSON metadata', init=False):
query = query or {}
if query:
query['__platform'] = 'web'
``` | # coding: utf-8
from __future__ import unicode_literals
import base64
from datetime import datetime
import itertools
import json
from .common import InfoExtractor
from ..utils import (
std_headers,
update_url_query,
random_uuidv4,
try_get,
float_or_none,
dict_get
)
from ..compat import (
c... | @@ -24,7 +25,12 @@ class MildomBaseIE(InfoExtractor):
def _call_api(self, url, video_id, query={}, note='Downloading JSON metadata', init=False): | yt_dlp/extractor/mildom.py | 26 | Python | 0.786 | suggestion | 218 | 51 | 51 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
# coding: utf-8
from __future__ import unicode_literals
import base64
from datetime import datetime
import itertools
import json
from .common import InfoExtractor
from ..utils import (
std_headers,
update_url_query,
random_uuidv4,
try_get,
float_or_none,
dict_get
)
from ..compat import (
c... | ```suggestion
compat_str,
```
unrelated diff | # coding: utf-8
from __future__ import unicode_literals
import base64
from datetime import datetime
import itertools
import json
from .common import InfoExtractor
from ..utils import (
std_headers,
update_url_query,
random_uuidv4,
try_get,
float_or_none,
dict_get
)
from ..compat import (
c... | @@ -12,9 +12,11 @@
update_url_query,
random_uuidv4,
try_get,
+ float_or_none,
+ dict_get
)
from ..compat import (
- compat_str,
+ compat_str | yt_dlp/extractor/mildom.py | 19 | Python | 0.571 | suggestion | 51 | 44 | 44 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
from __future__ import unicode_literals
import base64
from datetime import datetime
import itertools
import json
from .common import InfoExtractor
from ..utils import (
std_headers,
update_url_query,
random_uuidv4,
try_get,
float_or_none,
dict_get
)
from ..compat import (
compat_str
)
cl... | ```suggestion
def _call_api(self, url, video_id, query=None, note='Downloading JSON metadata', init=False):
``` | from __future__ import unicode_literals
import base64
from datetime import datetime
import itertools
import json
from .common import InfoExtractor
from ..utils import (
std_headers,
update_url_query,
random_uuidv4,
try_get,
float_or_none,
dict_get
)
from ..compat import (
compat_str,
)
c... | @@ -23,8 +25,16 @@ class MildomBaseIE(InfoExtractor):
_DISPATCHER_CONFIG = None
def _call_api(self, url, video_id, query={}, note='Downloading JSON metadata', init=False): | yt_dlp/extractor/mildom.py | 26 | Python | 0.714 | suggestion | 117 | 51 | 51 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
'ext': 'm4a'
}]
for fmt in autoplay['video_link']:
formats.append({
'format_id': 'video-%s' % fmt['name'],
'url': fmt['url'],
'protocol': 'm3u8_native',
'width': fmt['level'] * autoplay['video_width'] // autoplay['vi... | ```suggestion
return {
'id': video_id,
'title': title,
'description': description,
'timestamp': float_or_none(autoplay['publish_time'], scale=1000),
'duration': float_or_none(autoplay['video_length'], scale=1000),
``` | formats.append({
'format_id': 'video-%s' % fmt['name'],
'url': fmt['url'],
'protocol': 'm3u8_native',
'width': fmt['level'] * autoplay['video_width'] // autoplay['video_height'],
'height': fmt['level'],
'vcodec':... | @@ -209,10 +267,17 @@ def _real_extract(self, url):
self._sort_formats(formats)
+ timestamp = float_or_none(autoplay['publish_time'], scale=1000)
+
+ duration = float_or_none(autoplay['video_length'], scale=1000)
+
return {
'id': video_id,
'title': title,
... | yt_dlp/extractor/mildom.py | 26 | Python | 0.786 | suggestion | 292 | 51 | 51 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
'live_server_type': 'hls',
})
stream_query = self._common_queries({
'streamReqId': random_uuidv4(),
'is_lhls': '0',
})
m3u8_url = update_url_query(servers['stream_server'] + '/%s_master.m3u8' % video_id, stream_query)
formats = self._e... | ```suggestion
return {
'id': result_video_id,
'title': title,
'description': description,
'timestamp': float_or_none(enterstudio.get('live_start_ms'), scale=1000),
``` | 'user_id': video_id,
'live_server_type': 'hls',
})
stream_query = self._common_queries({
'streamReqId': random_uuidv4(),
'is_lhls': '0',
})
m3u8_url = update_url_query(servers['stream_server'] + '/%s_master.m3u8' % video_id, st... | @@ -144,10 +154,13 @@ def _real_extract(self, url):
self._sort_formats(formats)
+ timestamp = float_or_none(enterstudio.get('live_start_ms'), scale=1000)
+
return {
'id': result_video_id,
'title': title,
'description': description,
+ 'timest... | yt_dlp/extractor/mildom.py | 26 | Python | 0.786 | suggestion | 229 | 51 | 51 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
update_url_query,
random_uuidv4,
try_get,
float_or_none,
dict_get
)
from ..compat import (
compat_str
)
class MildomBaseIE(InfoExtractor):
_GUEST_ID = None
_DISPATCHER_CONFIG = None
def _call_api(self, url, video_id, query={}, note='Downloading JSON metadata', init=False):
... | ```suggestion
self.raise_no_formats(
f'Video not found or premium content. {content["code"]} - {content["message"]}',
expected=True)
``` | update_url_query,
random_uuidv4,
try_get,
float_or_none,
dict_get
)
from ..compat import (
compat_str,
)
class MildomBaseIE(InfoExtractor):
_GUEST_ID = None
_DISPATCHER_CONFIG = None
def _call_api(self, url, video_id, query=None, note='Downloading JSON metadata', init=False):
... | @@ -23,8 +25,16 @@ class MildomBaseIE(InfoExtractor):
_DISPATCHER_CONFIG = None
def _call_api(self, url, video_id, query={}, note='Downloading JSON metadata', init=False):
+ query = query or {}
+ if query:
+ query['__platform'] = 'web'
url = update_url_query(url, self._comm... | yt_dlp/extractor/mildom.py | 26 | Python | 0.714 | suggestion | 184 | 51 | 51 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
_VALID_URL = r'https?://(?:(?:www|m)\.)mildom\.com/profile/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.mildom.com/profile/10093333',
'info_dict': {
'id': '10093333',
'title': 'Uploads from ねこばたけ',
},
'playlist_mincount': 351,
},
{
'url... | ```suggestion
'limit': '30',
``` | 'playlist_mincount': 351,
}, {
'url': 'https://www.mildom.com/profile/10882672',
'info_dict': {
'id': '10882672',
'title': 'Uploads from kson組長(けいそん)',
},
'playlist_mincount': 191,
}]
def _entries(self, user_id):
for page in itertools.... | @@ -239,7 +312,7 @@ def _entries(self, user_id):
user_id, note='Downloading page %d' % page, query={
'user_id': user_id,
'page': page,
- 'limit': '30',
+ 'limit': '30' | yt_dlp/extractor/mildom.py | 26 | Python | 0.571 | suggestion | 54 | 43 | 35 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
'thumbnail': dict_get(autoplay, ('upload_pic', 'video_pic')),
'uploader': uploader,
'uploader_id': user_id,
'formats': formats,
}
class MildomUserVodIE(MildomBaseIE):
IE_NAME = 'mildom:user:vod'
IE_DESC = 'Download all VODs from specific user in Mildom'
... | ```suggestion
}, {
'url': 'https://www.mildom.com/profile/10882672',
'info_dict': {
'id': '10882672',
'title': 'Uploads from kson組長(けいそん)',
},
'playlist_mincount': 191,
``` | 'uploader_id': user_id,
'formats': formats,
}
class MildomUserVodIE(MildomBaseIE):
IE_NAME = 'mildom:user:vod'
IE_DESC = 'Download all VODs from specific user in Mildom'
_VALID_URL = r'https?://(?:(?:www|m)\.)mildom\.com/profile/(?P<id>\d+)'
_TESTS = [{
'url': '... | @@ -230,6 +290,14 @@ class MildomUserVodIE(MildomBaseIE):
'title': 'Uploads from ねこばたけ',
},
'playlist_mincount': 351,
+ },
+ {
+ 'url': 'https://www.mildom.com/profile/10882672',
+ 'info_dict': {
+ 'id': '10882672',
+ 'title': 'Uploads from ks... | yt_dlp/extractor/mildom.py | 26 | Python | 0.786 | suggestion | 240 | 51 | 50 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
'ext': 'mp4',
'title': '【kson】感染メイズ!麻酔銃で無双する',
'thumbnail': r're:^https?://.*\.(png|jpg)$',
'timestamp': 1597759093.0,
'uploader': 'kson組長(けいそん)',
'duration': 4302.58,
'uploader_id': '10882672',
'description': 'このステージ絶対乗り越えた... | ```suggestion
}, {
'url': 'https://www.mildom.com/playback/10882672/10882672-1597758589870-477',
'info_dict': {
'id': '10882672-1597758589870-477',
'ext': 'mp4',
'title': '【kson】感染メイズ!麻酔銃で無双する',
'thumbnail': r're:^https?://.*\.(png|jpg)$',
... | 'title': '【kson】感染メイズ!麻酔銃で無双する',
'thumbnail': r're:^https?://.*\.(png|jpg)$',
'timestamp': 1597759093.0,
'uploader': 'kson組長(けいそん)',
'duration': 4302.58,
'uploader_id': '10882672',
'description': 'このステージ絶対乗り越えたい',
'upload_da... | @@ -158,7 +170,52 @@ def _real_extract(self, url):
class MildomVodIE(MildomBaseIE):
IE_NAME = 'mildom:vod'
IE_DESC = 'Download a VOD in Mildom'
- _VALID_URL = r'https?://(?:(?:www|m)\.)mildom\.com/playback/(?P<user_id>\d+)/(?P<id>(?P=user_id)-[a-zA-Z0-9]+)'
+ _VALID_URL = r'https?://(?:(?:www|m)\.)mild... | yt_dlp/extractor/mildom.py | 26 | Python | 0.786 | suggestion | 1,130 | 51 | 51 | false | [mildom] Fixes and improvements (should close #2519 ) | 2,533 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lazypete365 |
@staticmethod
def _extract_url(webpage):
mobj = re.search(
r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//out\.pladform\.ru/player\?.+?)\1', webpage)
if mobj:
return mobj.group('url')
def _real_extract(self, url):
video_id = self._match_id(url)
qs = ... | ```suggestion
targetUrl = self._request_webpage(HEADRequest(url), video_id, note='Resolving final URL').geturl()
``` | 'url': 'https://out.pladform.ru/player?pl=64471&videoid=3777899&vk_puid15=0&vk_puid34=0',
'md5': '53362fac3a27352da20fa2803cc5cd6f',
'info_dict': {
'id': '3777899',
'ext': 'mp4',
'title': 'СТУДИЯ СОЮЗ • Шоу Студия Союз, 24 выпуск (01.02.2018) Нурлан Сабуров и ... | @@ -63,13 +63,20 @@ def _real_extract(self, url):
'http://out.pladform.ru/getVideo', video_id, query={
'pl': pl,
'videoid': video_id,
- })
+ }, fatal=False)
def fail(text):
raise ExtractorError(
'%s returned er... | yt_dlp/extractor/pladform.py | 26 | Python | 0.714 | suggestion | 130 | 51 | 51 | false | [Pladform] Fix redirection to external player | 2,550 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | KiberInfinity |
if mobj:
return mobj.group('url')
def _real_extract(self, url):
video_id = self._match_id(url)
qs = parse_qs(url)
pl = qs.get('pl', ['1'])[0]
video = self._download_xml(
'http://out.pladform.ru/getVideo', video_id, query={
'pl': pl,
... | ```py
if targetUrl == url:
raise ExtractorError('Can\'t parse page')
return self.url_result(targetUrl)
``` | 'ext': 'mp4',
'title': 'СТУДИЯ СОЮЗ • Шоу Студия Союз, 24 выпуск (01.02.2018) Нурлан Сабуров и Слава Комиссаренко',
'description': 'md5:05140e8bf1b7e2d46e7ba140be57fd95',
'thumbnail': r're:^https?://.*\.jpg$',
'duration': 3190,
},
}, {
'url... | @@ -63,13 +63,20 @@ def _real_extract(self, url):
'http://out.pladform.ru/getVideo', video_id, query={
'pl': pl,
'videoid': video_id,
- })
+ }, fatal=False)
def fail(text):
raise ExtractorError(
'%s returned er... | yt_dlp/extractor/pladform.py | 26 | Python | 0.929 | refactor | 150 | 51 | 51 | false | [Pladform] Fix redirection to external player | 2,550 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | KiberInfinity |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class NFBIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/(?:film)/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.nfb.ca/film/trafficopter/',
"info_dict": {
"id": "trafficopter... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class NFBIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.nfb.ca/film/trafficopter/',
'info_dict': {
... | @@ -0,0 +1,64 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class NFBIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nfb\.ca/(?:film)/(?P<id>[^/?#&]+)' | yt_dlp/extractor/nfb.py | 8 | Python | 0.571 | suggestion | 88 | 33 | 33 | false | [nfb] Add extractor | 2,579 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | ofkz |
webpage, 'title', default=None)
director = self._html_search_regex(
r'<[^>]+\bitemprop=["\']name["\'][^>]*>([^<]+)',
webpage, 'director', default=None)
year = self._html_search_regex(
r'<[^>]+\bitemprop=["\']datePublished["\'][^>]*>([^<]+)',
we... | Use self._extract_m3u8_formats_and_subtitles | r'<[^>]+\bid=["\']player-iframe["\'][^>]*src=["\']([^"\']+)',
webpage, 'iframe', default=None, fatal=True)
if iframe.startswith('/'):
iframe = f'https://www.nfb.ca{iframe}'
player = self._download_webpage(iframe, video_id)
source = self._html_search_regex(
... | @@ -0,0 +1,64 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class NFBIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nfb\.ca/(?:film)/(?P<id>[^/?#&]+)'
+ _TESTS = [{
+ 'url': 'https://www.nfb.ca/film/trafficopter/',
+ "info_dict": {
+ ... | yt_dlp/extractor/nfb.py | 26 | Python | 0.143 | refactor | 44 | 37 | 35 | false | [nfb] Add extractor | 2,579 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | ofkz |
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage('https://www.nfb.ca/film/%s/' % video_id, video_id)
title = self._html_search_regex(
r'<[^>]+\bid=["\']titleHeader["\'][^>]*>\s*<h1[^>]*>\s*([^<]+?)\s*</h1>',
... | Inline title, description, thumbnail, uploader and sort formats before returning. | 'release_year': 1972,
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage('https://www.nfb.ca/film/%s/' % video_id, video_id)
iframe = self._html_search_regex(
r'<[^>]+\bid=["\']player-iframe["\'][^>]*src=... | @@ -0,0 +1,64 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class NFBIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nfb\.ca/(?:film)/(?P<id>[^/?#&]+)'
+ _TESTS = [{
+ 'url': 'https://www.nfb.ca/film/trafficopter/',
+ "info_dict": {
+ ... | yt_dlp/extractor/nfb.py | 26 | Python | 0.214 | style | 82 | 47 | 45 | false | [nfb] Add extractor | 2,579 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | ofkz |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class NFBIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
_TEST = {
'url': 'https://www.nfb.ca/film/trafficopter/',
'info_dict': {
'id': 'trafficopter',
... | ```suggestion
_TESTS = [{
'url': 'https://www.nfb.ca/film/trafficopter/',
'info_dict': {
'id': 'trafficopter',
'ext': 'mp4',
'title': 'Trafficopter',
'description': 'md5:060228455eb85cf88785c41656776bc0',
'thumbnail': r're:^https?:/... | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class NFBIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.nfb.ca/film/trafficopter/',
'info_dict': {
... | @@ -0,0 +1,61 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class NFBIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
+ _TEST = {
+ 'url': 'https://www.nfb.ca/film/trafficopter/',
+ 'info_dict': {
+ ... | yt_dlp/extractor/nfb.py | 20 | Python | 0.786 | suggestion | 436 | 45 | 45 | false | [nfb] Add extractor | 2,579 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ofkz |
class NFBIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
_TEST = {
'url': 'https://www.nfb.ca/film/trafficopter/',
'info_dict': {
'id': 'trafficopter',
'ext': 'mp4',
'title': 'Trafficopter',
'description': 'md5:... | ```suggestion
iframe = f'https://www.nfb.ca{iframe}'
``` |
class NFBIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.nfb.ca/film/trafficopter/',
'info_dict': {
'id': 'trafficopter',
'ext': 'mp4',
'title': 'Trafficopter',
'description': 'm... | @@ -0,0 +1,61 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class NFBIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nfb\.ca/film/(?P<id>[^/?#&]+)'
+ _TEST = {
+ 'url': 'https://www.nfb.ca/film/trafficopter/',
+ 'info_dict': {
+ ... | yt_dlp/extractor/nfb.py | 26 | Python | 0.571 | suggestion | 70 | 51 | 51 | false | [nfb] Add extractor | 2,579 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ofkz |
'upload_date': '20220201',
'bitrate': 128000,
'release_date': '20220201',
},
}, {
'url': 'https://4d.rtvslo.si/arhiv/dnevnik/174842550',
'only_matching': True
}
]
def _real_extract(self, url):
v_id = se... | ```suggestion
lang = SUB_LANGS_MAP.get(s.get('language'), s.get('language') or 'und'))
subs.setdefault(lang, []).append({'url': s.get('file'), 'format': s.get('format').lower()})
``` | 'info_dict': {
'id': '174844609',
'ext': 'mp3',
'series_id': '106615841',
'title': 'Il giornale della sera',
'duration': 1328,
'series': 'Il giornale della sera',
'timestamp': 1643743800,
... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.786 | suggestion | 209 | 51 | 51 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
}, {
'url': 'https://365.rtvslo.si/arhiv/il-giornale-della-sera/174844609',
'info_dict': {
'id': '174844609',
'ext': 'mp3',
'series_id': '106615841',
'title': 'Il giornale della sera',
'duration': 1328,
... | Is this supposed to be fatal or not?
```suggestion
meta = self._download_json(self._API_BASE.format('getRecordingDrm', v_id), v_id)['response']
```
OR
```suggestion
meta = self._download_json(self._API_BASE.format('getRecordingDrm', v_id), v_id, fatal=False).get('response') or []
``` | 'release_date': '20220129',
'timestamp': 1643484455,
'title': 'Utrip',
'duration': 813,
'thumbnail': 'https://img.rtvcdn.si/_up/ava/ava_misc/show_logos/94/utrip_1_wide2.jpg',
'description': 'md5:77f2892630c7b17bb7a5bb8431902... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.786 | question | 309 | 51 | 51 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
'url': 'https://4d.rtvslo.si/arhiv/dnevnik/174842550',
'only_matching': True
}
]
def _real_extract(self, url):
v_id = self._match_id(url)
meta = self._download_json(self._API_BASE.format('getRecordingDrm', v_id), v_id).get('response')
date = unified_times... | ```suggestion
media = self._download_json(self._API_BASE.format('getMedia', v_id), v_id, query={jwt: jwt}).get('response')
``` | 'series': 'Il giornale della sera',
'timestamp': 1643743800,
'release_timestamp': 1643745424,
'thumbnail': 'https://img.rtvcdn.si/_up/ava/ava_misc/show_logos/il-giornale-della-sera_wide2.jpg',
'upload_date': '20220201',
'tbr... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 51 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
def _real_extract(self, url):
v_id = self._match_id(url)
meta = self._download_json(self._API_BASE.format('getRecordingDrm', v_id), v_id).get('response')
date = unified_timestamp(meta.get('broadcastDate') or meta.get('broadcastDates')[0])
thumbs = [{'id': k, 'url': v} for (k, v) in ... | ```suggestion
traverse_obj(media, ('addaptiveMedia', 'hls_sec'), expected_type=url_or_none),
``` | 'tbr': 128000,
'release_date': '20220201',
},
}, {
'url': 'https://4d.rtvslo.si/arhiv/dnevnik/174842550',
'only_matching': True
}
]
def _real_extract(self, url):
v_id = self._match_id(url)
meta = self._download... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.857 | suggestion | 114 | 51 | 51 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
subs[s.get('language')] = []
subs[s.get('language')].append({'url': s.get('file'), 'format': s.get('format').lower()})
jwt = meta.get('jwt')
if not jwt:
raise ExtractorError('Site did not provide an authentication token, cannot proceed.')
media = self._d... | ```suggestion
formats.extend({
'bitrate': f.get('bitrate'),
'url': traverse_obj(f, ('streams', strm)),
'filesize': f.get('filesize'),
'width': f.get('width'),
'height': f.get('height'),
'ext': f.get('media... |
thumbs = [{'id': k, 'url': v, 'http_headers': {'Accept': 'image/jpeg'}}
for k, v in (meta.get('images') or {}).items()]
subs = {}
for s in traverse_obj(meta, 'subs', 'subtitles', default=[]):
lang = self.SUB_LANGS_MAP.get(s.get('language'), s.get('language') or 'u... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.929 | suggestion | 614 | 51 | 51 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
jwt = meta.get('jwt')
if not jwt:
raise ExtractorError('Site did not provide an authentication token, cannot proceed.')
media = self._download_json(self._API_BASE.format('getMedia', v_id) + f'&jwt={jwt}', v_id).get('response')
formats = []
if media.get('addaptiveMe... | ```py
url = ...
if url:
``` | for k, v in (meta.get('images') or {}).items()]
subs = {}
for s in traverse_obj(meta, 'subs', 'subtitles', default=[]):
lang = self.SUB_LANGS_MAP.get(s.get('language'), s.get('language') or 'und')
subs.setdefault(lang, []).append({
'url': s.get(... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.429 | suggestion | 30 | 51 | 51 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
'width': f.get('width'),
'height': f.get('height'),
'ext': f.get('mediaType').lower(),
'format_id': f'files_{strm}_{f.get("mediaType").lower()}_{f.get("bitrate")}'
})
if media.get('addaptiveMedia... | `.extend`, make sure everything is non-fatal | formats = self._extract_wowza_formats(adaptive_url, v_id, skip_protocols=['smil'])
adaptive_url = traverse_obj(media, ('addaptiveMedia_sl', 'hls_sec'), expected_type=url_or_none)
if adaptive_url:
for f in self._extract_wowza_formats(adaptive_url, v_id, skip_protocols=['smil']):
... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.214 | suggestion | 44 | 51 | 50 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
for f in self._extract_wowza_formats(
traverse_obj(media, ('addaptiveMedia_sl', 'hls_sec')), v_id, skip_protocols=['smil']
):
f.update({'format_note': 'Sign language interpretation', 'preference': -3})
formats.append(f)
for strm in ('http',... | ```suggestion
raise ExtractorError(f'{self.IE_NAME} said: Clip not available', expected=True)
``` | 'format_id': 'sign-' + f['format_id'],
'format_note': 'Sign language interpretation', 'preference': -10,
'language': (
'slv' if f.get('language') == 'eng' and f.get('acodec') != 'none'
else f.get('language'))
... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.929 | refactor | 111 | 45 | 43 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
):
f.update({'format_note': 'Sign language interpretation', 'preference': -3})
formats.append(f)
for strm in ('http', 'https'):
for f in media.get('mediaFiles_sl'):
if traverse_obj(f, ('streams', strm)):
formats.append({... | ```suggestion
return {
``` | 'language': (
'slv' if f.get('language') == 'eng' and f.get('acodec') != 'none'
else f.get('language'))
})
formats.extend(
{
'url': f['streams'][strm],
'ext': traverse_obj(f, 'mediaTy... | @@ -0,0 +1,150 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj, parse_duration, unified_timestamp
+
+
+class RTVSLOIE(InfoExtractor):
+ IE_NAME = 'rtvslo.si'
+ _VALID_URL = r'https?://(?:(?:365|4d)\.rtvslo.si/arhiv/[^/?#&;]+|(?:www\.)?rtvslo\.si/rtv365/arhiv)/(?P<id>(\d+))'... | yt_dlp/extractor/rtvslo.py | 26 | Python | 0.429 | suggestion | 36 | 43 | 41 | false | New IE for RTVSLO (rtvslo.si) | 2,586 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
'only_matching': True,
}, {
'url': 'http://canaloff.globo.com/programas/desejar-profundo/videos/4518560.html',
'only_matching': True,
}, {
'url': 'globo:3607726',
'only_matching': True,
}, {
'url': 'https://globoplay.globo.com/v/10248083/',
'info_dict'... | try this
```suggestion
self._request_webpage(
HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'),
video_id, 'Getting cookies')
``` | 'url': 'http://globotv.globo.com/canal-brasil/sangue-latino/t/todos-os-videos/v/ator-e-diretor-argentino-ricado-darin-fala-sobre-utopias-e-suas-perdas/3928201/',
'only_matching': True,
}, {
'url': 'http://canaloff.globo.com/programas/desejar-profundo/videos/4518560.html',
'only_match... | @@ -67,11 +67,26 @@ class GloboIE(InfoExtractor):
}, {
'url': 'globo:3607726',
'only_matching': True,
+ }, {
+ 'url': 'https://globoplay.globo.com/v/10248083/',
+ 'info_dict': {
+ 'id': '10248083',
+ 'ext': 'mp4',
+ 'title': 'Melhores momentos: Eq... | yt_dlp/extractor/globo.py | 26 | Python | 0.786 | suggestion | 246 | 51 | 51 | false | Fixing globo #2524 | 2,589 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'uploader_id': '698',
},
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
self._download_webpage('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&s... | Confirm whether this (and below changes) works with the existing tests | 'uploader': 'SporTV',
'uploader_id': '698',
},
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
self._request_webpage(
HEADRequest('https://globo-ab.globo.com/v2/selecte... | @@ -82,7 +97,7 @@ def _real_extract(self, url):
formats = []
security = self._download_json(
- 'https://playback.video.globo.com/v1/video-session', video_id, 'Downloading security hash for %s' % video_id,
+ 'https://playback.video.globo.com/v2/video-session', video_id, 'Downloa... | yt_dlp/extractor/globo.py | 26 | Python | 0.286 | suggestion | 70 | 51 | 51 | false | Fixing globo #2524 | 2,589 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
video_id = self._match_id(url)
self._download_webpage('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true', video_id, 'Getting cookies')
video = self._download_json(
'http://api.globovideos.com/videos/%s/playlist' % vi... | ```suggestion
self._request_webpage(HeadRequest(security['sources'][0]['url_template']), video_id, 'Getting locksession cookie')
``` | def _real_extract(self, url):
video_id = self._match_id(url)
self._request_webpage(
HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'),
video_id, 'Getting cookies')
video = self._download... | @@ -92,7 +107,10 @@ def _real_extract(self, url):
"tz": "-3.0:00"
}).encode())
- security_hash = security['source']['token']
+ manifest = security['sources'][0]['url_template']
+ self._download_webpage(manifest, video_id, 'Getting locksession cookie') | yt_dlp/extractor/globo.py | 26 | Python | 0.857 | security | 142 | 51 | 51 | false | Fixing globo #2524 | 2,589 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'url': 'https://player.glomex.com/integration/1/iframe-player.html?playlistId=cl-bgqaata6aw8x&integrationId=19syy24xjn1oqlpc',
'info_dict': {
'id': 'cl-bgqaata6aw8x',
},
'playlist_mincount': 2,
}]
@classmethod
def build_player_url(cls, video_id, integration, orig... | I would advise against `re.finditer` as it appears to store a copy of webpage (`mobj.string`).
```suggestion
regex = fr'''(?x)
<iframe[^>]+?src=(?P<q>{quot_re})(?P<url>
(?:https?:)?{cls._BASE_PLAYER_URL_RE}\?(?:(?!(?P=q)).)+
)(?P=q)'''
for _, url, *_ in re.f... | 'url': 'https://player.glomex.com/integration/1/iframe-player.html?playlistId=cl-bgqaata6aw8x&integrationId=19syy24xjn1oqlpc',
'info_dict': {
'id': 'cl-bgqaata6aw8x',
},
'playlist_mincount': 2,
}]
@classmethod
def build_player_url(cls, video_id, integration, orig... | @@ -177,50 +178,38 @@ def build_player_url(cls, video_id, integration, origin_url=None):
@classmethod
def _extract_urls(cls, webpage, origin_url):
- VALID_SRC = rf'(?:https?:)?{cls._BASE_PLAYER_URL_RE}\?(?:(?!(?P=_q1)).)+'
-
# https://docs.glomex.com/publisher/video-player-integration/javasc... | yt_dlp/extractor/glomex.py | 26 | Python | 0.786 | security | 385 | 51 | 51 | false | [glomex] Simplify embed detection | 2,600 | yt-dlp/yt-dlp | 132,642 | Python | zmousm | pukkandan |
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... | Ditto for `re.finditer`.
```suggestion
regex = fr'''(?x)(
<glomex-player [^>]+?>|
<div[^>]* data-glomex-player=(?P<q>{quot_re})true(?P=q)[^>]*>)'''
for elem, *_ in re.findall(regex, webpage):
attrs = extract_attributes(elem)
``` | 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... | @@ -177,50 +178,38 @@ def build_player_url(cls, video_id, integration, origin_url=None):
@classmethod
def _extract_urls(cls, webpage, origin_url):
- VALID_SRC = rf'(?:https?:)?{cls._BASE_PLAYER_URL_RE}\?(?:(?!(?P=_q1)).)+'
-
# https://docs.glomex.com/publisher/video-player-integration/javasc... | yt_dlp/extractor/glomex.py | 26 | Python | 0.857 | refactor | 289 | 49 | 50 | false | [glomex] Simplify embed detection | 2,600 | yt-dlp/yt-dlp | 132,642 | Python | zmousm | pukkandan |
# https://docs.glomex.com/publisher/video-player-integration/javascript-api/
quot_re = r'["\']'
regex = fr'''(?x)
<iframe[^>]+?src=(?P<q>{quot_re})(?P<url>
(?:https?:)?{cls._BASE_PLAYER_URL_RE}\?(?:(?!(?P=q)).)+
)(?P=q)'''
for mobj in re.finditer(... | Ditto for `re.finditer`.
```suggestion
for script in re.findall(r'<script[^<]*>.+?</script>', webpage):
``` | # https://docs.glomex.com/publisher/video-player-integration/javascript-api/
quot_re = r'["\']'
regex = fr'''(?x)
<iframe[^>]+?src=(?P<q>{quot_re})(?P<url>
(?:https?:)?{cls._BASE_PLAYER_URL_RE}\?(?:(?!(?P=q)).)+
)(?P=q)'''
for mobj in re.finditer(... | @@ -177,50 +178,38 @@ def build_player_url(cls, video_id, integration, origin_url=None):
@classmethod
def _extract_urls(cls, webpage, origin_url):
- VALID_SRC = rf'(?:https?:)?{cls._BASE_PLAYER_URL_RE}\?(?:(?!(?P=_q1)).)+'
-
# https://docs.glomex.com/publisher/video-player-integration/javasc... | yt_dlp/extractor/glomex.py | 26 | Python | 0.714 | suggestion | 120 | 40 | 41 | false | [glomex] Simplify embed detection | 2,600 | yt-dlp/yt-dlp | 132,642 | Python | zmousm | pukkandan |
'tags': list,
'age_limit': 18,
'display_id': 2569966,
'upload_date': '20220131',
'description': 'md5:b4fc879a58ae6c604f8f259155b7e3b9',
}
}, {
# api/v6 v2
'url': 'https://beeg.com/1941093077?t=911-1391',
'only_matching': Tru... | ```suggestion
resources = traverse_obj(video, ('file', 'hls_resources'), ('fc_facts', 0, 'hls_resources'))
``` | 'description': 'md5:b4fc879a58ae6c604f8f259155b7e3b9',
'timestamp': 1643623200,
'display_id': 2569965,
'upload_date': '20220131',
}
}, {
# api/v6 v2
'url': 'https://beeg.com/1941093077?t=911-1391',
'only_matching': True,
}, {
... | @@ -36,78 +50,54 @@ class BeegIE(InfoExtractor):
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/video/5416503',
- 'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/5416503',
- 'only_ma... | yt_dlp/extractor/beeg.py | 26 | Python | 0.714 | suggestion | 120 | 51 | 51 | false | Fixing #2592 | 2,616 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'format_id': 'hls',
'height': int(height),
'ext': 'mp4',
'format': 'm3u8',
'protocol': 'm3u8_native',
'video_ext': 'mp4',
})
self._sort_formats(formats)
title = traverse_obj(video, ('file', 'stuf... | ```suggestion
return {
'id': video_id,
'display_id': traverse_obj(video, ('fc_facts', 0, 'id')),
'title': traverse_obj(video, ('file', 'stuff', 'sf_name')),
'description': traverse_obj(video, ('file', 'stuff', 'sf_story')),
'timestamp': unified_t... | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
try_get,
unified_timestamp,
)
class BeegIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?beeg\.(?:com(?:/video)?)/-?(?P<id>\d+)'
_TESTS = [{
'url': 'https://... | @@ -36,78 +50,54 @@ class BeegIE(InfoExtractor):
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/video/5416503',
- 'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/5416503',
- 'only_ma... | yt_dlp/extractor/beeg.py | 26 | Python | 0.786 | suggestion | 538 | 30 | 94 | false | Fixing #2592 | 2,616 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video = self._download_json(
'https://store.externulls.com... | What happens when you use this code?
PS: It should be `ext=mp4` | 'url': 'https://beeg.com/1277207756',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video = self._download_json(
'https://store.externulls.com/facts/file/%s' % video_id... | @@ -36,78 +50,54 @@ class BeegIE(InfoExtractor):
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/video/5416503',
- 'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/5416503',
- 'only_ma... | yt_dlp/extractor/beeg.py | 26 | Python | 0.429 | question | 66 | 51 | 45 | false | Fixing #2592 | 2,616 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
)
class BeegIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?beeg\.(?:com(?:/video)?)/-?(?P<id>\d+)'
_TESTS = [{
'url': 'https://beeg.com/-0983946056129650',
... | Why did you remove timestamp and display_id!? | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
try_get,
unified_timestamp,
)
class BeegIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?beeg\.(?:com(?:/video)?)/-?(?P<id>\d+)'
_TESTS = [{
'url': 'https://... | @@ -84,23 +76,12 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
- title = traverse_obj(video, ('file', 'stuff', 'sf_name'))
- video_id = compat_str(video_id)
- display_id = traverse_obj(video, ('fc_facts', 0, 'id'))
- description = traverse_obj(video,... | yt_dlp/extractor/beeg.py | 26 | Python | 0.143 | question | 45 | 88 | 94 | false | Fixing #2592 | 2,616 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
video = self._download_json(
'https://store.externulls.com/facts/file/%s' % video_id,
video_id, 'Downloading JSON for %s' % video_id)
fc_facts = video.get('fc_facts')
firstKey = None
for i in range(len(fc_facts)):
if not firstKey or fc_facts[i - 1]['... | ```suggestion
height = int_or_none(self._search_regex(r'fl_cdn_(\d+)', format_id, 'height', default=None))
current_formats = self._extract_m3u8_formats(f'https://video.beeg.com/{video_uri}', video_id, ext='mp4', m3u8_id=str(height))
for f in current_formats:
f['he... | webpage = self._download_webpage(url, video_id)
video = self._download_json(
'https://store.externulls.com/facts/file/%s' % video_id,
video_id, 'Downloading JSON for %s' % video_id)
fc_facts = video.get('fc_facts')
first_fact = {}
for fact in fc_facts:
... | @@ -36,81 +48,49 @@ class BeegIE(InfoExtractor):
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/video/5416503',
- 'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/5416503',
- 'only_ma... | yt_dlp/extractor/beeg.py | 26 | Python | 0.857 | refactor | 380 | 41 | 38 | false | Fixing #2592 | 2,616 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'upload_date': '20220131',
}
}, {
# api/v6 v2
'url': 'https://beeg.com/1941093077?t=911-1391',
'only_matching': True,
}, {
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
}]
def _real_extract(self, url):
... | I didnt test, but pretty sure this is wrong | 'display_id': 2569965,
'upload_date': '20220131',
}
}, {
# api/v6 v2
'url': 'https://beeg.com/1941093077?t=911-1391',
'only_matching': True,
}, {
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
}]
... | @@ -36,81 +48,49 @@ class BeegIE(InfoExtractor):
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/video/5416503',
- 'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/5416503',
- 'only_ma... | yt_dlp/extractor/beeg.py | 26 | Python | 0.071 | bug | 44 | 51 | 51 | false | Fixing #2592 | 2,616 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
}
}, {
# api/v6 v2
'url': 'https://beeg.com/1941093077?t=911-1391',
'only_matching': True,
}, {
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
... | ```suggestion
first_fact = {}
for fact in fc_facts:
if not first_fact or try_get(fact, lambda x: x['id'] < first_fact['id']):
``` | 'upload_date': '20220131',
}
}, {
# api/v6 v2
'url': 'https://beeg.com/1941093077?t=911-1391',
'only_matching': True,
}, {
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
}]
def _real_extract(self, url):
... | @@ -36,81 +48,47 @@ class BeegIE(InfoExtractor):
# api/v6 v2 w/o t
'url': 'https://beeg.com/1277207756',
'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/video/5416503',
- 'only_matching': True,
- }, {
- 'url': 'https://beeg.porn/5416503',
- 'only_ma... | yt_dlp/extractor/beeg.py | 26 | Python | 0.714 | suggestion | 161 | 51 | 51 | false | Fixing #2592 | 2,616 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bricio |
'source_preference': 1,
'quality': 1,
})
self._sort_formats(formats)
return {
'id': post_id,
'title': title,
'description': description,
'thumbnail': url_or_none(
urljoin(self._MEDIA_BASE_URL, p... | `site:type` IE_NAME format usually doesn't have capital letters
since GettrIE doesn't set it's own IE_NAME either,
```suggestion
``` | formats.append({
'url': urljoin(self._MEDIA_BASE_URL, ovid),
'format_id': 'ovid',
'ext': 'mp4',
'width': int_or_none(post_data.get('vid_wid')),
'height': int_or_none(post_data.get('vid_hgt')),
'source_preference'... | @@ -108,3 +109,70 @@ def _real_extract(self, url):
'duration': float_or_none(post_data.get('vid_dur')),
'tags': post_data.get('htgs'),
}
+
+
+class GettrStreamingIE(GettrIE):
+ IE_NAME = 'Gettr:streaming' | yt_dlp/extractor/gettr.py | 26 | Python | 0.857 | suggestion | 135 | 51 | 51 | false | [Gettr] Add `GettrStreamingIE` | 2,661 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | ghost |
live_info = video_info['broadcast']
live_url = url_or_none(live_info.get('url'))
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
live_url, video_id, ext='mp4',
entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) if live_url else []
thumbnai... | ```suggestion
'duration': float_or_none(live_info.get('duration'), scale=1000),
```
Duration is given in miliseconds, while info_dict should set `duration` to seconds | 'upload_date': '20220204',
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._call_api('live/join/%s' % video_id, video_id, data={})
live_info = video_info['broadcast']
live_url = url_or_none(live_info.get('url'))
f... | @@ -108,3 +109,70 @@ def _real_extract(self, url):
'duration': float_or_none(post_data.get('vid_dur')),
'tags': post_data.get('htgs'),
}
+
+
+class GettrStreamingIE(GettrIE):
+ IE_NAME = 'Gettr:streaming'
+ _VALID_URL = r'https?://(www\.)?gettr\.com/streaming/(?P<id>[a-z0-9]+)'
... | yt_dlp/extractor/gettr.py | 26 | Python | 0.786 | suggestion | 181 | 29 | 36 | false | [Gettr] Add `GettrStreamingIE` | 2,661 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | ghost |
video_info = self._download_json('https://api.gettr.com/u/live/join/%s' % video_id, video_id, data={})['result']
live_info = video_info['broadcast']
live_url = url_or_none(live_info.get('url'))
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
live_url, video_i... | ```suggestion
'timestamp': float_or_none(live_info.get('startAt'), scale=1000),
```
Same as duration | 'timestamp': 1643976662.858,
'upload_date': '20220204',
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._call_api('live/join/%s' % video_id, video_id, data={})
live_info = video_info['broadcast']
live_url = url... | @@ -108,3 +109,70 @@ def _real_extract(self, url):
'duration': float_or_none(post_data.get('vid_dur')),
'tags': post_data.get('htgs'),
}
+
+
+class GettrStreamingIE(GettrIE):
+ IE_NAME = 'Gettr:streaming'
+ _VALID_URL = r'https?://(www\.)?gettr\.com/streaming/(?P<id>[a-z0-9]+)'
... | yt_dlp/extractor/gettr.py | 26 | Python | 0.714 | suggestion | 115 | 30 | 37 | false | [Gettr] Add `GettrStreamingIE` | 2,661 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | ghost |
}, {
'url': 'https://gettr.com/streaming/psfmeefcc1',
'info_dict': {
'id': 'psfmeefcc1',
'ext': 'mp4',
'title': 'Session 90: "The Virus Of Power"',
'view_count': int,
'uploader_id': 'coronacommittee',
'description': 'md5:98986ac... | ```suggestion
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
live_url, video_id, ext='mp4',
entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) if live_url else ([], {})
``` | 'duration': 5180.184,
'thumbnail': r're:^https?://.+',
'title': 'Day 1: Opening Session of the Grand Jury Proceeding',
'timestamp': 1644080997.164,
'upload_date': '20220205',
}
}, {
'url': 'https://gettr.com/streaming/psfmeefcc1',
'... | @@ -108,3 +109,70 @@ def _real_extract(self, url):
'duration': float_or_none(post_data.get('vid_dur')),
'tags': post_data.get('htgs'),
}
+
+
+class GettrStreamingIE(GettrIE):
+ IE_NAME = 'Gettr:streaming'
+ _VALID_URL = r'https?://(www\.)?gettr\.com/streaming/(?P<id>[a-z0-9]+)'
... | yt_dlp/extractor/gettr.py | 26 | Python | 0.857 | refactor | 231 | 48 | 51 | false | [Gettr] Add `GettrStreamingIE` | 2,661 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | ghost |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
bool_or_none,
ExtractorError,
dict_get,
float_or_none,
int_or_none,
remove_end,
str_or_none,
try_get,
url_or_none,
urljoin,
)
class GettrBaseIE(InfoExtractor):
_... | Only used in one place, so can be hardcoded | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
bool_or_none,
ExtractorError,
dict_get,
float_or_none,
int_or_none,
remove_end,
str_or_none,
try_get,
url_or_none,
urljoin,
)
class GettrBaseIE(InfoExtractor):
_... | @@ -15,9 +16,16 @@
)
-class GettrIE(InfoExtractor):
- _VALID_URL = r'https?://(www\.)?gettr\.com/post/(?P<id>[a-z0-9]+)'
+class GettrBaseIE(InfoExtractor):
_MEDIA_BASE_URL = 'https://media.gettr.com/'
+ _API_BASE_URL = 'https://api.gettr.com/u/' | yt_dlp/extractor/gettr.py | 21 | Python | 0.143 | suggestion | 43 | 46 | 46 | false | [Gettr] Add `GettrStreamingIE` | 2,661 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
'uploader_id': 'coronacommittee',
'description': 'md5:98986acdf656aa836bf36f9c9704c65b',
'uploader': 'Corona Investigative Committee',
'thumbnail': r're:^https?://.+',
'duration': 21872.507,
'timestamp': 1643976662.858,
'upload_date': '... | ```suggestion
thumbnails = [{
'url': urljoin(self._MEDIA_BASE_URL, thumbnail),
} for thumbnail in try_get(video_info, lambda x: x['postData']['imgs']) or []]
``` | 'uploader_id': 'coronacommittee',
'description': 'md5:98986acdf656aa836bf36f9c9704c65b',
'uploader': 'Corona Investigative Committee',
'thumbnail': r're:^https?://.+',
'duration': 21872.507,
'timestamp': 1643976662.858,
'upload_date': '... | @@ -108,3 +115,73 @@ def _real_extract(self, url):
'duration': float_or_none(post_data.get('vid_dur')),
'tags': post_data.get('htgs'),
}
+
+
+class GettrStreamingIE(GettrBaseIE):
+ _VALID_URL = r'https?://(www\.)?gettr\.com/streaming/(?P<id>[a-z0-9]+)'
+
+ _TESTS = [{
+ '... | yt_dlp/extractor/gettr.py | 26 | Python | 0.714 | suggestion | 193 | 44 | 42 | false | [Gettr] Add `GettrStreamingIE` | 2,661 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
'duration': 5180.184,
'thumbnail': r're:^https?://.+',
'title': 'Day 1: Opening Session of the Grand Jury Proceeding',
'timestamp': 1644080997.164,
'upload_date': '20220205',
}
}, {
'url': 'https://gettr.com/streaming/psfmeefcc1',
'... | make the `_call_api` function return the `['result']` | 'uploader_id': 'coronacommittee',
'duration': 5180.184,
'thumbnail': r're:^https?://.+',
'title': 'Day 1: Opening Session of the Grand Jury Proceeding',
'timestamp': 1644080997.164,
'upload_date': '20220205',
}
}, {
'url': 'http... | @@ -108,3 +114,71 @@ def _real_extract(self, url):
'duration': float_or_none(post_data.get('vid_dur')),
'tags': post_data.get('htgs'),
}
+
+
+class GettrStreamingIE(GettrBaseIE):
+ _VALID_URL = r'https?://(www\.)?gettr\.com/streaming/(?P<id>[a-z0-9]+)'
+
+ _TESTS = [{
+ '... | yt_dlp/extractor/gettr.py | 26 | Python | 0.357 | suggestion | 53 | 51 | 51 | false | [Gettr] Add `GettrStreamingIE` | 2,661 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | ghost |
'description': 'Íþróttafréttir.',
},
}, {
'url': 'https://www.ruv.is/utvarp/spila/i-ljosi-sogunnar/23795/7hqkre',
'info_dict': {
'id': '7hqkre',
'ext': 'mp3',
'thumbnail': 'https://d38kdhuogyllre.cloudfront.net/fit-in/1960x/filters:quality(65)/... | ```suggestion
display_id, series_id = self._match_valid_url(url).group('id', 'series_id')
``` | 'description': 'Íþróttafréttir.',
'age_limit': 0,
},
}, {
'url': 'https://www.ruv.is/utvarp/spila/i-ljosi-sogunnar/23795/7hqkre',
'info_dict': {
'id': '7hqkre',
'ext': 'mp3',
'thumbnail': 'https://d38kdhuogyllre.cloudfront.net/fit-i... | @@ -99,3 +101,88 @@ def _real_extract(self, url):
'timestamp': timestamp,
'formats': formats,
}
+
+
+class RuvSpilaIE(InfoExtractor):
+ IE_NAME = 'ruv.is:spila'
+ _VALID_URL = r'https?://(?:www\.)?ruv\.is/(?:(?:sjon|ut)varp|(?:krakka|ung)ruv)/spila/.+/(?P<series_id>[0-9]+)/(?P<i... | yt_dlp/extractor/ruv.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | [ruv.is] add extractor | 2,665 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
'url': 'https://www.ruv.is/ungruv/spila/ungruv/28046/8beuph',
'only_matching': True
}, {
'url': 'https://www.ruv.is/krakkaruv/spila/krakkafrettir/30712/9jbgb0',
'only_matching': True
}]
def _real_extract(self, url):
mobj = self._match_valid_url(url)
display_i... | ```suggestion
program = self._download_json(
'https://www.ruv.is/gql/', display_id, query={'query': '''{
Program(id: %s){
title image description short_description
episodes(id: {value: "%s"}) {
rating title duratio... | },
}, {
'url': 'https://www.ruv.is/ungruv/spila/ungruv/28046/8beuph',
'only_matching': True
}, {
'url': 'https://www.ruv.is/krakkaruv/spila/krakkafrettir/30712/9jbgb0',
'only_matching': True
}]
def _real_extract(self, url):
display_id, series_id = self._m... | @@ -99,3 +101,88 @@ def _real_extract(self, url):
'timestamp': timestamp,
'formats': formats,
}
+
+
+class RuvSpilaIE(InfoExtractor):
+ IE_NAME = 'ruv.is:spila'
+ _VALID_URL = r'https?://(?:www\.)?ruv\.is/(?:(?:sjon|ut)varp|(?:krakka|ung)ruv)/spila/.+/(?P<series_id>[0-9]+)/(?P<i... | yt_dlp/extractor/ruv.py | 26 | Python | 0.786 | suggestion | 668 | 51 | 51 | false | [ruv.is] add extractor | 2,665 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
mobj = self._match_valid_url(url)
display_id = mobj.group('id')
series_id = mobj.group('series_id')
program = self._download_json(
'https://www.ruv.is/gql/', display_id,
query={'query': """{
Program(id: %s){
title image description short_descri... | ```suggestion
subs = {
trk['name']: [{'url': trk['value']}]
for trk in episode.get('subtitles', [])
if trk.get('name') and trk.get('value')
}
``` |
def _real_extract(self, url):
display_id, series_id = self._match_valid_url(url).group('id', 'series_id')
program = self._download_json(
'https://www.ruv.is/gql/', display_id, query={'query': '''{
Program(id: %s){
title image description short_descrip... | @@ -99,3 +101,88 @@ def _real_extract(self, url):
'timestamp': timestamp,
'formats': formats,
}
+
+
+class RuvSpilaIE(InfoExtractor):
+ IE_NAME = 'ruv.is:spila'
+ _VALID_URL = r'https?://(?:www\.)?ruv\.is/(?:(?:sjon|ut)varp|(?:krakka|ung)ruv)/spila/.+/(?P<series_id>[0-9]+)/(?P<i... | yt_dlp/extractor/ruv.py | 26 | Python | 0.786 | suggestion | 203 | 48 | 49 | false | [ruv.is] add extractor | 2,665 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
def _real_extract(self, url):
mobj = self._match_valid_url(url)
display_id = mobj.group('id')
series_id = mobj.group('series_id')
program = self._download_json(
'https://www.ruv.is/gql/', display_id,
query={'query': """{
Program(id: %s){
ti... | ```suggestion
for trk in episode.get('subtitles') or []:
``` | }]
def _real_extract(self, url):
display_id, series_id = self._match_valid_url(url).group('id', 'series_id')
program = self._download_json(
'https://www.ruv.is/gql/', display_id, query={'query': '''{
Program(id: %s){
title image description short_... | @@ -99,3 +101,88 @@ def _real_extract(self, url):
'timestamp': timestamp,
'formats': formats,
}
+
+
+class RuvSpilaIE(InfoExtractor):
+ IE_NAME = 'ruv.is:spila'
+ _VALID_URL = r'https?://(?:www\.)?ruv\.is/(?:(?:sjon|ut)varp|(?:krakka|ung)ruv)/spila/.+/(?P<series_id>[0-9]+)/(?P<i... | yt_dlp/extractor/ruv.py | 26 | Python | 0.571 | suggestion | 70 | 49 | 50 | false | [ruv.is] add extractor | 2,665 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
'url': 'https://www.ruv.is/krakkaruv/spila/krakkafrettir/30712/9jbgb0',
'only_matching': True
}]
def _real_extract(self, url):
display_id, series_id = self._match_valid_url(url).group('id', 'series_id')
program = self._download_json(
'https://www.ruv.is/gql/', displa... | ```suggestion
for trk in episode.get('subtitles'):
if trk.get('name') and trk.get('value'):
subs.setdefault(trk['name'], []).append({'url': trk['value'], 'ext': 'vtt'})
```
why would u use list comprehension like that !? | 'url': 'https://www.ruv.is/krakkaruv/spila/krakkafrettir/30712/9jbgb0',
'only_matching': True
}]
def _real_extract(self, url):
display_id, series_id = self._match_valid_url(url).group('id', 'series_id')
program = self._download_json(
'https://www.ruv.is/gql/', displa... | @@ -99,3 +101,88 @@ def _real_extract(self, url):
'timestamp': timestamp,
'formats': formats,
}
+
+
+class RuvSpilaIE(InfoExtractor):
+ IE_NAME = 'ruv.is:spila'
+ _VALID_URL = r'https?://(?:www\.)?ruv\.is/(?:(?:sjon|ut)varp|(?:krakka|ung)ruv)/spila/.+/(?P<series_id>[0-9]+)/(?P<i... | yt_dlp/extractor/ruv.py | 26 | Python | 0.857 | question | 261 | 51 | 51 | false | [ruv.is] add extractor | 2,665 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40810083_a.jpg'},
'skip': 'Video available only in one week'
}]
def _real_extract(self, url):
series_id, video_id = self._match_valid_url(url).groups()
self._request_webpage(HEADRequest(url), video_id)
... | ```suggestion
for f in fmt:
f.update(dict(zip(('height', 'width'),
self._BITRATE_MAP.get(f.get('tbr'), ()))))
``` | 'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40810083_a.jpg'},
'skip': 'Video available only in one week'
}]
def _real_extract(self, url):
series_id, video_id = self._match_valid_url(url).groups()
self._request_webpage(HEADRequest(url), video_id)
... | @@ -36,6 +54,13 @@ def _real_extract(self, url):
if not src.get('url'):
continue
fmt, subs = self._extract_m3u8_formats_and_subtitles(src['url'], video_id, 'mp4')
+ for f in fmt:
+ wh = self._BITRATE_MAP.get(f.get('tbr'))
+ if wh:
+ ... | yt_dlp/extractor/fujitv.py | 26 | Python | 0.714 | suggestion | 179 | 41 | 37 | false | [fujitv] Fix free source resolution mapping | 2,685 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | YuenSzeHong |
try:
comparison_value = int(m.group('value'))
except ValueError:
comparison_value = parse_filesize(m.group('value'))
if comparison_value is None:
comparison_value = parse_filesize(m.group('value') + 'B')
if compa... | ```suggestion
(?P<negation>!\s*)?(?P<op>%s)\s*(?P<none_inclusive>\?\s*)?
(?P<quote>["'])?
(?P<value>(?(quote)(?:(?!(?P=quote))[^\\]|\\.)+|[\w.-]+))
(?(quote)(?P=quote))\s*
``` | try:
comparison_value = int(m.group('value'))
except ValueError:
comparison_value = parse_filesize(m.group('value'))
if comparison_value is None:
comparison_value = parse_filesize(m.group('value') + 'B')
if compa... | @@ -1842,15 +1842,21 @@ def _build_format_filter(self, filter_spec):
'^=': lambda attr, value: attr.startswith(value),
'$=': lambda attr, value: attr.endswith(value),
'*=': lambda attr, value: value in attr,
+ '~=': lambda attr, value: value.search(attr)... | yt_dlp/YoutubeDL.py | 26 | Python | 0.786 | suggestion | 244 | 51 | 51 | false | Add regexp operator to format filters | 2,698 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lukasfink1 |
raise ValueError(
'Invalid value %r in format specification %r' % (
m.group('value'), filter_spec))
op = OPERATORS[m.group('op')]
if not m:
STR_OPERATORS = {
'=': operator.eq,
'^=': l... | You have to remove the escape chars before this | raise ValueError(
'Invalid value %r in format specification %r' % (
m.group('value'), filter_spec))
op = OPERATORS[m.group('op')]
if not m:
STR_OPERATORS = {
'=': operator.eq,
'^=': l... | @@ -1842,15 +1842,21 @@ def _build_format_filter(self, filter_spec):
'^=': lambda attr, value: attr.startswith(value),
'$=': lambda attr, value: attr.endswith(value),
'*=': lambda attr, value: value in attr,
+ '~=': lambda attr, value: value.search(attr)... | yt_dlp/YoutubeDL.py | 26 | Python | 0.143 | security | 47 | 51 | 51 | false | Add regexp operator to format filters | 2,698 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lukasfink1 |
is_meeting = form.get('useWhichPasswd') == 'meeting'
validation = self._download_json(
base_url + 'rec/validate%s_passwd' % ('_meet' if is_meeting else ''),
play_id, 'Validating passcode', 'Wrong passcode', data=urlencode_postdata({
'id': form[... | ```suggestion
formats = []
``` | form = None
if form:
password = self.get_param('videopassword')
if not password:
raise ExtractorError(
'This video is protected by a passcode, use the --video-password option', expected=True)
is_meeting = form.get('useWhichPassw... | @@ -51,27 +47,48 @@ def _real_extract(self, url):
raise ExtractorError(validation['errorMessage'], expected=True)
webpage = self._download_webpage(url, play_id)
+ data: dict[str, Union[None, str, int, list, bool, dict[str, Any]]]
data = self._parse_json(self._search_regex... | yt_dlp/extractor/zoom.py | 26 | Python | 0.429 | suggestion | 40 | 51 | 51 | false | [zoom] Adding support for downloading screen cast via formats | 2,699 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Mipsters |
subtitles[_type] = [{
'url': urljoin(base_url, data['%sUrl' % _type]),
'ext': 'vtt',
}]
formats: list[dict[str, Union[None, str, int]]] = []
if data.get('shareMp4Url'):
formats.append({
'format_note': '... | All this can be converted to a list comprehension at the cost of readability, something like
```py
formats = [{ 'format_note': f'{t} stream',
'url': str_or_none(data.get(f'{t}Mp4Url')),
'width': int_or_none(data.get(f'{t}ResolvtionsWidth')),
'height': int_or_none(data.get(f'{t}R... | webpage, 'data'), play_id, js_to_json)
subtitles = {}
for _type in ('transcript', 'cc', 'chapter'):
if data.get('%sUrl' % _type):
subtitles[_type] = [{
'url': urljoin(base_url, data['%sUrl' % _type]),
'ext': 'vtt',
... | @@ -51,27 +47,48 @@ def _real_extract(self, url):
raise ExtractorError(validation['errorMessage'], expected=True)
webpage = self._download_webpage(url, play_id)
+ data: dict[str, Union[None, str, int, list, bool, dict[str, Any]]]
data = self._parse_json(self._search_regex... | yt_dlp/extractor/zoom.py | 26 | Python | 0.786 | style | 685 | 38 | 47 | false | [zoom] Adding support for downloading screen cast via formats | 2,699 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Mipsters |
# coding: utf-8
from __future__ import unicode_literals
from typing import Union, Any
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
str_or_none,
js_to_json,
parse_filesize,
urlencode_postdata,
urljoin,
)
class ZoomIE(InfoExtractor):
IE_NAME = 'z... | use `skip` instead of deleting | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
str_or_none,
js_to_json,
parse_filesize,
urlencode_postdata,
urljoin,
)
class ZoomIE(InfoExtractor):
IE_NAME = 'zoom'
_VALID_URL = r'(?P<ba... | @@ -17,13 +19,7 @@ class ZoomIE(InfoExtractor):
IE_NAME = 'zoom'
_VALID_URL = r'(?P<base_url>https?://(?:[^.]+\.)?zoom.us/)rec(?:ording)?/(?:play|share)/(?P<id>[A-Za-z0-9_.-]+)'
_TEST = {
- 'url': 'https://economist.zoom.us/rec/play/dUk_CNBETmZ5VA2BwEl-jjakPpJ3M1pcfVYAPRsoIbEByGsLjUZtaa4yCATQuOL3d... | yt_dlp/extractor/zoom.py | 22 | Python | 0.286 | suggestion | 30 | 47 | 47 | false | [zoom] Adding support for downloading screen cast via formats | 2,699 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Mipsters |
'height': int_or_none(data.get('shareResolvtionsHeight')),
'format_id': str_or_none(data.get('shareVideoId')),
'ext': 'mp4',
})
formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
... | `self._sort_formats` before returning. Add `preference` to the dicts (with comment explaining why) if you want to maintain a specific order | if data.get('viewMp4Url'):
formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
'width': int_or_none(data.get('viewResolvtionsWidth')),
'height': int_or_none(data.get('viewResolvtionsHeight')),
... | @@ -51,27 +47,48 @@ def _real_extract(self, url):
raise ExtractorError(validation['errorMessage'], expected=True)
webpage = self._download_webpage(url, play_id)
+ data: dict[str, Union[None, str, int, list, bool, dict[str, Any]]]
data = self._parse_json(self._search_regex... | yt_dlp/extractor/zoom.py | 26 | Python | 0.571 | suggestion | 139 | 26 | 35 | false | [zoom] Adding support for downloading screen cast via formats | 2,699 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Mipsters |
'url': str_or_none(data.get('viewMp4Url')),
'width': int_or_none(data.get('viewResolvtionsWidth')),
'height': int_or_none(data.get('viewResolvtionsHeight')),
'format_id': str_or_none(data.get('recordingId')),
'ext': 'mp4',
'... | ```suggestion
```
Dont set url when setting formats | 'width': int_or_none(data.get('viewResolvtionsWidth')),
'height': int_or_none(data.get('viewResolvtionsHeight')),
'format_id': str_or_none(data.get('recordingId')),
'ext': 'mp4',
'filesize_approx': parse_filesize(data.get('fileSize')),
... | @@ -56,22 +59,47 @@ def _real_extract(self, url):
webpage, 'data'), play_id, js_to_json)
subtitles = {}
- for _type in ('transcript', 'cc'):
+ for _type in ('transcript', 'cc', 'chapter'):
if data.get('%sUrl' % _type):
subtitles[_type] = [{
... | yt_dlp/extractor/zoom.py | 26 | Python | 0.571 | suggestion | 53 | 33 | 31 | false | [zoom] Adding support for downloading screen cast via formats | 2,699 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Mipsters |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.