before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
if self._TOKEN_EXPIRY <= int(time.time()):
raise ExtractorError(
'Expired token. Refresh your cookies in browser and try again', expected=True)
return self._TOKEN
def _call_api(self, video_id, param='', msg='API', auth=True, data=None, query={}, fatal=True):
hea... | ```suggestion
if not Cryptodome:
raise ExtractorError('pycryptodomex not found. Please install', expected=True)
private_key = Cryptodome.PublicKey.RSA.generate(2048)
cipher = Cryptodome.Cipher.PKCS1_OAEP.new(private_key, hashAlgo=Cryptodome.Hash.SHA1)
```
At the top,
```py... |
if self._TOKEN_EXPIRY <= int(time.time()):
raise ExtractorError(
'Expired token. Refresh your cookies in browser and try again', expected=True)
return self._TOKEN
def _call_api(self, video_id, param='', msg='API', auth=True, data=None, query={}, fatal=True):
he... | @@ -0,0 +1,235 @@
+import base64
+import binascii
+import json
+import time
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+ jwt_decode_hs256,
+ traverse_obj,
+ try_call,
+ url_or_none,
+)
+
+
+class WrestleUniverseBaseIE(InfoExtractor):
+ _VALID_URL_TM... | yt_dlp/extractor/wrestleuniverse.py | 26 | Python | 1 | refactor | 364 | 51 | 51 | false | [extractor/wrestleuniverse] Add extractors | 6,158 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
if ft <= cursor and cursor < to:
prog = p
break
if not prog:
raise ExtractorError('Cannot identify radio program to download!')
assert ft, to
return prog, station_program, ft, ft_str, to_str
def _extract_formats(self, video_id, station... | ```suggestion
if is_onair and not pcu.startswith(self._HOSTS_FOR_LIVE) or (not is_onair and (pcu.startswith(self._HOSTS_FOR_TIME_FREE_FFMPEG_UNSUPPORTED) or pcu.startswith(self._HOSTS_FOR_LIVE)))):
```
`Allowlist style for Time Free to consider undiscovered URL` may be moved above `_HOSTS_FOR_TIME_FREE... | prog = p
break
if not prog:
raise ExtractorError('Cannot identify radio program to download!')
assert ft, to
return prog, station_program, ft, ft_str, to_str
def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token, area_id, ... | @@ -92,9 +109,18 @@ def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token,
formats = []
found = set()
for url_tag in m3u8_urls:
- pcu = url_tag.find('playlist_create_url')
+ pcu = url_tag.find('playlist_create_url').text
+ if (
+ ... | yt_dlp/extractor/radiko.py | 26 | Python | 0.857 | suggestion | 340 | 51 | 51 | false | Hotfix for radiko.jp | 6,159 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | road-master |
note='Downloading radio program for %s station' % station)
prog = None
for p in station_program.findall('.//prog'):
ft_str, to_str = p.attrib['ft'], p.attrib['to']
ft = unified_timestamp(ft_str, False)
to = unified_timestamp(to_str, False)
if ... | I believe this can be simplified to:
```suggestion
if (on_air ^ pcu.startswith(self._HOSTS_FOR_LIVE)) or (
not is_onair and pcu.startswith(self._HOSTS_FOR_TIME_FREE_FFMPEG_UNSUPPORTED)):
```
|
prog = None
for p in station_program.findall('.//prog'):
ft_str, to_str = p.attrib['ft'], p.attrib['to']
ft = unified_timestamp(ft_str, False)
to = unified_timestamp(to_str, False)
if ft <= cursor and cursor < to:
prog = p
... | @@ -92,9 +109,11 @@ def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token,
formats = []
found = set()
for url_tag in m3u8_urls:
- pcu = url_tag.find('playlist_create_url')
+ pcu = url_tag.find('playlist_create_url').text
+ if is_onair ... | yt_dlp/extractor/radiko.py | 26 | Python | 0.786 | suggestion | 228 | 51 | 51 | false | Hotfix for radiko.jp | 6,159 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | road-master |
prog = None
for p in station_program.findall('.//prog'):
ft_str, to_str = p.attrib['ft'], p.attrib['to']
ft = unified_timestamp(ft_str, False)
to = unified_timestamp(to_str, False)
if ft <= cursor and cursor < to:
prog = p
... | Instead of skipping these formats, maybe it's better to just de-prioritize them? (preference=-10). Opinion, @Lesmiscore ? | prog = None
for p in station_program.findall('.//prog'):
ft_str, to_str = p.attrib['ft'], p.attrib['to']
ft = unified_timestamp(ft_str, False)
to = unified_timestamp(to_str, False)
if ft <= cursor and cursor < to:
prog = p
b... | @@ -92,9 +109,11 @@ def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token,
formats = []
found = set()
for url_tag in m3u8_urls:
- pcu = url_tag.find('playlist_create_url')
+ pcu = url_tag.find('playlist_create_url').text
+ if is_onair ... | yt_dlp/extractor/radiko.py | 26 | Python | 0.429 | question | 121 | 51 | 51 | false | Hotfix for radiko.jp | 6,159 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | road-master |
from .common import InfoExtractor
from ..utils import ExtractorError
class EbayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
_TEST = {
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
... | ```suggestion
video_json = self._search_json(r'"video":', webpage, 'video json', video_id)
``` | from .common import InfoExtractor
from ..utils import remove_end
class EbayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
... | @@ -0,0 +1,43 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class EbayIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'https://www.ebay.com/itm/194509326719',
+ 'info_dict': {
+ 'id': '194509326719',
+... | yt_dlp/extractor/ebay.py | 24 | Python | 0.714 | suggestion | 104 | 44 | 37 | false | feat: add extractor for ebay video listings | 6,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
'title': 'HELIX upload [AN_Master_A04B.mp4] - 1666069406072',
},
'params': {
# m3u8 download
'skip_download': True,
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
... | ```suggestion
formats = []
for key, url in video_json['playlistMap'].items():
if key == 'HLS':
formats.extend(self._extract_m3u8_formats(url, video_id, fatal=False))
elif key == 'DASH':
formats.extend(self._extract_mpd_formats(url, video_id, ... | 'title': 'WiFi internal antenna adhesive for wifi 2.4GHz wifi 5 wifi 6 wifi 6E full bands',
},
'params': {'skip_download': 'm3u8'}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_json = se... | @@ -0,0 +1,43 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class EbayIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'https://www.ebay.com/itm/194509326719',
+ 'info_dict': {
+ 'id': '194509326719',
+... | yt_dlp/extractor/ebay.py | 26 | Python | 0.857 | refactor | 395 | 33 | 26 | false | feat: add extractor for ebay video listings | 6,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
from .common import InfoExtractor
from ..utils import ExtractorError
class EbayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
_TEST = {
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
... | ```suggestion
'skip_download': 'm3u8'',
``` | from .common import InfoExtractor
from ..utils import remove_end
class EbayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
... | @@ -0,0 +1,43 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class EbayIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'https://www.ebay.com/itm/194509326719',
+ 'info_dict': {
+ 'id': '194509326719',
+... | yt_dlp/extractor/ebay.py | 16 | Python | 0.571 | suggestion | 57 | 41 | 37 | false | feat: add extractor for ebay video listings | 6,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
from .common import InfoExtractor
from ..utils import ExtractorError
class EbayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
_TEST = {
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
... | ```suggestion
_TESTS = [{
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
'title': 'HELIX upload [AN_Master_A04B.mp4] - 1666069406072',
},
'params': {'skip_download': 'm3u8'}
}]
``` | from .common import InfoExtractor
from ..utils import remove_end
class EbayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
... | @@ -0,0 +1,43 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class EbayIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'https://www.ebay.com/itm/194509326719',
+ 'info_dict': {
+ 'id': '194509326719',
+... | yt_dlp/extractor/ebay.py | 18 | Python | 0.786 | suggestion | 318 | 43 | 37 | false | feat: add extractor for ebay video listings | 6,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
'title': 'WiFi internal antenna adhesive for wifi 2.4GHz wifi 5 wifi 6 wifi 6E full bands | eBay',
},
'params': {'skip_download': 'm3u8'}
}]
def _real_extract(self, url):
video_id = self._matc... | ```suggestion
'title': remove_end(self._html_extract_title(webpage), ' | eBay'),
``` | 'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
'title': 'WiFi internal antenna adhesive for wifi 2.4GHz wifi 5 wifi 6 wifi 6E full bands',
},
'params': {'skip_download': 'm3u8'}
}]
def _real_... | @@ -0,0 +1,35 @@
+from .common import InfoExtractor
+
+
+class EbayIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://www.ebay.com/itm/194509326719',
+ 'info_dict': {
+ 'id': '194509326719',
+ 'ext': 'mp4',
+ ... | yt_dlp/extractor/ebay.py | 26 | Python | 0.643 | refactor | 98 | 29 | 30 | false | feat: add extractor for ebay video listings | 6,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
class EbayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
'title': 'WiFi internal antenna adhesive for wifi 2.4GHz wi... | ```suggestion
self.report_warning(f'Unsupported format {key}', video_id)
``` |
class EbayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.ebay.com/itm/194509326719',
'info_dict': {
'id': '194509326719',
'ext': 'mp4',
'title': 'WiFi internal antenna adhesive for wifi 2.4GHz w... | @@ -0,0 +1,35 @@
+from .common import InfoExtractor
+
+
+class EbayIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://www.ebay.com/itm/194509326719',
+ 'info_dict': {
+ 'id': '194509326719',
+ 'ext': 'mp4',
+ ... | yt_dlp/extractor/ebay.py | 26 | Python | 0.571 | suggestion | 94 | 33 | 34 | false | feat: add extractor for ebay video listings | 6,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
import random
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
traverse_obj,
try_get,
unescapeHTML,
url_or_none,
)
class RedditIE(InfoExtractor):
_VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com... | Why not
```suggestion
_VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com/(?P<slug>(?:r|user)/[^/]+/comments/(?P<id>[^/?#&]+))'
``` | import random
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
traverse_obj,
try_get,
unescapeHTML,
url_or_none,
)
class RedditIE(InfoExtractor):
_VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com... | @@ -14,7 +14,7 @@
class RedditIE(InfoExtractor):
- _VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com/r/(?P<slug>[^/]+/comments/(?P<id>[^/?#&]+))'
+ _VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com/(?P<link_type>r|user)/(?P<slug>[^/]+/comments/(?P<id>[^/?#&]+))' | yt_dlp/extractor/reddit.py | 17 | Python | 0.786 | question | 155 | 42 | 42 | false | [extractor/reddit] Adjust regex for user posts | 6,173 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | OMEGARAZER |
ctx.resume_len = 0
ctx.open_mode = 'wb'
return
elif err.code < 500 or err.code >= 600:
# Unexpected HTTP error
raise
raise RetryDownload(err)
except url... | `None` is default?
```suggestion
if ctx.data.info().get('Content-encoding'):
```
Or maybe
```suggestion
if ctx.data.info().get('Content-encoding') is not None:
``` | ctx.resume_len = 0
ctx.open_mode = 'wb'
return
elif err.code < 500 or err.code >= 600:
# Unexpected HTTP error
raise
raise RetryDownload(err)
except url... | @@ -213,6 +213,11 @@ def close_stream():
def download():
data_len = ctx.data.info().get('Content-length', None)
+ if ctx.data.info().get('Content-encoding', None): | yt_dlp/downloader/http.py | 26 | Python | 0.714 | suggestion | 195 | 51 | 51 | false | [utils] Don't trust Content-length when Content-encoding is present | 6,176 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | felixonmars |
return
elif err.code < 500 or err.code >= 600:
# Unexpected HTTP error
raise
raise RetryDownload(err)
except urllib.error.URLError as err:
if isinstance(err.reason, ssl.CertificateError):
... | Add a reference back to this pr or the issue | return
elif err.code < 500 or err.code >= 600:
# Unexpected HTTP error
raise
raise RetryDownload(err)
except urllib.error.URLError as err:
if isinstance(err.reason, ssl.CertificateError):
... | @@ -211,7 +211,12 @@ def close_stream():
ctx.stream = None
def download():
- data_len = ctx.data.info().get('Content-length', None)
+ data_len = ctx.data.info().get('Content-length')
+
+ if ctx.data.info().get('Content-encoding'):
+ # Content-e... | yt_dlp/downloader/http.py | 26 | Python | 0.071 | suggestion | 44 | 51 | 51 | false | [utils] Don't trust Content-length when Content-encoding is present | 6,176 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | felixonmars |
@params paths Paths which to traverse by.
@param default Value to return if the paths do not match.
If the last key in the path is a `dict`, it will apply to each value inside
the dict instead, depth first. Try to avoid if using nested `... | ```suggestion
If no default is given and the last path branches, a `list` is always returned.
``` | @params paths Paths which to traverse by.
@param default Value to return if the paths do not match.
If the last key in the path is a `dict`, it will apply to each value inside
the dict instead, depth first. Try to avoid if using nested `... | @@ -5460,12 +5462,15 @@ def traverse_obj(
@param traverse_string Whether to traverse into objects as strings.
If `True`, any non-compatible object will first be
converted into a string and then traversed into.
+ The return value ... | yt_dlp/utils.py | 26 | Python | 0.714 | suggestion | 127 | 51 | 51 | false | [utils] `traverse_obj`: Fix several behavioral problems | 6,180 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
if appdata_dir:
yield os.path.join(appdata_dir, package_name)
# home (~/.package_name)
yield os.path.join(compat_expanduser('~'), f'.{package_name}')
def get_system_config_dirs(package_name):
# /etc/package_name
yield os.path.join('/etc', package_name)
def traverse_obj(
obj, *pa... | ```suggestion
Falsy values except `0`/`False` are treated as the absence of a value.
``` | if appdata_dir:
yield os.path.join(appdata_dir, package_name)
# home (~/.package_name)
yield os.path.join(compat_expanduser('~'), f'.{package_name}')
def get_system_config_dirs(package_name):
# /etc/package_name
yield os.path.join('/etc', package_name)
def traverse_obj(
obj, *pa... | @@ -5420,7 +5420,7 @@ def traverse_obj(
Each of the provided `paths` is tested and the first producing a valid result will be returned.
The next path will also be tested if the path branched but no results could be found.
Supported values for traversal are `Mapping`, `Sequence` and `re.Match`.
- A val... | yt_dlp/utils.py | 26 | Python | 0.571 | suggestion | 94 | 51 | 51 | false | [utils] `traverse_obj`: Fix several behavioral problems | 6,180 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
result = obj.groups()
elif traverse_string:
branching = False
result = str(obj)
else:
result = ()
elif callable(key):
branching = True
if isinstance(obj, collections.abc.Mapping):
ite... | ```suggestion
result = ''.join(result)
``` | result = obj.groups()
elif traverse_string:
branching = False
result = str(obj)
else:
result = ()
elif callable(key):
branching = True
if isinstance(obj, collections.abc.Mapping):
ite... | @@ -5475,87 +5480,94 @@ def traverse_obj(
else:
type_test = lambda val: try_call(expected_type or IDENTITY, args=(val,))
- def apply_key(key, test_type, obj):
+ def apply_key(key, obj, is_last):
+ branching = False
+ result = None
+
if obj is None:
- return
+ ... | yt_dlp/utils.py | 26 | Python | 0.571 | suggestion | 60 | 51 | 51 | false | [utils] `traverse_obj`: Fix several behavioral problems | 6,180 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
elif callable(key):
branching = True
if isinstance(obj, collections.abc.Mapping):
iter_obj = obj.items()
elif is_sequence(obj):
iter_obj = enumerate(obj)
elif isinstance(obj, re.Match):
iter_obj = itertools.chain(
... | Should we ignore falsey values hee too? | elif callable(key):
branching = True
if isinstance(obj, collections.abc.Mapping):
iter_obj = obj.items()
elif is_sequence(obj):
iter_obj = enumerate(obj)
elif isinstance(obj, re.Match):
iter_obj = itertools.chain(
... | @@ -5475,87 +5480,94 @@ def traverse_obj(
else:
type_test = lambda val: try_call(expected_type or IDENTITY, args=(val,))
- def apply_key(key, test_type, obj):
+ def apply_key(key, obj, is_last):
+ branching = False
+ result = None
+
if obj is None:
- return
+ ... | yt_dlp/utils.py | 26 | Python | 0.143 | question | 39 | 51 | 51 | false | [utils] `traverse_obj`: Fix several behavioral problems | 6,180 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
def lazy_last(iterable):
iterator = iter(iterable)
prev = next(iterator, NO_DEFAULT)
if prev is NO_DEFAULT:
return
for item in iterator:
yield False, prev
prev = item
yield True, prev
def apply_path(start_obj, path, test_type):
... | ```suggestion
elif ':' in key:
key = slice(*map(int_or_none, key.split(':')))
elif int_or_none(key) is not None:
key = int(key)
``` | def lazy_last(iterable):
iterator = iter(iterable)
prev = next(iterator, NO_DEFAULT)
if prev is NO_DEFAULT:
return
for item in iterator:
yield False, prev
prev = item
yield True, prev
def apply_path(start_obj, path, test_type):
... | @@ -5569,45 +5581,55 @@ def lazy_last(iterable):
yield True, prev
- def apply_path(start_obj, path, test_type=False):
+ def apply_path(start_obj, path, test_type):
objs = (start_obj,)
has_branched = False
key = None
for last, key in lazy_last(variadic(path, (str,... | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 208 | 51 | 51 | false | [utils] `traverse_obj`: Fix several behavioral problems | 6,180 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
else:
key = slice(*map(int_or_none, key.split(':')))
if not casesense and isinstance(key, str):
key = key.casefold()
if __debug__ and callable(key):
# Verify function signature
inspect.signature(key).bind(None,... | ```suggestion
results = LazyList(item for item in results if item or item in (0, False))
```
Maybe we should allow `''` too? We really only want to block `{}`/`None`, right? | key = int(key)
if not casesense and isinstance(key, str):
key = key.casefold()
if __debug__ and callable(key):
# Verify function signature
inspect.signature(key).bind(None, None)
new_objs = []
for obj ... | @@ -5569,45 +5581,55 @@ def lazy_last(iterable):
yield True, prev
- def apply_path(start_obj, path, test_type=False):
+ def apply_path(start_obj, path, test_type):
objs = (start_obj,)
has_branched = False
key = None
for last, key in lazy_last(variadic(path, (str,... | yt_dlp/utils.py | 26 | Python | 0.786 | question | 184 | 51 | 51 | false | [utils] `traverse_obj`: Fix several behavioral problems | 6,180 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
'format_id': 'lo_res'
},
}, {
'url': 'https://www.nzonscreen.com/title/shes-a-mod-1964?collection=best-of-the-60s',
'md5': 'e8a56d7d02cdcdc5d6f8897e2532e157',
'info_dict': {
'id': 'shes-a-mod-1964',
'ext': 'mp4',
'title': 'Ray Columbus ... | Should title be entirely discarded if `|` is not present? If yes, pls provide a test case | 'id': '726ed6585c6bfb30',
'ext': 'mp4',
'format_id': 'hi',
'display_id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'title': 'Monte Video - "Shoop Shoop, Diddy Wop"',
'description': 'Monte Video - "Shoop Shoop, Diddy Wop"',
'al... | @@ -0,0 +1,68 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import (
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class NZOnScreenIE(InfoExtractor):
+ _VALID_URL = r'^https://www.nzonscreen.com/title/(?P<id>[^\?]+)'
+ _TESTS = [{
+ 'url': 'https://www.nzonscreen.com/title/shoo... | yt_dlp/extractor/nzonscreen.py | 26 | Python | 0.429 | suggestion | 89 | 51 | 51 | false | [NZOnScreen] Add extractor | 6,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | gregsadetsky |
from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.utils import (
ExtractorError,
traverse_obj,
)
class NZOnScreenIE(InfoExtractor):
_VALID_URL = r'^https://www.nzonscreen.com/title/(?P<id>[^\?]+)'
_TESTS = [{
'url': 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumm... | Be default, we should download best format | from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
remove_end,
strip_or_none,
traverse_obj,
url_or_none,
)
class NZOnScreenIE(InfoExtractor):
_VALID_URL = r'^https://www\.nzonscreen\.com/title/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.nzo... | @@ -0,0 +1,68 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import (
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class NZOnScreenIE(InfoExtractor):
+ _VALID_URL = r'^https://www.nzonscreen.com/title/(?P<id>[^\?]+)'
+ _TESTS = [{
+ 'url': 'https://www.nzonscreen.com/title/shoo... | yt_dlp/extractor/nzonscreen.py | 17 | Python | 0.143 | style | 42 | 42 | 42 | false | [NZOnScreen] Add extractor | 6,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | gregsadetsky |
'format_id': 'lo_res'
},
}, {
'url': 'https://www.nzonscreen.com/title/shes-a-mod-1964?collection=best-of-the-60s',
'md5': 'e8a56d7d02cdcdc5d6f8897e2532e157',
'info_dict': {
'id': 'shes-a-mod-1964',
'ext': 'mp4',
'title': 'Ray Columbus ... | Is there a video where title extraction is **expected** to fail? If so, provide test case | 'id': '726ed6585c6bfb30',
'ext': 'mp4',
'format_id': 'hi',
'display_id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'title': 'Monte Video - "Shoop Shoop, Diddy Wop"',
'description': 'Monte Video - "Shoop Shoop, Diddy Wop"',
'al... | @@ -0,0 +1,68 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import (
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class NZOnScreenIE(InfoExtractor):
+ _VALID_URL = r'^https://www.nzonscreen.com/title/(?P<id>[^\?]+)'
+ _TESTS = [{
+ 'url': 'https://www.nzonscreen.com/title/shoo... | yt_dlp/extractor/nzonscreen.py | 26 | Python | 0.286 | bug | 89 | 51 | 51 | false | [NZOnScreen] Add extractor | 6,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | gregsadetsky |
'url': 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'md5': 'a0375e9b6f14b235438506cb0aee974c',
'info_dict': {
'id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'ext': 'mp4',
'title': 'Monte Video - "Shoop Shoop, ... | .+? may cause catastrophic backtracking |
class NZOnScreenIE(InfoExtractor):
_VALID_URL = r'^https://www\.nzonscreen\.com/title/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'info_dict': {
'id': '726ed6585c6bfb30',
'ext': 'mp4',
... | @@ -0,0 +1,68 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import (
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class NZOnScreenIE(InfoExtractor):
+ _VALID_URL = r'^https://www.nzonscreen.com/title/(?P<id>[^\?]+)'
+ _TESTS = [{
+ 'url': 'https://www.nzonscreen.com/title/shoo... | yt_dlp/extractor/nzonscreen.py | 26 | Python | 0.143 | suggestion | 39 | 51 | 51 | false | [NZOnScreen] Add extractor | 6,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | gregsadetsky |
'url': 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'md5': 'a0375e9b6f14b235438506cb0aee974c',
'info_dict': {
'id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'ext': 'mp4',
'title': 'Monte Video - "Shoop Shoop, ... | `_search_json` would be more robust here, but I won't insist |
class NZOnScreenIE(InfoExtractor):
_VALID_URL = r'^https://www\.nzonscreen\.com/title/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'info_dict': {
'id': '726ed6585c6bfb30',
'ext': 'mp4',
... | @@ -0,0 +1,68 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import (
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class NZOnScreenIE(InfoExtractor):
+ _VALID_URL = r'^https://www.nzonscreen.com/title/(?P<id>[^\?]+)'
+ _TESTS = [{
+ 'url': 'https://www.nzonscreen.com/title/shoo... | yt_dlp/extractor/nzonscreen.py | 26 | Python | 0.357 | suggestion | 60 | 51 | 51 | false | [NZOnScreen] Add extractor | 6,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | gregsadetsky |
if not title:
page_title = self._html_extract_title(webpage, default=None) or self._og_search_title(
webpage, default=None)
if page_title and '|' in page_title:
title = page_title.split('|')[0].strip()
playlist_formats = traverse_obj(playlist, 'h2... | This should be either id/uuid in the `playlist` dict. The one from URL is just `display_id` | 'duration': 130,
},
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://www.nzonscreen.com/title/puha-and-pakeha-1968/overview',
'info_dict': {
'id': 'f86342544385ad8a',
'ext': 'mp4',
'format_id': 'hi',
'display_id': '... | @@ -0,0 +1,68 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import (
+ ExtractorError,
+ traverse_obj,
+)
+
+
+class NZOnScreenIE(InfoExtractor):
+ _VALID_URL = r'^https://www.nzonscreen.com/title/(?P<id>[^\?]+)'
+ _TESTS = [{
+ 'url': 'https://www.nzonscreen.com/title/shoo... | yt_dlp/extractor/nzonscreen.py | 26 | Python | 0.429 | suggestion | 91 | 31 | 51 | false | [NZOnScreen] Add extractor | 6,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | gregsadetsky |
'info_dict': {
'id': '726ed6585c6bfb30',
'display_id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'ext': 'mp4',
'title': 'Monte Video - "Shoop Shoop, Diddy Wop"',
'playable_in_embed': False,
'thumbnail': r're:https://www\.nzonscree... | Once hd_res is fixed, this should be adjusted according to which is better format | 'info_dict': {
'id': '726ed6585c6bfb30',
'ext': 'mp4',
'format_id': 'hi',
'display_id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'title': 'Monte Video - "Shoop Shoop, Diddy Wop"',
'description': 'Monte Video - "Shoop Shoop, Diddy... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ int_or_none,
+ qualities,
+ traverse_obj,
+ try_get,
+ url_or_none,
+)
+
+
+class NZOnScreenIE(InfoExtractor):
+ _VALID_URL = r'^https://www.nzonscreen.com/title/(?P<id>[^\?]+)'
+ _TESTS = [{
+ '... | yt_dlp/extractor/nzonscreen.py | 26 | Python | 0.286 | suggestion | 81 | 51 | 51 | false | [NZOnScreen] Add extractor | 6,208 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | gregsadetsky |
content_id = get_binding_value('%s_content_id' % (card_name if is_amplify else 'player'))
formats, subtitles = self._extract_formats_from_vmap_url(vmap_url, content_id or twid)
thumbnails = []
for suffix in ('_small', '', '_large', '_x_large', '_original'... | ```suggestion
videos = traverse_obj(status, (
(None, 'quoted_status'), 'extended_entities', 'media', lambda _, m: m['type'] != 'photo', {dict}))
``` | content_id = get_binding_value('%s_content_id' % (card_name if is_amplify else 'player'))
formats, subtitles = self._extract_formats_from_vmap_url(vmap_url, content_id or twid)
thumbnails = []
for suffix in ('_small', '', '_large', '_x_large', '_original'... | @@ -1052,11 +1092,31 @@ def get_binding_value(k):
'content_duration_seconds')),
}
- media_path = ((None, 'quoted_status'), 'extended_entities', 'media', lambda _, m: m['type'] != 'photo')
- videos = map(extract_from_video_info, traverse_obj(status, media_path, e... | yt_dlp/extractor/twitter.py | 26 | Python | 0.857 | suggestion | 171 | 51 | 51 | false | [extractor/twitter] Fix `--no-playlist` and add media `view_count` when using GraphQL | 6,211 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
'url': 'https://abema.tv/video/episode/87-877_s1282_p31047',
'info_dict': {
'id': 'E8tvAnMJ7a9a5d',
'title': '第5話『光射す』',
'description': 'md5:56d4fc1b4f7769ded5f923c55bb4695d',
'thumbnail': r're:https://hayabusa\.io/.+',
'series': '相棒',
... | ```suggestion
if self.cache.load(self._NETRC_MACHINE, username) and self._get_media_token():
```
Use username as key so that multiple accounts may be cached | 'info_dict': {
'id': 'E8tvAnMJ7a9a5d',
'title': '第5話『光射す』',
'description': 'md5:56d4fc1b4f7769ded5f923c55bb4695d',
'thumbnail': r're:https://hayabusa\.io/.+',
'series': '相棒',
'episode': '第5話『光射す』',
},
'skip': 'expired',
... | @@ -300,6 +311,11 @@ class AbemaTVIE(AbemaTVBaseIE):
_TIMETABLE = None
def _perform_login(self, username, password):
+ auth_cache = self.cache.load('abema', 'usertoken')
+ if auth_cache and auth_cache[0] == username and self._get_media_token(): | yt_dlp/extractor/abematv.py | 26 | Python | 0.786 | performance | 167 | 51 | 51 | false | [extractor/AbemaTV] Cache user token whenever appropriate | 6,216 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
nonlocal tmp
for i in range(count):
mix_once(tmp)
def mix_twist(nonce):
nonlocal tmp
mix_once(base64.urlsafe_b64encode(tmp).rstrip(b'=') + nonce)
mix_once(cls._SECRETKEY)
mix_tmp(time_struct.tm_mon)
mix_twist(deviceid)
... | ```suggestion
AbemaTVBaseIE._USERTOKEN = username and self.cache.load(self._NETRC_MACHINE, username)
if auth_cache:
# try authentication with locally stored token
``` | nonlocal tmp
for i in range(count):
mix_once(tmp)
def mix_twist(nonce):
nonlocal tmp
mix_once(base64.urlsafe_b64encode(tmp).rstrip(b'=') + nonce)
mix_once(cls._SECRETKEY)
mix_tmp(time_struct.tm_mon)
mix_twist(deviceid)
... | @@ -190,6 +190,18 @@ def _get_device_token(self):
if self._USERTOKEN:
return self._USERTOKEN
+ username, _ = self._get_login_info()
+ auth_cache = username and self.cache.load(self._NETRC_MACHINE, username)
+ if auth_cache:
+ # try authentication with locally stor... | yt_dlp/extractor/abematv.py | 26 | Python | 0.786 | security | 198 | 51 | 51 | false | [extractor/AbemaTV] Cache user token whenever appropriate | 6,216 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
'https://auth-id.nfl.com/accounts.getAccountInfo', video_id,
note='Downloading account info', data=urlencode_postdata({
'include': 'profile,data',
'lang': 'en',
'APIKey': self._API_KEY,
'sdk': 'js_latest',
'login_tok... | ```suggestion
'https://api.nfl.com/identity/v3/token%s' % (
'/refresh' if self._ACCOUNT_INFO.get('refreshToken') else ''),
``` | self.raise_login_required()
account = self._download_json(
'https://auth-id.nfl.com/accounts.getAccountInfo', video_id,
note='Downloading account info', data=urlencode_postdata({
'include': 'profile,data',
'lang': 'en',
'APIKey... | @@ -157,3 +164,130 @@ def _real_extract(self, url):
'nfl-c-article__title', webpage)) or self._html_search_meta(
['og:title', 'twitter:title'], webpage)
return self.playlist_result(entries, display_id, title)
+
+
+class NFLPlusReplayIE(NFLBaseIE):
+ IE_NAME = 'nfl.com:plus:replay'
... | yt_dlp/extractor/nfl.py | 26 | Python | 0.714 | suggestion | 157 | 51 | 51 | false | [extractor/nfl] Add `NFLPlus` extractors | 6,222 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'params': {'skip_download': 'm3u8'},
}]
_CLIENT_DATA = {
'networkType': 'other',
'nflClaimGroupsToAdd': [],
'nflClaimGroupsToRemove': [],
'clientKey': '4cFUW6DmwJpzT9L7LrG3qRAcABG5s04g',
'clientSecret': 'CZuvCL49d9OwfGsR',
'deviceId': str(uuid.uuid4()),
... | There can be multiple `glt_`... cookies, and they don't always match the API key. In my testing, with each login the `glt` cookies have had identical values, so any `glt` cookie's value will probably work. But I figure if there *is* a `glt_{_API_KEY}` cookie, then that is the cookie most likely to work should the value... | 'params': {'skip_download': 'm3u8'},
}]
_CLIENT_DATA = {
'clientKey': '4cFUW6DmwJpzT9L7LrG3qRAcABG5s04g',
'clientSecret': 'CZuvCL49d9OwfGsR',
'deviceId': str(uuid.uuid4()),
'deviceInfo': base64.b64encode(json.dumps({
'model': 'desktop',
'version':... | @@ -157,3 +164,131 @@ def _real_extract(self, url):
'nfl-c-article__title', webpage)) or self._html_search_meta(
['og:title', 'twitter:title'], webpage)
return self.playlist_result(entries, display_id, title)
+
+
+class NFLPlusReplayIE(NFLBaseIE):
+ IE_NAME = 'nfl.com:plus:replay'
... | yt_dlp/extractor/nfl.py | 26 | Python | 0.643 | suggestion | 374 | 51 | 51 | false | [extractor/nfl] Add `NFLPlus` extractors | 6,222 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
import re
from typing import Optional
from .common import InfoExtractor
from ..utils import parse_resolution, \
get_element_text_and_html_by_tag, get_element_html_by_class, get_elements_html_by_class, extract_attributes, \
clean_html, urlencode_postdata, get_element_by_class, float_or_none, int_or_none, \
... | ```py
from ..utils import (
...,
...,
)
```
We have `isort` config set up if u want to use it | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
float_or_none,
format_field,
get_element_by_class,
get_element_by_id,
get_element_html_by_class,
get_elements_by_class,
int_or_none,
try_call,
unified_timestamp,
urlencode_postdata,
)
class Nubil... | @@ -0,0 +1,143 @@
+import re
+from typing import Optional
+
+from .common import InfoExtractor
+from ..utils import parse_resolution, \ | yt_dlp/extractor/nubilesporn.py | 5 | Python | 0.786 | style | 107 | 30 | 30 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
class NubilesPornIE(InfoExtractor):
_NETRC_MACHINE: str = 'nubiles-porn'
_BASE_DOMAIN: str = 'nubiles-porn.com'
_BASE_URL: str = f'https://{_BASE_DOMAIN}'
_MEMBERS_URL = f'https://members.{_BASE_DOMAIN}'
_VALID_URL: str = r'https://members.nubiles-porn.com/video/watch/(?P<id>\d+)/(?P<display_id>... | Tests aren't meant to check the format URLs. You can keep the check for format metadata if u think it'll remain consistent, but it isn't needed imo
Tip: Remove all fields except ext/id and run the test. It'll tell you which fields are needed. | get_element_by_id,
get_element_html_by_class,
get_elements_by_class,
int_or_none,
try_call,
unified_timestamp,
urlencode_postdata,
)
class NubilesPornIE(InfoExtractor):
_NETRC_MACHINE = 'nubiles-porn'
_VALID_URL = r'''(?x)
https://members.nubiles-porn.com/video/watch/(?P<id... | @@ -0,0 +1,143 @@
+import re
+from typing import Optional
+
+from .common import InfoExtractor
+from ..utils import parse_resolution, \
+ get_element_text_and_html_by_tag, get_element_html_by_class, get_elements_html_by_class, extract_attributes, \
+ clean_html, urlencode_postdata, get_element_by_class, float_or_... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.5 | suggestion | 246 | 51 | 51 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
{'url': _VALID_VIDEO_URL, 'format_id': 'mp4_480_270', 'width': 480, 'height': 270},
{'url': _VALID_VIDEO_URL, 'format_id': 'mp4_640_360', 'width': 640, 'height': 360},
{'url': _VALID_VIDEO_URL, 'format_id': 'mp4_960_540', 'width': 960, 'height': 540},
{'ur... | Don't use variables in test definition. Hard-code everything | 'md5': 'fa7f09da8027c35e4bdf0f94f55eac82',
'info_dict': {
'id': '165320',
'title': 'Trying To Focus My One Track Mind - S3:E1',
'ext': 'mp4',
'display_id': 'trying-to-focus-my-one-track-mind-s3e1',
'thumbnail': 'https://images.nubiles-porn.com/... | @@ -0,0 +1,143 @@
+import re
+from typing import Optional
+
+from .common import InfoExtractor
+from ..utils import parse_resolution, \
+ get_element_text_and_html_by_tag, get_element_html_by_class, get_elements_html_by_class, extract_attributes, \
+ clean_html, urlencode_postdata, get_element_by_class, float_or_... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.286 | suggestion | 60 | 51 | 51 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
if raw_name:
info['name'] = ' '.join(re.findall('[A-Z][^A-Z]*', raw_name.replace('.com', '')))
return info
@staticmethod
def _get_formats(element) -> list:
return [NubilesPornIE._get_format(i) for i in get_elements_html_by_class('edge-download-item', element)]
@staticme... | * Make use of traverse_obj etc to handle errors. For example, _get_tags should just be:
```py
try_call(lambda: list(map(clean_html, get_elements_by_class(
'btn', get_elements_by_class('tags', element)[1])))
```
* Once you do this, it becomes clear that most of these should even be functions and should just be... | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
float_or_none,
format_field,
get_element_by_class,
get_element_by_id,
get_element_html_by_class,
get_elements_by_class,
int_or_none,
try_call,
unified_timestamp,
urlencode_postdata,
)
class Nubil... | @@ -0,0 +1,143 @@
+import re
+from typing import Optional
+
+from .common import InfoExtractor
+from ..utils import parse_resolution, \
+ get_element_text_and_html_by_tag, get_element_html_by_class, get_elements_html_by_class, extract_attributes, \
+ clean_html, urlencode_postdata, get_element_by_class, float_or_... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 1 | refactor | 345 | 51 | 100 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
'series_id': 64,
'season': 'Season 3',
'season_number': 3,
'episode': 'Episode 1',
'episode_number': 1
}
}]
def _perform_login(self, username, password):
login_webpage: str = self._download_webpage(f'{NubilesPornIE._BASE_URL}/login', v... | Why put it in an intermediate dict, only to unpack it later? Extracting in _real_extract directly would make it way simpler | login_webpage = self._download_webpage('https://nubiles-porn.com/login', video_id=None)
inputs = self._hidden_inputs(login_webpage)
inputs.update({'username': username, 'password': password})
self._request_webpage('https://nubiles-porn.com/authentication/login', None, data=urlencode_post... | @@ -0,0 +1,143 @@
+import re
+from typing import Optional
+
+from .common import InfoExtractor
+from ..utils import parse_resolution, \
+ get_element_text_and_html_by_tag, get_element_html_by_class, get_elements_html_by_class, extract_attributes, \
+ clean_html, urlencode_postdata, get_element_by_class, float_or_... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.429 | refactor | 123 | 51 | 42 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
def _get_formats(element) -> list:
return [NubilesPornIE._get_format(i) for i in get_elements_html_by_class('edge-download-item', element)]
@staticmethod
def _get_format(element: str) -> dict:
res = parse_resolution(get_element_text_and_html_by_tag('div', element)[1])
url = extract_... | ```suggestion
video_id = self._match_valid_url(url).group('id')
page = self._download_webpage(url, video_id)
``` | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
float_or_none,
format_field,
get_element_by_class,
get_element_by_id,
get_element_html_by_class,
get_elements_by_class,
int_or_none,
try_call,
unified_timestamp,
urlencode_postdata,
)
class Nubil... | @@ -0,0 +1,143 @@
+import re
+from typing import Optional
+
+from .common import InfoExtractor
+from ..utils import parse_resolution, \
+ get_element_text_and_html_by_tag, get_element_html_by_class, get_elements_html_by_class, extract_attributes, \
+ clean_html, urlencode_postdata, get_element_by_class, float_or_... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.714 | suggestion | 131 | 51 | 100 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
float_or_none,
get_element_by_class,
get_element_by_id,
get_element_html_by_class,
get_elements_by_class,
int_or_none,
unified_timestamp,
urlencode_postdata,
)
class NubilesPornIE(InfoExtractor):
_NE... | ```suggestion
_VALID_URL = r'''(?x)
https://members.nubiles-porn.com/video/watch/(?P<id>\d+)
(?:/(?P<display_id>[\w\-]+-s(?P<season>\d+)e(?P<episode>\d+)))?
'''
```
URL need not have display_id | import re
from .common import InfoExtractor
from ..utils import (
clean_html,
float_or_none,
format_field,
get_element_by_class,
get_element_by_id,
get_element_html_by_class,
get_elements_by_class,
int_or_none,
try_call,
unified_timestamp,
urlencode_postdata,
)
class Nubil... | @@ -0,0 +1,94 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ float_or_none,
+ get_element_by_class,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_elements_by_class,
+ int_or_none,
+ unified_timestamp,
+ urlencode_postdata,
+)
+
+
+class Nub... | yt_dlp/extractor/nubilesporn.py | 19 | Python | 0.786 | suggestion | 223 | 44 | 44 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
'series_id': 64,
'season': 'Season 3',
'season_number': 3,
'episode': 'Episode 1',
'episode_number': 1
}
}]
def _perform_login(self, username, password):
login_webpage = self._download_webpage('https://nubiles-porn.com/login', video_id... | If regex doesn't match, this shouldn't crash
```suggestion
channel_id, channel_name = self._search_regex(
r'/video/website/(?P<id>\d+).+>(?P<name>\w+).com', get_element_html_by_class('site-link', page),
'channel', fatal=False, group=('id', 'name')) or (None, None)
channel_... | 'Glasses', 'Hardcore', 'Milf', 'Shaved Pussy', 'Tattoos', 'YoungerMommy.com'],
'tags': list,
'cast': ['Kenzie Love'],
'availability': 'needs_auth',
'series': 'Younger Mommy',
'series_id': '64',
'season': 'Season 3',
... | @@ -0,0 +1,94 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ float_or_none,
+ get_element_by_class,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_elements_by_class,
+ int_or_none,
+ unified_timestamp,
+ urlencode_postdata,
+)
+
+
+class Nub... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.857 | bug | 383 | 51 | 51 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
'series': 'Younger Mommy',
'series_id': 64,
'season': 'Season 3',
'season_number': 3,
'episode': 'Episode 1',
'episode_number': 1
}
}]
def _perform_login(self, username, password):
login_webpage = self._download_webpage('ht... | Could u give example for this? This replacement doesn't make much sense in my head. | 'categories': ['Big Boobs', 'Big Naturals', 'Blowjob', 'Brunette', 'Cowgirl', 'Girl Orgasm', 'Girl-Boy',
'Glasses', 'Hardcore', 'Milf', 'Shaved Pussy', 'Tattoos', 'YoungerMommy.com'],
'tags': list,
'cast': ['Kenzie Love'],
'availability': 'needs... | @@ -0,0 +1,94 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ float_or_none,
+ get_element_by_class,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_elements_by_class,
+ int_or_none,
+ unified_timestamp,
+ urlencode_postdata,
+)
+
+
+class Nub... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.286 | suggestion | 83 | 51 | 51 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
self._request_webpage('https://nubiles-porn.com/authentication/login', None, data=urlencode_postdata(inputs))
def _real_extract(self, url):
url_match = self._match_valid_url(url)
video_id = url_match.group('id')
page = self._download_webpage(url, video_id)
media_entries = s... | ```suggestion
'channel_url': format_field(channel_id, None, 'https://members.nubiles-porn.com/video/website/%s'),
``` |
def _perform_login(self, username, password):
login_webpage = self._download_webpage('https://nubiles-porn.com/login', video_id=None)
inputs = self._hidden_inputs(login_webpage)
inputs.update({'username': username, 'password': password})
self._request_webpage('https://nubiles-porn.c... | @@ -0,0 +1,94 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ float_or_none,
+ get_element_by_class,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_elements_by_class,
+ int_or_none,
+ unified_timestamp,
+ urlencode_postdata,
+)
+
+
+class Nub... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.714 | suggestion | 131 | 39 | 44 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
page = self._download_webpage(url, video_id)
media_entries = self._parse_html5_media_entries(
url, get_element_by_class('watch-page-video-wrapper', page), video_id)[0]
channel = re.search(
r'/video/website/(?P<id>\d+).+>(?P<name>\w+).com', get_element_html_by_class('sit... | Should be non-fatal. Read my previous suggestion again | self._request_webpage('https://nubiles-porn.com/authentication/login', None, data=urlencode_postdata(inputs))
def _real_extract(self, url):
url_match = self._match_valid_url(url)
video_id = url_match.group('id')
page = self._download_webpage(url, video_id)
media_entries = s... | @@ -0,0 +1,94 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ float_or_none,
+ get_element_by_class,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_elements_by_class,
+ int_or_none,
+ unified_timestamp,
+ urlencode_postdata,
+)
+
+
+class Nub... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.286 | suggestion | 54 | 34 | 39 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
'episode_number': 1
}
}]
def _perform_login(self, username, password):
login_webpage = self._download_webpage('https://nubiles-porn.com/login', video_id=None)
inputs = self._hidden_inputs(login_webpage)
inputs.update({'username': username, 'password': password})
... | ```suggestion
'title': self._search_regex('<h2>([^<]+)</h2>', page, 'title', fatal=False),
``` | 'series': 'Younger Mommy',
'series_id': '64',
'season': 'Season 3',
'season_number': 3,
'episode': 'Episode 1',
'episode_number': 1
}
}]
def _perform_login(self, username, password):
login_webpage = self._download_webpage('... | @@ -0,0 +1,94 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ float_or_none,
+ get_element_by_class,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_elements_by_class,
+ int_or_none,
+ unified_timestamp,
+ urlencode_postdata,
+)
+
+
+class Nub... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.714 | suggestion | 108 | 47 | 51 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
float_or_none,
get_element_by_class,
get_element_by_id,
get_element_html_by_class,
get_elements_by_class,
int_or_none,
unified_timestamp,
urlencode_postdata,
)
class NubilesPornIE(InfoExtractor):
_NE... | Why's channel and serie the same? |
channel_id, channel_name = self._search_regex(
r'/video/website/(?P<id>\d+).+>(?P<name>\w+).com', get_element_html_by_class('site-link', page),
'channel', fatal=False, group=('id', 'name')) or (None, None)
channel_name = re.sub(r'([^A-Z]+)([A-Z]+)', r'\1 \2', channel_name)
... | @@ -0,0 +1,94 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ float_or_none,
+ get_element_by_class,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_elements_by_class,
+ int_or_none,
+ unified_timestamp,
+ urlencode_postdata,
+)
+
+
+class Nub... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.071 | question | 33 | 95 | 30 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
inputs.update({'username': username, 'password': password})
self._request_webpage('https://nubiles-porn.com/authentication/login', None, data=urlencode_postdata(inputs))
def _real_extract(self, url):
url_match = self._match_valid_url(url)
video_id = url_match.group('id')
pag... | ids are supposed to be strings | inputs.update({'username': username, 'password': password})
self._request_webpage('https://nubiles-porn.com/authentication/login', None, data=urlencode_postdata(inputs))
def _real_extract(self, url):
url_match = self._match_valid_url(url)
video_id = url_match.group('id')
pag... | @@ -64,31 +69,31 @@ def _real_extract(self, url):
media_entries = self._parse_html5_media_entries(
url, get_element_by_class('watch-page-video-wrapper', page), video_id)[0]
- channel = re.search(
- r'/video/website/(?P<id>\d+).+>(?P<name>\w+).com', get_element_html_by_class('si... | yt_dlp/extractor/nubilesporn.py | 26 | Python | 0.071 | suggestion | 30 | 40 | 40 | false | [extractor/nubilesporn] Add NubilesPorn extractor | 6,231 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | permunkle |
for lang, cap_info in automatic_captions.items():
if lang not in available_subs:
available_subs[lang] = cap_info
if not available_subs or (
not self.params.get('writesubtitles')
and not self.params.get('writeautomaticsub')):
... | (untested)
```suggestion
requested_langs = LazyList(itertools.chain(
['en'] if 'en' in normal_sub_langs else [],
filter(lambda f: f.startswith('en'), normal_sub_langs),
['en'] if 'en' in all_sub_langs else [],
filter(lambda f: f.startsw... | for lang, cap_info in automatic_captions.items():
if lang not in available_subs:
available_subs[lang] = cap_info
if not available_subs or (
not self.params.get('writesubtitles')
and not self.params.get('writeautomaticsub')):
... | @@ -2810,10 +2810,14 @@ def process_subtitles(self, video_id, normal_subtitles, automatic_captions):
self.params.get('subtitleslangs'), {'all': all_sub_langs}, use_regex=True)
except re.error as e:
raise ValueError(f'Wrong regex for subtitlelangs: {e.pattern}')
- ... | yt_dlp/YoutubeDL.py | 26 | Python | 0.857 | question | 672 | 51 | 51 | false | Improve how default youtube subs are selected | 6,240 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sdht0 |
_VALID_URL = r'jstream:(?P<host>www\d+):(?P<id>(?P<publisher>[a-z0-9]+):(?P<mid>\d+))'
_TESTS = [{
'url': 'jstream:www50:eqd638pvwx:752',
'info_dict': {
'id': 'eqd638pvwx:752',
'ext': 'mp4',
'title': '阪神淡路大震災 激震の記録2020年版 解説動画',
'duration': 672,
... | ```suggestion
def _find_formats(self, video_id, movie_list_hls, host, publisher, subtitles):
for value in movie_list_hls:
text = value.get('text') or ''
if not text.startswith('auto'):
continue
m3u8_id = remove_start(remove_start(text, 'auto'), '_') ... | _VALID_URL = r'jstream:(?P<host>www\d+):(?P<id>(?P<publisher>[a-z0-9]+):(?P<mid>\d+))'
_TESTS = [{
'url': 'jstream:www50:eqd638pvwx:752',
'info_dict': {
'id': 'eqd638pvwx:752',
'ext': 'mp4',
'title': '阪神淡路大震災 激震の記録2020年版 解説動画',
'duration': 672,
... | @@ -0,0 +1,73 @@
+import base64
+import re
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ js_to_json,
+ remove_start,
+)
+
+
+class JStreamIE(InfoExtractor):
+ # group "id" only exists for compliance, not directly used in requests
+ # also all components are m... | yt_dlp/extractor/jstream.py | 26 | Python | 0.857 | refactor | 632 | 51 | 51 | false | [extractor/JStream] Add extractor | 6,252 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
video_info_jsonp = self._download_webpage(
f'https://{publisher}.eq.webcdn.stream.ne.jp/{host}/{publisher}/jmc_pub/eq_meta/v1/{mid}.jsonp',
video_id, 'Requesting video info')
video_info = self._parse_jsonp('metaDataResult', video_info_jsonp, video_id)['movie']
subtitles =... | ```suggestion
# TODO: using json.loads here as InfoExtractor._parse_json is not classmethod
``` | video_info_jsonp = self._download_webpage(
f'https://{publisher}.eq.webcdn.stream.ne.jp/{host}/{publisher}/jmc_pub/eq_meta/v1/{mid}.jsonp',
video_id, 'Requesting video info')
video_info = self._parse_jsonp('metaDataResult', video_info_jsonp, video_id)['movie']
subtitles =... | @@ -0,0 +1,73 @@
+import base64
+import re
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ float_or_none,
+ js_to_json,
+ remove_start,
+)
+
+
+class JStreamIE(InfoExtractor):
+ # group "id" only exists for compliance, not directly used in requests
+ # also all components are m... | yt_dlp/extractor/jstream.py | 26 | Python | 0.786 | refactor | 109 | 30 | 30 | false | [extractor/JStream] Add extractor | 6,252 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
orderedSet,
parse_codecs,
parse_count,
parse_duration,
parse_iso8601,
parse_qs,
qualities,
remove_start,
smuggle_url,
str_or_none,
str_to_int,
strftime_or_none,
traverse_obj,
try_get,
unescapeHTML,
unified_strdate,
unified_timestamp,
unsmuggle_url,... | ```suggestion
STREAMING_DATA_CLIENT_NAME = '__yt_dlp_client'
```
is similar to what we use in jsinterp | orderedSet,
parse_codecs,
parse_count,
parse_duration,
parse_iso8601,
parse_qs,
qualities,
remove_start,
smuggle_url,
str_or_none,
str_to_int,
strftime_or_none,
traverse_obj,
try_get,
unescapeHTML,
unified_strdate,
unified_timestamp,
unsmuggle_url,... | @@ -66,6 +66,8 @@
variadic,
)
+
+STRAMING_DATA_CLIENT_NAME = '@@youtubeplzdontusethis@@client_name' | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | suggestion | 105 | 51 | 51 | false | [extractor/youtube] Add the first 3 characters of client name in `format_note` | 6,254 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
if player_url:
self.report_warning(
f'nsig extraction failed: You may experience throttling for some formats\n{phantomjs_hint}'
f' n = {query["n"][0]} ; player = {player_url}', video_id=video_id, only_once=True)
... | With 3 chars, we can't tell `web_embedded` etc apart. Maybe use thw whole string? | decrypt_nsig = self._cached(self._decrypt_nsig, 'nsig', query['n'][0])
fmt_url = update_url_query(fmt_url, {
'n': decrypt_nsig(query['n'][0], video_id, player_url)
})
except ExtractorError as e:
phant... | @@ -3736,6 +3740,8 @@ def _extract_formats_and_subtitles(self, streaming_data, video_id, player_url, l
if is_damaged:
self.report_warning(
f'{video_id}: Some formats are possibly damaged. They will be deprioritized', only_once=True)
+
+ client_name = (traver... | yt_dlp/extractor/youtube.py | 26 | Python | 0.429 | question | 81 | 51 | 51 | false | [extractor/youtube] Add the first 3 characters of client name in `format_note` | 6,254 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
}, {
'md5': '58f2ce7f6044e34439ab2d50612ab02b',
'info_dict': {
'id': '36153164_2',
'ext': 'mp4',
'title': "BJ유트루와 함께하는 '팅커벨 메이크업!'",
'upload_date': '20160502',
},
}],
'skip': 'Video is gone',
... | Replace them with tests having similar URL | }, {
'md5': '58f2ce7f6044e34439ab2d50612ab02b',
'info_dict': {
'id': '36153164_2',
'ext': 'mp4',
'title': "BJ유트루와 함께하는 '팅커벨 메이크업!'",
'upload_date': '20160502',
},
}],
'skip': 'Video is gone',
... | @@ -76,59 +76,6 @@ class AfreecaTVIE(InfoExtractor):
},
}],
'skip': 'Video is gone',
- }, {
- 'url': 'http://vod.afreecatv.com/PLAYER/STATION/18650793',
- 'info_dict': {
- 'id': '18650793',
- 'ext': 'mp4',
- 'title': '오늘은 다르다! 쏘님의 우월한 위아래~... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.143 | suggestion | 42 | 51 | 51 | false | [extractor/afreecatv] Fix extractor | 6,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | blmarket |
webpage = self._download_webpage(url, video_id)
if re.search(r'alert\(["\']This video has been deleted', webpage):
raise ExtractorError(
'Video %s has been deleted' % video_id, expected=True)
video_id = self._search_regex(
r'vod.afreecatv.com/player/(\d+... | ```suggestion
video_json = self._download_json(
'https://api.m.afreecatv.com/station/video/a/view', video_id,
headers={'Referer': url}, data=urlencode_postdata({
'nTitleNo': video_id,
'nApiLevel': 10,
}))
... | partial_view = False
adult_view = False
for _ in range(2):
data = self._download_json(
'https://api.m.afreecatv.com/station/video/a/view',
video_id, headers={'Referer': url}, data=urlencode_postdata({
'nTitleNo': video_id,
... | @@ -229,16 +185,26 @@ def _real_extract(self, url):
raise ExtractorError(
'Video %s has been deleted' % video_id, expected=True)
- station_id = self._search_regex(
- r'nStationNo\s*=\s*(\d+)', webpage, 'station')
- bbs_id = self._search_regex(
- r'nBbs... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.786 | suggestion | 494 | 51 | 51 | false | [extractor/afreecatv] Fix extractor | 6,283 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | blmarket |
0: 'The username does not exist or you have entered the wrong password.',
-1: 'The username does not exist or you have entered the wrong password.',
-3: 'You have entered your username/password incorrectly.',
-7: 'You cannot use your Global AfreecaTV account to access Kor... | Minor regex fix...but is this `video_id = ...` even necessary though? The `video_id` is always matched from the URL, yeah? Are there any tests/examples that need this?
```suggestion
r'vod\.afreecatv\.com/player/(\d+)/', webpage, 'title', default=video_id)
``` | -1: 'The username does not exist or you have entered the wrong password.',
-3: 'You have entered your username/password incorrectly.',
-7: 'You cannot use your Global AfreecaTV account to access Korean AfreecaTV.',
-10: 'Sorry for the inconvenience. \nYour account has bee... | @@ -229,16 +186,20 @@ def _real_extract(self, url):
raise ExtractorError(
'Video %s has been deleted' % video_id, expected=True)
- station_id = self._search_regex(
- r'nStationNo\s*=\s*(\d+)', webpage, 'station')
- bbs_id = self._search_regex(
- r'nBbs... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.786 | suggestion | 274 | 51 | 51 | false | [extractor/afreecatv] Fix extractor | 6,283 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | blmarket |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
if re.search(r'alert\(["\']This video has been deleted', webpage):
raise ExtractorError(
'Video %s has been deleted' % video_id, expected=True)
... | single-quote URL, and you could simplify it like this:
```suggestion
data = self._download_json(
'https://api.m.afreecatv.com/station/video/a/view',
video_id, headers={'Referer': url}, data=urlencode_postdata({
'nTitleNo': video_id,
... | video_id = self._match_id(url)
partial_view = False
adult_view = False
for _ in range(2):
data = self._download_json(
'https://api.m.afreecatv.com/station/video/a/view',
video_id, headers={'Referer': url}, data=urlencode_postdata({
... | @@ -229,16 +186,20 @@ def _real_extract(self, url):
raise ExtractorError(
'Video %s has been deleted' % video_id, expected=True)
- station_id = self._search_regex(
- r'nStationNo\s*=\s*(\d+)', webpage, 'station')
- bbs_id = self._search_regex(
- r'nBbs... | yt_dlp/extractor/afreecatv.py | 26 | Python | 0.857 | refactor | 629 | 51 | 51 | false | [extractor/afreecatv] Fix extractor | 6,283 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | blmarket |
self._LOGIN_URL, None, note='Downloading login page',
errnote='Downloading login page failed')
login_form = self._hidden_inputs(login_page)
login_form.update({
'_email': username,
'_password': password})
profile_select_html, login_handle = self.... | Use `query` param of _download_webpage_handle |
login_form = self._hidden_inputs(login_page)
login_form.update({
'_email': username,
'_password': password})
profile_select_html, login_handle = self._download_webpage_handle(
f'{self._AUTH_ROOT}/oauth2/login', None, data=urlencode_postdata(login_form),
... | @@ -76,20 +78,36 @@ def _perform_login(self, username, password):
'_email': username,
'_password': password})
- _, login_handle = self._download_webpage_handle(
+ profile_select_html, login_handle = self._download_webpage_handle(
self._LOGIN_URL, None, data=urlenco... | yt_dlp/extractor/iprima.py | 26 | Python | 0.429 | suggestion | 45 | 51 | 51 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | std-move |
'_email': username,
'_password': password})
profile_select_html, login_handle = self._download_webpage_handle(
self._LOGIN_URL, None, data=urlencode_postdata(login_form),
note='Logging in')
# a profile may need to be selected first, even when there is on... | ```suggestion
codes = traverse_obj(login_handle.geturl(), ({parse_qs}, 'code', 0))
if not codes:
raise ExtractorError('Login failed', expected=True)
``` |
profile_select_html, login_handle = self._download_webpage_handle(
f'{self._AUTH_ROOT}/oauth2/login', None, data=urlencode_postdata(login_form),
note='Logging in')
# a profile may need to be selected first, even when there is only a single one
if '/profile-select' in lo... | @@ -76,20 +78,36 @@ def _perform_login(self, username, password):
'_email': username,
'_password': password})
- _, login_handle = self._download_webpage_handle(
+ profile_select_html, login_handle = self._download_webpage_handle(
self._LOGIN_URL, None, data=urlenco... | yt_dlp/extractor/iprima.py | 26 | Python | 0.929 | bug | 184 | 51 | 51 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | std-move |
token_data = self._download_json(
self._TOKEN_URL, None,
note='Downloading token', errnote='Downloading token failed',
data=urlencode_postdata(token_request_data))
self.access_token = token_data.get('access_token')
if self.access_token is None:
ra... | ```suggestion
title = self._html_extract_title(webpage) or self._html_search_meta(
``` | def _real_initialize(self):
if not self.access_token:
self.raise_login_required('Login is required to access any iPrima content', method='password')
def _raise_access_error(self, error_code):
if error_code == 'PLAY_GEOIP_DENIED':
self.raise_geo_restricted(countries=['CZ'... | @@ -115,14 +133,18 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id)
- title = self._html_search_meta(
+ title = self._html_extract_title(webpage)
+ title = title or self._html_search_meta( | yt_dlp/extractor/iprima.py | 26 | Python | 0.643 | refactor | 96 | 51 | 51 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | std-move |
if not self.access_token:
self.raise_login_required('Login is required to access any iPrima content', method='password')
def _raise_access_error(self, error_code):
if error_code == 'PLAY_GEOIP_DENIED':
self.raise_geo_restricted(countries=['CZ'], metadata_available=True)
... | ```suggestion
video_id = self._search_regex((
r'productId\s*=\s*([\'"])(?P<id>p\d+)\1',
r'pproduct_id\s*=\s*([\'"])(?P<id>p\d+)\1',
r'([\'"]?)videoLength\1\s*:.*?([\'"]?)videoPlayId\2\s*:\s*(["\'])(?P<id>p\d+)\3',
), webpage, 'real id', group='id', flags=re.MULTI... | def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_extract_title(webpage) or self._html_search_meta(
['og:title', 'twitter:title'],
webpage, 'title', default=None)
video_id = self.... | @@ -115,14 +133,18 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id)
- title = self._html_search_meta(
+ title = self._html_extract_title(webpage)
+ title = title or self._html_search_meta(
['og:title', 'twitter:title'],
webpage,... | yt_dlp/extractor/iprima.py | 26 | Python | 0.786 | suggestion | 344 | 51 | 51 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | std-move |
import re
import time
import urllib.parse
from .common import InfoExtractor
from ..utils import (
determine_ext,
js_to_json,
urlencode_postdata,
ExtractorError,
parse_qs
)
class IPrimaIE(InfoExtractor):
_VALID_URL = r'https?://(?!cnn)(?:[^/]+)\.iprima\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
_GEO... | Only _AUTH_ROOT needs to be variable imo | import re
import time
from .common import InfoExtractor
from ..utils import (
determine_ext,
js_to_json,
urlencode_postdata,
ExtractorError,
parse_qs,
traverse_obj
)
class IPrimaIE(InfoExtractor):
_VALID_URL = r'https?://(?!cnn)(?:[^/]+)\.iprima\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
_GEO_B... | @@ -15,8 +16,9 @@ class IPrimaIE(InfoExtractor):
_VALID_URL = r'https?://(?!cnn)(?:[^/]+)\.iprima\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
_GEO_BYPASS = False
_NETRC_MACHINE = 'iprima'
- _LOGIN_URL = 'https://auth.iprima.cz/oauth2/login'
- _TOKEN_URL = 'https://auth.iprima.cz/oauth2/token'
+ _AUTH_ROOT ... | yt_dlp/extractor/iprima.py | 21 | Python | 0.071 | security | 40 | 46 | 46 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | std-move |
login_page = self._download_webpage(
self._LOGIN_URL, None, note='Downloading login page',
errnote='Downloading login page failed')
login_form = self._hidden_inputs(login_page)
login_form.update({
'_email': username,
'_password': password})
... | Since we are not using the page contents, use _request_webpage | f'{self._AUTH_ROOT}/oauth2/login', None, note='Downloading login page',
errnote='Downloading login page failed')
login_form = self._hidden_inputs(login_page)
login_form.update({
'_email': username,
'_password': password})
profile_select_html, lo... | @@ -76,20 +78,36 @@ def _perform_login(self, username, password):
'_email': username,
'_password': password})
- _, login_handle = self._download_webpage_handle(
+ profile_select_html, login_handle = self._download_webpage_handle(
self._LOGIN_URL, None, data=urlenco... | yt_dlp/extractor/iprima.py | 26 | Python | 0.286 | suggestion | 62 | 51 | 51 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | std-move |
try:
data = nuxt_data['data']
inner = data[list(data.keys())[0]]
video_id = traverse_obj(inner, ('content', 'additionals', 'videoPlayId'))
assert video_id and len(video_id), 'Failed to get video id from nuxt'
return video_id
except Exception as... | ```suggestion
if not video_id:
nuxt_data = self._search_nuxt_data(webpage, video_id, traverse='data')
video_id = traverse_obj(
nuxt_data, (..., 'content', 'additionals', 'videoPlayId', {str}), get_all=False)
if not video_id:
self.raise_no... | title = self._html_extract_title(webpage) or self._html_search_meta(
['og:title', 'twitter:title'],
webpage, 'title', default=None)
video_id = self._search_regex((
r'productId\s*=\s*([\'"])(?P<id>p\d+)\1',
r'pproduct_id\s*=\s*([\'"])(?P<id>p\d+)\1',
... | @@ -110,19 +123,33 @@ def _raise_access_error(self, error_code):
elif error_code is not None:
self.raise_no_formats('Access to stream infos forbidden', expected=True)
+ def _extract_id_from_nuxt(self, nuxt_data):
+ try:
+ data = nuxt_data['data']
+ inner = data[li... | yt_dlp/extractor/iprima.py | 26 | Python | 0.857 | refactor | 376 | 51 | 51 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | std-move |
'only_matching': True,
}]
def _perform_login(self, username, password):
if self.access_token:
return
login_page = self._download_webpage(
f'{self._AUTH_ROOT}/oauth2/login', None, note='Downloading login page',
errnote='Downloading login page failed')... | ```suggestion
profile_id = self._search_regex(
r'data-identifier\s*=\s*["\']?(\w+)', profile_select_html, 'profile id')
```
`["\']?` is a no-op | 'only_matching': True,
}]
def _perform_login(self, username, password):
if self.access_token:
return
login_page = self._download_webpage(
f'{self._AUTH_ROOT}/oauth2/login', None, note='Downloading login page',
errnote='Downloading login page failed')... | @@ -76,11 +76,24 @@ def _perform_login(self, username, password):
'_email': username,
'_password': password})
- _, login_handle = self._download_webpage_handle(
- self._LOGIN_URL, None, data=urlencode_postdata(login_form),
+ profile_select_html, login_handle = self._... | yt_dlp/extractor/iprima.py | 26 | Python | 0.714 | suggestion | 175 | 51 | 51 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | std-move |
login_page = self._download_webpage(
f'{self._AUTH_ROOT}/oauth2/login', None, note='Downloading login page',
errnote='Downloading login page failed')
login_form = self._hidden_inputs(login_page)
login_form.update({
'_email': username,
'_password'... | ```suggestion
login_handle = self._request_webpage(
f'{self._AUTH_ROOT}/user/profile-select-perform/{profile_id}', None,
query={'continueUrl': '/user/login?redirect_uri=/user/'}, note='Selecting profile')
``` | login_page = self._download_webpage(
f'{self._AUTH_ROOT}/oauth2/login', None, note='Downloading login page',
errnote='Downloading login page failed')
login_form = self._hidden_inputs(login_page)
login_form.update({
'_email': username,
'_password'... | @@ -76,11 +76,24 @@ def _perform_login(self, username, password):
'_email': username,
'_password': password})
- _, login_handle = self._download_webpage_handle(
- self._LOGIN_URL, None, data=urlencode_postdata(login_form),
+ profile_select_html, login_handle = self._... | yt_dlp/extractor/iprima.py | 26 | Python | 1 | security | 256 | 51 | 51 | false | [extractor/iprima] fix token retrieval, fix extractor | 6,291 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | std-move |
from .common import InfoExtractor
from ..utils import ExtractorError, merge_dicts
class RecurbateIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://recurbate.com/play.php?video=39161415',
'md5': 'dd2b4ec57aa3e3572cb5... | `import urllib.error` above and:
```suggestion
if isinstance(e.cause, urllib.error.HTTPError) and e.cause.code == 403:
self.raise_login_required()
raise
``` | import urllib.error
from .common import InfoExtractor
from ..utils import ExtractorError, merge_dicts
class RecurbateIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>\d+)'
_TESTS = [{
'url': 'https://recurbate.com/play.php?video=39161415',
'md5': 'dd... | @@ -0,0 +1,43 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, merge_dicts
+
+
+class RecurbateIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://recurbate.com/play.php?video=39161415',
+ 'm... | yt_dlp/extractor/recurbate.py | 26 | Python | 1 | suggestion | 201 | 44 | 44 | false | [recurbate.com] Add recurbate extractor | 6,297 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | mrscrapy |
'id': '39161415',
'ext': 'mp4',
'description': 'md5:db48d09e4d93fc715f47fd3d6b7edd51',
'title': 'Performer zsnicole33 show on 2022-10-25 20:23, Chaturbate Archive – Recurbate',
'age_limit': 18,
},
'skip': 'Website require membership.',
}]
... | is this still necessary if unauthenticated users will be getting 403 from the initial webpage request? | 'md5': 'dd2b4ec57aa3e3572cb5cf0997fca99f',
'info_dict': {
'id': '39161415',
'ext': 'mp4',
'description': 'md5:db48d09e4d93fc715f47fd3d6b7edd51',
'title': 'Performer zsnicole33 show on 2022-10-25 20:23, Chaturbate Archive – Recurbate',
'age_limi... | @@ -0,0 +1,43 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, merge_dicts
+
+
+class RecurbateIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://recurbate.com/play.php?video=39161415',
+ 'm... | yt_dlp/extractor/recurbate.py | 26 | Python | 0.429 | security | 102 | 34 | 34 | false | [recurbate.com] Add recurbate extractor | 6,297 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | mrscrapy |
'ext': 'mp4',
'description': 'md5:db48d09e4d93fc715f47fd3d6b7edd51',
'title': 'Performer zsnicole33 show on 2022-10-25 20:23, Chaturbate Archive – Recurbate',
'age_limit': 18,
},
'skip': 'Website require membership.',
}]
def _real_extract(self, ur... | ```suggestion
self.raise_no_formats('No media links found')
``` | 'info_dict': {
'id': '39161415',
'ext': 'mp4',
'description': 'md5:db48d09e4d93fc715f47fd3d6b7edd51',
'title': 'Performer zsnicole33 show on 2022-10-25 20:23, Chaturbate Archive – Recurbate',
'age_limit': 18,
},
'skip': 'Website require... | @@ -0,0 +1,43 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, merge_dicts
+
+
+class RecurbateIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://recurbate.com/play.php?video=39161415',
+ 'm... | yt_dlp/extractor/recurbate.py | 26 | Python | 0.571 | suggestion | 77 | 33 | 33 | false | [recurbate.com] Add recurbate extractor | 6,297 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | mrscrapy |
from .common import InfoExtractor
from ..utils import ExtractorError, merge_dicts
class RecurbateIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://recurbate.com/play.php?video=39161415',
'md5': 'dd2b4ec57aa3e3572cb5... | I don't know if this message is clear enough, but the --user-agent parameter is required to match the one set during the browser session.
Is there also an automated way to do that? | from .common import InfoExtractor
from ..utils import ExtractorError, merge_dicts
class RecurbateIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>\d+)'
_TESTS = [{
'url': 'https://recurbate.com/play.php?video=39161415',
'md5': 'dd2b4ec57aa3e3572cb5cf0... | @@ -25,7 +25,7 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id)
except ExtractorError as e:
if isinstance(e.cause, urllib.error.HTTPError) and e.cause.code == 403:
- self.raise_login_required()
+ self.raise_login_required(m... | yt_dlp/extractor/recurbate.py | 26 | Python | 0.429 | question | 183 | 41 | 42 | false | [recurbate.com] Add recurbate extractor | 6,297 | yt-dlp/yt-dlp | 132,642 | Python | mrscrapy | mrscrapy |
import urllib.error
from .common import InfoExtractor
from ..utils import ExtractorError, merge_dicts
class RecurbateIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://recurbate.com/play.php?video=39161415',
'md5': ... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>\d+)'
``` | import urllib.error
from .common import InfoExtractor
from ..utils import ExtractorError, merge_dicts
class RecurbateIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>\d+)'
_TESTS = [{
'url': 'https://recurbate.com/play.php?video=39161415',
'md5': 'dd... | @@ -0,0 +1,42 @@
+import urllib.error
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, merge_dicts
+
+
+class RecurbateIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)' | yt_dlp/extractor/recurbate.py | 8 | Python | 0.714 | suggestion | 102 | 33 | 33 | false | [recurbate.com] Add recurbate extractor | 6,297 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mrscrapy |
'ext': 'mp4',
'description': 'md5:db48d09e4d93fc715f47fd3d6b7edd51',
'title': 'Performer zsnicole33 show on 2022-10-25 20:23, Chaturbate Archive – Recurbate',
'age_limit': 18,
},
'skip': 'Website require membership.',
}]
def _real_extract(self, ur... | ```suggestion
token = self._html_search_regex(r'data-token="([^"]+)"', webpage, 'token')
video_url = f'https://recurbate.com/api/get.php?video={video_id}&token={token}'
video_webpage = self._download_webpage(video_url, video_id)
entries = self._parse_html5_media_entries(vid... | 'ext': 'mp4',
'description': 'md5:db48d09e4d93fc715f47fd3d6b7edd51',
'title': 'Performer zsnicole33 show on 2022-10-25 20:23, Chaturbate Archive – Recurbate',
'age_limit': 18,
},
'skip': 'Website require membership.',
}]
def _real_extract(self, ur... | @@ -0,0 +1,42 @@
+import urllib.error
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, merge_dicts
+
+
+class RecurbateIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://recurbate.com/play.php?video... | yt_dlp/extractor/recurbate.py | 26 | Python | 0.857 | refactor | 482 | 30 | 31 | false | [recurbate.com] Add recurbate extractor | 6,297 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mrscrapy |
from .common import InfoExtractor
from .francetv import FranceTVIE
class LumniIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
'md5': '960e8240c4f2c7a2... | Right now you are only matching letters or numbers for the 'id', it would be better if you matched letters, numbers and dashes like this:
```python
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>[\w-]+)'
```
This way, the display id for 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans... | from .common import InfoExtractor
from .francetv import FranceTVIE
class LumniIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
'md5': '960e8240c4f2c... | @@ -0,0 +1,23 @@
+from .common import InfoExtractor
+from .francetv import FranceTVIE
+
+
+class LumniIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>\w+)' | yt_dlp/extractor/lumni.py | 6 | Python | 0.857 | suggestion | 440 | 24 | 25 | false | added lumni.fr extractor | 6,302 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | carusocr |
from .common import InfoExtractor
from .francetv import FranceTVIE
class LumniIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
'md5': '960e8240c4f2c7a2... | https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#do-not-misuse--and-use-the-correct-quantifiers-
Avoid using .* in regex because it can quickly over-match
Do this instead, [^"\']+ matches until it finds the closing quotes
```python
<div[^>]+data-factoryid\s*=\s*["\'](?P<video_id>[^"\']+)
```
| from .common import InfoExtractor
from .francetv import FranceTVIE
class LumniIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
'md5': '960e8240c4f2c... | @@ -0,0 +1,23 @@
+from .common import InfoExtractor
+from .francetv import FranceTVIE
+
+
+class LumniIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>\w+)'
+ _TESTS = [{
+ 'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
+ ... | yt_dlp/extractor/lumni.py | 22 | Python | 0.857 | suggestion | 319 | 24 | 25 | false | added lumni.fr extractor | 6,302 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | carusocr |
from .common import InfoExtractor
from .francetv import FranceTVIE
class LumniIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
'md5': '960e8240c4f2c7a2... | I think it would be better to move this extractor to francetv.py, they're closely related | from .common import InfoExtractor
from .francetv import FranceTVIE
class LumniIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
'md5': '960e8240c4f2c... | @@ -0,0 +1,23 @@
+from .common import InfoExtractor
+from .francetv import FranceTVIE
+
+
+class LumniIE(InfoExtractor): | yt_dlp/extractor/lumni.py | 5 | Python | 0.286 | refactor | 89 | 24 | 25 | false | added lumni.fr extractor | 6,302 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | carusocr |
from .common import InfoExtractor
from .francetv import FranceTVIE
class LumniIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
'md5': '960e8240c4f2c... | ```suggestion
video_id = self._html_search_regex(
r'<div[^>]+data-factoryid\s*=\s*["\']([^"\']+)', webpage, 'video id')
``` | from .common import InfoExtractor
from .francetv import FranceTVIE
class LumniIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
'md5': '960e8240c4f2c... | @@ -0,0 +1,23 @@
+from .common import InfoExtractor
+from .francetv import FranceTVIE
+
+
+class LumniIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?lumni\.fr/video/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://www.lumni.fr/video/l-homme-et-son-environnement-dans-la-revolution-industrielle',
+ ... | yt_dlp/extractor/lumni.py | 22 | Python | 0.714 | suggestion | 146 | 24 | 25 | false | added lumni.fr extractor | 6,302 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | carusocr |
'info_dict': {
'id': 'QJzqoNbf',
'title': 'La philosophe Nathalie Sarthou-Lajus est l’invitée du Figaro Live',
'description': 'md5:c586793bb72e726c83aa257f99a8c8c4',
'upload_date': '20230217',
'timestamp': 1676661986,
'duration': 1558,
... | Never use $ in VALID_URLs. I noticed it in your other PRs too. To block more `/...`, use
```suggestion
_VALID_URL = r'https?://video\.lefigaro\.fr/figaro/(?P<id>[\w-]+)/?(?:[#?]|$)'
``` | import re
from .common import InfoExtractor
from ..utils import unsmuggle_url
class JWPlatformIE(InfoExtractor):
_VALID_URL = r'(?:https?://(?:content\.jwplatform|cdn\.jwplayer)\.com/(?:(?:feed|player|thumb|preview|manifest)s|jw6|v2/media)/|jwplatform:)(?P<id>[a-zA-Z0-9]{8})'
_TESTS = [{
'url': 'http... | @@ -73,3 +75,128 @@ def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._download_json('https://cdn.jwplayer.com/v2/media/' + video_id, video_id)
return self._parse_jwplayer_data(json_data, video_id)
+
+
+class LeFigaroVideoEmbedIE(InfoExtractor):
+ _VALID_URL = r... | yt_dlp/extractor/jwplatform.py | 26 | Python | 0.786 | suggestion | 193 | 51 | 76 | false | [extractor/jwplatform] Add LeFigaroVideo extractors | 6,309 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
def _get_api_response(self, display_id, page_num, note=None):
return self._download_json(
'https://api-graphql.lefigaro.fr/graphql', display_id, note=note,
query={
'id': 'flive-website_UpdateListPage_1fb260f996bca2d78960805ac382544186b3225f5bedb43ad08b9b8abef79af6',
... | ```suggestion
return [self.url_result(
video['embedUrl'], LeFigaroVideoEmbedIE, **traverse_obj(video, {
'title': 'name',
'description': 'description',
'thumbnail': 'thumbnailUrl',
}) for video in api_response['... | import re
from .common import InfoExtractor
from ..utils import unsmuggle_url
class JWPlatformIE(InfoExtractor):
_VALID_URL = r'(?:https?://(?:content\.jwplatform|cdn\.jwplayer)\.com/(?:(?:feed|player|thumb|preview|manifest)s|jw6|v2/media)/|jwplatform:)(?P<id>[a-zA-Z0-9]{8})'
_TESTS = [{
'url': 'http... | @@ -73,3 +75,128 @@ def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._download_json('https://cdn.jwplayer.com/v2/media/' + video_id, video_id)
return self._parse_jwplayer_data(json_data, video_id)
+
+
+class LeFigaroVideoEmbedIE(InfoExtractor):
+ _VALID_URL = r... | yt_dlp/extractor/jwplatform.py | 26 | Python | 0.786 | suggestion | 376 | 32 | 76 | false | [extractor/jwplatform] Add LeFigaroVideo extractors | 6,309 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
parse_iso8601,
traverse_obj,
)
class TuneInBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?tunein\.com'
def _extract_metadata(self, webpage, content_id):
return self._search_json(r'window.INITIAL_STATE=', webpage, 'hydration', content_id, fatal=False)
def _extract_formats_a... | ```suggestion
'url': self._search_regex(r'File1=(.*)', playlist_content, 'url'),
``` | parse_iso8601,
traverse_obj,
)
class TuneInBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?tunein\.com'
def _extract_metadata(self, webpage, content_id):
return self._search_json(r'window.INITIAL_STATE=', webpage, 'hydration', content_id, fatal=False)
def _extract_formats_a... | @@ -1,149 +1,201 @@
-import re
+import urllib.parse
from .common import InfoExtractor
-from ..utils import ExtractorError
-from ..compat import compat_urlparse
+from ..utils import (
+ OnDemandPagedList,
+ determine_ext,
+ parse_iso8601,
+ traverse_obj,
+)
class TuneInBaseIE(InfoExtractor):
- _AP... | yt_dlp/extractor/tunein.py | 26 | Python | 0.714 | suggestion | 106 | 51 | 51 | false | [extractor/tunein] Fix broken extractors | 6,310 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
formats, subtitles = [], {}
for stream in streams:
if stream.get('media_type') == 'hls':
fmts, subs = self._extract_m3u8_formats_and_subtitles(stream['url'], content_id, fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subt... | ```suggestion
_VALID_URL = TuneInBaseIE._VALID_URL_BASE + r'(?:/radio/[^?#]+-|/embed/player/)(?P<id>s\d+)'
``` |
formats, subtitles = [], {}
for stream in streams:
if stream.get('media_type') == 'hls':
fmts, subs = self._extract_m3u8_formats_and_subtitles(stream['url'], content_id, fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subt... | @@ -1,149 +1,201 @@
-import re
+import urllib.parse
from .common import InfoExtractor
-from ..utils import ExtractorError
-from ..compat import compat_urlparse
+from ..utils import (
+ OnDemandPagedList,
+ determine_ext,
+ parse_iso8601,
+ traverse_obj,
+)
class TuneInBaseIE(InfoExtractor):
- _AP... | yt_dlp/extractor/tunein.py | 26 | Python | 0.714 | suggestion | 116 | 51 | 51 | false | [extractor/tunein] Fix broken extractors | 6,310 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
def _real_extract(self, url):
podcast_id = self._match_id(url)
webpage = self._download_webpage(url, podcast_id, fatal=False)
metadata = self._extract_metadata(webpage, podcast_id)
def page_func(page_num):
api_response = self._download_json(
f'https://a... | ```suggestion
return self.playlist_result(
entries, playlist_id=podcast_id, playlist_title=traverse_obj(metadata, ('profiles', podcast_id, 'title')),
playlist_description=traverse_obj(metadata, ('profiles', podcast_id, 'description')))
```
```suggestion
return self.playlist... |
def _real_extract(self, url):
podcast_id = self._match_id(url)
webpage = self._download_webpage(url, podcast_id, fatal=False)
metadata = self._extract_metadata(webpage, podcast_id)
def page_func(page_num):
api_response = self._download_json(
f'https://a... | @@ -1,149 +1,201 @@
-import re
+import urllib.parse
from .common import InfoExtractor
-from ..utils import ExtractorError
-from ..compat import compat_urlparse
+from ..utils import (
+ OnDemandPagedList,
+ determine_ext,
+ parse_iso8601,
+ traverse_obj,
+)
class TuneInBaseIE(InfoExtractor):
- _AP... | yt_dlp/extractor/tunein.py | 26 | Python | 0.929 | suggestion | 534 | 51 | 51 | false | [extractor/tunein] Fix broken extractors | 6,310 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
'description': 'md5:1218e575eeaff75f48ed978261fa2068',
},
'playlist_mincount': 200,
}]
_PAGE_SIZE = 30
def _real_extract(self, url):
podcast_id = self._match_id(url)
webpage = self._download_webpage(url, podcast_id, fatal=False)
metadata = self._extract... | ```suggestion
self.url_result(
f'https://tunein.com/podcasts/{podcast_id}?topicId={episode["GuideId"][1:]}',
TuneInPodcastEpisodeIE, title=episode.get('Title'))
``` | 'description': 'md5:1218e575eeaff75f48ed978261fa2068',
},
'playlist_mincount': 200,
}]
_PAGE_SIZE = 30
def _real_extract(self, url):
podcast_id = self._match_id(url)
webpage = self._download_webpage(url, podcast_id, fatal=False)
metadata = self._extract... | @@ -1,149 +1,201 @@
-import re
+import urllib.parse
from .common import InfoExtractor
-from ..utils import ExtractorError
-from ..compat import compat_urlparse
+from ..utils import (
+ OnDemandPagedList,
+ determine_ext,
+ parse_iso8601,
+ traverse_obj,
+)
class TuneInBaseIE(InfoExtractor):
- _AP... | yt_dlp/extractor/tunein.py | 26 | Python | 0.929 | suggestion | 224 | 51 | 51 | false | [extractor/tunein] Fix broken extractors | 6,310 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
def _real_extract(self, url):
station_id = self._match_id(url)
webpage = self._download_webpage(url, station_id)
metadata = self._extract_metadata(webpage, station_id)
formats, subtitles = self._extract_formats_and_subtitles(station_id)
return {
'id': station_i... | See comment about $ on other PR |
def _real_extract(self, url):
station_id = self._match_id(url)
webpage = self._download_webpage(url, station_id)
metadata = self._extract_metadata(webpage, station_id)
formats, subtitles = self._extract_formats_and_subtitles(station_id)
return {
'id': station_i... | @@ -1,149 +1,201 @@
-import re
+import urllib.parse
from .common import InfoExtractor
-from ..utils import ExtractorError
-from ..compat import compat_urlparse
+from ..utils import (
+ OnDemandPagedList,
+ determine_ext,
+ parse_iso8601,
+ traverse_obj,
+)
class TuneInBaseIE(InfoExtractor):
- _AP... | yt_dlp/extractor/tunein.py | 26 | Python | 0.071 | suggestion | 31 | 51 | 51 | false | [extractor/tunein] Fix broken extractors | 6,310 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
def _real_extract(self, url):
station_id = self._match_id(url)
webpage = self._download_webpage(url, station_id)
metadata = self._extract_metadata(webpage, station_id)
formats, subtitles = self._extract_formats_and_subtitles(station_id)
return {
'id': station_i... | ```suggestion
_VALID_URL = TuneInBaseIE._VALID_URL_BASE + r'/(?:podcasts/[^?#]+-|embed/player/)(?P<id>p\d+)/?(?:#|$)'
``` |
def _real_extract(self, url):
station_id = self._match_id(url)
webpage = self._download_webpage(url, station_id)
metadata = self._extract_metadata(webpage, station_id)
formats, subtitles = self._extract_formats_and_subtitles(station_id)
return {
'id': station_i... | @@ -1,149 +1,201 @@
-import re
+import urllib.parse
from .common import InfoExtractor
-from ..utils import ExtractorError
-from ..compat import compat_urlparse
+from ..utils import (
+ OnDemandPagedList,
+ determine_ext,
+ parse_iso8601,
+ traverse_obj,
+)
class TuneInBaseIE(InfoExtractor):
- _AP... | yt_dlp/extractor/tunein.py | 26 | Python | 0.857 | suggestion | 127 | 51 | 51 | false | [extractor/tunein] Fix broken extractors | 6,310 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
return self.playlist_from_matches(
re.findall(r'<a[^>]+href\s*=\s*"([^"]+\.mp4)', self._download_player_webpage(webpage, display_id)),
playlist_id=display_id, playlist_title=self._get_clean_title(self._og_search_title(webpage)))
class TelecaribePlayLiveIE(TelecaribeBaseIE):
_VALID_... | ```suggestion
m3u8_url = self._search_regex(
r'(?:let|const|var)\s+source\s*=\s*["\']([^"\']+)',
self._download_player_webpage(webpage, display_id), 'formats url')
formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, display_id, 'mp4')
``` | import re
from .common import InfoExtractor
from ..utils import traverse_obj
class TelecaribePlayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?play\.telecaribe\.co/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.play.telecaribe.co/breicok',
'info_dict': {
'id': 'breicok',
... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+
+
+class TelecaribeBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https?://(?:www\.)?play\.telecaribe\.co'
+
+ def _download_player_webpage(self, webpage, display_id):
+ page_id = (self._search_regex(r'window.firstPageId\s*=\s*["\']([^"\']+)'... | yt_dlp/extractor/telecaribe.py | 26 | Python | 0.857 | refactor | 303 | 35 | 78 | false | [extractor/telecaribe] Add TelecaribePlay extractors | 6,311 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
import re
from .common import InfoExtractor
class TelecaribeBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?play\.telecaribe\.co'
def _download_player_webpage(self, webpage, display_id):
page_id = (self._search_regex(r'window.firstPageId\s*=\s*["\']([^"\']+)', webpage, 'page_id', fatal... | ```suggestion
page_id = self._search_regex(
(r'window.firstPageId\s*=\s*["\']([^"\']+)', r'<div[^>]+id\s*=\s*["\']pageBackground_([^"\']+)'),
webpage, 'page id')
```
Why fatal=False? | import re
from .common import InfoExtractor
from ..utils import traverse_obj
class TelecaribePlayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?play\.telecaribe\.co/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.play.telecaribe.co/breicok',
'info_dict': {
'id': 'breicok',
... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+
+
+class TelecaribeBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https?://(?:www\.)?play\.telecaribe\.co'
+
+ def _download_player_webpage(self, webpage, display_id):
+ page_id = (self._search_regex(r'window.firstPageId\s*=\s*["\']([^"\']+)'... | yt_dlp/extractor/telecaribe.py | 11 | Python | 0.786 | question | 220 | 36 | 36 | false | [extractor/telecaribe] Add TelecaribePlay extractors | 6,311 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
import re
from .common import InfoExtractor
class TelecaribeBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?play\.telecaribe\.co'
def _download_player_webpage(self, webpage, display_id):
page_id = (self._search_regex(r'window.firstPageId\s*=\s*["\']([^"\']+)', webpage, 'page_id', fatal... | ```suggestion
traverse_obj(props, (..., 'url')[-1], display_id)
``` | import re
from .common import InfoExtractor
from ..utils import traverse_obj
class TelecaribePlayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?play\.telecaribe\.co/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.play.telecaribe.co/breicok',
'info_dict': {
'id': 'breicok',
... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+
+
+class TelecaribeBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https?://(?:www\.)?play\.telecaribe\.co'
+
+ def _download_player_webpage(self, webpage, display_id):
+ page_id = (self._search_regex(r'window.firstPageId\s*=\s*["\']([^"\']+)'... | yt_dlp/extractor/telecaribe.py | 20 | Python | 0.571 | suggestion | 81 | 45 | 45 | false | [extractor/telecaribe] Add TelecaribePlay extractors | 6,311 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
'videoID': item_id,
},
}, {
'operationName': 'VideoPlayer_ChapterSelectButtonVideo',
'variables': {
'includePrivate': False,
'videoID': item_id,
},
}, {
'op... | ```suggestion
video = traverse_obj(data, (..., 'data', 'video'), get_all=False)
if not video:
raise ExtractorError(f'Video {item_id} does not exist', expected=True)
video['moments'] = traverse_obj(data, (..., 'data', 'video', 'moments', 'edges', ..., 'node'))
video['st... | 'videoID': item_id,
},
}, {
'operationName': 'VideoPlayer_ChapterSelectButtonVideo',
'variables': {
'includePrivate': False,
'videoID': item_id,
},
}, {
'op... | @@ -380,13 +380,16 @@ def _download_info(self, item_id):
}],
'Downloading stream metadata GraphQL')
- video = traverse_obj(data, (0, 'data', 'video'))
- video['moments'] = traverse_obj(data, (1, 'data', 'video', 'moments', 'edges', ..., 'node'))
- video['storyboard'] = t... | yt_dlp/extractor/twitch.py | 26 | Python | 1 | refactor | 451 | 51 | 51 | false | [extractor/twitch] Skip errors in GQL response | 6,318 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | elyse0 |
'url': 'http://fivethirtyeight.com/features/how-the-6-8-raiders-can-still-make-the-playoffs/',
'info_dict': {
'id': '56032156',
'ext': 'flv',
'title': 'FiveThirtyEight: The Raiders can still make the playoffs',
'description': 'Neil Paine breaks down the si... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?espncricinfo\.com/(?:cricket-)?videos?/[^#$&?/]+-(?P<id>\d+)'
``` | 'url': 'http://fivethirtyeight.com/features/how-the-6-8-raiders-can-still-make-the-playoffs/',
'info_dict': {
'id': '56032156',
'ext': 'flv',
'title': 'FiveThirtyEight: The Raiders can still make the playoffs',
'description': 'Neil Paine breaks down the si... | @@ -240,7 +240,7 @@ def _real_extract(self, url):
class ESPNCricInfoIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?espncricinfo\.com/video/[^#$&?/]+-(?P<id>\d+)'
+ _VALID_URL = _VALID_URL = r'https?://(?:www\.)?espncricinfo\.com/(?:cricket-)?videos?/[^#$&?/]+-(?P<id>\d+)' | yt_dlp/extractor/espn.py | 26 | Python | 0.714 | suggestion | 119 | 51 | 51 | false | ESPNcricinfo extractor url update | 6,321 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | vsakhamuri12 |
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
find_xpath_attr,
xpath_attr,
xpath_with_ns,
xpath_text,
orderedSet,
update_url_query,
int_or_none,
float_or_none,
parse_iso8601,
deter... | Hard to read. could u split it up into multiple lines? | import itertools
import re
from .common import InfoExtractor
from ..compat import compat_str, compat_urlparse
from ..utils import (
determine_ext,
find_xpath_attr,
float_or_none,
int_or_none,
orderedSet,
parse_iso8601,
traverse_obj,
update_url_query,
xpath_attr,
xpath_text,
... | @@ -22,12 +22,12 @@
class LivestreamIE(InfoExtractor):
IE_NAME = 'livestream'
- _VALID_URL = r'https?://(?:new\.)?livestream\.com/(?:accounts/(?P<account_id>\d+)|(?P<account_name>[^/]+))/(?:events/(?P<event_id>\d+)|(?P<event_name>[^/]+))(?:/videos/(?P<id>\d+))?'
+ _VALID_URL = r'https?://(?:new\.)?livestr... | yt_dlp/extractor/livestream.py | 25 | Python | 0.286 | question | 54 | 50 | 50 | false | Livstream: support for downloading videos with account id | 6,324 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | theperfectpunk |
entries = self._generate_event_playlist(event_data)
return self.playlist_result(entries, event_id, event_data['full_name'])
def _extract_account_events(self, account_data):
upcoming_events = account_data['upcoming_events']
past_events = account_data['past_events']
entries = ... | ```suggestion
api_url = f'http://livestream.com/api/accounts/{account}'
if video_id:
video_data = self._download_json(
f'{api_url}/events/{event}/videos/{video_id}', video_id)
return self._extract_video_info(video_data)
elif event:
even... | video_id = mobj.group('id')
event = mobj.group('event_id') or mobj.group('event_name')
account = mobj.group('account_id') or mobj.group('account_name')
api_url = f'http://livestream.com/api/accounts/{account}'
if video_id:
video_data = self._download_json(
... | @@ -207,21 +223,39 @@ def _extract_event(self, event_data):
'http://livestream.com/accounts/%s/events/%s/videos/%s' % (account_id, event_id, v_id),
'Livestream', v_id, v.get('caption')))
last_video = videos_info[-1]['id']
+ return entries
+
+ def _extract... | yt_dlp/extractor/livestream.py | 26 | Python | 0.857 | refactor | 388 | 51 | 51 | false | Livstream: support for downloading videos with account id | 6,324 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | theperfectpunk |
last_video = None
entries = []
for i in itertools.count(1):
if last_video is None:
info_url = feed_root_url
else:
info_url = '{root}?&id={id}&newer=-1&type=video'.format(
root=feed_root_url, id=last_video)
vi... | This needs a rewrite, but I won't insuiste coz it's legacy code | return self._extract_stream_info(stream_info)
last_video = None
for i in itertools.count(1):
if last_video is None:
info_url = feed_root_url
else:
info_url = '{root}?&id={id}&newer=-1&type=video'.format(
root=feed_r... | @@ -207,21 +223,39 @@ def _extract_event(self, event_data):
'http://livestream.com/accounts/%s/events/%s/videos/%s' % (account_id, event_id, v_id),
'Livestream', v_id, v.get('caption')))
last_video = videos_info[-1]['id']
+ return entries
+
+ def _extract... | yt_dlp/extractor/livestream.py | 26 | Python | 0.214 | suggestion | 63 | 51 | 51 | false | Livstream: support for downloading videos with account id | 6,324 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | theperfectpunk |
videos_info = [v['data'] for v in videos_info if v['type'] == 'video']
if not videos_info:
break
for v in videos_info:
v_id = compat_str(v['id'])
entries.append(self.url_result(
'http://livestream.com/accounts/%s/eve... | ```suggestion
def _extract_account_events(self, account_data):
items = traverse_obj(account_data, (('upcoming_events', 'past_events'), 'data', ...))
return self.playlist_result(
itertools.chain.from_iterable(map(self._generate_event_playlist, items)),
account_data.get('i... | info_url, event_id, f'Downloading page {i}')['data']
videos_info = [v['data'] for v in videos_info if v['type'] == 'video']
if not videos_info:
break
for v in videos_info:
v_id = compat_str(v['id'])
yield self.url_result... | @@ -207,21 +223,39 @@ def _extract_event(self, event_data):
'http://livestream.com/accounts/%s/events/%s/videos/%s' % (account_id, event_id, v_id),
'Livestream', v_id, v.get('caption')))
last_video = videos_info[-1]['id']
+ return entries
+
+ def _extract... | yt_dlp/extractor/livestream.py | 26 | Python | 0.857 | refactor | 395 | 51 | 51 | false | Livstream: support for downloading videos with account id | 6,324 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | theperfectpunk |
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
find_xpath_attr,
xpath_attr,
xpath_with_ns,
xpath_text,
orderedSet,
update_url_query,
int_or_none,
float_or_none,
parse_iso8601,
determine_ext,
traverse_obj
)... | ```suggestion
_VALID_URL = r'''(?x)
https?://(?:new\.)?livestream.com/
(?:accounts/(?P<account_id>\d+)|(?P<account_name>[^/]+))
(?:/events/(?P<event_id>\d+)|/(?P<event_name>[^/]+))?
(?:/videos/(?P<id>\d+))?
'''
``` | from .common import InfoExtractor
from ..compat import compat_str, compat_urlparse
from ..utils import (
determine_ext,
find_xpath_attr,
float_or_none,
int_or_none,
orderedSet,
parse_iso8601,
traverse_obj,
update_url_query,
xpath_attr,
xpath_text,
xpath_with_ns,
)
class Liv... | @@ -17,17 +17,21 @@
float_or_none,
parse_iso8601,
determine_ext,
+ traverse_obj
)
class LivestreamIE(InfoExtractor):
IE_NAME = 'livestream'
- _VALID_URL = r'https?://(?:new\.)?livestream\.com/(?:accounts/(?P<account_id>\d+)|(?P<account_name>[^/]+))/(?:events/(?P<event_id>\d+)|(?P<event_n... | yt_dlp/extractor/livestream.py | 26 | Python | 0.786 | suggestion | 261 | 51 | 51 | false | Livstream: support for downloading videos with account id | 6,324 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | theperfectpunk |
class ZingMp3BaseIE(InfoExtractor):
_VALID_URL_TMPL = r'https?://(?:mp3\.zing|zingmp3)\.vn/(?P<type>(?:%s))/[^/?#]+/(?P<id>\w+)(?:\.html|\?)'
_GEO_COUNTRIES = ['VN']
_DOMAIN = 'https://zingmp3.vn'
_PER_PAGE = 50
_API_SLUGS = {
# Audio/video
'bai-hat': '/api/v2/page/get/song',
... | ```suggestion
'hub': '/api/v2/page/get/hub-detail',
``` | _DOMAIN = 'https://zingmp3.vn'
_PER_PAGE = 50
_API_SLUGS = {
# Audio/video
'bai-hat': '/api/v2/page/get/song',
'embed': '/api/v2/page/get/song',
'video-clip': '/api/v2/page/get/video',
'lyric': '/api/v2/lyric/get/lyric',
'song-streaming': '/api/v2/song/get/str... | @@ -37,6 +35,8 @@ class ZingMp3BaseIE(InfoExtractor):
'info-artist': '/api/v2/page/get/artist',
'user-list-song': '/api/v2/song/get/list',
'user-list-video': '/api/v2/video/get/list',
+ # Hub
+ 'hub': '/api/v2/page/get/hub-detail', | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.571 | suggestion | 65 | 51 | 51 | false | [extractor/zingmp3]: add Hub extractor and update secretKey and apiKey | 6,367 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'song-streaming': '/api/v2/song/get/streaming',
# Playlist
'playlist': '/api/v2/page/get/playlist',
'album': '/api/v2/page/get/playlist',
# Chart
'zing-chart': '/api/v2/page/get/chart-home',
'zing-chart-tuan': '/api/v2/page/get/week-chart',
'moi-phat-hanh'... | ```suggestion
'sig': hmac.new(b'acOrvUS15XRW2o9JksiK1KgQ6Vbds8ZW',
f'{api_slug}{sha256}'.encode(),
hashlib.sha512).hexdigest(),
``` | 'album': '/api/v2/page/get/playlist',
# Chart
'zing-chart': '/api/v2/page/get/chart-home',
'zing-chart-tuan': '/api/v2/page/get/week-chart',
'moi-phat-hanh': '/api/v2/page/get/newrelease-chart',
'the-loai-video': '/api/v2/video/get/list',
# User
'info-arti... | @@ -46,9 +46,8 @@ def _api_url(self, url_type, params):
''.join(f'{k}={v}' for k, v in sorted(params.items())).encode()).hexdigest()
data = {
**params,
- 'apiKey': '88265e23d4284f25963e6eedac8fbfa3',
- 'sig': hmac.new(
- b'2aa2d1c561e809b267f3638c4... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.786 | suggestion | 203 | 51 | 51 | false | [extractor/zingmp3]: add Hub extractor and update secretKey and apiKey | 6,367 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
params.update({'ctime': '1'})
sha256 = hashlib.sha256(
''.join(f'{k}={v}' for k, v in sorted(params.items())).encode()).hexdigest()
data = {
**params,
'apiKey': 'X5BM3w8N7MKozC0B85o4KMlzLZKhV00y',
'sig': hmac.new(b'acOrvUS15XRW2o9JksiK1KgQ6Vbds8ZW'... | ```suggestion
def _fetch_page(self, id_, url_type, page):
``` | **params,
'apiKey': 'X5BM3w8N7MKozC0B85o4KMlzLZKhV00y',
'sig': hmac.new(b'acOrvUS15XRW2o9JksiK1KgQ6Vbds8ZW',
f'{api_slug}{sha256}'.encode(), hashlib.sha512).hexdigest(),
}
return f'{self._DOMAIN}{api_slug}?{urllib.parse.urlencode(data)}'
... | @@ -67,6 +66,20 @@ def _parse_items(self, items):
for url in traverse_obj(items, (..., 'link')) or []:
yield self.url_result(urljoin(self._DOMAIN, url))
+ def _fetch_page(self, *arg): | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.714 | suggestion | 67 | 51 | 51 | false | [extractor/zingmp3]: add Hub extractor and update secretKey and apiKey | 6,367 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'title': 'Mr. Siro - video',
'description': 'md5:5bdcf45e955dc1b8d7f518f322ffef36',
},
'playlist_mincount': 15,
}]
def _fetch_page(self, user_id, url_type, page):
url_type = 'user-list-song' if url_type == 'bai-hat' else 'user-list-video'
return self._cal... | `else 'aSingle'` doesn't make sense. The lambda should only return bool | }]
def _fetch_page(self, user_id, url_type, page):
url_type = 'user-list-song' if url_type == 'bai-hat' else 'user-list-video'
return self._call_api(url_type, {
'id': user_id,
'type': 'artist',
'page': page,
'count': self._PER_PAGE
})
... | @@ -376,10 +390,40 @@ def _real_extract(self, url):
user_info = self._call_api('info-artist', {}, user_alias, query={'alias': user_alias})
if url_type in ('bai-hat', 'video'):
- entries = OnDemandPagedList(
- functools.partial(self._fetch_page, user_info['id'], url_type), s... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.429 | suggestion | 71 | 51 | 51 | false | [extractor/zingmp3]: add Hub extractor and update secretKey and apiKey | 6,367 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
# Playlist
'playlist': '/api/v2/page/get/playlist',
'album': '/api/v2/page/get/playlist',
# Chart
'zing-chart': '/api/v2/page/get/chart-home',
'zing-chart-tuan': '/api/v2/page/get/week-chart',
'moi-phat-hanh': '/api/v2/page/get/newrelease-chart',
'the-loai... | ```suggestion
f'{api_slug}{sha256}'.encode(), hashlib.sha512).hexdigest(),
``` | # Chart
'zing-chart': '/api/v2/page/get/chart-home',
'zing-chart-tuan': '/api/v2/page/get/week-chart',
'moi-phat-hanh': '/api/v2/page/get/newrelease-chart',
'the-loai-video': '/api/v2/video/get/list',
# User
'info-artist': '/api/v2/page/get/artist',
'user-... | @@ -46,9 +45,10 @@ def _api_url(self, url_type, params):
''.join(f'{k}={v}' for k, v in sorted(params.items())).encode()).hexdigest()
data = {
**params,
- 'apiKey': '88265e23d4284f25963e6eedac8fbfa3',
- 'sig': hmac.new(
- b'2aa2d1c561e809b267f3638c... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.714 | suggestion | 108 | 51 | 51 | false | [extractor/zingmp3]: add Hub extractor and update secretKey and apiKey | 6,367 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
if k not in ('mp4', 'hls'):
formats.append({
'ext': 'mp3',
'format_id': k,
'tbr': int_or_none(k),
'url': self._proto_relative_url(v),
'vcodec': 'none',
})
conti... | why isn't this `raise_no_formats`? | 'tbr': int_or_none(k),
'url': self._proto_relative_url(v),
'vcodec': 'none',
})
continue
for res, video_url in v.items():
if not video_url:
continue
if k == 'hls':
... | @@ -166,8 +179,11 @@ def _real_extract(self, url):
'height': int_or_none(res),
})
- if not formats and item.get('msg') == 'Sorry, this content is not available in your country.':
- self.raise_geo_restricted(countries=self._GEO_COUNTRIES, metadata_available=True)... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.214 | question | 34 | 51 | 51 | false | [extractor/zingmp3]: add Hub extractor and update secretKey and apiKey | 6,367 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
self._api_url(url_type, params), display_id or params.get('id'),
note=f'Downloading {url_type} JSON metadata', **kwargs)
return (resp or {}).get('data') or {}
def _real_initialize(self):
if not self._cookies_passed:
self._request_webpage(
self._ap... | ```suggestion
count = 0
for page in itertool.count(1):
data = self._fetch_page(_id, url_type, page)
entries = self._parse_items(data.get('items'))
count += len(entries)
yield from entries
if not data.get('hasMore') or count > data.get('t... |
def _real_initialize(self):
if not self._cookies_passed:
self._request_webpage(
self._api_url('bai-hat', {'id': ''}), None, note='Updating cookies')
def _parse_items(self, items):
for url in traverse_obj(items, (..., 'link')) or []:
yield self.url_result... | @@ -67,6 +66,20 @@ def _parse_items(self, items):
for url in traverse_obj(items, (..., 'link')) or []:
yield self.url_result(urljoin(self._DOMAIN, url))
+ def _fetch_page(self, id_, url_type, page):
+ raise NotImplementedError('This method must be implemented by subclasses')
+
+ def... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.929 | suggestion | 368 | 51 | 51 | false | [extractor/zingmp3]: add Hub extractor and update secretKey and apiKey | 6,367 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hatienl0i2612 |
'id': 'ed063cd5-72c8-46b5-a60a-569243edcea8',
'ext': 'mp4',
'title': '11 - Kryptographie - 24.11.2015',
'thumbnail': r're:^https?://.*\.jpg$',
'timestamp': 1606208400,
'upload_date': '20201124',
},
}
... | ```suggestion
_VALID_URL = rf'''(?x)
https?://(?P<host>{OpencastBaseIE._INSTANCES_RE})(
/engage/ui/index.html\?(?:[^#]+&)?epFrom=|
/lttools/index.html\?(?:[^#]+&)?series=
)(?P<id>{OpencastBaseIE._UUID_RE})'''
``` | 'ext': 'mp4',
'title': '11 - Kryptographie - 24.11.2015',
'thumbnail': r're:^https?://.*\.jpg$',
'timestamp': 1606208400,
'upload_date': '20201124',
'season_id': 'cf68a4a1-36b1-4a53-a6ba-61af5705a0d0',
'serie... | @@ -135,8 +138,10 @@ def _real_extract(self, url):
class OpencastPlaylistIE(OpencastBaseIE):
_VALID_URL = r'''(?x)
- https?://(?P<host>%s)/engage/ui/index.html\?.*?
- epFrom=(?P<id>%s)
+ https?://(?P<host>%s)
+ ... | yt_dlp/extractor/opencast.py | 26 | Python | 0.929 | suggestion | 262 | 51 | 51 | false | [extractor/opencast] Add ltitools interface to OpencastPlaylistIE and fix Tests | 6,371 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | C0D3D3V |
track_obj.update({
'app': m_obj.group('app'),
'ext': m_obj.group('ext'),
'play_path': m_obj.group('ext') + ':' + m_obj.group('playpath'),
'rtmp_live': True,
'preference': -2,
... | ```suggestion
_VALID_URL = rf'''(?x)
https?://(?P<host>{OpencastBaseIE._INSTANCES_RE})/paella/ui/watch.html\?
(?:[^#]+&)?id=(?P<id>{OpencastBaseIE._UUID_RE})'''
``` | track_obj.update({
'app': m_obj.group('app'),
'ext': m_obj.group('ext'),
'play_path': m_obj.group('ext') + ':' + m_obj.group('playpath'),
'rtmp_live': True,
'preference': -2,
... | @@ -105,10 +105,10 @@ def _parse_mediapackage(self, video):
class OpencastIE(OpencastBaseIE):
- _VALID_URL = r'''(?x)
- https?://(?P<host>%s)/paella/ui/watch.html\?.*?
- id=(?P<id>%s)
- ''' % (OpencastBaseIE._INSTANCES_RE, OpencastBaseIE._UUID_RE)
+ _V... | yt_dlp/extractor/opencast.py | 26 | Python | 0.857 | suggestion | 188 | 51 | 51 | false | [extractor/opencast] Add ltitools interface to OpencastPlaylistIE and fix Tests | 6,371 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | C0D3D3V |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.