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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
if password:
content_id = self._search_regex(r'''content_id=(.*?)[\"\']''', webpage, 'content_id')
payload = f'is_xhr=true&t={self._get_cookies("https://www.dropbox.com").get("t").value}&content_id={content_id}&password={password}&url={url}'
response = self._d... | ```suggestion
formats.append({'url': video_url, 'format_id': 'original', 'format_note': 'Original', 'quality': 1})
self._sort_formats(formats)
```
if there are multiple formats, sort_formats must be called | if password:
content_id = self._search_regex(r'content_id=(.*?)["\']', webpage, 'content_id')
payload = f'is_xhr=true&t={self._get_cookies("https://www.dropbox.com").get("t").value}&content_id={content_id}&password={password}&url={url}'
response = self._downlo... | @@ -26,15 +31,46 @@ class DropboxIE(InfoExtractor):
]
def _real_extract(self, url):
+
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
+ webpage = self._download_webpage(url, video_id)
fn = compat_urllib_parse_unquote(url_basename(url))
title = os.path... | yt_dlp/extractor/dropbox.py | 26 | Python | 0.786 | suggestion | 229 | 34 | 34 | false | [Dropbox] Add support for more formats and password protected files | 2,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zenerdi0de |
class DropboxIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?dropbox[.]com/sh?/(?P<id>[a-zA-Z0-9]{15})/.*'
_TESTS = [
{
'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0',
'info_dict': {
'id': 'neli... | ```suggestion
if (self._og_search_title(webpage) == 'Dropbox - Password Required'
or 'Enter the password for this link' in webpage):
``` | class DropboxIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?dropbox[.]com/sh?/(?P<id>[a-zA-Z0-9]{15})/.*'
_TESTS = [
{
'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0',
'info_dict': {
'id': 'neli... | @@ -26,15 +31,46 @@ class DropboxIE(InfoExtractor):
]
def _real_extract(self, url):
+
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
+ webpage = self._download_webpage(url, video_id)
fn = compat_urllib_parse_unquote(url_basename(url))
title = os.path... | yt_dlp/extractor/dropbox.py | 26 | Python | 0.714 | suggestion | 163 | 51 | 51 | false | [Dropbox] Add support for more formats and password protected files | 2,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zenerdi0de |
'info_dict': {
'id': 'nelirfsxnmcfbfh',
'ext': 'mp4',
'title': 'youtube-dl test video \'ä"BaW_jenozKc'
}
}, {
'url': 'https://www.dropbox.com/sh/662glsejgzoj9sr/AAByil3FGH9KFNZ13e08eSa1a/Pregame%20Ceremony%20Program%20PA%2020140... | ```suggestion
response = self._download_json(
'https://www.dropbox.com/sm/auth', video_id, 'POSTing video password', data=payload.encode('UTF-8'),
headers={'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'})
```
line too long | 'info_dict': {
'id': 'nelirfsxnmcfbfh',
'ext': 'mp4',
'title': 'youtube-dl test video \'ä"BaW_jenozKc'
}
}, {
'url': 'https://www.dropbox.com/sh/662glsejgzoj9sr/AAByil3FGH9KFNZ13e08eSa1a/Pregame%20Ceremony%20Program%20PA%2020140... | @@ -26,15 +31,46 @@ class DropboxIE(InfoExtractor):
]
def _real_extract(self, url):
+
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
+ webpage = self._download_webpage(url, video_id)
fn = compat_urllib_parse_unquote(url_basename(url))
title = os.path... | yt_dlp/extractor/dropbox.py | 26 | Python | 0.929 | security | 303 | 51 | 51 | false | [Dropbox] Add support for more formats and password protected files | 2,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zenerdi0de |
{
'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0',
'info_dict': {
'id': 'nelirfsxnmcfbfh',
'ext': 'mp4',
'title': 'youtube-dl test video \'ä"BaW_jenozKc'
}
... | ```suggestion
content_id = self._search_regex(r'content_id=(.*?)["\']', webpage, 'content_id')
```
unnecessary escapes | {
'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0',
'info_dict': {
'id': 'nelirfsxnmcfbfh',
'ext': 'mp4',
'title': 'youtube-dl test video \'ä"BaW_jenozKc'
}
... | @@ -26,15 +31,46 @@ class DropboxIE(InfoExtractor):
]
def _real_extract(self, url):
+
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
+ webpage = self._download_webpage(url, video_id)
fn = compat_urllib_parse_unquote(url_basename(url))
title = os.path... | yt_dlp/extractor/dropbox.py | 26 | Python | 0.714 | security | 137 | 51 | 51 | false | [Dropbox] Add support for more formats and password protected files | 2,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zenerdi0de |
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id)
fn = compat_urllib_parse_unquote(url_basename(url))
title = os.path.splitext(fn)[0]
password = self.get_param('videopassword')... | ```suggestion
if response.get('status') != 'authed':
raise ExtractorError('Authentication failed!', expected=True)
webpage = self._download_webpage(url, video_id)
elif self._get_cookies('https://dropbox.com').get('sm_auth'):
webpage ... | def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id)
fn = compat_urllib_parse_unquote(url_basename(url))
title = os.path.splitext(fn)[0]
password = self.get_param('videopassword')
... | @@ -26,15 +31,46 @@ class DropboxIE(InfoExtractor):
]
def _real_extract(self, url):
+
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
+ webpage = self._download_webpage(url, video_id)
fn = compat_urllib_parse_unquote(url_basename(url))
title = os.path... | yt_dlp/extractor/dropbox.py | 26 | Python | 1 | bug | 497 | 45 | 45 | false | [Dropbox] Add support for more formats and password protected files | 2,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zenerdi0de |
stream_base = get_cdn_shield_base()
formats = []
formats.extend(self._extract_m3u8_formats(
f'{stream_base}{q_acc}/files/{q_prefix}/{q_locator}/{q_acc}-{stream_data.get("qHEVCHash") or q_hash}.ism/manifest.m3u8',
video_id, 'mp4', m3u8_id=f'{cdn}-hls', fatal=False))
... | ```suggestion
q_references = stream_data.get('qReferences') or ''
fds = q_references.split(',')
for fd in fds:
ss = fd.split(':')
if len(ss) != 3:
continue
tbr = int_or_none(ss[1], scale=1000)
formats.append({
... |
stream_base = get_cdn_shield_base()
formats = []
formats.extend(self._extract_m3u8_formats(
f'{stream_base}{q_acc}/files/{q_prefix}/{q_locator}/{q_acc}-{stream_data.get("qHEVCHash") or q_hash}.ism/manifest.m3u8',
video_id, 'mp4', m3u8_id=f'{cdn}-hls', fatal=False))
... | @@ -220,6 +221,71 @@ def p0(p):
return formats
+ def _extract_3q_formats(self, video, video_id):
+ stream_data = video['streamdata']
+ cdn = stream_data['cdnType']
+ assert cdn == '3q'
+
+ q_acc, q_prefix, q_locator, q_hash = stream_data['qAccount'], stream_data['qPrefix'], s... | yt_dlp/extractor/nexx.py | 26 | Python | 0.857 | refactor | 541 | 51 | 51 | false | [Nexx] Support 3q CDN | 2,213 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
"""Returns a temporary filename for the given filename."""
if self.params.get('nopart', False) or filename == '-' or \
(os.path.exists(encodeFilename(filename)) and not os.path.isfile(encodeFilename(filename))):
return filename
return filename + '.part'
def undo_... | bad design. This should be decided when calling, not during defenition | """Returns a temporary filename for the given filename."""
if self.params.get('nopart', False) or filename == '-' or \
(os.path.exists(encodeFilename(filename)) and not os.path.isfile(encodeFilename(filename))):
return filename
return filename + '.part'
def undo_... | @@ -210,28 +210,38 @@ def undo_temp_name(self, filename):
def ytdl_filename(self, filename):
return filename + '.ytdl'
+ def wrap_file_access(func):
+ def inner(self, *argv, **kwargs):
+ file_access_retries = self.params.get('file_access_retries', 10)
+ retry = 0
+ ... | yt_dlp/downloader/common.py | 26 | Python | 0.286 | suggestion | 70 | 51 | 51 | false | Extend file access retries to check rename and remove as well | 2,224 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ehoogeveen-medweb |
# coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | ```suggestion
}, {'skip': 'Live'}
}]
``` | # coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | @@ -0,0 +1,27 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class VimmIE(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',
+ 'e... | yt_dlp/extractor/vimm.py | 16 | Python | 0.571 | suggestion | 57 | 28 | 32 | false | Added Vimm stream extractor | 2,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
# coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | ```suggestion
formats = self._extract_m3u8_formats(
f'https://www.vimm.tv/hls/{channel_id}.m3u8', channel_id, 'mp4', m3u8_id='hls', live=True)
self._sort_formats(formats)
``` | # coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | @@ -0,0 +1,27 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class VimmIE(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',
+ 'e... | yt_dlp/extractor/vimm.py | 20 | Python | 0.857 | refactor | 206 | 28 | 32 | false | Added Vimm stream extractor | 2,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
# coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | ```suggestion
},
'skip': 'Live',
``` | # coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | @@ -0,0 +1,29 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class VimmIE(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',
+ 'e... | yt_dlp/extractor/vimm.py | 14 | Python | 0.571 | suggestion | 55 | 30 | 32 | false | Added Vimm stream extractor | 2,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
# coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | use `_extract_m3u8_formats_and_subs` even if subs don't exist. | # coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | @@ -0,0 +1,29 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class VimmIE(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',
+ 'e... | yt_dlp/extractor/vimm.py | 21 | Python | 0.429 | refactor | 62 | 30 | 32 | false | Added Vimm stream extractor | 2,231 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | alerikaisattera |
class VimmIE(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',
'title': 're:^calimeatwagon [0-9]{4}-[0-9]{2}-[0-9]{2} ... | ```suggestion
formats, subs = self._extract_m3u8_formats(
f'https://www.vimm.tv/hls/{channel_id}.m3u8', channel_id, 'mp4', m3u8_id='hls', live=True)
self._sort_formats(formats)
return {
'id': channel_id,
'title': channel_id,
'is_live': Tru... |
class VimmIE(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',
'title': 're:^calimeatwagon [0-9]{4}-[0-9]{2}-[0-9]{2} ... | @@ -0,0 +1,30 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class VimmIE(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',
+ 'e... | yt_dlp/extractor/vimm.py | 26 | Python | 0.857 | refactor | 392 | 28 | 29 | false | Added Vimm stream extractor | 2,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
# coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | ```suggestion
formats, subs = self._extract_m3u8_formats_and_subtitles(
``` | # coding: utf-8
from .common import InfoExtractor
class VimmIE(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',
'tit... | @@ -0,0 +1,31 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class VimmIE(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',
+ 'e... | yt_dlp/extractor/vimm.py | 21 | Python | 0.643 | refactor | 85 | 32 | 32 | false | Added Vimm stream extractor | 2,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
def _real_extract(self, url):
video_id = self._match_id(url)
self._access_token = self._call_api(
'previewpassmvpd?device_id=%s&mvpd_id=TempPass_fbcfox_60min' % self._device_id,
video_id)['accessToken']
data = json.dumps({
"capabilities": ["drm/widevine... | ```suggestion
video = self._call_api('watch', video_id, data=json.dumps({
'capabilities': ['drm/widevine', 'fsdk/yo'],
'deviceWidth': 1280,
'deviceHeight': 720,
'maxRes': '720p',
'os': 'macos',
'osv': '',
'provider': {
... |
def _real_extract(self, url):
video_id = self._match_id(url)
self._access_token = self._call_api(
'previewpassmvpd?device_id=%s&mvpd_id=TempPass_fbcfox_60min' % self._device_id,
video_id)['accessToken']
video = self._call_api('watch', video_id, data=json.dumps({
... | @@ -87,16 +89,38 @@ def _real_initialize(self):
if not self._access_token:
self._access_token = self._call_api(
'login', None, json.dumps({
- 'deviceId': compat_str(uuid.uuid4()),
+ 'deviceId': self._device_id,
... | yt_dlp/extractor/fox.py | 26 | Python | 0.929 | suggestion | 682 | 51 | 51 | false | [fox] Fix extraction of m3u8 URL, do not inherit from AdobePass | 2,235 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | ischmidt20 |
raise ExtractorError(messages, expected=True)
raise
def _real_initialize(self):
if not self._access_token:
mvpd_auth = self._get_cookies(self._HOME_PAGE_URL).get('mvpd-auth')
if mvpd_auth:
self._access_token = (self._parse_json(compat_urll... | why are we asking for DRM formats? | 'subscription. You may want to use --cookies.', expected=True)
messages = ', '.join([e['message'] for e in entitlement_issues])
raise ExtractorError(messages, expected=True)
raise
def _real_initialize(self):
if not self._access_token:
... | @@ -87,16 +89,37 @@ def _real_initialize(self):
if not self._access_token:
self._access_token = self._call_api(
'login', None, json.dumps({
- 'deviceId': compat_str(uuid.uuid4()),
+ 'deviceId': self._device_id,
... | yt_dlp/extractor/fox.py | 26 | Python | 0.071 | question | 34 | 51 | 51 | false | [fox] Fix extraction of m3u8 URL, do not inherit from AdobePass | 2,235 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
webpage = self._download_webpage(url, video_id)
iframe_src = self._html_search_regex(r'<iframe src="([^"]+)"', webpage, 'iframe', fatal=True)
title = self._html_search_meta(['name', 'twitter:title', 'og:title'], webpage, 'title', default=None) or self._search_regex(r'<h1>(.*?)</h1>', webpage, 't... | You can use `_parse_html5_media_entries` instead. (even without it you have to request for finding more formats using `_extract_m3u8_formats` or set `protocol` key)
<!--Note that this returns list of root info-dict (which you return at `_real_extract`), so expect minor rewrite--> | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/video(?P<id>[0-9]+)/'
_TEST = {
'url': 'https://pornez.net/video344819/mistresst-funny_penis_names-wmv/... | @@ -0,0 +1,60 @@
+# coding: utf-8
+from __future__ import unicode_literals
+import re
+from .common import InfoExtractor
+from ..utils import (
+ extract_attributes,
+ int_or_none,
+ mimetype2ext
+)
+
+
+class PornezIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?pornez\.net/video(?P<id>[0-9]+)/'
+ ... | yt_dlp/extractor/pornez.py | 26 | Python | 0.643 | refactor | 283 | 34 | 44 | false | [Pornez] Add extractor | 2,236 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | mozlima |
_TESTS = [{
'url': 'https://vplayer.nbcsports.com/p/BxmELC/nbcsports_embed/select/9CsDKds0kvHI',
'info_dict': {
'id': '9CsDKds0kvHI',
'ext': 'mp4',
'description': 'md5:df390f70a9ba7c95ff1daace988f0d8d',
'title': 'Tyler Kalinoski hits buzzer-beater to l... | match the old regex as well just in case | _TESTS = [{
'url': 'https://vplayer.nbcsports.com/p/BxmELC/nbcsports_embed/select/9CsDKds0kvHI',
'info_dict': {
'id': '9CsDKds0kvHI',
'ext': 'mp4',
'description': 'md5:df390f70a9ba7c95ff1daace988f0d8d',
'title': 'Tyler Kalinoski hits buzzer-beater to l... | @@ -208,16 +211,15 @@ class NBCSportsVPlayerIE(InfoExtractor):
@staticmethod
def _extract_url(webpage):
- iframe_m = re.search(
- r'<(?:iframe[^>]+|div[^>]+data-(?:mpx-)?)src="(?P<url>%s[^"]+)"' % NBCSportsVPlayerIE._VALID_URL_BASE, webpage)
- if iframe_m:
- return iframe... | yt_dlp/extractor/nbc.py | 26 | Python | 0.071 | suggestion | 40 | 51 | 51 | false | [NBCSports] fix regexes to properly extract platform URLs | 2,244 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
from ..utils import (
urljoin,
traverse_obj,
int_or_none,
mimetype2ext,
clean_html,
url_or_none,
unified_timestamp,
str_or_none,
)
class PRXBaseIE(InfoExtractor):
PRX_BASE_URL_RE = r'https?://(?:(?:beta|listen)\.)?prx.org/%s'
def _call_api(self, item_id, path, query=None, fata... | ```suggestion
def _get_prx_embed_response(response, section):
return traverse_obj(response, ('_embedded', f'prx:{section}'))
```
I noticed _extract_embedded_data isn't used anywhere else. This probly doesnt even need to be a function though | from ..utils import (
urljoin,
traverse_obj,
int_or_none,
mimetype2ext,
clean_html,
url_or_none,
unified_timestamp,
str_or_none,
)
class PRXBaseIE(InfoExtractor):
PRX_BASE_URL_RE = r'https?://(?:(?:beta|listen)\.)?prx.org/%s'
def _call_api(self, item_id, path, query=None, fata... | @@ -0,0 +1,449 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import itertools
+from .common import InfoExtractor, SearchInfoExtractor
+from ..utils import (
+ urljoin,
+ traverse_obj,
+ int_or_none,
+ mimetype2ext,
+ clean_html,
+ url_or_none,
+ unified_timestamp,
+ str_or_none... | yt_dlp/extractor/prx.py | 26 | Python | 0.857 | refactor | 256 | 51 | 51 | false | [PRX] Add Extractors | 2,245 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
Extract entries from paginated list API
@param entry_func: Function to generate entry from response item
"""
total = 0
for page in itertools.count(1):
query = {
**(query or {}),
'page': page,
'per': 100
}
... | ```suggestion
response = self._call_api(f'{item_id}: page {page}', endpoint, query={
**(query or {}),
'page': page,
'per': 100
})
if not response:
break
items = self._get_prx_embed_response(response... | response = self._call_api(f'{item_id}: page {page}', endpoint, query={
**(query or {}),
'page': page,
'per': 100
})
items = self._get_prx_embed_response(response, 'items')
if not response or not items:
break
... | @@ -0,0 +1,449 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import itertools
+from .common import InfoExtractor, SearchInfoExtractor
+from ..utils import (
+ urljoin,
+ traverse_obj,
+ int_or_none,
+ mimetype2ext,
+ clean_html,
+ url_or_none,
+ unified_timestamp,
+ str_or_none... | yt_dlp/extractor/prx.py | 26 | Python | 0.786 | suggestion | 674 | 51 | 51 | false | [PRX] Add Extractors | 2,245 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
self._get_prx_embed_response(story_response, 'audio'))
if len(audio_pieces) > 1:
for idx, fmt in enumerate(audio_pieces):
entries.append({
'_type': 'video',
**info, # needs to be before id to override
'id': '%s_... | ```suggestion
return self._extract_story(response)
```
nitpick | 'entries': entries,
**info
}
def _real_extract(self, url):
story_id = self._match_id(url)
response = self._call_api(story_id, f'stories/{story_id}')
return self._extract_story(response)
class PRXSeriesIE(PRXBaseIE):
_VALID_URL = PRXBaseIE.PRX_BASE_URL_R... | @@ -0,0 +1,449 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import itertools
+from .common import InfoExtractor, SearchInfoExtractor
+from ..utils import (
+ urljoin,
+ traverse_obj,
+ int_or_none,
+ mimetype2ext,
+ clean_html,
+ url_or_none,
+ unified_timestamp,
+ str_or_none... | yt_dlp/extractor/prx.py | 26 | Python | 0.643 | refactor | 73 | 51 | 51 | false | [PRX] Add Extractors | 2,245 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
def _extract_story(self, story_response):
info = self._extract_story_info(story_response)
if not info:
return
entries = []
audio_pieces = self._extract_audio_pieces(
self._get_prx_embed_response(story_response, 'audio'))
if len(audio_pieces) > 1:
... | ```suggestion
audio_pieces = self._extract_audio_pieces(
self._get_prx_embed_response(story_response, 'audio'))
if len(audio_pieces) == 1:
return {
'formats': audio_pieces,
**info
}
entries = [{
**info,
... | return
audio_pieces = self._extract_audio_pieces(
self._get_prx_embed_response(story_response, 'audio'))
if len(audio_pieces) == 1:
return {
'formats': audio_pieces,
**info
}
entries = [{
**info,
... | @@ -0,0 +1,438 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import itertools
+from .common import InfoExtractor, SearchInfoExtractor
+from ..utils import (
+ urljoin,
+ traverse_obj,
+ int_or_none,
+ mimetype2ext,
+ clean_html,
+ url_or_none,
+ unified_timestamp,
+ str_or_none... | yt_dlp/extractor/prx.py | 26 | Python | 1 | refactor | 582 | 51 | 51 | false | [PRX] Add Extractors | 2,245 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'description': 'md5:9f1b5a3cbd64fb159d08c3baa31f1539',
'timestamp': 1641233952,
'modified_timestamp': 1641234248,
'duration': 3540,
'series': 'Café Chill',
'series_id': '37762',
'channel_id': '5767',
... | typo?
(also, this can be list comprehension) | 'description': 'md5:9f1b5a3cbd64fb159d08c3baa31f1539',
'timestamp': 1641233952,
'modified_timestamp': 1641234248,
'duration': 3540,
'series': 'Café Chill',
'series_id': '37762',
'channel_id': '5767',
... | @@ -0,0 +1,438 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import itertools
+from .common import InfoExtractor, SearchInfoExtractor
+from ..utils import (
+ urljoin,
+ traverse_obj,
+ int_or_none,
+ mimetype2ext,
+ clean_html,
+ url_or_none,
+ unified_timestamp,
+ str_or_none... | yt_dlp/extractor/prx.py | 26 | Python | 0.071 | nitpick | 47 | 51 | 51 | false | [PRX] Add Extractors | 2,245 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
})
return {
'id': video_id,
'formats': formats,
'title': title,
'thumbnail': data.get('jpg'),
'uploader': data.get('md_author'),
'uploader_id': str_or_none(data.get('author_id') or mv_data.get('authorId')),
'duratio... | Verify that the old URL redirects correctly via generic | return {
'id': video_id,
'formats': formats,
'title': title,
'thumbnail': data.get('jpg'),
'uploader': data.get('md_author'),
'uploader_id': str_or_none(data.get('author_id') or mv_data.get('authorId')),
'duration': int_or_none(... | @@ -511,37 +511,22 @@ def _real_extract(self, url):
class VKUserVideosIE(VKBaseIE):
IE_NAME = 'vk:uservideos'
IE_DESC = "VK - User's Videos"
- _VALID_URL = r'https?://(?:(?:m|new)\.)?vk\.com/videos(?P<id>-?[0-9]+)(?!\?.*\bz=video)(?:[/?#&](?:.*?\bsection=(?P<section>\w+))?|$)'
+ _VALID_URL = r'https?:/... | yt_dlp/extractor/vk.py | 26 | Python | 0.214 | suggestion | 55 | 51 | 51 | false | Fix VKUserVideosIE | 2,248 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
qualities,
try_get
)
class VeohIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P<id>(?:v|e|yapi-)[\da-zA-Z]+)'
_... | ```py
'description': 'md5:...',
``` | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
qualities,
try_get
)
class VeohIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P<id>(?:v|e|yapi-)[\da-zA-Z]+)'
_... | @@ -5,21 +5,30 @@
int_or_none,
parse_duration,
qualities,
+ try_get
)
class VeohIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|embed|iphone/#_Watch)/(?P<id>(?:v|e|yapi-)[\da-zA-Z]+)'
+ _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Wat... | yt_dlp/extractor/veoh.py | 22 | Python | 0.429 | suggestion | 49 | 47 | 47 | false | [veoh] Accept "videos" URLs; prefer HQ format; get additional metadata | 2,251 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | foghawk |
# coding: utf-8
from __future__ import unicode_literals
from yt_dlp.utils import parse_duration
from .common import InfoExtractor
import re
class Rule34VideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rule34video\.com/videos/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://rule34video... | ```suggestion
import re
from .utils import parse_duration
from .common import InfoExtractor
``` | # coding: utf-8
from __future__ import unicode_literals
import re
from ..utils import parse_duration
from .common import InfoExtractor
class Rule34VideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rule34video\.com/videos/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://rule34video.com/vi... | @@ -0,0 +1,82 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from yt_dlp.utils import parse_duration
+
+from .common import InfoExtractor
+
+import re | yt_dlp/extractor/rule34video.py | 8 | Python | 0.786 | refactor | 101 | 33 | 33 | false | [Rule34video] Add extractor | 2,279 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
# coding: utf-8
from __future__ import unicode_literals
from yt_dlp.utils import parse_duration
from .common import InfoExtractor
import re
class Rule34VideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rule34video\.com/videos/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://rule34video... | Add md5
```py
'url': 'https://rule34video.com/videos/3065157/shot-it-mmd-hmv/',
'md5': ...
``` | # coding: utf-8
from __future__ import unicode_literals
import re
from ..utils import parse_duration
from .common import InfoExtractor
class Rule34VideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rule34video\.com/videos/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://rule34video.com/vi... | @@ -0,0 +1,82 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from yt_dlp.utils import parse_duration
+
+from .common import InfoExtractor
+
+import re
+
+
+class Rule34VideoIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?rule34video\.com/videos/(?P<id>\d+)'
+ _TESTS = [
+ {
+ ... | yt_dlp/extractor/rule34video.py | 13 | Python | 0.714 | suggestion | 122 | 38 | 38 | false | [Rule34video] Add extractor | 2,279 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
html, escape_value=False)
def get_elements_by_attribute(*args, **kwargs):
"""Return the content of the tag with the specified attribute in the passed HTML document"""
return [content for content, _ in get_elements_text_and_html_by_attribute(*args, **kwargs)]
def get_elements_html_by_attribute(*args,... | Would this not work?
```suggestion
# Do not use re.verbose since value may contain unescaped spaces
partial_element_re = (
r'''<(?P<tag>[a-zA-Z0-9:._-]+)(?:\s(?:[^>"']|"[^"]*"|'[^']*')*)?\s%(attribute)s\s*=\s*(?P<_q>['"]%(vqo)s)(?:%(value)s)(?P=_q)'''
% {'attribute': re.escape(attribute), '... | html, escape_value=False)
def get_elements_by_attribute(*args, **kwargs):
"""Return the content of the tag with the specified attribute in the passed HTML document"""
return [content for content, _ in get_elements_text_and_html_by_attribute(*args, **kwargs)]
def get_elements_html_by_attribute(*args,... | @@ -473,24 +473,19 @@ def get_elements_text_and_html_by_attribute(attribute, value, html, escape_value
attribute in the passed HTML document
"""
+ value_quote_optional = '' if re.match(r'''[\s"'`=<>]''', value) else r'?'
+
value = re.escape(value) if escape_value else value
- retlist = []
- ... | yt_dlp/utils.py | 26 | Python | 0.857 | security | 572 | 51 | 51 | false | [utils] Fix get_elements_text_and_html_by_attribute regex | 2,280 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zmousm |
"""Return the html of the tag with the specified attribute in the passed HTML document"""
return [whole for _, whole in get_elements_text_and_html_by_attribute(*args, **kwargs)]
def get_elements_text_and_html_by_attribute(attribute, value, html, escape_value=True):
"""
Return the text (content) and th... | ```suggestion
whole
)
``` | """Return the html of the tag with the specified attribute in the passed HTML document"""
return [whole for _, whole in get_elements_text_and_html_by_attribute(*args, **kwargs)]
def get_elements_text_and_html_by_attribute(attribute, value, html, escape_value=True):
"""
Return the text (content) and th... | @@ -473,24 +473,22 @@ def get_elements_text_and_html_by_attribute(attribute, value, html, escape_value
attribute in the passed HTML document
"""
+ value_quote_optional = '' if re.match(r'''[\s"'`=<>]''', value) else r'?'
+
value = re.escape(value) if escape_value else value
- retlist = []
- ... | yt_dlp/utils.py | 26 | Python | 0.429 | suggestion | 48 | 51 | 51 | false | [utils] Fix get_elements_text_and_html_by_attribute regex | 2,280 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zmousm |
def get_elements_html_by_class(class_name, html):
"""Return the html of all tags with the specified class in the passed HTML document as a list"""
return get_elements_html_by_attribute(
'class', r'[^\'"]*\b%s\b[^\'"]*' % re.escape(class_name),
html, escape_value=False)
def get_elements_by_at... | ```suggestion
value_quote_optional = '' if re.match(r'''[\s"'`=<>]''', value) else '?'
``` |
def get_elements_html_by_class(class_name, html):
"""Return the html of all tags with the specified class in the passed HTML document as a list"""
return get_elements_html_by_attribute(
'class', r'[^\'"]*\b%s\b[^\'"]*' % re.escape(class_name),
html, escape_value=False)
def get_elements_by_at... | @@ -473,24 +473,22 @@ def get_elements_text_and_html_by_attribute(attribute, value, html, escape_value
attribute in the passed HTML document
"""
+ value_quote_optional = '' if re.match(r'''[\s"'`=<>]''', value) else r'?' | yt_dlp/utils.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [utils] Fix get_elements_text_and_html_by_attribute regex | 2,280 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zmousm |
'skip_download': True,
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_data = self._download_json(
'https://watch-cdn.product.api.espn.com/api/product/v3/watchespn/web/event?id=%s' % video_id, video_id)['page']['contents']
title =... | ```suggestion
formats = self._extract_m3u8_formats(
asset['stream'], video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls')
self._sort_formats(formats)
``` | },
'params': {
'skip_download': True,
},
}, {
'url': 'https://www.espn.com/watch/player/_/id/4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'info_dict': {
'id': '4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'ext': 'mp4',
'title': 'Real Madrid... | @@ -279,3 +275,52 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.786 | refactor | 194 | 36 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
class WatchESPNIE(AdobePassIE):
_VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
_TESTS = [{
'url': 'https://www.espn.com/watch/player/_/id/6eee6cb0-1795-49e3-84ea-766b517e0309',
'info_dict': {
'id': '6eee6c... | Are you sure passing cookies don't work? | 'formats': formats,
'subtitles': subtitles,
}
class WatchESPNIE(AdobePassIE):
_VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
_TESTS = [{
'url': 'https://www.espn.com/watch/player/_/id/ba7d17da-... | @@ -279,3 +275,52 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.071 | question | 40 | 50 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
(?:
video/(?:clip|iframe/twitter)|
)
(?:
.*?\?.*?\bid=|
/_/id/
... | maybe better to use a regex instead | )|
[^/]+/video/
)
)|
(?:www\.)espnfc\.(?:com|us)/(?:video/)?[^/]+/\d+/video/
)
(?P<id>\d+)
'... | @@ -49,6 +55,8 @@ class ESPNIE(OnceIE):
'description': 'md5:39370c2e016cb4ecf498ffe75bef7f0f',
'timestamp': 1390936111,
'upload_date': '20140128',
+ 'duration': 1302,
+ 'thumbnail': 'md5:328b04abedca5cc2a55d76d613759de1', | yt_dlp/extractor/espn.py | 26 | Python | 0.143 | suggestion | 35 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'upload_date': '20140128',
'duration': 1302,
'thumbnail': 'md5:328b04abedca5cc2a55d76d613759de1',
},
'params': {
'skip_download': True,
},
}, {
'url': 'https://broadband.espn.go.com/video/clip?id=18910086',
'info_dict': {
... | Add these to the new extractor | },
}, {
'url': 'https://broadband.espn.go.com/video/clip?id=18910086',
'info_dict': {
'id': '18910086',
'ext': 'mp4',
'title': 'Kyrie spins around defender for two',
'description': 'md5:2b0f5bae9616d26fba8808350f0d2b9b',
'timestamp'... | @@ -73,15 +81,6 @@ class ESPNIE(OnceIE):
}, {
'url': 'https://cdn.espn.go.com/video/clip/_/id/19771774',
'only_matching': True,
- }, {
- 'url': 'http://www.espn.com/watch/player?id=19141491',
- 'only_matching': True,
- }, {
- 'url': 'http://www.espn.com/watch/player?buc... | yt_dlp/extractor/espn.py | 26 | Python | 0.143 | refactor | 30 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'skip_download': True,
},
}, {
'url': 'https://www.espn.com/watch/player/_/id/bd1f3d12-0654-47d9-852e-71b85ea695c7',
'info_dict': {
'id': 'bd1f3d12-0654-47d9-852e-71b85ea695c7',
'ext': 'mp4',
'title': 'Tue, 1/11 - ESPN FC',
'thumbna... | `urllib.parse.urlencode(payload)` | 'skip_download': True,
},
}, {
'url': 'https://www.espn.com/watch/player/_/id/4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'info_dict': {
'id': '4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'ext': 'mp4',
'title': 'Real Madrid vs. Real Betis (LaLiga)',
... | @@ -279,3 +278,133 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.214 | suggestion | 33 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'url': 'https://www.espn.com/watch/player/_/id/bd1f3d12-0654-47d9-852e-71b85ea695c7',
'info_dict': {
'id': 'bd1f3d12-0654-47d9-852e-71b85ea695c7',
'ext': 'mp4',
'title': 'Tue, 1/11 - ESPN FC',
'thumbnail': 'https://s.secure.espncdn.com/stitcher/artwork/col... | doesnt need to be a function. It can just be a part of _call_bamgrid_api | 'url': 'https://www.espn.com/watch/player/_/id/4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'info_dict': {
'id': '4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'ext': 'mp4',
'title': 'Real Madrid vs. Real Betis (LaLiga)',
'thumbnail': 'https://s.secure.espncdn.com/stit... | @@ -279,3 +278,133 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.214 | suggestion | 72 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
if 'authorization' not in headers:
headers['authorization'] = 'Bearer ' + self._API_KEY
return self._download_json(
'https://espn.api.edge.bamgrid.com/' + path,
video_id, data=data, headers=headers)
def _payload_to_string_data(self, payload):
return '&'.j... | 1. check with .get instead of KeyError
2. self.raise_login_required | if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.urlencode if path == 'token' else json.dumps
return self._download_json(
f'https://espn.api.edge.bamgrid.com/{path}', video_id, headers=headers, data=parse(payload... | @@ -279,3 +278,133 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.429 | suggestion | 68 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
video_id,
data=self._payload_to_string_data({
'subject_token': assertion,
'subject_token_type': 'urn:bamtech:params:oauth:token-type:device',
'platform': 'android',
'grant_type': 'urn:ietf:params:oauth:grant-... | does all this really have to be done for each video? or it can be done once and the token saved | })['assertion']
token = self._call_bamgrid_api(
'token', video_id, payload={
'subject_token': assertion,
'subject_token_type': 'urn:bamtech:params:oauth:token-type:account',
'platform': 'android',
... | @@ -279,3 +278,133 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.214 | suggestion | 95 | 51 | 39 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
}]
_API_KEY = 'ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c'
def _call_bamgrid_api(self, path, video_id, payload=None, headers={}):
if 'Authorization' not in headers:
headers['Authorization'] = 'Bearer ' + self._API_KEY
if path == 'token':
da... | ```suggestion
raise self.raise_login_required(method='cookies')
``` | headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.urlencode if path == 'token' else json.dumps
return self._download_json(
f'https://espn.api.edge.bamgrid.com/{path}', video_id, headers=headers, data=parse(payload).encode())
def _real_extract(self, ur... | @@ -279,3 +284,130 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.571 | suggestion | 85 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
assertion = self._call_bamgrid_api(
'accounts/grant',
video_id,
payload={'id_token': id_token},
headers={
'Authorization': token,
'Content-Type': 'application/json; charset=UTF-8'}
)['assertio... | ```suggestion
assertion = self._call_bamgrid_api(
'devices', video_id,
headers={'Content-Type': 'application/json; charset=UTF-8'},
payload={
'deviceFamily': 'android',
'applicationRuntime': 'android',
... | headers={
'Accept': 'application/vnd.media-service+json; version=5',
'Authorization': token
})
m3u8_url, headers = playback['stream']['complete'][0]['url'], {'authorization': token}
# TV Provider required
else:
... | @@ -279,3 +284,130 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 1 | security | 2,092 | 51 | 28 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
token = self._call_bamgrid_api(
'token', video_id, payload={
'subject_token': assertion,
'subject_token_type': 'urn:bamtech:params:oauth:token-type:account',
'platform': 'android',
'grant_type': 'urn:ietf:params:... | Do either
```suggestion
'adobeToken=%s&drmSupport=HLS' % urllib.parse.quote_plus(base64.b64encode(auth))).encode())
```
or
```suggestion
urlencode_postdata({
'adobeToken': base64.b64encode(auth).decode(),
'drmSupport'... | 'Accept': 'application/vnd.media-service+json; version=5',
'Authorization': token
})
m3u8_url, headers = playback['stream']['complete'][0]['url'], {'authorization': token}
# TV Provider required
else:
resource = self._get_m... | @@ -277,3 +282,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 1 | security | 520 | 40 | 27 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | ischmidt20 |
import re
import base64
import json
import urllib
from .common import InfoExtractor
from .adobepass import AdobePassIE
from .once import OnceIE
from ..utils import (
determine_ext,
dict_get,
int_or_none,
unified_strdate,
unified_timestamp,
)
class ESPNIE(OnceIE):
_VALID_URL = r'''(?x)
... | ```suggestion
import base64
import json
import re
import urllib
``` | import base64
import json
import re
import urllib
from .common import InfoExtractor
from .adobepass import AdobePassIE
from .once import OnceIE
from ..utils import (
determine_ext,
dict_get,
int_or_none,
unified_strdate,
unified_timestamp,
)
class ESPNIE(OnceIE):
_VALID_URL = r'''(?x)
... | @@ -1,8 +1,11 @@
import re
+import base64
+import json
+import urllib | yt_dlp/extractor/espn.py | 4 | Python | 0.571 | suggestion | 72 | 29 | 29 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'skip_download': True,
},
}, {
'url': 'https://www.espn.com/watch/player/_/id/4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'info_dict': {
'id': '4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'ext': 'mp4',
'title': 'Real Madrid vs. Real Betis (LaLiga)',
... | use fstrings instead of + everywhere | 'skip_download': True,
},
}, {
'url': 'https://www.espn.com/watch/player/_/id/4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'info_dict': {
'id': '4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'ext': 'mp4',
'title': 'Real Madrid vs. Real Betis (LaLiga)',
... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.143 | suggestion | 36 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
},
}, {
'url': 'https://www.espn.com/watch/player/_/id/4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'info_dict': {
'id': '4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'ext': 'mp4',
'title': 'Real Madrid vs. Real Betis (LaLiga)',
'thumbnail': 'https://s.sec... | ```suggestion
if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.urlencode if path == 'token' else json.dumps
return self._download_json(
f'https://espn.api.edge.bamgrid.com/{path}', video_id, headers=head... | },
}, {
'url': 'https://www.espn.com/watch/player/_/id/4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'info_dict': {
'id': '4e9b5bd1-4ceb-4482-9d28-1dd5f30d2f34',
'ext': 'mp4',
'title': 'Real Madrid vs. Real Betis (LaLiga)',
'thumbnail': 'https://s.sec... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.786 | security | 359 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'title': 'Real Madrid vs. Real Betis (LaLiga)',
'thumbnail': 'https://s.secure.espncdn.com/stitcher/artwork/collections/media/bd1f3d12-0654-47d9-852e-71b85ea695c7/16x9.jpg?timestamp=202201112217&showBadge=true&cb=12&package=ESPN_PLUS',
},
'params': {
'skip_download': ... | ```suggestion
video_data = self._download_json(
f'https://watch-cdn.product.api.espn.com/api/product/v3/watchespn/web/playback/event?id={video_id}',
video_id)['playbackState']
``` | 'title': 'Real Madrid vs. Real Betis (LaLiga)',
'thumbnail': 'https://s.secure.espncdn.com/stitcher/artwork/collections/media/bd1f3d12-0654-47d9-852e-71b85ea695c7/16x9.jpg?timestamp=202201112217&showBadge=true&cb=12&package=ESPN_PLUS',
},
'params': {
'skip_download': ... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.786 | suggestion | 215 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
}]
_API_KEY = 'ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c'
def _call_bamgrid_api(self, path, video_id, payload=None, headers={}):
if 'Authorization' not in headers:
headers['Authorization'] = 'Bearer %s' % self._API_KEY
if path == 'token':
... | ```suggestion
self.raise_login_required(method='cookies')
``` | }]
_API_KEY = 'ZXNwbiZicm93c2VyJjEuMC4w.ptUt7QxsteaRruuPmGZFaJByOoqKvDP2a5YkInHrc7c'
def _call_bamgrid_api(self, path, video_id, payload=None, headers={}):
if 'Authorization' not in headers:
headers['Authorization'] = f'Bearer {self._API_KEY}'
parse = urllib.parse.urlencode if ... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.571 | suggestion | 79 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
if video_data.get('sourceId') == 'ESPN_DTC':
cookie = self._get_cookies(url).get('ESPN-ONESITE.WEB-PROD.token')
if not cookie:
raise self.raise_login_required(method='cookies')
id_token = cookie.value.split('|')[1]
assertion = self._call_bamgrid_a... | ```suggestion
'accounts/grant', video_id, payload={'id_token': cookie.value.split('|')[1]},
``` |
assertion = self._call_bamgrid_api(
'devices', video_id,
headers={'Content-Type': 'application/json; charset=UTF-8'},
payload={
'deviceFamily': 'android',
'applicationRuntime': 'android',
'deviceProf... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.714 | suggestion | 113 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
headers={
'Authorization': token,
'Content-Type': 'application/json; charset=UTF-8'
})['assertion']
token = self._call_bamgrid_api(
'token', video_id, payload={
'subject_token': assertion,
... | ```suggestion
auth = self._extract_mvpd_auth(url, video_id, 'ESPN', resource).encode()
``` | 'subject_token': assertion,
'subject_token_type': 'urn:bamtech:params:oauth:token-type:account',
'platform': 'android',
'grant_type': 'urn:ietf:params:oauth:grant-type:token-exchange'
})['access_token']
playback... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.786 | security | 104 | 45 | 36 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'token', video_id, payload={
'subject_token': assertion,
'subject_token_type': 'urn:bamtech:params:oauth:token-type:account',
'platform': 'android',
'grant_type': 'urn:ietf:params:oauth:grant-type:token-exchange'
... | ```suggestion
asset = self._download_json(
f'https://watch.auth.api.espn.com/video/auth/media/{video_id}/asset?apikey=uiqlbgzdwuru14v627vdusswb',
video_id, data=f'adobeToken={urllib.parse.quote_plus(base64.b64encode(auth)).encode()}&drmSupport=HLS')
m3u8_url, ... | playback = self._download_json(
video_data['videoHref'].format(scenario='browser~ssai'), video_id,
headers={
'Accept': 'application/vnd.media-service+json; version=5',
'Authorization': token
})
m3u8_url, head... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.786 | security | 359 | 39 | 30 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'platform': 'android',
'grant_type': 'urn:ietf:params:oauth:grant-type:token-exchange'
})['access_token']
playback = self._download_json(
video_data['videoHref'].format(scenario='browser~ssai'), video_id,
headers={
... | ```suggestion
formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls')
``` | 'Accept': 'application/vnd.media-service+json; version=5',
'Authorization': token
})
m3u8_url, headers = playback['stream']['complete'][0]['url'], {'authorization': token}
# TV Provider required
else:
resource = self._get_m... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.786 | refactor | 131 | 36 | 27 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'Authorization': token
})
m3u8_url, m3u8_headers = playback['stream']['complete'][0]['url'], {'authorization': token}
# TV Provider required
else:
resource = self._get_mvpd_resource('ESPN', title, video_id, None)
auth = self._extr... | ```suggestion
'title': video_data.get('name'),
'formats': formats,
'subtitles': subtitles,
'thumbnail': video_data.get('posterHref')
'http_headers': headers,
``` | import base64
import json
import re
import urllib
from .common import InfoExtractor
from .adobepass import AdobePassIE
from .once import OnceIE
from ..utils import (
determine_ext,
dict_get,
int_or_none,
unified_strdate,
unified_timestamp,
)
class ESPNIE(OnceIE):
_VALID_URL = r'''(?x)
... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.786 | suggestion | 227 | 28 | 390 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'grant_type': 'urn:ietf:params:oauth:grant-type:token-exchange'
})['access_token']
assertion = self._call_bamgrid_api(
'accounts/grant', video_id, payload={'id_token': id_token},
headers={
'Authorization': token,
... | ```suggestion
m3u8_url, headers = playback['stream']['complete'][0]['url'], {'authorization': token}
``` | 'Authorization': token,
'Content-Type': 'application/json; charset=UTF-8'
})['assertion']
token = self._call_bamgrid_api(
'token', video_id, payload={
'subject_token': assertion,
'subject_token_ty... | @@ -277,3 +278,121 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.714 | security | 118 | 50 | 41 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
headers={
'Accept': 'application/vnd.media-service+json; version=5',
'Authorization': token
})
m3u8_url, headers = playback['stream']['complete'][0]['url'], {'authorization': token}
# TV Provider required
else:
... | ```suggestion
'thumbnail': video_data.get('posterHref'),
``` | 'Authorization': token
})
m3u8_url, headers = playback['stream']['complete'][0]['url'], {'authorization': token}
# TV Provider required
else:
resource = self._get_mvpd_resource('ESPN', video_data['name'], video_id, None)
auth = sel... | @@ -277,3 +278,115 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.571 | suggestion | 74 | 29 | 26 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'grant_type': 'urn:ietf:params:oauth:grant-type:token-exchange'
})['access_token']
assertion = self._call_bamgrid_api(
'accounts/grant', video_id, payload={'id_token': cookie.value.split('|')[1]},
headers={
'Authorizati... | ```suggestion
assertion = self._call_bamgrid_api(
'devices', video_id,
headers={'Content-Type': 'application/json; charset=UTF-8'},
payload={
'deviceFamily': 'android',
'applicationRuntime': 'android',
... | })['access_token']
assertion = self._call_bamgrid_api(
'accounts/grant', video_id, payload={'id_token': cookie.value.split('|')[1]},
headers={
'Authorization': token,
'Content-Type': 'application/json; charset=UTF-8'
... | @@ -277,3 +278,115 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 1 | security | 1,941 | 49 | 46 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
'ext': 'mp4',
'title': 'Serbia vs. Turkey',
'thumbnail': 'https://artwork.api.espn.com/artwork/collections/media/ba7d17da-453b-4697-bf92-76a99f61642b/default?width=640&apikey=1ngjw23osgcis1i1vbj96lmfqs',
},
'params': {
'skip_download': True,
},
... | ```suggestion
parse = urllib.parse.urlencode if path == 'token' else json.dumps
``` | 'ext': 'mp4',
'title': 'Serbia vs. Turkey',
'thumbnail': 'https://artwork.api.espn.com/artwork/collections/media/ba7d17da-453b-4697-bf92-76a99f61642b/default?width=640&apikey=1ngjw23osgcis1i1vbj96lmfqs',
},
'params': {
'skip_download': True,
},
... | @@ -277,3 +278,115 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.571 | suggestion | 93 | 51 | 51 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
})['assertion']
token = self._call_bamgrid_api(
'token', video_id, payload={
'subject_token': assertion,
'subject_token_type': 'urn:bamtech:params:oauth:token-type:account',
'platform': 'android',
... | ```suggestion
m3u8_url, headers = asset['stream'], {}
``` | })['assertion']
token = self._call_bamgrid_api(
'token', video_id, payload={
'subject_token': assertion,
'subject_token_type': 'urn:bamtech:params:oauth:token-type:account',
'platform': 'android',
... | @@ -371,28 +364,26 @@ def _real_extract(self, url):
'Accept': 'application/vnd.media-service+json; version=5',
'Authorization': token
})
-
- m3u8_url, m3u8_headers = playback['stream']['complete'][0]['url'], {'authorization': token}
+ m3u8... | yt_dlp/extractor/espn.py | 26 | Python | 0.571 | suggestion | 71 | 39 | 39 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
assertion = self._call_bamgrid_api(
'accounts/grant', video_id, payload={'id_token': cookie.value.split('|')[1]},
headers={
'Authorization': token,
'Content-Type': 'application/json; charset=UTF-8'
})['assertion']
... | ```suggestion
resource = self._get_mvpd_resource('ESPN', video_data['name'], video_id, None)
``` |
assertion = self._call_bamgrid_api(
'accounts/grant', video_id, payload={'id_token': cookie.value.split('|')[1]},
headers={
'Authorization': token,
'Content-Type': 'application/json; charset=UTF-8'
})['assertion']
... | @@ -277,3 +278,112 @@ def _real_extract(self, url):
'formats': formats,
'subtitles': subtitles,
}
+
+
+class WatchESPNIE(AdobePassIE):
+ _VALID_URL = r'https://www.espn.com/watch/player/_/id/(?P<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
+ _TESTS = [{
+ ... | yt_dlp/extractor/espn.py | 26 | Python | 0.714 | suggestion | 110 | 45 | 45 | false | [ESPN] Add extractor for WatchESPN videos | 2,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ischmidt20 |
def _extract_ondemand(self, ondemand_id):
ondemand_termtoken, ondemand_type, info_dict = self._extract_ondemand_info(ondemand_id)
formats = self._extract_formats(
None, ondemand_id, ondemand_id=ondemand_id,
ondemand_termtoken=ondemand_termtoken,
ondemand_type=onde... | ```suggestion
return self._extract_video(self._match_id(url))
``` |
def _make_valid_url(host):
return rf'https?://(?:www\.)?{re.escape(host)}/watch/[^/]+?/(?P<id>[0-9]+)[^/]+(?:/(?P<recid>[0-9]+))?'
class ZattooBaseIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'zattoo'
_HOST = 'zattoo.com'
@staticmethod
def _create_valid_url(match, qs, base_re=None):
match... | @@ -204,16 +255,16 @@ class QuicklineBaseIE(ZattooPlatformBaseIE):
class QuicklineIE(QuicklineBaseIE):
- _VALID_URL = r'https?://(?:www\.)?%s/watch/(?P<channel>[^/]+)/(?P<id>[0-9]+)' % re.escape(QuicklineBaseIE._HOST)
+ _VALID_URL = r'https?://(?:www\.)?%s/watch/[^/]+/(?P<id>[0-9]+)' % re.escape(QuicklineBas... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.643 | refactor | 75 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
_TEST = {
'url': 'https://mobiltv.quickline.com/watch/prosieben/130671867-maze-runner-die-auserwaehlten-in-der-brandwueste',
'only_matching': True,
}
def _real_extract(self, url):
video_id = self._match_valid_url(url).groups()
return self._extract_video(video_id)
class Qu... | ```suggestion
return self._extract_live(self._match_id(url))
``` |
def _real_extract(self, url):
vid1, vid2 = self._match_valid_url(url).group('vid1', 'vid2')
return getattr(self, f'_extract_{self._TYPE}')(vid1 or vid2)
class ZattooIE(ZattooBaseIE):
_VALID_URL = ZattooBaseIE._create_valid_url(r'\d+', 'program', '(?:program|watch)/[^/]+')
_TYPE = 'video'
... | @@ -229,8 +280,8 @@ def suitable(cls, url):
return False if QuicklineIE.suitable(url) else super(QuicklineLiveIE, cls).suitable(url)
def _real_extract(self, url):
- channel_name = video_id = self._match_id(url)
- return self._extract_video(channel_name, video_id, is_live=True)
+ cha... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.643 | refactor | 74 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
'url': 'https://zattoo.com/vod/movies/7521',
'only_matching': True,
}, {
'url': 'https://zattoo.com/program/daserste/210177916',
'only_matching': True,
}, {
'url': 'https://zattoo.com/ondemand?movie_id=7521&term_token=9f00f43183269484edde',
'only_matching': True,
... | ```py
return self._extract_live(channel_id)
raise ExtractorError(...)
``` | 'only_matching': True,
}]
class NetPlusIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'netplus'
_HOST = 'netplus.tv'
_API_HOST = 'www.%s' % _HOST
_VALID_URL = _make_valid_url(_HOST)
_TESTS = [{
'url': 'https://www.netplus.tv/watch/abc/123-abc',
'only_matching': True,
}... | @@ -243,7 +294,67 @@ def _make_valid_url(tmpl, host):
class ZattooIE(ZattooBaseIE):
- _VALID_URL_TEMPLATE = r'https?://(?:www\.)?%s/watch/(?P<channel>[^/]+?)/(?P<id>[0-9]+)[^/]+(?:/(?P<recid>[0-9]+))?'
+ _VALID_URL_TEMPLATE = r'''(?x)
+ https?://(?:www\.)?%s/
+ ... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.786 | refactor | 96 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
_HOST = 'zattoo.com'
def _make_valid_url(tmpl, host):
return tmpl % re.escape(host)
class ZattooIE(ZattooBaseIE):
_VALID_URL_TEMPLATE = r'''(?x)
https?://(?:www\.)?%s/
(?:
(?:
vod/... | ```suggestion
_VALID_URL = r'''(?x)
https?://(?:www\.)?zattoo.com/(?:
(?:
vod/movies/([A-Za-z0-9]+)|
(?:program|watch)/([^/]+)/(\d+)|
live/([^/]+)
)|
[^?#]+\?(?:
recording=([0-9]+)|
... | }]
class ZattooLiveIE(ZattooBaseIE):
_VALID_URL = ZattooBaseIE._create_valid_url(r'[^/?&#]+', 'channel', 'live')
_TYPE = 'live'
_TESTS = [{
'url': 'https://zattoo.com/channels/german?channel=srf_zwei',
'only_matching': True,
}, {
'url': 'https://zattoo.com/live/srf1',
... | @@ -243,7 +294,67 @@ def _make_valid_url(tmpl, host):
class ZattooIE(ZattooBaseIE):
- _VALID_URL_TEMPLATE = r'https?://(?:www\.)?%s/watch/(?P<channel>[^/]+?)/(?P<id>[0-9]+)[^/]+(?:/(?P<recid>[0-9]+))?'
+ _VALID_URL_TEMPLATE = r'''(?x)
+ https?://(?:www\.)?%s/
+ ... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.857 | refactor | 578 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
'url': 'https://zattoo.com/program/daserste/210177916',
'only_matching': True,
}, {
'url': 'https://zattoo.com/ondemand?movie_id=7521&term_token=9f00f43183269484edde',
'only_matching': True,
}, {
'url': 'https://zattoo.com/live/srf1',
'only_matching': True,
}]... | Do not change the old extractor name (it breaks archive). Rename the new one instead |
class NetPlusIE(ZattooPlatformBaseIE):
_NETRC_MACHINE = 'netplus'
_HOST = 'netplus.tv'
_API_HOST = 'www.%s' % _HOST
_VALID_URL = _make_valid_url(_HOST)
_TESTS = [{
'url': 'https://www.netplus.tv/watch/abc/123-abc',
'only_matching': True,
}]
class MNetTVIE(ZattooPlatformBaseIE... | @@ -243,7 +294,67 @@ def _make_valid_url(tmpl, host):
class ZattooIE(ZattooBaseIE):
- _VALID_URL_TEMPLATE = r'https?://(?:www\.)?%s/watch/(?P<channel>[^/]+?)/(?P<id>[0-9]+)[^/]+(?:/(?P<recid>[0-9]+))?'
+ _VALID_URL_TEMPLATE = r'''(?x)
+ https?://(?:www\.)?%s/
+ ... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.286 | refactor | 84 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
if stream_type in ('dash', 'dash_widevine', 'dash_playready'):
this_formats = self._extract_mpd_formats(
watch_url, video_id, mpd_id=format_id, fatal=False)
elif stream_type in ('hls', 'hls5', 'hls5_fairplay'):
this_formats ... | ```suggestion
info_dict['formats'] = self._extract_formats(cid, video_id, record_id=record_id)
```
same below | watch_url, video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id=format_id,
fatal=False)
self._merge_subtitles(subs, target=subtitles)
elif stream_type == 'hds':
this_formats = self._extract_... | @@ -182,18 +215,36 @@ def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
self._sort_formats(formats)
return formats
- def _extract_video(self, channel_name, video_id, record_id=None, is_live=False):
- if is_live:
- cid = self._extract_cid(video_id, channel... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.786 | refactor | 120 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
this_formats = self._extract_ism_formats(
watch_url, video_id, ism_id=format_id, fatal=False)
else:
assert False
for this_format in this_formats:
this_format['quality'] = preference
format... | ```suggestion
return {
'id': channel_name,
'title': channel_name,
'is_live': True,
'format': self._extract_formats(cid, cid, is_live=True),
}
``` | for this_format in this_formats:
this_format['quality'] = preference
formats.extend(this_formats)
self._sort_formats(formats)
return formats, subtitles
def _extract_video(self, video_id, record_id=None):
cid, info_dict = self._extract_cid_... | @@ -182,18 +215,36 @@ def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
self._sort_formats(formats)
return formats
- def _extract_video(self, channel_name, video_id, record_id=None, is_live=False):
- if is_live:
- cid = self._extract_cid(video_id, channel... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.857 | refactor | 216 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
cid = p['cid']
info_dict = {
'id': video_id,
'title': p.get('t') or p['et'],
'description': p.get('d'),
'thumbnail': p.get('i_url'),
'creator': p.get('channel_name'),
'episode': p.get('et'),
'episode_number': int_or_non... | ```suggestion
'title': data.get('title'),
```
due to recent core changes, title is now non-fatal | 'season_number': int_or_none(p.get('s_no')),
'release_year': int_or_none(p.get('year')),
'categories': try_get(p, lambda x: x['c'], list),
'tags': try_get(p, lambda x: x['g'], list)
}
return cid, info_dict
def _extract_ondemand_info(self, ondemand_id... | @@ -122,7 +133,24 @@ def _extract_cid_and_video_info(self, video_id):
return cid, info_dict
- def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
+ def _extract_ondemand_info(self, ondemand_id):
+ data = self._download_json(
+ '%s/zapi/vod/movies/%s' % (self._h... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.786 | suggestion | 111 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
try:
data = self._download_json(
'%s/zapi/v2/account/login' % self._host_url(), None, 'Logging in',
data=urlencode_postdata({
'login': username,
'password': password,
'remember': 'true',
}), ... | ```suggestion
session_token = self._download_json(
f'{self._host_url()}/token.json', None, 'Downloading session token')['session_token']
``` | data = self._download_json(
'%s/zapi/v2/account/login' % self._host_url(), None, 'Logging in',
data=urlencode_postdata({
'login': username,
'password': password,
'remember': 'true',
}), headers={
... | @@ -53,27 +53,38 @@ def _login(self):
self._power_guide_hash = data['session']['power_guide_hash']
def _real_initialize(self):
- webpage = self._download_webpage(
- self._host_url(), None, 'Downloading app token')
- app_token = self._html_search_regex(
- r'appToken\s*... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.714 | suggestion | 163 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
# Will setup appropriate cookies
self._request_webpage(
'%s/zapi/v3/session/hello' % self._host_url(), None,
'Opening session', data=urlencode_postdata({
'uuid': compat_str(uuid4()),
'lang': 'en',
'app_version': '1.8.2',
... | ```suggestion
playlist = self._download_json(
f'{self._host_url()}/zapi/v2/playlist', recid, 'Downloading playlist')
try:
return next(
str(item['program_id']) for item in playlist['recordings']
if item.get('program_id') and str(item.get('id')... | 'uuid': compat_str(uuid4()),
'lang': 'en',
'app_version': '1.8.2',
'format': 'json',
'client_app_token': session_token,
}))
def _extract_video_id_from_recording(self, recid):
playlist = self._download_json(
... | @@ -53,27 +53,38 @@ def _login(self):
self._power_guide_hash = data['session']['power_guide_hash']
def _real_initialize(self):
- webpage = self._download_webpage(
- self._host_url(), None, 'Downloading app token')
- app_token = self._html_search_regex(
- r'appToken\s*... | yt_dlp/extractor/zattoo.py | 26 | Python | 1 | refactor | 458 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
info_dict = {
'id': ondemand_id,
'title': data['title'],
'description': data.get('description'),
'duration': int_or_none(data.get('duration')),
'release_year': int_or_none(data.get('year')),
'episode_number': int_or_none(data.get('episode_n... | ```suggestion
elif ondemand_id:
postdata_common.update({
'teasable_id': ondemand_id,
'term_token': ondemand_termtoken,
'teasable_type': ondemand_type
})
``` | 'categories': try_get(data, lambda x: x['categories'], list),
}
return data['terms_catalog'][0]['terms'][0]['token'], data['type'], info_dict
def _extract_formats(self, cid, video_id, record_id=None, ondemand_id=None, ondemand_termtoken=None, ondemand_type=None, is_live=False):
... | @@ -132,8 +160,13 @@ def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
url = '%s/zapi/watch/live/%s' % (self._host_url(), cid)
elif record_id:
url = '%s/zapi/watch/recording/%s' % (self._host_url(), record_id)
+ elif ondemand_id:
+ postdata_co... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.929 | suggestion | 243 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
formats.extend(this_formats)
self._sort_formats(formats)
return formats
def _extract_video(self, video_id, record_id=None):
cid, info_dict = self._extract_cid_and_video_info(video_id)
formats = self._extract_formats(cid, video_id, record_id=record_id)
info_di... | ```suggestion
info_dict['formats'] = self._extract_formats(cid, video_id, record_id=record_id)
``` | def _extract_video(self, video_id, record_id=None):
cid, info_dict = self._extract_cid_and_video_info(video_id)
info_dict['formats'], info_dict['subtitles'] = self._extract_formats(cid, video_id, record_id=record_id)
return info_dict
def _extract_live(self, channel_name):
cid = ... | @@ -182,18 +215,36 @@ def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
self._sort_formats(formats)
return formats
- def _extract_video(self, channel_name, video_id, record_id=None, is_live=False):
- if is_live:
- cid = self._extract_cid(video_id, channel... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.786 | refactor | 108 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
return info_dict
def _extract_live(self, channel_name):
cid = self._extract_cid(channel_name, channel_name)
info_dict = {
'id': channel_name,
'title': channel_name,
'is_live': True,
}
formats = self._extract_formats(cid, cid, is_live=True)... | ```suggestion
None, ondemand_id, ondemand_id=ondemand_id,
ondemand_termtoken=ondemand_termtoken, ondemand_type=ondemand_type)
``` | return {
'id': channel_name,
'title': channel_name,
'is_live': True,
'format': formats,
'subtitles': subtitles
}
def _extract_record(self, record_id):
video_id = self._extract_video_id_from_recording(record_id)
cid, info_di... | @@ -182,18 +215,36 @@ def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
self._sort_formats(formats)
return formats
- def _extract_video(self, channel_name, video_id, record_id=None, is_live=False):
- if is_live:
- cid = self._extract_cid(video_id, channel... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.857 | suggestion | 156 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
# flake8: noqa
from __future__ import unicode_literals
from .abc import (
ABCIE,
ABCIViewIE,
ABCIViewShowSeriesIE,
)
from .abcnews import (
AbcNewsIE,
AbcNewsVideoIE,
)
from .abcotvs import (
ABCOTVSIE,
ABCOTVSClipsIE,
)
from .academicearth import AcademicEarthCourseIE
from .acast import (
... | Why the OldIEs are not added here? | YoutubeSubscriptionsIE,
YoutubeTruncatedIDIE,
YoutubeTruncatedURLIE,
YoutubeYtBeIE,
YoutubeYtUserIE,
YoutubeWatchLaterIE,
)
from .zapiks import ZapiksIE
from .zattoo import (
BBVTVIE,
EinsUndEinsTVIE,
EWETVIE,
GlattvisionTVIE,
MNetTVIE,
NetPlusIE,
OsnatelTVIE,
Qua... | @@ -1973,7 +1973,6 @@
VTXTVIE,
WalyTVIE,
ZattooIE,
- ZattooLiveIE, | yt_dlp/extractor/extractors.py | 26 | Python | 0.071 | question | 34 | 1,989 | 39 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
})
p = data['programs'][0]
cid = p['cid']
info_dict = {
'id': video_id,
'title': p.get('t') or p['et'],
'description': p.get('d'),
'thumbnail': p.get('i_url'),
'creator': p.get('channel_name'),
'episode': p.get... | ```suggestion
ondemand_id, 'Downloading ondemand information')
``` |
info_dict = {
'id': video_id,
'title': p.get('t') or p['et'],
'description': p.get('d'),
'thumbnail': p.get('i_url'),
'creator': p.get('channel_name'),
'episode': p.get('et'),
'episode_number': int_or_none(p.get('e_no')),
... | @@ -122,7 +127,24 @@ def _extract_cid_and_video_info(self, video_id):
return cid, info_dict
- def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
+ def _extract_ondemand_info(self, ondemand_id):
+ data = self._download_json(
+ '%s/zapi/vod/movies/%s' % (self._h... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.571 | suggestion | 80 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
data = self._download_json(
'%s/zapi/v2/cached/program/power_details/%s' % (
self._host_url(), self._power_guide_hash),
video_id,
'Downloading video information',
query={
'program_ids': video_id,
'complete': True,
... | Could u add a small docstring explaining what it returns? | 'Downloading video information',
query={
'program_ids': video_id,
'complete': True,
})
p = data['programs'][0]
cid = p['cid']
info_dict = {
'id': video_id,
'title': p.get('t') or p['et'],
'd... | @@ -122,7 +127,24 @@ def _extract_cid_and_video_info(self, video_id):
return cid, info_dict
- def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
+ def _extract_ondemand_info(self, ondemand_id): | yt_dlp/extractor/zattoo.py | 26 | Python | 0.286 | question | 57 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
p = data['programs'][0]
cid = p['cid']
info_dict = {
'id': video_id,
'title': p.get('t') or p['et'],
'description': p.get('d'),
'thumbnail': p.get('i_url'),
'creator': p.get('channel_name'),
'episode': p.get('et'),
... | ```suggestion
@returns (ondemand_token, ondemand_type, info_dict)
``` | 'id': video_id,
'title': p.get('t') or p['et'],
'description': p.get('d'),
'thumbnail': p.get('i_url'),
'creator': p.get('channel_name'),
'episode': p.get('et'),
'episode_number': int_or_none(p.get('e_no')),
'season_number':... | @@ -122,7 +127,30 @@ def _extract_cid_and_video_info(self, video_id):
return cid, info_dict
- def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
+ def _extract_ondemand_info(self, ondemand_id):
+ """
+ Returns a triple where the first element is the ondemand token... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.714 | suggestion | 82 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
subtitles = {}
for stream_type in ('dash', 'hls7'):
postdata = postdata_common.copy()
postdata['stream_type'] = stream_type
data = self._download_json(
url, video_id, 'Downloading %s formats' % stream_type.upper(),
data=urlencode_postd... | isn't `'dash' in stream_type` or `streamtype.startswith('dash')` better? Same for hls | for stream_type in ('dash', 'hls7'):
postdata = postdata_common.copy()
postdata['stream_type'] = stream_type
data = self._download_json(
url, video_id, 'Downloading %s formats' % stream_type.upper(),
data=urlencode_postdata(postdata), fatal=Fa... | @@ -157,13 +189,15 @@ def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
preference = 1 if audio_channel == 'A' else None
format_id = join_nonempty(stream_type, watch.get('maxrate'), audio_channel)
if stream_type in ('dash', 'dash_widevine', 'das... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.571 | question | 85 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
'season_number': int_or_none(data.get('season_number')),
'categories': try_get(data, lambda x: x['categories'], list),
}
return data['terms_catalog'][0]['terms'][0]['token'], data['type'], info_dict
def _extract_formats(self, cid, video_id, record_id=None, ondemand_id=None, ... | the others don't exist anymore? | 'categories': try_get(data, lambda x: x['categories'], list),
}
return data['terms_catalog'][0]['terms'][0]['token'], data['type'], info_dict
def _extract_formats(self, cid, video_id, record_id=None, ondemand_id=None, ondemand_termtoken=None, ondemand_type=None, is_live=False):
... | @@ -128,11 +153,18 @@ def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
url = '%s/zapi/watch/live/%s' % (self._host_url(), cid)
elif record_id:
url = '%s/zapi/watch/recording/%s' % (self._host_url(), record_id)
+ elif ondemand_id:
+ postdata_c... | yt_dlp/extractor/zattoo.py | 26 | Python | 0.071 | question | 31 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
return info_dict
def _extract_live(self, channel_name):
cid = self._extract_cid(channel_name, channel_name)
formats, subtitles = self._extract_formats(cid, cid, is_live=True)
return {
'id': channel_name,
'title': channel_name,
'is_live': True,
... | ```suggestion
info_dict['formats'], info_dict['subtitles'] = self._extract_formats(
None, ondemand_id, ondemand_id=ondemand_id,
ondemand_termtoken=ondemand_termtoken, ondemand_type=ondemand_type)
``` |
def _extract_live(self, channel_name):
cid = self._extract_cid(channel_name, channel_name)
formats, subtitles = self._extract_formats(cid, cid, is_live=True)
return {
'id': channel_name,
'title': channel_name,
'is_live': True,
'format': format... | @@ -176,247 +210,253 @@ def _extract_formats(self, cid, video_id, record_id=None, is_live=False):
this_format['quality'] = preference
formats.extend(this_formats)
self._sort_formats(formats)
- return formats
+ return formats, subtitles
- def _extract_vid... | yt_dlp/extractor/zattoo.py | 26 | Python | 1 | refactor | 235 | 51 | 51 | false | [Zattoo] Fix information extractor (closes #1244) | 2,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | goggle |
playlist = 'https://adult.noodlemagazine.com/playlist/%s?m=%s' % (video_id, m)
info = self._download_json(playlist, video_id)
thumbnail = self._og_search_property('image', webpage, default=None) or info.get('image')
formats = []
for mobj in info.get('sources'):
form... | ```suggestion
'upload_date': upload_update
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_count,
unified_strdate
)
class NoodleMagazineIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]+)'
_TEST = {
... | @@ -0,0 +1,92 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..utils import (
+ traverse_obj,
+ str_to_int,
+ str_or_none
+)
+from .common import InfoExtractor
+
+
+class NoodleMagazineIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]... | yt_dlp/extractor/noodlemagazine.py | 26 | Python | 0.571 | suggestion | 60 | 28 | 68 | false | [noodlemagazine] Add extrator | 2,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
'url': r're:^https://.*\.pvvstream.pro/.*extra=',
'quality': '480',
'ext': 'mp4',
},
{
'url': r're:^https://.*\.pvvstream.pro/.*extra=',
'quality': '720',
'ext': 'mp4',... | ```suggestion
m = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'm')
```
what's m? Use a better name | like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None))
upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default=''))
key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
playlist_info ... | @@ -0,0 +1,92 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..utils import (
+ traverse_obj,
+ str_to_int,
+ str_or_none
+)
+from .common import InfoExtractor
+
+
+class NoodleMagazineIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]... | yt_dlp/extractor/noodlemagazine.py | 26 | Python | 0.786 | suggestion | 140 | 51 | 29 | false | [noodlemagazine] Add extrator | 2,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
'ext': 'mp4',
},
{
'url': r're:^https://.*\.pvvstream.pro/.*extra=',
'quality': '720',
'ext': 'mp4',
},
]
}
}
def _real_extract(self, url):
video_id = self... | ```suggestion
playlist_info = self._download_json(f'https://adult.noodlemagazine.com/playlist/{video_id}?m={m}', video_id)
``` |
key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
playlist_info = self._download_json(f'https://adult.noodlemagazine.com/playlist/{video_id}?m={key}', video_id)
thumbnail = self._og_search_property('image', webpage, default=None) or playlist_info.get('image... | @@ -0,0 +1,92 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..utils import (
+ traverse_obj,
+ str_to_int,
+ str_or_none
+)
+from .common import InfoExtractor
+
+
+class NoodleMagazineIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]... | yt_dlp/extractor/noodlemagazine.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 27 | false | [noodlemagazine] Add extrator | 2,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._og_search_title(webpage)
duration = str_to_int(self._html_search_meta('video:duration', webpage, 'duration', default=None))
description = self._og_searc... | ```suggestion
formats = [{
'url':source.get('file'),
'quality': source.get('label'),
'ext': source.get('type'),
} for source in info.get('sources')]
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_count,
unified_strdate
)
class NoodleMagazineIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]+)'
_TEST = {
... | @@ -0,0 +1,92 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..utils import (
+ traverse_obj,
+ str_to_int,
+ str_or_none
+)
+from .common import InfoExtractor
+
+
+class NoodleMagazineIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]... | yt_dlp/extractor/noodlemagazine.py | 26 | Python | 0.929 | suggestion | 210 | 42 | 68 | false | [noodlemagazine] Add extrator | 2,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
'title': 'Aria alexander manojob',
'thumbnail': r're:^https://.*\.jpg',
'ext': 'mp4',
'duration': 903,
'view_count': int,
'like_count': int,
'description': 'Aria alexander manojob',
'tags': ['aria', 'alexander', 'manojob'],
... | ```suggestion
key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
``` | 'title': 'Aria alexander manojob',
'thumbnail': r're:^https://.*\.jpg',
'ext': 'mp4',
'duration': 903,
'view_count': int,
'like_count': int,
'description': 'Aria alexander manojob',
'tags': ['aria', 'alexander', 'manojob'],
... | @@ -0,0 +1,68 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..utils import (
+ parse_duration,
+ parse_count,
+ unified_strdate
+)
+from .common import InfoExtractor
+
+
+class NoodleMagazineIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>... | yt_dlp/extractor/noodlemagazine.py | 26 | Python | 0.714 | suggestion | 115 | 51 | 50 | false | [noodlemagazine] Add extrator | 2,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None))
upload_update = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default=''))
key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
playlist_inf... | ```suggestion
upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default=''))
key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
playlist_info = self._download_json(f'https://adult.noodlemagazine.com/playlist/{video_id}?m... | like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None))
upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default=''))
key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
playlist_info ... | @@ -0,0 +1,67 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..utils import (
+ parse_duration,
+ parse_count,
+ unified_strdate
+)
+from .common import InfoExtractor
+
+
+class NoodleMagazineIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>... | yt_dlp/extractor/noodlemagazine.py | 26 | Python | 0.929 | suggestion | 1,064 | 29 | 29 | false | [noodlemagazine] Add extrator | 2,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
# coding: utf-8
from __future__ import unicode_literals
from ..utils import (
parse_duration,
parse_count,
unified_strdate
)
from .common import InfoExtractor
class NoodleMagazineIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]+)'
_TEST = {
... | ```suggestion
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_count,
unified_strdate
)
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_count,
unified_strdate
)
class NoodleMagazineIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]+)'
_TEST = {
... | @@ -0,0 +1,67 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..utils import (
+ parse_duration,
+ parse_count,
+ unified_strdate
+)
+from .common import InfoExtractor
+ | yt_dlp/extractor/noodlemagazine.py | 10 | Python | 0.786 | refactor | 141 | 35 | 35 | false | [noodlemagazine] Add extrator | 2,293 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | trassshhub |
'info_dict': {
'id': 'Congressional Chronicle - Members of Congress, Hearings and More | C-SPAN.org',
'title': 'Congressional Chronicle - Members of Congress, Hearings and More',
'description': 'md5:54c264b7a8f219937987610243305a84',
'ext': 'mp4'
}
}]
... | ```suggestion
f.setdefault('http_headers', {}).update({
'Referer': basic_url + '/',
'Origin': basic_url,
'Accept': '*/*',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site'... |
class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
_TESTS = [{
'url': 'https://www.c-span.org/congress/?chamber=house&date=2017-12-13&t=1513208380',
'info_dict': {
'id': 'house_2017-12-13',
'title': 'Congressional Chronicle - M... | @@ -242,3 +243,49 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ IE_DESC = 'C-SPAN'
+ _TESTS = [{
... | yt_dlp/extractor/cspan.py | 26 | Python | 0.786 | suggestion | 341 | 40 | 39 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Grabien |
'entries': entries,
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
IE_DESC = 'C-SPAN'
_TESTS = [{
'url': 'https:... | ```suggestion
video_url = self._search_regex(r'sources: \[\{file: \'(.*?)\'\}\],', webpage, 'video URL')
```
You should be able to also just extract the entire jwplayer config with
```py
self._parse_json(
self._search_regex(r'jwsetup\s*=\s*({.+});', webpage, 'player config'),
display_id, transfor... | entry = dict(entries[0])
entry['id'] = 'c' + video_id if video_type == 'clip' else video_id
return entry
else:
return {
'_type': 'playlist',
'entries': entries,
'title': title,
'id': 'c' + video_id if... | @@ -242,3 +243,49 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ IE_DESC = 'C-SPAN'
+ _TESTS = [{
... | yt_dlp/extractor/cspan.py | 26 | Python | 0.857 | refactor | 447 | 51 | 50 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Grabien |
'thumbnail': thumbnail,
'duration': int_or_none(get_text_attr(f, 'length')),
'subtitles': {
'en': [{
'url': capfile,
'ext': determine_ext(capfile, 'dfxp')
}],
} if capf... | imo this isn't descriptive, especially since it's copied from CSpanIE
```suggestion
``` | 'id': '%s_%d' % (video_id, partnum + 1),
'title': (
title if len(files) == 1 else
'%s part %d' % (title, partnum + 1)),
'formats': formats,
'description': description,
'thumbnail': thumbnail,
... | @@ -242,3 +243,49 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ IE_DESC = 'C-SPAN' | yt_dlp/extractor/cspan.py | 26 | Python | 0.571 | suggestion | 89 | 51 | 51 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Grabien |
'url': capfile,
'ext': determine_ext(capfile, 'dfxp')
}],
} if capfile else None,
})
if len(entries) == 1:
entry = dict(entries[0])
entry['id'] = 'c' + video_id if video_type == 'clip' else v... | i don't like this id tbh.
I personally would have parsed the `chamber` `date` and `t` from the url and maybe hashed them if not just joined them using `_` and used that as the id.
| 'formats': formats,
'description': description,
'thumbnail': thumbnail,
'duration': int_or_none(get_text_attr(f, 'length')),
'subtitles': {
'en': [{
'url': capfile,
'ext': ... | @@ -242,3 +243,49 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ IE_DESC = 'C-SPAN'
+ _TESTS = [{
... | yt_dlp/extractor/cspan.py | 26 | Python | 0.571 | suggestion | 183 | 51 | 51 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Grabien |
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
IE_DESC = 'C-SPAN'
_TESTS = [{
'url': 'https://www.c-span.org/congress/?chamber=h... | ```suggestion
formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_url, display_id, ext='mp4')
``` | entry['id'] = 'c' + video_id if video_type == 'clip' else video_id
return entry
else:
return {
'_type': 'playlist',
'entries': entries,
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
... | @@ -242,3 +243,49 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ IE_DESC = 'C-SPAN'
+ _TESTS = [{
... | yt_dlp/extractor/cspan.py | 26 | Python | 0.786 | refactor | 123 | 50 | 49 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Grabien |
from __future__ import unicode_literals
import re
from urllib.parse import (
parse_qs,
urlparse,
)
from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
extract_attributes,
find_xpath_attr,
get_element_by_attribute,
get_element_by_class,
int_or_none... | ```suggestion
import urllib
``` | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_HTMLParseError
from ..utils import (
determine_ext,
ExtractorError,
extract_attributes,
find_xpath_attr,
get_element_by_attribute,
get_element_by_class,
int_or_none,
join_non... | @@ -1,6 +1,10 @@
from __future__ import unicode_literals
import re
+from urllib.parse import (
+ parse_qs,
+ urlparse,
+) | yt_dlp/extractor/cspan.py | 7 | Python | 0.429 | suggestion | 33 | 32 | 32 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
video_id = m.group('id')
video_type = 'program' if m.group('type') == 'prog' else 'clip'
else:
senate_isvp_url = SenateISVPIE._search_iframe_url(webpage)
if senate_isvp_url:
title = self._og_search_title(webpage)
... | ```suggestion
```
unrelated diff | video_id = m.group('id')
video_type = 'program' if m.group('type') == 'prog' else 'clip'
else:
senate_isvp_url = SenateISVPIE._search_iframe_url(webpage)
if senate_isvp_url:
title = self._og_search_title(webpage)
... | @@ -180,6 +187,7 @@ def get_text_attr(d, attr):
data = self._download_json(
'http://www.c-span.org/assets/player/ajax-player.php?os=android&html5=%s&id=%s' % (video_type, video_id),
video_id)['video']
+ | yt_dlp/extractor/cspan.py | 26 | Python | 0.429 | suggestion | 34 | 51 | 51 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
}],
} if capfile else None,
})
if len(entries) == 1:
entry = dict(entries[0])
entry['id'] = 'c' + video_id if video_type == 'clip' else video_id
return entry
else:
return {
'_type': 'playlist... | ```suggestion
'thumbnail': r're:https://ximage.c-spanvideo.org/.+',
``` | } if capfile else None,
})
if len(entries) == 1:
entry = dict(entries[0])
entry['id'] = 'c' + video_id if video_type == 'clip' else video_id
return entry
else:
return {
'_type': 'playlist',
'entr... | @@ -242,3 +250,42 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ _TESTS = [{
+ 'url': 'https:/... | yt_dlp/extractor/cspan.py | 26 | Python | 0.571 | suggestion | 85 | 51 | 51 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
'url': capfile,
'ext': determine_ext(capfile, 'dfxp')
}],
} if capfile else None,
})
if len(entries) == 1:
entry = dict(entries[0])
entry['id'] = 'c' + video_id if video_type == 'clip' else v... | `| C-SPAN.org` should be removed | 'ext': determine_ext(capfile, 'dfxp')
}],
} if capfile else None,
})
if len(entries) == 1:
entry = dict(entries[0])
entry['id'] = 'c' + video_id if video_type == 'clip' else video_id
return entry
... | @@ -242,3 +250,42 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ _TESTS = [{
+ 'url': 'https:/... | yt_dlp/extractor/cspan.py | 26 | Python | 0.286 | suggestion | 32 | 51 | 51 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
entry['id'] = 'c' + video_id if video_type == 'clip' else video_id
return entry
else:
return {
'_type': 'playlist',
'entries': entries,
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
... | ```suggestion
query = parse_qs(url)
```
Use the `parse_qs` from utils | return entry
else:
return {
'_type': 'playlist',
'entries': entries,
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?... | @@ -242,3 +250,42 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ _TESTS = [{
+ 'url': 'https:/... | yt_dlp/extractor/cspan.py | 26 | Python | 0.643 | suggestion | 80 | 49 | 48 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
}]
def _real_extract(self, url):
parsed_url = urlparse(url)
if parse_qs(parsed_url.query)['chamber'] is not None:
display_id = parse_qs(parsed_url.query)['chamber'][0]
if parse_qs(parsed_url.query)['date'] is not None:
display_id = display_id + '_' + pars... | ```suggestion
title = (self._og_search_title(webpage, default=None)
or self._html_search_regex(r'(?s)<title>(.*?)</title>', webpage, 'video title'))
description = (self._og_search_description(webpage, default=None)
or self._html_search_meta('description', webp... |
def _real_extract(self, url):
query = parse_qs(url)
video_date = query.get('date', [None])[0]
video_id = join_nonempty(query.get('chamber', ['senate'])[0], video_date, delim='_')
webpage = self._download_webpage(url, video_id)
if not video_date:
jwp_date = re.sea... | @@ -242,3 +250,42 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ _TESTS = [{
+ 'url': 'https:/... | yt_dlp/extractor/cspan.py | 26 | Python | 0.786 | suggestion | 605 | 27 | 26 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
_TESTS = [{
'url': 'https://www.c-span.org/congress/?chamber=house&date=2017-12-13&t=... | This is a problem. The video id MUST be both unique and consistent (per extractor). ie, (1) Diff videos must never have the same id and, (2) A video must always have the same id even if download using different URLs. This does not seem to satisfy either case | return {
'_type': 'playlist',
'entries': entries,
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
... | @@ -242,3 +246,52 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ _TESTS = [{
+ 'url': 'https:/... | yt_dlp/extractor/cspan.py | 26 | Python | 0.5 | refactor | 258 | 51 | 46 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
_TESTS = [{
'url': 'https://www.c-span.org/congress/?chamber=house&date=2017-12-13&t=1513208380',
'info_dict': {
'id': 'house_2017-12-13',
'title': 'Congressional Chronicle - Me... | ```suggestion
video_date = query.get('date', [None])[0]
video_id = join_nonempty(query.get('chamber', ['senate'])[0], video_date, delim='_')
webpage = self._download_webpage(url, video_id)
if not video_date:
``` | }
class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
_TESTS = [{
'url': 'https://www.c-span.org/congress/?chamber=house&date=2017-12-13&t=1513208380',
'info_dict': {
'id': 'house_2017-12-13',
'title': 'Congressiona... | @@ -242,3 +246,49 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ _TESTS = [{
+ 'url': 'https:/... | yt_dlp/extractor/cspan.py | 26 | Python | 0.786 | suggestion | 248 | 45 | 41 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
'url': 'https://www.c-span.org/congress/?chamber=house&date=2017-12-13&t=1513208380',
'info_dict': {
'id': 'house_2017-12-13',
'title': 'Congressional Chronicle - Members of Congress, Hearings and More',
'description': 'md5:54c264b7a8f219937987610243305a84',
... | avoid `+` ing strings. Use fstrings/%s
```suggestion
video_id = f'{video_id}_{jwp_date.group("date")}'
``` | class CSpanCongressIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
_TESTS = [{
'url': 'https://www.c-span.org/congress/?chamber=house&date=2017-12-13&t=1513208380',
'info_dict': {
'id': 'house_2017-12-13',
'title': 'Congressional Chronicle - Me... | @@ -242,3 +246,49 @@ def get_text_attr(d, attr):
'title': title,
'id': 'c' + video_id if video_type == 'clip' else video_id,
}
+
+
+class CSpanCongressIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?c-span\.org/congress/'
+ _TESTS = [{
+ 'url': 'https:/... | yt_dlp/extractor/cspan.py | 26 | Python | 0.786 | suggestion | 125 | 42 | 38 | false | [extractor/cspan] Support of C-Span congress videos | 2,295 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
'upload_date': '20220109',
'timestamp': 1641686400,
},
}, {
'url': 'https://www.tvopen.gr/watch/100979/se28099agapaomenalla7cepeisodio267cmhthrargiapashskakias',
'md5': '38f98a1be0c577db4ea2d1b1c0770c48',
'info_dict': {
'id': '100979',
... | ```suggestion
return self._download_json(url, query, query=query)
```
this note is basically same as the default
Also, `query` in place of video id? | 'timestamp': 1641686400,
},
}, {
'url': 'https://www.tvopen.gr/watch/100979/se28099agapaomenalla7cepeisodio267cmhthrargiapashskakias',
'md5': '38f98a1be0c577db4ea2d1b1c0770c48',
'info_dict': {
'id': '100979',
'title': 'md5:e021f3001e16088ee40fa79b2... | @@ -0,0 +1,150 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ get_elements_text_and_html_by_attribute,
+ unescapeHTML,
+)
+
+
+class TVOpenGrBaseIE(InfoExtractor):
+ def _return_can... | yt_dlp/extractor/tvopengr.py | 26 | Python | 0.714 | question | 162 | 51 | 51 | false | [extractor/tvopengr] Add new extractor | 2,297 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zmousm |
url, query,
'Downloading JSON',
'Unable to download JSON',
query=query)
def _extract_formats_and_subs(self, options, video_id):
formats, subs = [], {}
for format_id, format_url in options.items():
if format_id not in ('stream', 'httpstream... | self._merge_subtitles
(just realized I overlooked this in glomex. I'll fix that) | ext = determine_ext(format_url)
if ext == 'm3u8':
formats_, subs_ = self._extract_m3u8_formats_and_subtitles(
format_url, video_id, 'mp4', m3u8_id=format_id,
fatal=False)
elif ext == 'mpd':
formats_, subs_ = self... | @@ -0,0 +1,150 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ get_elements_text_and_html_by_attribute,
+ unescapeHTML,
+)
+
+
+class TVOpenGrBaseIE(InfoExtractor):
+ def _return_can... | yt_dlp/extractor/tvopengr.py | 26 | Python | 0.214 | suggestion | 83 | 51 | 51 | false | [extractor/tvopengr] Add new extractor | 2,297 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zmousm |
class TVOpenGrEmbedIE(TVOpenGrBaseIE):
IE_NAME = 'tvopengr:embed'
IE_DESC = 'tvopen.gr embedded videos'
_VALID_URL = r'https?://(?:www\.|cdn\.|)(?:tvopen|ethnos).gr/embed/(?P<id>\d+)'
_TESTS = [{
'url': 'https://cdn.ethnos.gr/embed/100963',
'md5': '2da147881f45571d81662d94d086628b',
... | You can make it optional in _VALID_URL itself to simplify this. This is generally not done, but is also harmless | return info
class TVOpenGrEmbedIE(TVOpenGrBaseIE):
IE_NAME = 'tvopengr:embed'
IE_DESC = 'tvopen.gr embedded videos'
_VALID_URL = r'(?:https?:)?//(?:www\.|cdn\.|)(?:tvopen|ethnos).gr/embed/(?P<id>\d+)'
_EMBED_RE = re.compile(rf'''<iframe[^>]+?src=(?P<_q1>["'])(?P<url>{_VALID_URL})(?P=_q1)''')
... | @@ -0,0 +1,150 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ get_elements_text_and_html_by_attribute,
+ unescapeHTML,
+)
+
+
+class TVOpenGrBaseIE(InfoExtractor):
+ def _return_can... | yt_dlp/extractor/tvopengr.py | 26 | Python | 0.429 | refactor | 112 | 40 | 33 | false | [extractor/tvopengr] Add new extractor | 2,297 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | zmousm |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.