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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'duration': 89,
'view_count': int,
'comment_count': int,
'average_rating': float,
'categories': ['News & Politics'],
'tags': ['fulp', 'tube', 'sucks', 'bad', 'fulptube'],
},
}, {
'url': 'https://www.vidlii.com/embed?v=tJluaH4BJ3... | ```suggestion
height = int(self._search_regex(r'(\d+).mp4', format_url, 'height', default=360))
``` | 'view_count': int,
'comment_count': int,
'average_rating': float,
'categories': ['News & Politics'],
'tags': ['fulp', 'tube', 'sucks', 'bad', 'fulptube'],
},
}, {
'url': 'https://www.vidlii.com/embed?v=tJluaH4BJ3v&a=0',
'only_matchi... | @@ -45,10 +67,33 @@ def _real_extract(self, url):
webpage = self._download_webpage(
'https://www.vidlii.com/watch?v=%s' % video_id, video_id)
-
- video_url = self._search_regex(
- r'src\s*:\s*(["\'])(?P<url>(?:https?://)?(?:(?!\1).)+)\1', webpage,
- 'video url', grou... | yt_dlp/extractor/vidlii.py | 26 | Python | 0.714 | suggestion | 113 | 51 | 51 | false | [VidLii] Add 720p support | 1,681 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mrpapersonic |
'average_rating': float,
'categories': ['News & Politics'],
'tags': ['fulp', 'tube', 'sucks', 'bad', 'fulptube'],
},
}, {
'url': 'https://www.vidlii.com/embed?v=tJluaH4BJ3v&a=0',
'only_matching': True,
}]
def _real_extract(self, url):
vide... | ```suggestion
'format_id': f'{height}p',
```
The `if` doesn't make sense since u set default height to 360 | 'categories': ['News & Politics'],
'tags': ['fulp', 'tube', 'sucks', 'bad', 'fulptube'],
},
}, {
'url': 'https://www.vidlii.com/embed?v=tJluaH4BJ3v&a=0',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
w... | @@ -45,10 +67,33 @@ def _real_extract(self, url):
webpage = self._download_webpage(
'https://www.vidlii.com/watch?v=%s' % video_id, video_id)
-
- video_url = self._search_regex(
- r'src\s*:\s*(["\'])(?P<url>(?:https?://)?(?:(?!\1).)+)\1', webpage,
- 'video url', grou... | yt_dlp/extractor/vidlii.py | 26 | Python | 0.714 | suggestion | 127 | 51 | 51 | false | [VidLii] Add 720p support | 1,681 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mrpapersonic |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(
'https://www.vidlii.com/watch?v=%s' % video_id, video_id)
formats = []
def add_format(format_url, height=None):
formats.append({
'url': for... | ```suggestion
height = int(self._search_regex(r'(\d+).mp4', source, 'height', default=360))
if self._request_webpage(HeadRequest(source), video_id, f'Checking {height}p url', errnote=False):
formats.append({
'url': source,
'format_id':... | 'url': 'https://www.vidlii.com/embed?v=tJluaH4BJ3v&a=0',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(
'https://www.vidlii.com/watch?v=%s' % video_id, video_id)
formats = []
... | @@ -45,10 +64,26 @@ def _real_extract(self, url):
webpage = self._download_webpage(
'https://www.vidlii.com/watch?v=%s' % video_id, video_id)
-
- video_url = self._search_regex(
- r'src\s*:\s*(["\'])(?P<url>(?:https?://)?(?:(?!\1).)+)\1', webpage,
- 'video url', grou... | yt_dlp/extractor/vidlii.py | 26 | Python | 0.786 | suggestion | 398 | 51 | 51 | false | [VidLii] Add 720p support | 1,681 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mrpapersonic |
'twitter:image', webpage, default=None)
if not thumbnail:
thumbnail_path = self._search_regex(
r'img\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
'thumbnail', fatal=False, group='url')
if thumbnail_path:
thumbnail = urljoin(u... | why search-replace the whole webpage? Isnt this enough?
```suggestion
view_count = str_to_int(self._search_regex(
(r'<strong>([,0-9]+)</strong> views',
r'Views\s*:\s*<strong>([,0-9]+)</strong>'),
webpage, 'view count', fatal=False))
``` | 'thumbnail', fatal=False, group='url')
if thumbnail_path:
thumbnail = urljoin(url, thumbnail_path)
uploader = self._search_regex(
r'<div[^>]+class=["\']wt_person[^>]+>\s*<a[^>]+\bhref=["\']/user/[^>]+>([^<]+)',
webpage, 'uploader', fatal=False... | @@ -85,7 +120,7 @@ def _real_extract(self, url):
view_count = int_or_none(self._search_regex(
(r'<strong>(\d+)</strong> views',
r'Views\s*:\s*<strong>(\d+)</strong>'),
- webpage, 'view count', fatal=False))
+ webpage.replace(",", ""), 'view count', fatal=False)) | yt_dlp/extractor/vidlii.py | 26 | Python | 0.857 | question | 287 | 51 | 51 | false | [VidLii] Add 720p support | 1,681 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mrpapersonic |
import random
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
try_get,
unescapeHTML,
url_or_none,
)
class RedditIE(InfoExtractor):
_VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com/r/(?P<slug>[^/]+/comments/(?P<id>[^/?... | Better not to change id if possible. This will break archives | import random
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
try_get,
unescapeHTML,
url_or_none,
traverse_obj
)
class RedditIE(InfoExtractor):
_VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com/r/(?P<slug>[^/]+/com... | @@ -12,44 +12,11 @@
class RedditIE(InfoExtractor):
- _VALID_URL = r'https?://v\.redd\.it/(?P<id>[^/?#&]+)'
- _TEST = {
- # from https://www.reddit.com/r/videos/comments/6rrwyj/that_small_heart_attack/
- 'url': 'https://v.redd.it/zv89llsvexdz',
- 'md5': '0a070c53eba7ec4534d95a5a1259e253',... | yt_dlp/extractor/reddit.py | 19 | Python | 0.286 | bug | 61 | 44 | 44 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
thumbnails = []
def add_thumbnail(src):
if not isinstance(src, dict):
return
thumbnail_url = url_or_none(src.get('url'))
if not thumbnail_url:
return
thumbnails.append({
'url': unescapeHTML(thumbnail_url),
... | url and formats shouldnt both be set | 'dislike_count': int_or_none(data.get('downs')),
'comment_count': int_or_none(data.get('num_comments')),
'age_limit': age_limit,
}
# Check if media is hosted on reddit:
reddit_video = traverse_obj(data, (('media', 'secure_media'), 'reddit_video'), get_all=Fal... | @@ -147,19 +144,42 @@ def add_thumbnail(src):
for resolution in resolutions:
add_thumbnail(resolution)
- return {
- '_type': 'url_transparent',
+ info = {
+ 'id': video_id,
'url': video_url, | yt_dlp/extractor/reddit.py | 26 | Python | 0.143 | style | 36 | 51 | 45 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
}, {
# imgur
'url': 'https://www.reddit.com/r/MadeMeSmile/comments/6t7wi5/wait_for_it/',
'only_matching': True,
}, {
# imgur @ old reddit
'url': 'https://old.reddit.com/r/MadeMeSmile/comments/6t7wi5/wait_for_it/',
'only_matching': True,
}, {
# streamab... | ```suggestion
@staticmethod
``` | 'only_matching': True,
}, {
# imgur
'url': 'https://www.reddit.com/r/MadeMeSmile/comments/6t7wi5/wait_for_it/',
'only_matching': True,
}, {
# imgur @ old reddit
'url': 'https://old.reddit.com/r/MadeMeSmile/comments/6t7wi5/wait_for_it/',
'only_matching': Tr... | @@ -94,7 +61,7 @@ class RedditRIE(InfoExtractor):
'only_matching': True,
}]
- @staticmethod
+ @ staticmethod | yt_dlp/extractor/reddit.py | 26 | Python | 0.429 | suggestion | 37 | 51 | 51 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
if isinstance(resolutions, list):
for resolution in resolutions:
add_thumbnail(resolution)
info = {
'id': video_id,
'url': video_url,
'title': data.get('title'),
'thumbnails': thumbnails,
'timestamp': fl... | this code looks weird. Not sure how to make it better though 🤔 | resolutions = image.get('resolutions')
if isinstance(resolutions, list):
for resolution in resolutions:
add_thumbnail(resolution)
info = {
'title': data.get('title'),
'thumbnails': thumbnails,
'timestamp': float_or_... | @@ -147,19 +114,42 @@ def add_thumbnail(src):
for resolution in resolutions:
add_thumbnail(resolution)
- return {
- '_type': 'url_transparent',
+ info = {
+ 'id': video_id,
'url': video_url,
'title': data.get('title'),... | yt_dlp/extractor/reddit.py | 26 | Python | 0.286 | suggestion | 63 | 44 | 51 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
# Check if media is hosted on reddit:
reddit_video = try_get(data, lambda x: x['media']['reddit_video'])
if reddit_video:
playlist_urls = [
try_get(reddit_video, lambda x: unescapeHTML(x[y])) for y in ('dash_url', 'hls_url')
]
dash_playlist_ur... | something like this is more readable imo
```suggestion
return {
**info,
'formats': formats,
'duration': int_or_none(reddit_video.get('duration')),
})
return {
**info,
'_type': 'url_transparent',
... | reddit_video = traverse_obj(data, (('media', 'secure_media'), 'reddit_video'), get_all=False)
if reddit_video:
playlist_urls = [
try_get(reddit_video, lambda x: unescapeHTML(x[y]))
for y in ('dash_url', 'hls_url')
]
# Update video_id
... | @@ -147,19 +114,42 @@ def add_thumbnail(src):
for resolution in resolutions:
add_thumbnail(resolution)
- return {
- '_type': 'url_transparent',
+ info = {
+ 'id': video_id,
'url': video_url,
'title': data.get('title'),... | yt_dlp/extractor/reddit.py | 26 | Python | 0.929 | suggestion | 358 | 27 | 39 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
for image in try_get(data, lambda x: x['preview']['images']) or []:
if not isinstance(image, dict):
continue
add_thumbnail(image.get('source'))
resolutions = image.get('resolutions')
if isinstance(resolutions, list):
for resolution ... | btw, `traverse_obj` can be used to simplify this
or just
```suggestion
reddit_video = traverse_obj(data, (('media', 'secure_media'), 'reddit_video'), get_all=False)
``` |
for image in try_get(data, lambda x: x['preview']['images']) or []:
if not isinstance(image, dict):
continue
add_thumbnail(image.get('source'))
resolutions = image.get('resolutions')
if isinstance(resolutions, list):
for resolution... | @@ -147,19 +114,48 @@ def add_thumbnail(src):
for resolution in resolutions:
add_thumbnail(resolution)
- return {
- '_type': 'url_transparent',
- 'url': video_url,
+ info = {
+ 'id': video_id,
'title': data.get('title'),... | yt_dlp/extractor/reddit.py | 26 | Python | 0.786 | refactor | 182 | 51 | 51 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
playlist_urls = [
try_get(reddit_video, lambda x: unescapeHTML(x[y]))
for y in ('dash_url', 'hls_url')
]
# Update video_id
video_id = self._search_regex(
r'https?://v\.redd\.it/(?P<id>[^/?#&]+)', reddit_video['fallback_url'... | maybe the original id can be returned as `display_id`? just a thought | for y in ('dash_url', 'hls_url')
]
# Update video_id
display_id = video_id
video_id = self._search_regex(
r'https?://v\.redd\.it/(?P<id>[^/?#&]+)', reddit_video['fallback_url'],
'video_id', default=display_id)
... | @@ -147,19 +114,54 @@ def add_thumbnail(src):
for resolution in resolutions:
add_thumbnail(resolution)
- return {
- '_type': 'url_transparent',
- 'url': video_url,
+ info = {
'title': data.get('title'),
'thumbnails': t... | yt_dlp/extractor/reddit.py | 26 | Python | 0.357 | suggestion | 69 | 35 | 35 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
video_id = self._search_regex(
r'https?://v\.redd\.it/(?P<id>[^/?#&]+)', reddit_video['fallback_url'],
'video_id', default=display_id)
dash_playlist_url = playlist_urls[0] or f'https://v.redd.it/{video_id}/DASHPlaylist.mpd'
hls_playlist_url = playlist... | ```suggestion
'display_id': video_id,
```
I forgot about this. `url_transparent`/`url` should return `id` only when it's known to be same as the final id. Hence why the original code wasnt returning id | video_id = self._search_regex(
r'https?://v\.redd\.it/(?P<id>[^/?#&]+)', reddit_video['fallback_url'],
'video_id', default=display_id)
dash_playlist_url = playlist_urls[0] or f'https://v.redd.it/{video_id}/DASHPlaylist.mpd'
hls_playlist_url = playlist... | @@ -147,19 +115,53 @@ def add_thumbnail(src):
for resolution in resolutions:
add_thumbnail(resolution)
- return {
- '_type': 'url_transparent',
- 'url': video_url,
+ info = {
'title': data.get('title'),
'thumbnails': t... | yt_dlp/extractor/reddit.py | 26 | Python | 0.857 | suggestion | 216 | 30 | 30 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
'comment_count': int_or_none(data.get('num_comments')),
'age_limit': age_limit,
}
# Check if media is hosted on reddit:
reddit_video = traverse_obj(data, (('media', 'secure_media'), 'reddit_video'), get_all=False)
if reddit_video:
playlist_urls = [
... | ```suggestion
formats = self._extract_m3u8_formats(
hls_playlist_url, display_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)
formats.extend(self._extract_mpd_formats(
dash_playlist_url, display_id, mpd_id='dash', fatal=Fa... | 'comment_count': int_or_none(data.get('num_comments')),
'age_limit': age_limit,
}
# Check if media is hosted on reddit:
reddit_video = traverse_obj(data, (('media', 'secure_media'), 'reddit_video'), get_all=False)
if reddit_video:
playlist_urls = [
... | @@ -147,19 +115,53 @@ def add_thumbnail(src):
for resolution in resolutions:
add_thumbnail(resolution)
- return {
- '_type': 'url_transparent',
- 'url': video_url,
+ info = {
'title': data.get('title'),
'thumbnails': t... | yt_dlp/extractor/reddit.py | 26 | Python | 0.857 | refactor | 330 | 44 | 44 | false | [Reddit] Add support for 1080p videos | 1,682 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | xenova |
# coding: utf-8
from __future__ import unicode_literals
import json
import time
from urllib.error import HTTPError
from .common import InfoExtractor
from ..compat import compat_str, compat_urllib_parse_unquote, compat_urllib_parse_quote, compat_urllib_request
from ..utils import (
ExtractorError,
parse_iso860... | split it to multiline. You can also drop a lot of these since we only support py3.6+ now (see last part of compat.py) | # coding: utf-8
from __future__ import unicode_literals
import itertools
import json
import time
import urllib
from ..utils import (
ExtractorError,
parse_iso8601,
try_get,
)
from .common import InfoExtractor
class NebulaBaseIE(InfoExtractor):
_NETRC_MACHINE = 'watchnebula'
_nebula_api_token = ... | @@ -6,92 +6,26 @@
from urllib.error import HTTPError
from .common import InfoExtractor
-from ..compat import compat_str, compat_urllib_parse_unquote, compat_urllib_parse_quote
+from ..compat import compat_str, compat_urllib_parse_unquote, compat_urllib_parse_quote, compat_urllib_request | yt_dlp/extractor/nebula.py | 9 | Python | 0.357 | suggestion | 117 | 34 | 34 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
self.raise_login_required()
# save nebula token as cookie
self._set_cookie(
'nebula.app', 'nebula-auth',
compat_urllib_parse_quote(
json.dumps({
"apiToken": response["key"],
"isLoggingIn": False,
... | ```suggestion
authorization = f'Token {self._nebula_api_token}' if auth_type == 'api' else f'Bearer {self._nebula_bearer_token}'
return self._download_json(
url, video_id, note=note, headers={'Authorization': authorization},
data=b'' if method == 'POST' else None)
``` | self.raise_login_required()
# save nebula token as cookie
self._set_cookie(
'nebula.app', 'nebula-auth',
urllib.parse.quote(
json.dumps({
"apiToken": response["key"],
"isLoggingIn": False,
"i... | @@ -120,50 +54,25 @@ def _retrieve_nebula_auth(self):
return response['key']
- def _retrieve_zype_api_key(self, page_url, display_id):
- """
- Retrieves the Zype API key
- """
-
- # Find the js that has the API key from the webpage and download it
- webpage = self._dow... | yt_dlp/extractor/nebula.py | 26 | Python | 0.929 | security | 313 | 51 | 51 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
'channel_url': 'https://nebula.app/{channel_slug}'.format(channel_slug=episode['channel_slug']),
'uploader': episode['channel_title'],
'uploader_id': episode['channel_slug'],
'uploader_url': 'https://nebula.app/{channel_slug}'.format(channel_slug=episode['channel_slug']),... | I think it makes sense to move these comments to the docstrings of these functions instead | 'Unable to extract Zype access token from Nebula API authentication endpoint. '
'Open an arbitrary video in a browser with this account to generate a token',
expected=True)
raise ExtractorError('Unable to extract Zype access token from Nebula API a... | @@ -195,44 +128,156 @@ def _real_initialize(self):
if nebula_cookie:
self.to_screen('Authenticating to Nebula with token from cookie jar')
nebula_cookie_value = compat_urllib_parse_unquote(nebula_cookie.value)
- self._nebula_token = self._parse_json(nebula_cookie_value, Non... | yt_dlp/extractor/nebula.py | 26 | Python | 0.286 | suggestion | 90 | 51 | 51 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
# get a Zype access token which is required to access video streams (for us: to generate video URLs)
self._zype_access_token = self._fetch_zype_access_token()
class NebulaIE(NebulaBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:watchnebula\.com|nebula\.app)/videos/(?P<id>[-\w]+)'
_TESTS = [
... | We don't run download tests in GHA anymore. So you can remove the skip. Anyone running this test will be already aware that creds are needed | 'duration': episode['duration'],
'channel': episode['channel_title'],
'channel_id': channel_slug,
'channel_url': f'https://nebula.app/{channel_slug}',
'uploader': episode['channel_title'],
'uploader_id': channel_slug,
'uploader_url': f'... | @@ -195,44 +128,156 @@ def _real_initialize(self):
if nebula_cookie:
self.to_screen('Authenticating to Nebula with token from cookie jar')
nebula_cookie_value = compat_urllib_parse_unquote(nebula_cookie.value)
- self._nebula_token = self._parse_json(nebula_cookie_value, Non... | yt_dlp/extractor/nebula.py | 26 | Python | 0.429 | suggestion | 140 | 51 | 51 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
'md5': '8c7d272910eea320f6f8e6d3084eecf5',
'info_dict': {
'id': '5e779ebdd157bc0001d1c75a',
'ext': 'mp4',
'title': 'Episode 1: The Draw',
'description': r'contains:There’s free money on offer… if the players can all work together.',... | u can use f-strings. Same elsewhere too | 'description': r're:^In this episode we explore the unsung heroes of D-Day, the landing craft.',
'upload_date': '20200327',
'timestamp': 1585348140,
'channel': 'Real Engineering',
'channel_id': 'realengineering',
'uploader':... | @@ -195,44 +128,156 @@ def _real_initialize(self):
if nebula_cookie:
self.to_screen('Authenticating to Nebula with token from cookie jar')
nebula_cookie_value = compat_urllib_parse_unquote(nebula_cookie.value)
- self._nebula_token = self._parse_json(nebula_cookie_value, Non... | yt_dlp/extractor/nebula.py | 26 | Python | 0.143 | suggestion | 39 | 51 | 51 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
'params': {
'usenetrc': True,
},
'skip': 'All Nebula content requires authentication',
},
{
'url': 'https://watchnebula.com/videos/money-episode-1-the-draw',
'only_matching': True,
},
]
def _fetch_video_metadata... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?(?:watchnebula\.com|nebula\.app)/(?P<id>[-\w]+)/?(?:[?#]|$)'
```
should fix the tests | 'url': 'https://nebula.app/videos/money-episode-1-the-draw',
'md5': '8c7d272910eea320f6f8e6d3084eecf5',
'info_dict': {
'id': '5e779ebdd157bc0001d1c75a',
'ext': 'mp4',
'title': 'Episode 1: The Draw',
'description': r'cont... | @@ -195,44 +128,156 @@ def _real_initialize(self):
if nebula_cookie:
self.to_screen('Authenticating to Nebula with token from cookie jar')
nebula_cookie_value = compat_urllib_parse_unquote(nebula_cookie.value)
- self._nebula_token = self._parse_json(nebula_cookie_value, Non... | yt_dlp/extractor/nebula.py | 26 | Python | 0.786 | suggestion | 142 | 51 | 51 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
'playlist_mincount': 100,
'params': {
'usenetrc': True,
},
},
]
def _fetch_collection(self, collection_id):
page_nr = 1
next_url = f'https://content.watchnebula.com/video/channels/{collection_id}/'
episodes = []
channel... | It is better if the episode list is a generator. It makes sure only the necessary API calls are made when used with `--playlist-end` and similiar. But in this case, having to get the `channel_details` makes it a bit tricky. It can be done with itertools/LazyList, but it's hard for me to explain how over a review. Can u... | 'usenetrc': True,
},
}, {
'url': 'https://nebula.app/lindsayellis',
'info_dict': {
'id': 'lindsayellis',
'title': 'Lindsay Ellis',
'description': 'Enjoy these hottest of takes on Disney, Transformers, and Musical... | @@ -179,60 +113,173 @@ def _fetch_zype_access_token(self, video_id):
raise ExtractorError('Unable to extract Zype access token from Nebula API authentication endpoint')
return access_token
- def _extract_channel_title(self, video_meta):
- # TODO: Implement the API calls giving us the c... | yt_dlp/extractor/nebula.py | 26 | Python | 0.643 | question | 388 | 36 | 41 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
'url': 'https://nebula.app/lindsayellis',
'info_dict': {
'id': 'lindsayellis',
'title': 'Lindsay Ellis',
'description': 'Enjoy these hottest of takes on Disney, Transformers, and Musicals.',
},
'playlist_mincount': 100,
... | Oh, this actually turned out much simpler than I initially thought. I didn't think to extract one page in `_real_extract` and then pass that data inside 👍
I would write this function like this, but your implementation is fine as well. So I won't insist
```py
episodes = channel['episodes']['results']
... | 'id': 'tom-scott-presents-money',
'title': 'Tom Scott Presents: Money',
'description': 'Tom Scott hosts a series all about trust, negotiation and money.',
},
'playlist_count': 5,
'params': {
'usenetrc': True,
... | @@ -179,60 +113,171 @@ def _fetch_zype_access_token(self, video_id):
raise ExtractorError('Unable to extract Zype access token from Nebula API authentication endpoint')
return access_token
- def _extract_channel_title(self, video_meta):
- # TODO: Implement the API calls giving us the c... | yt_dlp/extractor/nebula.py | 26 | Python | 1 | security | 757 | 40 | 47 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
if nebula_cookie:
self.to_screen('Authenticating to Nebula with token from cookie jar')
nebula_cookie_value = urllib.parse.unquote(nebula_cookie.value)
nebula_api_token = self._parse_json(nebula_cookie_value, None).get('apiToken')
if nebula_api_token:
... | perhaps move the code to a `_login` function and then just call it from both _real_initialize and here. While it is effectively same, it should make the intend clearer (and also makes it simpler to add other things to _real_initialize if needed) | if nebula_cookie:
self.to_screen('Authenticating to Nebula with token from cookie jar')
nebula_cookie_value = urllib.parse.unquote(nebula_cookie.value)
nebula_api_token = self._parse_json(nebula_cookie_value, None).get('apiToken')
if nebula_api_token:
... | @@ -73,10 +73,23 @@ def _retrieve_nebula_api_token(self):
def _call_nebula_api(self, url, video_id=None, method='GET', auth_type='api', note=''):
assert method in ('GET', 'POST',)
assert auth_type in ('api', 'bearer',)
- authorization = f'Token {self._nebula_api_token}' if auth_type == 'ap... | yt_dlp/extractor/nebula.py | 26 | Python | 0.643 | suggestion | 245 | 51 | 51 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
nebula_api_token = self._parse_json(nebula_cookie_value, None).get('apiToken')
if nebula_api_token:
return nebula_api_token
return self._perform_nebula_auth()
def _call_nebula_api(self, url, video_id=None, method='GET', auth_type='api', note=''):
assert meth... | another way to do this could be:
```py
for retry in range(2):
try:
return self._download_json(...)
except ExtractorError as e:
if not retry and ... and e.cause.code in (401, 403):
self._login()
else:
raise
```
which is more consise, but maybe harder t... | nebula_api_token = self._parse_json(nebula_cookie_value, None).get('apiToken')
if nebula_api_token:
return nebula_api_token
return self._perform_nebula_auth()
def _call_nebula_api(self, url, video_id=None, method='GET', auth_type='api', note=''):
assert meth... | @@ -73,10 +73,23 @@ def _retrieve_nebula_api_token(self):
def _call_nebula_api(self, url, video_id=None, method='GET', auth_type='api', note=''):
assert method in ('GET', 'POST',)
assert auth_type in ('api', 'bearer',)
- authorization = f'Token {self._nebula_api_token}' if auth_type == 'ap... | yt_dlp/extractor/nebula.py | 26 | Python | 1 | refactor | 338 | 51 | 51 | false | [nebula] Rewrite extractor with channel support / fix #1690 "Unable to extract API key" | 1,694 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
def _extract_triforce_mgid(self, webpage, data_zone=None, video_id=None):
triforce_feed = self._parse_json(self._search_regex(
r'triforceManifestFeed\s*=\s*({.+?})\s*;\s*\n', webpage,
'triforce feed', default='{}'), video_id, fatal=False)
data_zone = self._search_regex(
... | is this necessary?
I can't think of a genuine case where this change is beneficial 🤔 |
def _extract_triforce_mgid(self, webpage, data_zone=None, video_id=None):
triforce_feed = self._parse_json(self._search_regex(
r'triforceManifestFeed\s*=\s*({.+?})\s*;\s*\n', webpage,
'triforce feed', default='{}'), video_id, fatal=False)
data_zone = self._search_regex(
... | @@ -278,7 +278,7 @@ def _extract_triforce_mgid(self, webpage, data_zone=None, video_id=None):
@staticmethod
def _extract_child_with_type(parent, t):
for c in parent['children']:
- if c.get('type') == t:
+ if c.get('type') and c.get('type') == t: | yt_dlp/extractor/mtv.py | 26 | Python | 0.286 | question | 87 | 51 | 51 | false | Update MTV Extractor | 1,713 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Sipherdrakon |
auth_string = connection.get('authString')
identifier = connection.get('identifier')
server = connection.get('server')
fmt.update({
'url': '%s://%s/%s?%s' % (protocol, server, ... | this is fine, but before returning, u need to cast it to a dict.
So it may be simpler to just use the `subtitles.setdefault(lang, [])` idiom | identifier = connection.get('identifier')
server = connection.get('server')
fmt.update({
'url': '%s://%s/%s?%s' % (protocol, server, application, auth_string),
'play_path':... | @@ -451,9 +452,10 @@ def _download_playlist(self, playlist_id):
playlist = self._download_json(
'http://www.bbc.co.uk/programmes/%s/playlist.json' % playlist_id,
playlist_id, 'Downloading playlist JSON')
+ formats = []
+ subtitles = defaultdict(list) | yt_dlp/extractor/bbc.py | 26 | Python | 0.714 | suggestion | 141 | 51 | 51 | false | [bbc] Get all available formats, deprioritize audio description | 1,717 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
playlist = self._download_json(
'http://www.bbc.co.uk/programmes/%s/playlist.json' % playlist_id,
playlist_id, 'Downloading playlist JSON')
version = playlist.get('defaultAvailableVersion')
if version:
smp_config = version['smpConfig']... | ```suggestion
subtitles.setdefault(tag, []).extend(subformats)
``` | playlist = self._download_json(
'http://www.bbc.co.uk/programmes/%s/playlist.json' % playlist_id,
playlist_id, 'Downloading playlist JSON')
formats = []
subtitles = {}
for version in playlist.get('allAvailableVersions', []):
... | @@ -463,8 +464,18 @@ def _download_playlist(self, playlist_id):
continue
programme_id = item.get('vpid')
duration = int_or_none(item.get('duration'))
- formats, subtitles = self._download_media_selector(programme_id)
- ... | yt_dlp/extractor/bbc.py | 26 | Python | 0.571 | suggestion | 92 | 51 | 51 | false | [bbc] Get all available formats, deprioritize audio description | 1,717 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
'id': '169662',
'display_id': 'd5winning-moment-eng-vs-ind-streaming-online-4th-test-india-tour-of-england-2021',
'ext': 'mp4',
'title': 'Winning Moment: 4th Test, England vs India',
'thumbnail': 'https://aimages.willow.tv/ytThumbnails/6748_D5winning_moment.jp... | why trending_videos? Is this first one in this list always guarenteed to be the main video? | 'title': 'Winning Moment: 4th Test, England vs India',
'thumbnail': 'https://aimages.willow.tv/ytThumbnails/6748_D5winning_moment.jpg',
'duration': 233,
'timestamp': 1630947954,
'upload_date': '20210906',
'location': 'Kennington Oval, London',
... | @@ -0,0 +1,64 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..compat import compat_str
+from ..utils import ExtractorError
+from .common import InfoExtractor
+
+
+class WillowIE(InfoExtractor):
+ _VALID_URL = r'https?://(www\.)?willow\.tv/videos/(?P<id>[0-9a-z-_]+)'
+ _GEO_COUNTRIES = ['US'... | yt_dlp/extractor/willow.py | 26 | Python | 0.214 | question | 91 | 50 | 44 | false | [willow] new extractor | 1,723 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | aarubui |
r'var\s+data_js\s*=\s*JSON\.parse\(\'(.+)\'\)', webpage,
'data_js'), video_id)
videos = video_data.get('trending_videos') or []
for v in videos:
m3u8_url = v.get('secureurl')
if m3u8_url:
formats = self._extract_m3u8_formats(m3u8_url, vid... | ```suggestion
video = next((v for v in video_data.get('trending_videos') or []
if v.get('secureurl')), None)
if not video:
raise ExtractorError('No videos found')
formats = self._extract_m3u8_formats(video['secureurl'], video_id, 'mp4')
self._s... | # coding: utf-8
from ..utils import ExtractorError
from .common import InfoExtractor
class WillowIE(InfoExtractor):
_VALID_URL = r'https?://(www\.)?willow\.tv/videos/(?P<id>[0-9a-z-_]+)'
_GEO_COUNTRIES = ['US']
_TESTS = [{
'url': 'http://willow.tv/videos/d5winning-moment-eng-vs-ind-streaming-onli... | @@ -0,0 +1,64 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..compat import compat_str
+from ..utils import ExtractorError
+from .common import InfoExtractor
+
+
+class WillowIE(InfoExtractor):
+ _VALID_URL = r'https?://(www\.)?willow\.tv/videos/(?P<id>[0-9a-z-_]+)'
+ _GEO_COUNTRIES = ['US'... | yt_dlp/extractor/willow.py | 26 | Python | 1 | refactor | 949 | 27 | 59 | false | [willow] new extractor | 1,723 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | aarubui |
# coding: utf-8
from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601
class StreamFFIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
_API_URL = 'https://streamff.com/api'
_TESTS = [{
'url': 'https://streamff.com/v/55cc94',
... | just a suggestion (it's not needed per say tbh)
But i personally would have kept it same as all other extractors
```suggestion
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601
``` | # coding: utf-8
from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601
class StreamFFIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
_TESTS = [{
'url': 'https://streamff.com/v/55cc94',
'md5': '8745a67bb5e5c570738efe798382637... | @@ -0,0 +1,46 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import int_or_none, parse_iso8601 | yt_dlp/extractor/streamff.py | 3 | Python | 0.857 | refactor | 277 | 28 | 28 | false | Streamff extractor | 1,736 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | cntrl-s |
# coding: utf-8
from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601
class StreamFFIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
_API_URL = 'https://streamff.com/api'
_TESTS = [{
'url': 'https://streamff.com/v/55cc94',
... | only used once so remove this from here | # coding: utf-8
from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601
class StreamFFIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
_TESTS = [{
'url': 'https://streamff.com/v/55cc94',
'md5': '8745a67bb5e5c570738efe798382637... | @@ -0,0 +1,46 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import int_or_none, parse_iso8601
+
+
+class StreamFFIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
+ _API_URL = 'https://streamff.com/api' | yt_dlp/extractor/streamff.py | 8 | Python | 0.143 | refactor | 39 | 33 | 32 | false | Streamff extractor | 1,736 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | cntrl-s |
'url': 'https://streamff.com/v/55cc94',
'md5': '8745a67bb5e5c570738efe7983826370',
'info_dict': {
'id': '55cc94',
'ext': 'mp4',
'title': '55cc94',
'timestamp': 1634764643,
'upload_date': '20211020'
}
}]
def _real_extrac... | ```suggestion
json_data = self._download_json(f'https://streamff.com/api/videos/{video_id}', video_id)
``` | # coding: utf-8
from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601
class StreamFFIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
_TESTS = [{
'url': 'https://streamff.com/v/55cc94',
'md5': '8745a67bb5e5c570738efe798382637... | @@ -0,0 +1,46 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import int_or_none, parse_iso8601
+
+
+class StreamFFIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
+ _API_URL = 'https://streamff.com/api'
+
+ _TESTS = [{
+ 'url': 'https://s... | yt_dlp/extractor/streamff.py | 26 | Python | 0.714 | suggestion | 116 | 37 | 32 | false | Streamff extractor | 1,736 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | cntrl-s |
def _real_extract(self, url):
video_id = self._match_id(url)
api_path = f'/videos/{video_id}'
""""
{
'views': 94,
'uploaded': True,
'publicURl': '55cc94',
'date': '2021-10-20T21:17:23.887Z',
'name': '55cc94',
'... | ```suggestion
return {
'id': video_id,
'title': json_data.get('name') or video_id,
'url': 'https://streamff.com/%s' % json_data['videoLink'],
'view_count': int_or_none(json_data.get('views')),
'timestamp': parse_iso8601(json_data.get('date')),
... | # coding: utf-8
from .common import InfoExtractor
from ..utils import int_or_none, parse_iso8601
class StreamFFIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
_TESTS = [{
'url': 'https://streamff.com/v/55cc94',
'md5': '8745a67bb5e5c570738efe798382637... | @@ -0,0 +1,46 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import int_or_none, parse_iso8601
+
+
+class StreamFFIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
+ _API_URL = 'https://streamff.com/api'
+
+ _TESTS = [{
+ 'url': 'https://s... | yt_dlp/extractor/streamff.py | 26 | Python | 0.786 | suggestion | 333 | 27 | 32 | false | Streamff extractor | 1,736 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | cntrl-s |
'series': try_get(content, lambda x: x['Media']['Name']),
'tags': tags,
'categories': categories,
'duration': float_or_none(content_package.get('Duration')),
'formats': formats,
'thumbnails': thumbnails,
}
if content_package.get('H... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?cp24\.com/news/(?P<id>[^?#]+)'
```
and use this id for the webpage download message
and maybe also return as `display_id` | 'categories': categories,
'duration': float_or_none(content_package.get('Duration')),
'formats': formats,
'thumbnails': thumbnails,
}
if content_package.get('HasClosedCaptions'):
info['subtitles'] = {
'en': [{
... | @@ -99,3 +100,40 @@ def _real_extract(self, url):
}
return info
+
+
+class CPTwentyFourIE(InfoExtractor):
+ IE_NAME = 'cp24'
+ _GEO_COUNTRIES = ['CA']
+ _VALID_URL = r'https?://(?:www\.)?cp24\.com/news/.*' | yt_dlp/extractor/ninecninemedia.py | 26 | Python | 0.786 | suggestion | 177 | 51 | 51 | false | [CPTwentyFour] Add extractor | 1,769 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
}
return info
class CPTwentyFourIE(InfoExtractor):
IE_NAME = 'cp24'
_GEO_COUNTRIES = ['CA']
_VALID_URL = r'https?://(?:www\.)?cp24\.com/news/.*'
_TESTS = [{
'url': 'https://www.cp24.com/news/video-shows-atm-being-ripped-out-of-business-by-pickup-truck-driver-in-mississaug... | `duration_string` is auto-generated and shouldn't be tested | return info
class CPTwentyFourIE(InfoExtractor):
IE_NAME = 'cp24'
_GEO_COUNTRIES = ['CA']
_VALID_URL = r'https?://(?:www\.)?cp24\.com/news/(?P<id>[^?#]+)'
_TESTS = [{
'url': 'https://www.cp24.com/news/video-shows-atm-being-ripped-out-of-business-by-pickup-truck-driver-in-mississauga-1... | @@ -99,3 +100,40 @@ def _real_extract(self, url):
}
return info
+
+
+class CPTwentyFourIE(InfoExtractor):
+ IE_NAME = 'cp24'
+ _GEO_COUNTRIES = ['CA']
+ _VALID_URL = r'https?://(?:www\.)?cp24\.com/news/.*'
+
+ _TESTS = [{
+ 'url': 'https://www.cp24.com/news/video-shows-atm-bei... | yt_dlp/extractor/ninecninemedia.py | 26 | Python | 0.429 | suggestion | 59 | 41 | 36 | false | [CPTwentyFour] Add extractor | 1,769 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'id': '2328005',
'ext': 'mp4',
'title': 'WATCH: Truck rips ATM from Mississauga business',
'description': 'md5:cf7498480885f080a754389a2b2f7073',
'timestamp': 1637618377,
'episode_number': None,
'season': 'Season 0',
'season... | ```suggestion
video_id, destination = self._search_regex(
r'getAuthStates\("(?P<id>[^"]+)",\s?"(?P<destination>[^"]+)"\);',
webpage, 'video id and destination', group=('id', 'destination'))
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
parse_iso8601,
try_get,
)
class NineCNineMediaIE(InfoExtractor):
IE_NAME = '9c9media'
_GEO_COUNTRIES = ['CA']
_VALID_URL = r'9c9media:(?P<destination... | @@ -99,3 +100,40 @@ def _real_extract(self, url):
}
return info
+
+
+class CPTwentyFourIE(InfoExtractor):
+ IE_NAME = 'cp24'
+ _GEO_COUNTRIES = ['CA']
+ _VALID_URL = r'https?://(?:www\.)?cp24\.com/news/.*'
+
+ _TESTS = [{
+ 'url': 'https://www.cp24.com/news/video-shows-atm-bei... | yt_dlp/extractor/ninecninemedia.py | 26 | Python | 0.786 | security | 229 | 28 | 135 | false | [CPTwentyFour] Add extractor | 1,769 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
return {
'title': video_title,
'description': description,
'upload_date': upload_date,
'uploader': uploader,
'channel_id': channel_id,
'channel_url': channel_url,
'duration': duration,
'uploader_url': uploader_url,
... | If the thumbnail names are like youtube, you can instead copy what I did for youtube (see youtube.py#L2802-2817). Otherwise, nothing we can do but to depend on filesize. u can set `preference` to filesize in that case. | if uploader_mobj is not None:
uploader_id, uploader_url = uploader_mobj.group('uploader_id'), uploader_mobj.group('uploader_url')
else:
# @a6211d2
uploader_url = url_or_none(microformats.get('ownerProfileUrl'))
uploader_id = self._search_regex(
... | @@ -278,141 +281,377 @@ class YoutubeWebArchiveIE(InfoExtractor):
'info_dict': {
'id': 'aYAGB11YrSs',
'ext': 'webm',
- 'title': 'Team Fortress 2 - Sandviches!'
+ 'title': 'Team Fortress 2 - Sandviches!',
+ 'description': 'md5:49... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.643 | suggestion | 219 | 51 | 51 | false | [web.archive:youtube] Improve extractor | 1,785 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
# coding: utf-8
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
)
class RedGifsIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|thumbs2?)\.)?redgifs\.com/(?:watch/)?(?P<id>[^-/?#\.]+)'
_FORMATS = {
'gif': 250,
'sd': ... | imo should still be a class function | # coding: utf-8
import functools
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
OnDemandPagedList,
)
class RedGifsBaseInfoExtractor(InfoExtractor):
_FORMATS = {
'gif': 250,
'sd': 480... | @@ -0,0 +1,98 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..compat import compat_parse_qs
+from ..utils import ExtractorError, int_or_none
+
+
+def _parse_gif_entry(gif_data):
+ video_id = gif_data["id"]
+ title = " ".join(gif_data.get('tags') or [])
+ formats = [
+ {
+ "form... | yt_dlp/extractor/redgifs.py | 21 | Python | 0.143 | suggestion | 36 | 46 | 46 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Deer-Spangle |
'age_limit': 18,
}
}]
def _real_extract(self, url):
video_id = self._match_id(url).lower()
video_info = self._download_json(
'https://api.redgifs.com/v2/gifs/%s' % video_id,
video_id, 'Downloading video info')
if 'error' in video_info:
... | maybe try adding an example of this to the tests? it should also just paginate between all pages imo but not one to judge | 'ie_key': RedGifsIE.ie_key(),
'extractor': 'RedGifs',
'title': ' '.join(gif_data.get('tags') or []) or 'RedGifs',
'timestamp': int_or_none(gif_data.get('createDate')),
'uploader': gif_data.get('userName'),
'duration': int_or_none(gif_data.get('dura... | @@ -0,0 +1,98 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..compat import compat_parse_qs
+from ..utils import ExtractorError, int_or_none
+
+
+def _parse_gif_entry(gif_data):
+ video_id = gif_data["id"]
+ title = " ".join(gif_data.get('tags') or [])
+ formats = [
+ {
+ "form... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.429 | suggestion | 121 | 49 | 51 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Deer-Spangle |
aspect_ratio = try_get(gif, lambda x: orig_height / x['width'])
formats = []
for format_id, height in self._FORMATS.items():
video_url = urls.get(format_id)
if not video_url:
continue
height = min(orig_height, height or orig_height)
... | ```suggestion
description = f'Redgifs search for {tags}, ordered by {order}'
```
not a written rule, just something i noticed | return data
def _fetch_page(self, ep, video_id, query, page):
query['page'] = page + 1
data = self._call_api(
ep, video_id, query=query, note=f'Downloading JSON metadata page {page + 1}')
for entry in data['gifs']:
yield self._parse_gif_data(entry)
def ... | @@ -0,0 +1,98 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..compat import compat_parse_qs
+from ..utils import ExtractorError, int_or_none
+
+
+def _parse_gif_entry(gif_data):
+ video_id = gif_data["id"]
+ title = " ".join(gif_data.get('tags') or [])
+ formats = [
+ {
+ "form... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.714 | suggestion | 136 | 30 | 51 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Deer-Spangle |
video_id,
query=api_query
)
if 'error' in data:
raise ExtractorError(f'RedGifs said: {data["error"]}', expected=True)
return [self._parse_gif_data(entry) for entry in data['gifs']]
def _real_extract(self, url):
query_str = self._match_valid_url(u... | Since its inside if, no default is needed
```suggestion
page = query.get('page')[0]
``` | {
'url': 'https://www.redgifs.com/browse?type=g&order=latest&tags=Lesbian',
'info_dict': {
'id': 'type=g&order=latest&tags=Lesbian',
'title': 'Lesbian',
'description': 'RedGifs search for Lesbian, ordered by latest'
},
... | @@ -80,15 +75,110 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
+ webpage_url = f'https://redgifs.com/watch/{video_id}'
+
return {
'id': video_id,
- 'title': ' '.join(gif.get('tags') or []) or 'RedGifs',
- 'timestamp': int_or_n... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.714 | suggestion | 102 | 41 | 51 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
'uploader': gif_data.get('userName'),
'duration': int_or_none(gif_data.get('duration')),
'view_count': int_or_none(gif_data.get('views')),
'like_count': int_or_none(gif_data.get('likes')),
'categories': gif_data.get('tags') or [],
'webpage_url': we... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?redgifs\.com/browse\?(?P<query>[^#]+)'
``` | page = int_or_none(query.get('page', (None,))[0])
page_fetcher = functools.partial(
self._fetch_page, ep, item_id, self._prepare_api_query(query, fields))
return page_fetcher(page) if page else OnDemandPagedList(page_fetcher, self._PAGE_SIZE)
class RedGifsIE(RedGifsBaseInfoExtracto... | @@ -80,15 +75,110 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
+ webpage_url = f'https://redgifs.com/watch/{video_id}'
+
return {
'id': video_id,
- 'title': ' '.join(gif.get('tags') or []) or 'RedGifs',
- 'timestamp': int_or_n... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
for format_id, height in self._FORMATS.items():
video_url = urls.get(format_id)
if not video_url:
continue
height = min(orig_height, height or orig_height)
formats.append({
'url': video_url,
'format_id': format_id,
... | Since one extractor is directly retuning another's result, add `ie_key` and `extractor` as well | if 'error' in data:
raise ExtractorError(f'RedGifs said: {data["error"]}', expected=True, video_id=video_id)
return data
def _fetch_page(self, ep, video_id, query, page):
query['page'] = page + 1
data = self._call_api(
ep, video_id, query=query, note=f'Downlo... | @@ -80,15 +75,196 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
+ webpage_url = f'https://redgifs.com/watch/{video_id}'
+
return {
'id': video_id,
- 'title': ' '.join(gif.get('tags') or []) or 'RedGifs',
- 'timestamp': int_or_n... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.429 | refactor | 95 | 51 | 51 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
'url': 'https://www.redgifs.com/users/lamsinka89?order=best&type=g',
'info_dict': {
'id': 'lamsinka89?order=best&type=g',
'title': 'lamsinka89',
'description': 'RedGifs user lamsinka89'
},
'playlist_mincount': 100,
}... | ```suggestion
username, query_str = self._match_valid_url(url).group('username', 'query')
``` | # coding: utf-8
import functools
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
OnDemandPagedList,
)
class RedGifsBaseInfoExtractor(InfoExtractor):
_FORMATS = {
'gif': 250,
'sd': 480... | @@ -80,15 +75,196 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
+ webpage_url = f'https://redgifs.com/watch/{video_id}'
+
return {
'id': video_id,
- 'title': ' '.join(gif.get('tags') or []) or 'RedGifs',
- 'timestamp': int_or_n... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.786 | suggestion | 103 | 51 | 233 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
'order': order,
}
if query.get('type'):
api_query['type'] = query.get('type')[0]
if query.get('page'):
page = query.get('page', (1,))[0]
entries = self._fetch_page(query_str, api_query, page)
else:
entries = OnDemandPagedList(
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?redgifs\.com/users/(?P<username>[^/?#]+)(?:\?(?P<query>[^#]+))?'
``` |
def _real_extract(self, url):
query_str = self._match_valid_url(url).group('query')
query = compat_parse_qs(query_str)
if not query.get('tags'):
raise ExtractorError('Invalid query tags', expected=True)
tags = query.get('tags')[0]
order = query.get('order', ('tr... | @@ -80,15 +75,196 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
+ webpage_url = f'https://redgifs.com/watch/{video_id}'
+
return {
'id': video_id,
- 'title': ' '.join(gif.get('tags') or []) or 'RedGifs',
- 'timestamp': int_or_n... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.786 | suggestion | 122 | 51 | 51 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
def _real_extract(self, url):
match = self._match_valid_url(url)
username = match.group('username')
query_str = match.group('query')
playlist_id = username
if query_str:
playlist_id = f'{username}?{query_str}'
description = f'RedGifs user {username}'
... | lots of redundant code
```suggestion
query = compat_parse_qs(query_str or '')
api_query = {
'order': query.get('order', ('recent',))[0],
}
if query.get('type'):
api_query['type'] = query.get('type')[0]
page = query.get('page', (None,))[0]
... | # coding: utf-8
import functools
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
OnDemandPagedList,
)
class RedGifsBaseInfoExtractor(InfoExtractor):
_FORMATS = {
'gif': 250,
'sd': 480... | @@ -80,15 +75,196 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
+ webpage_url = f'https://redgifs.com/watch/{video_id}'
+
return {
'id': video_id,
- 'title': ' '.join(gif.get('tags') or []) or 'RedGifs',
- 'timestamp': int_or_n... | yt_dlp/extractor/redgifs.py | 26 | Python | 1 | suggestion | 409 | 40 | 233 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
if query_str:
playlist_id = f'{username}?{query_str}'
description = f'RedGifs user {username}'
if not username:
raise ExtractorError('Invalid username', expected=True)
api_query = {
'order': 'recent',
}
page = None
if query_st... | this pattern is repeating in both extractors. Maybe make it a method | # coding: utf-8
import functools
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
OnDemandPagedList,
)
class RedGifsBaseInfoExtractor(InfoExtractor):
_FORMATS = {
'gif': 250,
'sd': 480... | @@ -80,15 +75,196 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
+ webpage_url = f'https://redgifs.com/watch/{video_id}'
+
return {
'id': video_id,
- 'title': ' '.join(gif.get('tags') or []) or 'RedGifs',
- 'timestamp': int_or_n... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.286 | refactor | 68 | 34 | 233 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
'title': ' '.join(gif_data.get('tags') or []) or 'RedGifs',
'timestamp': int_or_none(gif_data.get('createDate')),
'uploader': gif_data.get('userName'),
'duration': int_or_none(gif_data.get('duration')),
'view_count': int_or_none(gif_data.get('views')),
... | Do not subclass from another user-facing extractor - that's just asking for trouble. Make a `RedGifsBaseInfoExtractor` from which all of these can be subclassed |
def _paged_entries(self, ep, item_id, query, fields):
page = int_or_none(query.get('page', (None,))[0])
page_fetcher = functools.partial(
self._fetch_page, ep, item_id, self._prepare_api_query(query, fields))
return page_fetcher(page) if page else OnDemandPagedList(page_fetcher,... | @@ -80,15 +75,196 @@ def _real_extract(self, url):
})
self._sort_formats(formats)
+ webpage_url = f'https://redgifs.com/watch/{video_id}'
+
return {
'id': video_id,
- 'title': ' '.join(gif.get('tags') or []) or 'RedGifs',
- 'timestamp': int_or_n... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.571 | refactor | 160 | 51 | 51 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
video_id = gif_data.get('id')
quality = qualities(tuple(self._FORMATS.keys()))
orig_height = int_or_none(gif_data.get('height'))
aspect_ratio = try_get(gif_data, lambda x: orig_height / x['width'])
formats = []
for format_id, height in self._FORMATS.items():
... | ```suggestion
return {
'id': video_id,
'webpage_url': f'https://redgifs.com/watch/{video_id}',
``` | video_id = gif_data.get('id')
quality = qualities(tuple(self._FORMATS.keys()))
orig_height = int_or_none(gif_data.get('height'))
aspect_ratio = try_get(gif_data, lambda x: orig_height / x['width'])
formats = []
for format_id, height in self._FORMATS.items():
... | @@ -1,21 +1,96 @@
# coding: utf-8
+import functools
from .common import InfoExtractor
+from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
+ OnDemandPagedList,
)
-class RedGifsIE(InfoExtractor):
- _VALID_URL = r'https?://(?:(?:w... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.714 | suggestion | 134 | 51 | 51 | false | [RedGifsSearch] Add RedGifs search (and user) extractor | 1,808 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Deer-Spangle |
# coding: utf-8
from .common import InfoExtractor
class CableAVIE(InfoExtractor):
_VALID_URL = r'https://cableav\.tv/(?P<id>[a-zA-Z0-9]+)/'
_TESTS = [{
'url': 'https://cableav.tv/lS4iR9lWjN8/',
'md5': '7e3fe5e49d61c4233b7f5b0f69b15e18',
'info_dict': {
'id': 'lS4iR9lWjN8',
... | ```suggestion
_VALID_URL = r'https://cableav\.tv/(?P<id>[a-zA-Z0-9]+)'
``` | # coding: utf-8
from .common import InfoExtractor
class CableAVIE(InfoExtractor):
_VALID_URL = r'https://cableav\.tv/(?P<id>[a-zA-Z0-9]+)'
_TESTS = [{
'url': 'https://cableav.tv/lS4iR9lWjN8/',
'md5': '7e3fe5e49d61c4233b7f5b0f69b15e18',
'info_dict': {
'id': 'lS4iR9lWjN8',
... | @@ -0,0 +1,35 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class CableAVIE(InfoExtractor):
+ _VALID_URL = r'https://cableav\.tv/(?P<id>[a-zA-Z0-9]+)/' | yt_dlp/extractor/cableav.py | 6 | Python | 0.571 | suggestion | 80 | 31 | 31 | false | Add CableAV extractor | 1,842 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | j54vc1bk |
)
class TrueIDIE(InfoExtractor):
_VALID_URL = r'https?://(?P<domain>vn\.trueid\.net|trueid\.(?:id|ph))/(?:movie|series/[^/]+)/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://trueid.id/movie/XYNlDOZZJzL6/pengabdi-setan/',
'md5': '2552c7535125885901f1a2a4bcf32ca3',
'info_dict': {
... | ```py
'params': {
'format': 'bv'
}
```
is not needed in tests anymore. I have changed tests' default params to handle this automatically | )
class TrueIDIE(InfoExtractor):
_VALID_URL = r'https?://(?P<domain>vn\.trueid\.net|trueid\.(?:id|ph))/(?:movie|series/[^/]+)/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://trueid.id/movie/XYNlDOZZJzL6/pengabdi-setan/',
'md5': '2552c7535125885901f1a2a4bcf32ca3',
'info_dict': {
... | @@ -0,0 +1,150 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..compat import compat_HTTPError
+from ..utils import (
+ determine_ext,
+ ExtractorError,
+ int_or_none,
+ parse_age_limit,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none
+)
+... | yt_dlp/extractor/trueid.py | 26 | Python | 0.929 | style | 171 | 51 | 51 | false | [TrueID] Add extractor | 1,847 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
'ext': 'mp4',
'title': 'Haikyu!!: Vua Bóng Chuyền Phần 1 - Tập 1',
'description': 'md5:0374dd44d247799169449ee30cca963a',
'timestamp': 1629270901,
'categories': ['Anime', 'Phim Hài', 'Phim Học Đường', 'Phim Thể Thao', 'Shounen'],
'release_timestamp... | ```suggestion
domain, video_id = self._match_valid_url(url).group('domain', 'id')
``` | 'categories': ['Anime', 'Phim Hài', 'Phim Học Đường', 'Phim Thể Thao', 'Shounen'],
'release_timestamp': 1629270720,
'release_year': 2014,
'age_limit': 13,
'thumbnail': 'https://cms.dmpcdn.com/movie/2021/09/28/b6e7ec00-2039-11ec-8436-974544e5841f_webp_original.... | @@ -0,0 +1,150 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..compat import compat_HTTPError
+from ..utils import (
+ determine_ext,
+ ExtractorError,
+ int_or_none,
+ parse_age_limit,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none
+)
+... | yt_dlp/extractor/trueid.py | 26 | Python | 0.571 | suggestion | 95 | 51 | 51 | false | [TrueID] Add extractor | 1,847 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
'only_matching': True,
}]
_CUSTOM_RATINGS = {
'PG': 7,
}
def _real_extract(self, url):
match = self._match_valid_url(url).groupdict()
domain, video_id = match['domain'], match['id']
webpage = self._download_webpage(url, video_id)
initial_data = traverse_o... | ```suggestion
if not isinstance(e.cause, compat_HTTPError):
raise e
errmsg = self._parse_json(e.cause.read().decode(), video_id)['meta']['message']
if 'country' in errmsg:
self.raise_geo_restricted(
errmsg, [initial_data['disp... | def _real_extract(self, url):
domain, video_id = self._match_valid_url(url).group('domain', 'id')
webpage = self._download_webpage(url, video_id)
initial_data = traverse_obj(
self._search_nextjs_data(webpage, video_id, fatal=False), ('props', 'pageProps', 'initialContentData'), d... | @@ -0,0 +1,150 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..compat import compat_HTTPError
+from ..utils import (
+ determine_ext,
+ ExtractorError,
+ int_or_none,
+ parse_age_limit,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none
+)
+... | yt_dlp/extractor/trueid.py | 26 | Python | 1 | suggestion | 480 | 51 | 51 | false | [TrueID] Add extractor | 1,847 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
errmsg = self._parse_json(e.cause.read().decode(), video_id)['meta']['message']
if 'country' in errmsg:
self.raise_geo_restricted(
errmsg, [initial_data['display_country']] if initial_data.get('display_country') else None, True)
... | ```suggestion
thumbnails = [
{'id': thumb_key, 'url': thumb_url}
for thumb_key, thumb_url in (initial_data.get('thumb_list') or {}).items()
if url_or_none(thumb_url)]
``` | stream_ext = determine_ext(stream_url)
if stream_ext == 'm3u8':
formats, subs = self._extract_m3u8_formats_and_subtitles(stream_url, video_id, 'mp4')
elif stream_ext == 'mpd':
formats, subs = self._extract_mpd_formats_and_subtitles(stream_url, video_id... | @@ -0,0 +1,153 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..compat import compat_HTTPError
+from ..utils import (
+ determine_ext,
+ ExtractorError,
+ int_or_none,
+ parse_age_limit,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none
+)
+... | yt_dlp/extractor/trueid.py | 26 | Python | 0.786 | suggestion | 219 | 50 | 36 | false | [TrueID] Add extractor | 1,847 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
from ..utils import (
ExtractorError
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'md5': '57c04f65556ddbecf9697528274c3212',
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-... | Don't use print
There's to_screen func in common.py afair but more importantly printing this to screen is not needed imo | from ..utils import (
ExtractorError,
try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'p... | @@ -0,0 +1,57 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'md5': '57c04f65556ddbecf96975... | yt_dlp/extractor/gofile.py | 26 | Python | 0.429 | suggestion | 121 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Jertzukka |
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'md5': '57c04f65556ddbecf9697528274c3212',
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
'title': 'nuuh.mp4'
}
}]
def _real_extra... | declare this outside real_extract | _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bd... | @@ -0,0 +1,57 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'md5': '57c04f65556ddbecf96975... | yt_dlp/extractor/gofile.py | 26 | Python | 0.143 | refactor | 33 | 49 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Jertzukka |
'ext': 'mp4',
'title': 'nuuh.mp4'
}
}]
def _real_extract(self, url):
file_id = self._match_id(url)
# Create guest account
accountdata = self._download_json_handle('https://api.gofile.io/createAccount', 'Gofile', note='Getting a new guest account')
... | only return files that are videos and audio
if a link has none then raise no video file error | 'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
'title': 'nuuh'
}
}]
}, { # URL to test mixed file types
'url... | @@ -0,0 +1,57 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'md5': '57c04f65556ddbecf96975... | yt_dlp/extractor/gofile.py | 26 | Python | 0.357 | suggestion | 94 | 43 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Jertzukka |
# coding: utf-8
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'md5': '774879ad31bc62c23269da8bf490d025',
... | This format of tests is not correct AFAIK. You are returning a playlist but checking for a file. See 4channel on how to write tests for such cases. | # coding: utf-8
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
... | @@ -0,0 +1,55 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{ | yt_dlp/extractor/gofile.py | 11 | Python | 0.357 | style | 147 | 36 | 36 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Jertzukka |
# coding: utf-8
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'md5': '774879ad31bc62c23269da8bf490d025',
... | Try to see if u can cache this token so the request is not made for every url | # coding: utf-8
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
... | @@ -0,0 +1,55 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'md5': '774879ad... | yt_dlp/extractor/gofile.py | 26 | Python | 0.214 | performance | 77 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Jertzukka |
try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'md5': '774879ad31bc62c23269da8bf490d025',
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'f... | Use _download_json() if u are not using the handle | try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
... | @@ -0,0 +1,55 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'md5': '774879ad... | yt_dlp/extractor/gofile.py | 26 | Python | 0.429 | suggestion | 50 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Jertzukka |
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
... | move this to `_real_initialize`. That way if user gives `yt-dlp URL1 URL2`, the token is only generated once. Also, if user gives cookies, use that token instead of generating a new one
PS: This is what Ashish meant by "cache the token" | )
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
... | @@ -0,0 +1,65 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.643 | performance | 239 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
ExtractorError,
try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
... | these comments are redundant. the `note=Getting a new guest account` self-documents what is being done | ExtractorError,
try_get
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
... | @@ -0,0 +1,65 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.5 | suggestion | 102 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
'title': 'nuuh'
}
... | single quotes everywhere (except inside fstrings) | 'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
'title': 'nuuh'
}
... | @@ -0,0 +1,65 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.071 | suggestion | 49 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
accountToken = accountdata['data']['token']
# Get file list
requesturl = f'https://api.gofile.io/getContent?contentId={file_id}&token={accountToken}&websiteToken=websiteToken&cache=true'
filelist = self._download_json(requesturl, 'Gofile', note='Getting filelist')
status = file... | The only things we absolutely need are id, title, URL. The code must tolerate failure in getting the other fields. Use `.get`/`try_get` as necessary | }, { # URL to test no video/audio error
'url': 'https://gofile.io/d/aB03lZ',
'info_dict': {
'id': 'aB03lZ',
},
'playlist_count': 0,
'skip': 'No video/audio found at provided URL.',
}]
_TOKEN = None
def _real_initialize(self):
token = self._ge... | @@ -0,0 +1,65 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.571 | bug | 148 | 36 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
requesturl = f'https://api.gofile.io/getContent?contentId={file_id}&token={accountToken}&websiteToken=websiteToken&cache=true'
filelist = self._download_json(requesturl, 'Gofile', note='Getting filelist')
status = filelist['status']
if status != "ok":
raise ExtractorError('R... | same as above, this should be in `_real_initialize` | 'id': 'aB03lZ',
},
'playlist_count': 0,
'skip': 'No video/audio found at provided URL.',
}]
_TOKEN = None
def _real_initialize(self):
token = self._get_cookies('https://gofile.io/').get('accountToken')
if token:
self._TOKEN = token.value
... | @@ -0,0 +1,65 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.429 | suggestion | 51 | 33 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
status = filelist['status']
if status != 'ok':
raise ExtractorError('Received error from service, status: %s' % status, expected=True)
contents = try_get(filelist, lambda x: x['data']['contents'], dict)
foundfiles = False
for file in contents.values():
... | ```suggestion
raise ExtractorError('No video/audio found at provided URL.', expected=True)
```
This is a playlist. It doesn't make sense to raise_no_formats | 'info_dict': {
'id': 'aB03lZ',
},
'playlist_count': 0,
'skip': 'No video/audio found at provided URL.',
}]
_TOKEN = None
def _real_initialize(self):
token = self._get_cookies('https://gofile.io/').get('accountToken')
if token:
self._TO... | @@ -0,0 +1,75 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.929 | refactor | 171 | 44 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
'title': 'nuuh'
}
}]
}]
_TOKEN = None
def _entries(self, file_id):
# Get file list
requesturl = f'https://api.gofile.io/getCon... | Can u give an example of the `vnd.mts`? | 'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
'title': 'nuuh'
}
}]
}, { # URL to test mixed file types
'url': 'https://gofile.io/d/avt34h',
'info_dict': {
'id': 'avt34h'... | @@ -0,0 +1,75 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.214 | question | 39 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
)
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
... | snake_case your variables. `request_url`, not `requesturl` etc | )
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
... | @@ -0,0 +1,75 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.357 | style | 62 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
... | ```suggestion
file_list = self._download_json(
f'https://api.gofile.io/getContent?contentId={file_id}&token={self._TOKEN}&websiteToken=websiteToken&cache=true',
file_id, note='Getting filelist')
``` |
class GofileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
... | @@ -0,0 +1,75 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.786 | performance | 234 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
_TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'... | ```suggestion
raise ExtractorError(f'{self.IE_NAME} said: status {status}', expected=True)
``` | _TESTS = [{
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'... | @@ -0,0 +1,75 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.929 | refactor | 108 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
filetype, fileformat = file['mimetype'].split('/', 1)
if filetype != 'video' and filetype != 'audio' and fileformat != 'vnd.mts':
continue
foundfiles = True
filedata = {
'id': file['id'],
'title': file['name'].rsplit('.', ... | ```suggestion
accountdata = self._download_json('https://api.gofile.io/createAccount', None, note='Getting a new guest account')
``` | token = self._get_cookies('https://gofile.io/').get('accountToken')
if token:
self._TOKEN = token.value
return
account_data = self._download_json(
'https://api.gofile.io/createAccount', None, note='Getting a new guest account')
self._TOKEN = account_d... | @@ -0,0 +1,75 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.714 | suggestion | 142 | 35 | 43 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
'title': file['name'].rsplit('.', 1)[0],
'url': file['directLink'],
'filesize': file.get('size'),
'release_timestamp': file.get('createTime')
}
yield filedata
if not foundfiles:
self.raise_no_formats('No video/a... | ```suggestion
def _real_initialize(self):
token = self._get_cookies('https://gofile.io/').get('accountToken')
if token:
self._TOKEN = token.value
return
account_data = self._download_json(
'https://api.gofile.io/createAccount', None, note='Getti... | self._set_cookie('gofile.io', 'accountToken', self._TOKEN)
def _entries(self, file_id):
files = self._download_json(
f'https://api.gofile.io/getContent?contentId={file_id}&token={self._TOKEN}&websiteToken=websiteToken&cache=true',
'Gofile', note='Getting filelist')
... | @@ -0,0 +1,75 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 1 | performance | 1,783 | 27 | 35 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
'title': 'nuuh'
}
}]
}]
_TOKEN = None
def _real_initialize(s... | ```suggestion
def _real_initialize(self):
``` | 'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
'title': 'nuuh'
}
}]
}, { # URL to test mixed file types
'url... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.571 | suggestion | 51 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
... | ```suggestion
self._TOKEN = account_data['data']['token']
``` | 'url': 'https://gofile.io/d/AMZyDw',
'info_dict': {
'id': 'AMZyDw',
},
'playlist_mincount': 2,
'playlist': [{
'info_dict': {
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116,
'ext': 'mp4',
... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.571 | suggestion | 71 | 51 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
'title': 'nuuh'
}
}]
}]
_TOKEN = None
def _real_initialize(self):
token = self._get_cookies('https://gofile.io/').get('accountToken')
if token:
self._TOKEN = token.value
return
account_data = self._download_json(
... | ```suggestion
raise ExtractorError(f'{self.IE_NAME} said: status {status}', expected=True)
``` | 'title': 'nuuh'
}
}]
}, { # URL to test mixed file types
'url': 'https://gofile.io/d/avt34h',
'info_dict': {
'id': 'avt34h',
},
'playlist_mincount': 1,
}, { # URL to test no video/audio error
'url': 'https://gofile.io/d/aB... | @@ -0,0 +1,69 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get
+)
+
+
+class GofileIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gofile\.io/d/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://gofile.io/d/AMZyDw',
+ 'info_dict': {
+... | yt_dlp/extractor/gofile.py | 26 | Python | 0.929 | refactor | 108 | 49 | 51 | false | gofile Add extractor | 1,850 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Jertzukka |
'acodec': format_copy.get('acodec'),
'fps': format_copy.get('fps'),
'format_id': 'https-%s' % tbr,
} if format_copy else {
'width': _QUALITY[tbr][0],
'height': _QUALITY[tbr][1],
'format_id': 'https-%s' % tbr,
... | I dont understand this. `fmts` is never used below this point? | 'width': format_copy.get('width'),
'height': format_copy.get('height'),
'tbr': format_copy.get('tbr'),
'vcodec': format_copy.get('vcodec'),
'acodec': format_copy.get('acodec'),
'fps': format_copy.get('fps'),
... | @@ -183,6 +183,9 @@ def get_format_info(tbr):
available_qualities = mobj.group('quality').split(',') if mobj.group('quality') else ['*']
available_qualities = [i for i in available_qualities if i]
+ # filter out audio-only formats
+ fmts = [f for f in fmts if not f.get('vcodec') == 'no... | yt_dlp/extractor/rai.py | 26 | Python | 0.429 | question | 62 | 51 | 51 | false | [rai] Rainews fix #1862 | 1,864 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
relinker_info = self._extract_relinker_info(video['content_url'], video_id)
self._sort_formats(relinker_info['formats'])
thumbnails = []
for _, value in media.get('images', {}).items():
if value:
thumbnails.append({
'url': urljoin(url, val... | ```suggestion
alt_title = join_nonempty(media.get('subtitle'), media.get('toptitle'), delim=' - ')
``` |
relinker_info = self._extract_relinker_info(video['content_url'], video_id)
self._sort_formats(relinker_info['formats'])
thumbnails = []
for _, value in media.get('images', {}).items():
if value:
thumbnails.append({
'url': urljoin(url, va... | @@ -309,12 +312,19 @@ def _real_extract(self, url):
program_info = media.get('program_info') or {}
season = media.get('season')
+ alt_title = media.get('subtitle')
+ toptitle = media.get('toptitle')
+ if alt_title and toptitle:
+ alt_title += ' - ' + toptitle
+ ... | yt_dlp/extractor/rai.py | 26 | Python | 0.714 | suggestion | 112 | 51 | 51 | false | [rai] Rainews fix #1862 | 1,864 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
'thumbnail': r're:^https?://.*\.jpg$',
'upload_date': '20140301',
'vcodec': 'none',
}
}, {
# no thumbnail
'url': 'https://www.franceculture.fr/emissions/la-recherche-montre-en-main/la-recherche-montre-en-main-du-mercredi-10-octobre-2018',
'only_mat... | u can combine the extraction from video_data by using traverse_obj | 'title': 'Jeudi, vous avez dit bizarre ?',
'description': 'md5:47cf1e00cc21c86b0210279996a812c6',
'duration': 604,
'upload_date': '20201024',
'thumbnail': r're:^https?://.*\.jpg$',
'timestamp': 1603576680
},
... | @@ -44,18 +54,42 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.286 | refactor | 67 | 51 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
'url': 'https://www.franceculture.fr/emissions/la-recherche-montre-en-main/la-recherche-montre-en-main-du-mercredi-10-octobre-2018',
'only_matching': True,
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
... | use search_html_regex (might have mixed the order but see in common.py) | },
},
],
}, {
'url': 'https://www.franceculture.fr/emissions/carnet-nomade/rendez-vous-au-pays-des-geeks',
'info_dict': {
'id': 'rendez-vous-au-pays-des-geeks',
'display_id': 'rendez-vous-au-pays-des-geeks',
'ext': 'mp3',
't... | @@ -44,18 +54,42 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.286 | suggestion | 71 | 51 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
'only_matching': True,
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
video_data = extract_attributes(self._search_regex(
r'''(?sx)
(?:
</h1>|
... | same as above unless u don't want the regex result to be cleaned | },
],
}, {
'url': 'https://www.franceculture.fr/emissions/carnet-nomade/rendez-vous-au-pays-des-geeks',
'info_dict': {
'id': 'rendez-vous-au-pays-des-geeks',
'display_id': 'rendez-vous-au-pays-des-geeks',
'ext': 'mp3',
'title': 'Rendez-... | @@ -44,18 +54,42 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.214 | suggestion | 65 | 51 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
</h1>|
<div[^>]+class="[^"]*?(?:title-zone-diffusion|heading-zone-(?:wrapper|player-button))[^"]*?"[^>]*>
).*?
(<button[^>]+data-(?:url|asset-source)="[^"]+"[^>]+>)
''',
webpage, 'video data'))
title = video_data.ge... | U can use single quotes here instead of `'''` | 'vcodec': 'none',
'duration': 3569,
},
}, {
# no thumbnail
'url': 'https://www.franceculture.fr/emissions/la-recherche-montre-en-main/la-recherche-montre-en-main-du-mercredi-10-octobre-2018',
'only_matching': True,
}]
def _real_extract(self, url):
... | @@ -44,18 +54,42 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.286 | suggestion | 45 | 51 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
r'''(?sx)
(?:
</h1>|
<div[^>]+class="[^"]*?(?:title-zone-diffusion|heading-zone-(?:wrapper|player-button))[^"]*?"[^>]*>
).*?
(<button[^>]+data-(?:url|asset-source)="[^"]+"[^>]+>)
''',
webpage, 'vi... | if i remember right, the None field is ie_key
use this `FranceCultureIE.ie_key()` | 'thumbnail': r're:^https?://.*\.jpg$',
'upload_date': '20140301',
'vcodec': 'none',
'duration': 3569,
},
}, {
# no thumbnail
'url': 'https://www.franceculture.fr/emissions/la-recherche-montre-en-main/la-recherche-montre-en-main-du-mercredi-10-o... | @@ -44,18 +54,42 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.429 | suggestion | 82 | 51 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
r'''(?sx)
<div[^>]+class="[^"]*?podcast-list[^"?]*?"[^>]*>
(.*?)
<div[^>]+class="[^"]*?see-more-anchor[^"]*?">
''',
webpage, 'playlist data')
entries = [
self.url_result(video_url, No... | ```suggestion
if upload_date:
``` | 'title': self._html_search_regex(
r'(?s)<h1[^>]*itemprop="[^"]*name[^"]*"[^>]*>(.+?)</h1>',
webpage, 'title', default=self._og_search_title(webpage)),
'description': self._html_search_regex(
r'(?s)<div[^>]+class="excerpt"[^>]*>(.*?)</div>', webpage... | @@ -44,18 +54,42 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.429 | suggestion | 43 | 43 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
)
import re
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*(?P<id>[^/?#&]+)'... | inline this in the return statement | 'url': item_attributes.get('data-url'),
'title': item_attributes.get('data-diffusion-title'),
'duration': int_or_none(traverse_obj(item_attributes, 'data-duration-seconds', 'data-duration-seconds')),
'description': item_description,
... | @@ -44,18 +54,42 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.071 | suggestion | 35 | 107 | 36 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
title = video_data.get('data-emission-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
description = self._html_search_regex(
r'(?s)<div[^>]+class="intro"[^>]*>.*?<h2>(.+?)</h2>',
webpage, 'description', default=None)
# page has playli... | traverse_obj can be used here aswell | 'only_matching': True,
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
info = {
'id': display_id,
'title': self._html_search_regex(
r'(?s)<h1[^>]*itemprop="[^"]*name[^"]*... | @@ -44,18 +54,42 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.143 | suggestion | 36 | 51 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
)
import re
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*(?P<id>[^/?#&]+)'... | Don't set maxcount
test will break if new videos are added in future | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
traverse_obj,
unified_strdate,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/... | @@ -8,19 +8,29 @@
int_or_none,
)
+import re
+
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*(?P<id>[^/?#&]+)'
_TESTS = [{
- 'url': 'http://www.franceculture.fr/emissions/carnet-nomade/rendez-vous-au-pays-des-geeks',
+ # ... | yt_dlp/extractor/franceculture.py | 20 | Python | 0.214 | suggestion | 69 | 45 | 45 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
playlist_data)
]
return self.playlist_result(entries, display_id, title, description)
video_url = traverse_obj(video_data, 'data-url', 'data-asset-source')
thumbnail = self._search_regex(
r'(?s)<figure[^>]+itemtype="https://schema.org/ImageObjec... | ```suggestion
'upload_date': upload_date.replace('-', '') if upload_date is not None else None,
``` |
playlist_data = self._search_regex(
r'''(?sx)
<section[^>]+data-xiti-place="[^"]*?liste_episodes[^"?]*?"[^>]*>
(.*?)
</section>
''',
webpage, 'playlist data', fatal=False, default=None)
if playlist_data:
en... | @@ -67,7 +98,6 @@ def _real_extract(self, url):
'thumbnail': thumbnail,
'ext': ext,
'vcodec': 'none' if ext == 'mp3' else None,
- 'uploader': uploader,
- 'timestamp': int_or_none(video_data.get('data-start-time')) or int_or_none(video_data.get('data-asset-cre... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.786 | suggestion | 113 | 29 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bohwaz |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
traverse_obj,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*... | Add all the keys u are returning to the tests, for example...the description | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
traverse_obj,
unified_strdate,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/... | @@ -1,26 +1,35 @@
# coding: utf-8
from __future__ import unicode_literals
+import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
+ traverse_obj,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?france... | yt_dlp/extractor/franceculture.py | 17 | Python | 0.214 | suggestion | 76 | 42 | 42 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bohwaz |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
traverse_obj,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*... | Add a test for the entries as well. Like this:
```py
'url': ...,
'info_dict': {
...
},
'playlist': [{
'md5': ...,
'info_dict': {
...
},
}],
'params': {'playlist_end': 1},
``` | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
traverse_obj,
unified_strdate,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/... | @@ -1,27 +1,39 @@
# coding: utf-8
from __future__ import unicode_literals
+import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
+ traverse_obj,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?france... | yt_dlp/extractor/franceculture.py | 18 | Python | 0.786 | suggestion | 299 | 43 | 43 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bohwaz |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
traverse_obj,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*... | what? If description extraction is failing, it should be fixed, not add `None` to test 😐 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
traverse_obj,
unified_strdate,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/... | @@ -1,27 +1,39 @@
# coding: utf-8
from __future__ import unicode_literals
+import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
int_or_none,
+ traverse_obj,
)
class FranceCultureIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?france... | yt_dlp/extractor/franceculture.py | 23 | Python | 0.429 | bug | 89 | 48 | 48 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bohwaz |
playlist_data)
]
return self.playlist_result(entries, display_id, title, description)
video_url = traverse_obj(video_data, 'data-url', 'data-asset-source')
thumbnail = self._search_regex(
r'(?s)<figure[^>]+itemtype="https://schema.org/ImageObjec... | Use `unified_strdate`
and why remove uploader and timestamp? | (.*?)
</section>
''',
webpage, 'playlist data', fatal=False, default=None)
if playlist_data:
entries = []
for item, item_description in re.findall(
r'(?s)(<button[^<]*class="[^"]*replay-button[^>]*>).*?<p[^>]*cl... | @@ -67,7 +102,6 @@ def _real_extract(self, url):
'thumbnail': thumbnail,
'ext': ext,
'vcodec': 'none' if ext == 'mp3' else None,
- 'uploader': uploader,
- 'timestamp': int_or_none(video_data.get('data-start-time')) or int_or_none(video_data.get('data-asset-cr... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.429 | question | 63 | 29 | 50 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bohwaz |
r'''(?sx)
(?:
</h1>|
<div[^>]+class="[^"]*?(?:title-zone-diffusion|heading-zone-(?:wrapper|player-button))[^"]*?"[^>]*>
).*?
(<button[^>]+data-(?:url|asset-source)="[^"]+"[^>]+>)
''',
webpage, 'vi... | ```suggestion
if playlist_data is not None:
``` | 'vcodec': 'none',
'duration': 3569,
},
}, {
# no thumbnail
'url': 'https://www.franceculture.fr/emissions/la-recherche-montre-en-main/la-recherche-montre-en-main-du-mercredi-10-octobre-2018',
'only_matching': True,
}]
def _real_extract(self, url):
... | @@ -44,18 +56,41 @@ def _real_extract(self, url):
''',
webpage, 'video data'))
- video_url = video_data.get('data-url') or video_data['data-asset-source']
- title = video_data.get('data-asset-title') or video_data.get('data-diffusion-title') or self._og_search_title(webpage)
-
... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.571 | suggestion | 57 | 51 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bohwaz |
playlist_data = self._search_regex(
r'''(?sx)
<div[^>]+class="[^"]*?podcast-list[^"?]*?"[^>]*>
(.*?)
<div[^>]+class="[^"]*?see-more-anchor[^"]*?">
''',
webpage, 'playlist data', fatal=False, default=None)
if playlist_d... | are you sure the thumbnail is same for video and playlist? | r'(?s)class="teaser-text-date".*?(\d{2}/\d{2}/\d{4})', webpage, 'date', default=None)),
}
playlist_data = self._search_regex(
r'''(?sx)
<section[^>]+data-xiti-place="[^"]*?liste_episodes[^"?]*?"[^>]*>
(.*?)
</section>
... | @@ -31,9 +56,54 @@ class FranceCultureIE(InfoExtractor):
def _real_extract(self, url):
display_id = self._match_id(url)
-
webpage = self._download_webpage(url, display_id)
+ info = {
+ 'id': display_id,
+ 'title': self._html_search_regex(
+ r'(?s)<h... | yt_dlp/extractor/franceculture.py | 26 | Python | 0.214 | question | 58 | 51 | 51 | false | Add playlist support to FranceCulture extractor | 1,872 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bohwaz |
for format_id, format_url in sources.items():
if format_url:
formats.append({
'url': format_url,
'format_id': format_id,
'height': int_or_none(format_id),
})
medias = self.... | any reason for the isinstance check? Cant this just be `more_media or []`? Same above | r'sources\s*:\s*({.+?})', webpage, 'source', default='{}'),
video_id, fatal=False)
if sources and isinstance(sources, dict):
for format_id, format_url in sources.items():
if format_url:
formats.append({
'url': fo... | @@ -84,24 +87,33 @@ def _real_extract(self, url):
r'mediaDefinition["\']?\s*:\s*(\[.+?}\s*\])', webpage,
'media definitions', default='{}'),
video_id, fatal=False)
- if medias and isinstance(medias, list):
- for media in medias:
+ for media in medi... | yt_dlp/extractor/redtube.py | 26 | Python | 0.357 | suggestion | 85 | 51 | 51 | false | [redtube] fix #1663 | 1,877 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
duration = float_or_none(try_get(
ptmd, lambda x: x['attributes']['duration']['value']), scale=1000)
return {
'extractor_key': ZDFIE.ie_key(),
'id': content_id,
'duration': duration,
'formats': formats,
'subtitles': self._extract_... | Don't remove tests
if the url no longer exists then add it as matching only | self._sort_formats(formats, ('hasaud', 'res', 'quality', 'language_preference'))
duration = float_or_none(try_get(
ptmd, lambda x: x['attributes']['duration']['value']), scale=1000)
return {
'extractor_key': ZDFIE.ie_key(),
'id': content_id,
'dur... | @@ -135,19 +136,6 @@ def _extract_player(self, webpage, video_id, fatal=True):
class ZDFIE(ZDFBaseIE):
_VALID_URL = r'https?://www\.zdf\.de/(?:[^/]+/)*(?P<id>[^/?#&]+)\.html'
_TESTS = [{
- # Same as https://www.phoenix.de/sendungen/ereignisse/corona-nachgehakt/wohin-fuehrt-der-protest-in-der-pandemie-... | yt_dlp/extractor/zdf.py | 26 | Python | 0.286 | suggestion | 76 | 51 | 51 | false | [zdf] add support for videos with different ptmd-template location | 1,893 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | iw0nderhow |
'only_matching': True,
}, {
'url': 'https://www.zdf.de/service-und-hilfe/die-neue-zdf-mediathek/zdfmediathek-trailer-100.html',
'only_matching': True,
}, {
'url': 'https://www.zdf.de/filme/taunuskrimi/die-lebenden-und-die-toten-1---ein-taunuskrimi-100.html',
'only_matchin... | why use traverse_obj here? The point of it is to handle missing data without throwing errors. If the keys are absent, the .replace will throw error anyway. Also, further extraction cannot continue without this data | 'only_matching': True,
}, {
'url': 'https://www.zdf.de/service-und-hilfe/die-neue-zdf-mediathek/zdfmediathek-trailer-100.html',
'only_matching': True,
}, {
'url': 'https://www.zdf.de/filme/taunuskrimi/die-lebenden-und-die-toten-1---ein-taunuskrimi-100.html',
'only_matchin... | @@ -202,8 +206,8 @@ def _extract_entry(self, url, player, content, video_id):
ptmd_path = t.get('http://zdf.de/rels/streams/ptmd')
if not ptmd_path:
- ptmd_path = t[
- 'http://zdf.de/rels/streams/ptmd-template'].replace(
+ ptmd_path = traverse_obj(
+ ... | yt_dlp/extractor/zdf.py | 26 | Python | 0.643 | refactor | 214 | 51 | 51 | false | [zdf] add support for videos with different ptmd-template location | 1,893 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | iw0nderhow |
}],
'params': {
# m3u8 download
'skip_download': True,
},
}, {
# iframe embed
'url': 'http://www.ceskatelevize.cz/porady/10614999031-neviditelni/21251212048/',
'only_matching': True,
}]
def _real_extract(self, url):
playlist_id... | ```suggestion
idec = traverse_obj(next_data, ('props', 'pageProps', 'data', ('show', 'mediaMeta'), 'idec'), get_all=False)
``` | 'skip_download': True,
},
}, {
# iframe embed
'url': 'http://www.ceskatelevize.cz/porady/10614999031-neviditelni/21251212048/',
'only_matching': True,
}]
def _real_extract(self, url):
playlist_id = self._match_id(url)
parsed_url = compat_urllib_pa... | @@ -99,11 +101,12 @@ def _real_extract(self, url):
playlist_description = playlist_description.replace('\xa0', ' ')
if parsed_url.path.startswith('/porady/'):
- refer_url = update_url_query(unescapeHTML(self._search_regex(
- (r'<span[^>]*\bdata-url=(["\'])(?P<url>(?:(?!... | yt_dlp/extractor/ceskatelevize.py | 26 | Python | 0.714 | suggestion | 140 | 51 | 51 | false | [ceskatelevize] Update to 2021-12-06 changes (#1899) | 1,904 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mkubecek |
},
}, {
# iframe embed
'url': 'http://www.ceskatelevize.cz/porady/10614999031-neviditelni/21251212048/',
'only_matching': True,
}]
def _real_extract(self, url):
playlist_id = self._match_id(url)
parsed_url = compat_urllib_parse_urlparse(url)
webpage =... | ```suggestion
hash = self._download_webpage(self._IFRAME_HASH_URL, playlist_id)
webpage = self._download_webpage(self._IFRAME_URL, playlist_id, query={'hash': hash, 'origin': 'iVysilani', 'autoStart': 'true', 'IDEC': idec})
```
Also, since `_IFRAME_HASH_URL` and `_IFRAME_URL` are only ever... | 'url': 'http://www.ceskatelevize.cz/porady/10614999031-neviditelni/21251212048/',
'only_matching': True,
}]
def _real_extract(self, url):
playlist_id = self._match_id(url)
parsed_url = compat_urllib_parse_urlparse(url)
webpage = self._download_webpage(url, playlist_id)
... | @@ -99,11 +101,12 @@ def _real_extract(self, url):
playlist_description = playlist_description.replace('\xa0', ' ')
if parsed_url.path.startswith('/porady/'):
- refer_url = update_url_query(unescapeHTML(self._search_regex(
- (r'<span[^>]*\bdata-url=(["\'])(?P<url>(?:(?!... | yt_dlp/extractor/ceskatelevize.py | 26 | Python | 0.857 | suggestion | 373 | 51 | 51 | false | [ceskatelevize] Update to 2021-12-06 changes (#1899) | 1,904 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mkubecek |
medien\.ph-noe\.ac\.at|
oc-video\.ruhr-uni-bochum\.de|
oc-video1\.ruhr-uni-bochum\.de|
opencast\.informatik\.uni-goettingen\.de|
heicast\.uni-heidelberg\.de|
... | don't use get chains, use try_get instead | oc-presentation\.ltcc\.tuwien\.ac\.at|
medien\.ph-noe\.ac\.at|
oc-video\.ruhr-uni-bochum\.de|
oc-video1\.ruhr-uni-bochum\.de|
opencast\.informatik\.uni-goettingen\.de|
... | @@ -0,0 +1,251 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ parse_iso8601,
+ parse_resolution,
+ int_or_none,
+ ExtractorError,
+)
+
+
+class OpencastBaseIE(InfoExtractor):
+ _INSTANCES_RE = r''... | yt_dlp/extractor/opencast.py | 26 | Python | 0.143 | suggestion | 41 | 51 | 51 | false | [OpenCast] Add extractor | 1,905 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bwildenhain |
mcmedia\.missioncollege\.org|
clases\.odon\.edu\.uy
)'''
_UUID_RE = r'[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}'
def _call_api(self, host, video_id, path, note=None, errnote=None, fatal=True):
r... | use _extract_*_formats_and_subtitles just in case | cursosabertos\.c3sl\.ufpr\.br|
mcmedia\.missioncollege\.org|
clases\.odon\.edu\.uy
)'''
_UUID_RE = r'[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}'
def _call_api(self, host, vide... | @@ -0,0 +1,251 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ parse_iso8601,
+ parse_resolution,
+ int_or_none,
+ ExtractorError,
+)
+
+
+class OpencastBaseIE(InfoExtractor):
+ _INSTANCES_RE = r''... | yt_dlp/extractor/opencast.py | 26 | Python | 0.143 | refactor | 49 | 51 | 51 | false | [OpenCast] Add extractor | 1,905 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bwildenhain |
audio_encoder = audio_info.get('encoder', {})
if 'type' in audio_encoder:
track_obj.update({'acodec': audio_encoder.get('type')})
video_info = track.get('video')
if video_info is not None:
if 'resolution... | id is supposed to be fatal
may as well stop the extraction if it doesn't exist | })
formats.append(track_obj)
self._sort_formats(formats)
return {
'id': video_id,
'formats': formats,
'title': video.get('title'),
'series': video.get('seriestitle'),
'season_id': video.get('series'),
... | @@ -0,0 +1,251 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ parse_iso8601,
+ parse_resolution,
+ int_or_none,
+ ExtractorError,
+)
+
+
+class OpencastBaseIE(InfoExtractor):
+ _INSTANCES_RE = r''... | yt_dlp/extractor/opencast.py | 26 | Python | 0.286 | refactor | 79 | 51 | 51 | false | [OpenCast] Add extractor | 1,905 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | bwildenhain |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.