before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
def test_encrypt(self):
msg = b'message'
key = list(range(16))
encrypted = aes_encrypt(bytes_to_intlist(msg), key)
decrypted = intlist_to_bytes(aes_decrypt(encrypted, key))
self.assertEqual(decrypted, msg)
def test_cbc_decrypt(self):
data = b"\x97\x92+\xe5\x0b\xc... | ```suggestion
def test_ctr_decrypt(self):
data = bytes_to_intlist(
b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08')
```
single quotes and parens at end of line. same in other places | def test_encrypt(self):
msg = b'message'
key = list(range(16))
encrypted = aes_encrypt(bytes_to_intlist(msg), key)
decrypted = intlist_to_bytes(aes_decrypt(encrypted, key))
self.assertEqual(decrypted, msg)
def test_cbc_decrypt(self):
data = b'\x97\x92+\xe5\x0b\xc... | @@ -40,6 +53,33 @@ def test_cbc_encrypt(self):
encrypted,
b"\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6'\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd")
+ def test_ctr_decrypt(self):
+ data = bytes_to_intlist(
+ b"\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xa... | test/test_aes.py | 26 | Python | 0.786 | suggestion | 232 | 51 | 51 | false | Add aes-128-gcm decrypt and verify | 1,020 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sulyi |
def setUp(self):
self.key = self.iv = [0x20, 0x15] + 14 * [0]
self.secret_msg = b'Secret message goes here'
def test_encrypt(self):
msg = b'message'
key = list(range(16))
encrypted = aes_encrypt(bytes_to_intlist(msg), key)
decrypted = intlist_to_bytes(aes_decrypt... | ```suggestion
b'\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6\'\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd')
``` | def setUp(self):
self.key = self.iv = [0x20, 0x15] + 14 * [0]
self.secret_msg = b'Secret message goes here'
def test_encrypt(self):
msg = b'message'
key = list(range(16))
encrypted = aes_encrypt(bytes_to_intlist(msg), key)
decrypted = intlist_to_bytes(aes_decrypt... | @@ -27,18 +39,46 @@ def test_encrypt(self):
self.assertEqual(decrypted, msg)
def test_cbc_decrypt(self):
- data = bytes_to_intlist(
- b"\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6'\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd"
- )
- decrypted = intlist_to_bytes(aes_cbc_decry... | test/test_aes.py | 26 | Python | 0.714 | suggestion | 123 | 51 | 51 | false | Add aes-128-gcm decrypt and verify | 1,020 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sulyi |
decrypted = intlist_to_bytes(aes_cbc_decrypt(bytes_to_intlist(data), self.key, self.iv))
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
if compat_pycrypto_AES:
decrypted = aes_cbc_decrypt_bytes(data, intlist_to_bytes(self.key), intlist_to_bytes(self.iv))
sel... | ```suggestion
b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08')
``` | decrypted = intlist_to_bytes(aes_cbc_decrypt(bytes_to_intlist(data), self.key, self.iv))
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
if compat_pycrypto_AES:
decrypted = aes_cbc_decrypt_bytes(data, intlist_to_bytes(self.key), intlist_to_bytes(self.iv))
sel... | @@ -27,18 +39,46 @@ def test_encrypt(self):
self.assertEqual(decrypted, msg)
def test_cbc_decrypt(self):
- data = bytes_to_intlist(
- b"\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6'\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd"
- )
- decrypted = intlist_to_bytes(aes_cbc_decry... | test/test_aes.py | 26 | Python | 0.714 | suggestion | 102 | 51 | 51 | false | Add aes-128-gcm decrypt and verify | 1,020 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sulyi |
)
def test_ctr_decrypt(self):
data = bytes_to_intlist(b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08')
decrypted = intlist_to_bytes(aes_ctr_decrypt(data, self.key, self.iv))
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
def test_ctr_encrypt(... | ```suggestion
data, intlist_to_bytes(self.key), authentication_tag, intlist_to_bytes(self.iv[:12]))
``` |
def test_ctr_decrypt(self):
data = bytes_to_intlist(b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08')
decrypted = intlist_to_bytes(aes_ctr_decrypt(data, self.key, self.iv))
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
def test_ctr_encrypt(self):
... | @@ -27,18 +39,46 @@ def test_encrypt(self):
self.assertEqual(decrypted, msg)
def test_cbc_decrypt(self):
- data = bytes_to_intlist(
- b"\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6'\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd"
- )
- decrypted = intlist_to_bytes(aes_cbc_decry... | test/test_aes.py | 26 | Python | 0.714 | security | 121 | 49 | 46 | false | Add aes-128-gcm decrypt and verify | 1,020 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sulyi |
def _real_extract(self, url):
video_id = self._match_id(url)
formats = []
qualities = {
'lq': '360p',
'hq': '720p',
}
json_url = f'https://www.nuvid.com/player_config_json/?vid={video_id}&aid=0&domain_id=0&embed=0&check_speed=0'
video_data =... | ```suggestion
formats = [{
'url': source,
'format_id': qualities.get(quality),
'height': int_or_none(qualities.get(quality)[:-1]),
} for quality, source in video_data.get('files').items() if source]
``` |
def _real_extract(self, url):
video_id = self._match_id(url)
qualities = {
'lq': '360p',
'hq': '720p',
}
json_url = f'https://www.nuvid.com/player_config_json/?vid={video_id}&aid=0&domain_id=0&embed=0&check_speed=0'
video_data = self._download_json(... | @@ -1,71 +1,84 @@
+# coding: utf-8
from __future__ import unicode_literals
-import re
-
from .common import InfoExtractor
from ..utils import (
parse_duration,
+ int_or_none,
+ try_get,
)
class NuvidIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|m)\.nuvid\.com/video/(?P<id>[0-9]+)'
- _T... | yt_dlp/extractor/nuvid.py | 26 | Python | 0.786 | suggestion | 260 | 51 | 42 | false | [Nuvid] Fix extractor | 1,022 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'height': int_or_none(qualities.get(quality)[:-1]),
})
self._check_formats(formats, video_id)
self._sort_formats(formats)
title = video_data.get('title')
thumbnail_base_url = try_get(video_data, lambda x: x['thumbs']['url'])
thumbnail_extension = try_... | Are you sure these are needed? | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
try_get,
)
class NuvidIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|m)\.nuvid\.com/video/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://www.nuvid.c... | @@ -1,71 +1,84 @@
+# coding: utf-8
from __future__ import unicode_literals
-import re
-
from .common import InfoExtractor
from ..utils import (
parse_duration,
+ int_or_none,
+ try_get,
)
class NuvidIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|m)\.nuvid\.com/video/(?P<id>[0-9]+)'
- _T... | yt_dlp/extractor/nuvid.py | 26 | Python | 0.071 | question | 30 | 29 | 74 | false | [Nuvid] Fix extractor | 1,022 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'id': 'chocobozzz',
'timestamp': 1553874564,
'title': 'chocobozzz',
},
'playlist_mincount': 2,
}, {
'url': 'https://framatube.org/c/bf54d359-cfad-4935-9d45-9d6be93f63e8/videos',
'info_dict': {
'id': 'bf54d359-cfad-4935-9d45-9d6be93f63e8... | here aswell, it should be list and not dict
doing for each on dict gives you the keys. | # coding: utf-8
from __future__ import unicode_literals
import functools
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
parse_resolution,
str_or_none,
try_get,
unified_timestamp,
url_or_none,
urljoin,
OnDemandPagedList,
)
... | @@ -1369,3 +1369,60 @@ def _real_extract(self, url):
return self.playlist_result(
entries, playlist_id, playlist_title, playlist_description,
timestamp=playlist_timestamp, channel=channel, channel_id=channel_id, thumbnail=thumbnail)
+
+
+class PeerTubeChannelIE(InfoExtractor):
+ IE... | yt_dlp/extractor/peertube.py | 26 | Python | 0.286 | suggestion | 87 | 49 | 1,403 | false | [Peertube] Add Channel extractor | 1,023 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | u-spec-png |
class PeerTubeBaseIE(InfoExtractor):
_API_BASE = 'https://%s/api/v1/%s/%s%s'
_PAGE_SIZE = 30
def call_api(self, host, name, path, base, note=None, **kwargs):
return self._download_json(
self._API_BASE % (host, base, name, path), name,
note=note, **kwargs)
def fetch_pa... | ```suggestion
class PeerTubePlaylistIE(PeerTubeBaseIE):
```
same below |
class PeerTubePlaylistIE(InfoExtractor):
IE_NAME = 'PeerTube:Playlist'
_TYPES = {
'a': 'accounts',
'c': 'video-channels',
'w/p': 'video-playlists',
}
_VALID_URL = r'''(?x)
https?://(?P<host>%s)/(?P<type>(?:%s))/
(?P<id>[^/]+)
... | @@ -1295,15 +1295,37 @@ def channel_data(field, type_):
}
-class PeerTubePlaylistIE(InfoExtractor):
+class PeerTubeBaseIE(InfoExtractor):
+ _API_BASE = 'https://%s/api/v1/%s/%s%s'
+ _PAGE_SIZE = 30
+
+ def call_api(self, host, name, path, base, note=None, **kwargs):
+ return self._download_... | yt_dlp/extractor/peertube.py | 26 | Python | 0.571 | suggestion | 73 | 51 | 51 | false | [Peertube] Add Channel extractor | 1,023 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'description': 'playlist',
'timestamp': 1611171863,
'title': 'playlist',
},
'playlist_mincount': 6,
}, {
'url': 'https://peertube.tux.ovh/w/p/wkyqcQBnsvFxtUB2pkYc1e',
'info_dict': {
'id': 'wkyqcQBnsvFxtUB2pkYc1e',
'descripti... | Seems same as channelIE except type is hardcoded to `video-playlists` | 'timestamp': 1599676222,
},
'playlist_mincount': 9,
}, {
'url': 'https://peertube2.cpy.re/a/chocobozzz/videos',
'info_dict': {
'id': 'chocobozzz',
'timestamp': 1553874564,
'title': 'chocobozzz',
},
'playlist_mincount': 2... | @@ -1332,28 +1354,10 @@ class PeerTubePlaylistIE(InfoExtractor):
},
'playlist_mincount': 9,
}]
- _PAGE_SIZE = 30
-
- def _call_api(self, host, uuid, path, note=None, errnote=None, fatal=True):
- return self._download_json(
- self._API_BASE % (host, uuid, path), uuid,
- ... | yt_dlp/extractor/peertube.py | 26 | Python | 0.5 | suggestion | 69 | 51 | 51 | false | [Peertube] Add Channel extractor | 1,023 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
},
'playlist_mincount': 9,
}, {
'url': 'https://peertube2.cpy.re/a/chocobozzz/videos',
'info_dict': {
'id': 'chocobozzz',
'timestamp': 1553874564,
'title': 'chocobozzz',
},
'playlist_mincount': 2,
}, {
'url': 'https://fr... | note can also be in kwargs, no? | 'info_dict': {
'id': 'hFdJoTuyhNJVa1cDWd1d12',
'description': 'Diversas palestras do Richard Stallman no Brasil.',
'title': 'Richard Stallman no Brasil',
'timestamp': 1599676222,
},
'playlist_mincount': 9,
}, {
'url': 'https://peertube2... | @@ -1395,19 +1345,51 @@ class PeerTubeChannelIE(PeerTubeBaseIE, InfoExtractor):
},
'playlist_mincount': 345,
}]
+ _API_BASE = 'https://%s/api/v1/%s/%s%s'
+ _PAGE_SIZE = 30
- def _real_extract(self, url):
- type, host, channel_id = self._match_valid_url(url).group('type', 'host',... | yt_dlp/extractor/peertube.py | 26 | Python | 0.071 | question | 31 | 51 | 51 | false | [Peertube] Add Channel extractor | 1,023 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
def _extract_playlist(self, host, type, id):
info = self.call_api(host, id, '', type, note='Downloading playlist information', fatal=False)
playlist_title = info.get('displayName')
playlist_description = info.get('description')
playlist_timestamp = unified_timestamp(info.get('create... | you can add this in the class definition
```py
_TYPES = {
'a': 'accounts',
...
}
```
and then do
```py
type = self._TYPES[type]
```
Then u can also use `'|'.join(_TYPES.keys())` in `_VALID_URL` | page += 1
video_data = self.call_api(
host, id,
f'/videos?sort=-createdAt&start={self._PAGE_SIZE * (page - 1)}&count={self._PAGE_SIZE}&nsfw=both',
type, note=f'Downloading page {page}').get('data', [])
for video in video_data:
shortUUID = video.get... | @@ -1395,19 +1345,51 @@ class PeerTubeChannelIE(PeerTubeBaseIE, InfoExtractor):
},
'playlist_mincount': 345,
}]
+ _API_BASE = 'https://%s/api/v1/%s/%s%s'
+ _PAGE_SIZE = 30
- def _real_extract(self, url):
- type, host, channel_id = self._match_valid_url(url).group('type', 'host',... | yt_dlp/extractor/peertube.py | 26 | Python | 1 | suggestion | 237 | 28 | 35 | false | [Peertube] Add Channel extractor | 1,023 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
}, info_dict)
def _prepare_external_frag_download(self, ctx):
if 'live' not in ctx:
ctx['live'] = False
if not ctx['live']:
total_frags_str = '%d' % ctx['total_frags']
ad_frags = ctx.get('ad_frags', 0)
if ad_frags:
total_frags_... | not good design. better to let args be (a list of) dicts/tuples | }, info_dict)
def _prepare_external_frag_download(self, ctx):
if 'live' not in ctx:
ctx['live'] = False
if not ctx['live']:
total_frags_str = '%d' % ctx['total_frags']
ad_frags = ctx.get('ad_frags', 0)
if ad_frags:
total_frags_... | @@ -324,7 +336,42 @@ def _prepare_external_frag_download(self, ctx):
'fragment_index': 0,
})
- def download_and_append_fragments(self, ctx, fragments, info_dict, *, pack_func=None, finish_func=None):
+ # ctx1, fragments1, info_dict1, ctx2, fragments2, info_dict2, ...
+ # length of argum... | yt_dlp/downloader/fragment.py | 26 | Python | 0.286 | suggestion | 63 | 51 | 51 | false | [YoutubeDL] simultaneous download for segments | 1,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
})
def download_and_append_fragments_multiple(self, *args, pack_func=None, finish_func=None):
'''
@params (ctx1, fragments1, info_dict1), (ctx2, fragments2, info_dict2), ...
all args must be either tuple or list
'''
max_progress = len(args)
if max_pro... | u can do
```py
for idx, (ctx, fragments, info_dict) in enumerate(args):
```
| })
def decrypter(self, info_dict):
_key_cache = {}
def _get_key(url):
if url not in _key_cache:
_key_cache[url] = self.ydl.urlopen(self._prepare_url(info_dict, url)).read()
return _key_cache[url]
def decrypt_fragment(fragment, frag_content):... | @@ -356,7 +358,8 @@ def __exit__(self, exc_type, exc_val, exc_tb):
pass
spins = []
- for idx, ctx, fragments, info_dict in zip(itertools.count(0), args[::3], args[1::3], args[2::3]):
+ for idx, cfi in enumerate(args):
+ ctx, fragments, info_dict = cfi | yt_dlp/downloader/fragment.py | 26 | Python | 0.571 | suggestion | 88 | 51 | 51 | false | [YoutubeDL] simultaneous download for segments | 1,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
import re
from threading import Lock
from .utils import compat_os_name, get_windows_version
try:
# curses is in standard modules, but like sqlite in cookies.py,
# it is not present under some circumstances (especially when running on Windows)
import curses
has_curses = True
CURSES_ERROR = (curses.... | isnt it possible to completely get rid of this dependancy by hard coding the UNIX control chars (like for windows)? afaik, all flavors and terminals use the same standard, correct? | import os
from threading import Lock
from .utils import compat_os_name, get_windows_version
class MultilinePrinterBase():
def __enter__(self):
return self
def __exit__(self, *args):
self.end()
def print_at_line(self, text, pos):
pass
def end(self):
pass
class Mult... | @@ -0,0 +1,162 @@
+import re
+
+from threading import Lock
+from .utils import compat_os_name, get_windows_version
+
+try:
+ # curses is in standard modules, but like sqlite in cookies.py,
+ # it is not present under some circumstances (especially when running on Windows)
+ import curses
+ has_curses = True... | yt_dlp/minicurses.py | 14 | Python | 0.429 | question | 180 | 39 | 39 | false | [YoutubeDL] simultaneous download for segments | 1,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
base_url = media_data['base']
author_data = post_data.get('authorData', {})
song_data = post_data.get('song', {}) # revist this in future for differentiating b/w 'art' and 'author'
formats = []
for frmt, frmt_path in media_data.get('transcoded', {}).items():
formats... | if thumbnail key is not present, it points to base url? | def _get_post(self, id, post_data):
media_data = post_data['mediaLocation']
base_url = media_data['base']
author_data = post_data.get('authorData', {})
song_data = post_data.get('song', {}) # revist this in future for differentiating b/w 'art' and 'author'
formats = [{
... | @@ -0,0 +1,199 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..compat import compat_urllib_parse_unquote_plus
+from ..utils import (
+ clean_html,
+ ExtractorError,
+ str_to_int,
+)
+
+
+class ChingariBaseIE(InfoExtracto... | yt_dlp/extractor/chingari.py | 26 | Python | 0.214 | question | 55 | 51 | 51 | false | Add ChingariIE and ChingariUserIE. | 1,038 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
for frmt, frmt_path in media_data.get('transcoded', {}).items():
formats.append({
'format_id': frmt,
'width': str_to_int(frmt[1:]),
'url': base_url + frmt_path,
})
if media_data.get('path'):
formats.append({
... | Do you have to use `str_to_int`? If not,
```suggestion
'timestamp': int_or_none(post_data.get('created_at'), 1000),
```
If you do, still take care that `None // 1000` doesnt throw error |
formats = [{
'format_id': frmt,
'width': str_to_int(frmt[1:]),
'url': base_url + frmt_path,
} for frmt, frmt_path in media_data.get('transcoded', {}).items()]
if media_data.get('path'):
formats.append({
'format_id': 'original',
... | @@ -0,0 +1,199 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..compat import compat_urllib_parse_unquote_plus
+from ..utils import (
+ clean_html,
+ ExtractorError,
+ str_to_int,
+)
+
+
+class ChingariBaseIE(InfoExtracto... | yt_dlp/extractor/chingari.py | 26 | Python | 1 | suggestion | 201 | 51 | 51 | false | Add ChingariIE and ChingariUserIE. | 1,038 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
import itertools
import json
from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote_plus
from ..utils import (
clean_html,
ExtractorError,
str_to_int,
)
class ChingariBaseIE(InfoExtractor):
def _get_post(self, id, post_data):
media_data = post_data['mediaLocation']... | ```suggestion
formats = [{
'format_id': frmt,
'width': str_to_int(frmt[1:]),
'url': base_url + frmt_path,
} for frmt, frmt_path in media_data.get('transcoded', {}).items())
``` | import itertools
import json
from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote_plus
from ..utils import (
clean_html,
ExtractorError,
int_or_none,
str_to_int,
url_or_none,
)
class ChingariBaseIE(InfoExtractor):
def _get_post(self, id, post_data):
media... | @@ -0,0 +1,199 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import itertools
+import json
+
+from .common import InfoExtractor
+from ..compat import compat_urllib_parse_unquote_plus
+from ..utils import (
+ clean_html,
+ ExtractorError,
+ str_to_int,
+)
+
+
+class ChingariBaseIE(InfoExtracto... | yt_dlp/extractor/chingari.py | 26 | Python | 0.786 | suggestion | 234 | 51 | 51 | false | Add ChingariIE and ChingariUserIE. | 1,038 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
def _real_extract(self, url):
playlist_id = self._match_id(url)
if playlist_id.endswith('/'):
playlist_id = playlist_id[:-1]
webpage = self._download_webpage(url, playlist_id)
static_assets_base = self._search_regex(r'staticAssetsBase:\"(.*?)\"', webpage, 'staticAssets... | ```suggestion
category = next((cat for cat in game['subcategories'] if cat['slug'].lower() == category_slug),
game['subcategories'][0])
category_slug = category.get('slug', '').lower() or category_slug
``` |
def _real_extract(self, url):
playlist_id = self._match_id(url)
if playlist_id.endswith('/'):
playlist_id = playlist_id[:-1]
webpage = self._download_webpage(url, playlist_id)
static_assets_base = self._search_regex(r'staticAssetsBase:\"(.*?)\"', webpage, 'staticAssets... | @@ -188,7 +196,12 @@ def _real_extract(self, url):
category_slug = 'misc'
game = next(game for game in sovietscloset if game['slug'].lower() == game_slug)
- category = next(cat for cat in game['subcategories'] if cat['slug'].lower() == category_slug)
+ category = game['subcategorie... | yt_dlp/extractor/sovietscloset.py | 26 | Python | 0.786 | suggestion | 249 | 38 | 35 | false | [SovietsCloset] Fix finding playlists for games with only named categories | 1,042 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ChillingPepper |
'title': 'Total War: Warhammer - Greenskins',
},
'playlist_mincount': 33,
},
]
def _real_extract(self, url):
playlist_id = self._match_id(url)
if playlist_id.endswith('/'):
playlist_id = playlist_id[:-1]
webpage = self._downlo... | ```suggestion
category = next((cat for cat in game['subcategories'] if cat.get('slug', '').lower() == category_slug),
``` | 'title': 'Total War: Warhammer - Greenskins',
},
'playlist_mincount': 33,
},
]
def _real_extract(self, url):
playlist_id = self._match_id(url)
if playlist_id.endswith('/'):
playlist_id = playlist_id[:-1]
webpage = self._downlo... | @@ -188,7 +196,9 @@ def _real_extract(self, url):
category_slug = 'misc'
game = next(game for game in sovietscloset if game['slug'].lower() == game_slug)
- category = next(cat for cat in game['subcategories'] if cat['slug'].lower() == category_slug)
+ category = next((cat for cat i... | yt_dlp/extractor/sovietscloset.py | 26 | Python | 0.714 | suggestion | 131 | 40 | 40 | false | [SovietsCloset] Fix finding playlists for games with only named categories | 1,042 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ChillingPepper |
'description': 'md5:7afc4eb839074ddeb2beea5dd6fe9500',
'timestamp': 1632211468,
'uploader_id': 'ytdlpTestAccount',
'uploader': 'yt-dlpTestAccount',
'duration': 14000,
'upload_date': '20210921'
},
'params': {'skip_download': True}
... | why limit=20 and showsimilar=true? | 'uploader': 'yt-dlpTestAccount',
'duration': 14000,
'upload_date': '20210921'
},
'params': {'skip_download': True}
}, { # Test for link
'url': 'https://www.kooapp.com/koo/ytdlpTestAccount/01bf5b94-81a5-4d8e-a387-5f732022e15a',
'skip': 'No video/au... | @@ -0,0 +1,118 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ ExtractorError,
+ try_get,
+)
+
+
+class KooIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?kooapp\.com/koo/[^/]+/(?P<id>[^/&#$?]+)'
+ _TEST... | yt_dlp/extractor/koo.py | 26 | Python | 0.071 | question | 34 | 51 | 51 | false | Add KooIE. | 1,044 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'ext': 'none',
},
}]
def _real_extract(self, url):
id = self._match_id(url)
data_json = self._download_json(f'https://www.kooapp.com/apiV1/ku/{id}?limit=20&offset=0&showSimilarKoos=true', id)['parentContent']
item_json = next(content['items'][0] for content in data_j... | why is title part of description? |
def _real_extract(self, url):
id = self._match_id(url)
data_json = self._download_json(f'https://www.kooapp.com/apiV1/ku/{id}?limit=20&offset=0&showSimilarKoos=true', id)['parentContent']
item_json = next(content['items'][0] for content in data_json
if try_get(conte... | @@ -0,0 +1,118 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ ExtractorError,
+ try_get,
+)
+
+
+class KooIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?kooapp\.com/koo/[^/]+/(?P<id>[^/&#$?]+)'
+ _TEST... | yt_dlp/extractor/koo.py | 26 | Python | 0.071 | question | 33 | 35 | 33 | false | Add KooIE. | 1,044 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
clean_html,
try_get,
)
class KooIE(InfoExtractor):
_VALID_URL = r'(?:https?://)(?:www\.)?kooapp\.com/koo/[^/]+/(?P<id>[^/&#$?]+)'
_TESTS = [{ # Test for video in the comments
'url... | ```suggestion
```
First time I'm noticing this. Did ur other PRs also use 2 lines 🤔 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
clean_html,
try_get,
)
class KooIE(InfoExtractor):
_VALID_URL = r'(?:https?://)(?:www\.)?kooapp\.com/koo/[^/]+/(?P<id>[^/&#$?]+)'
_TESTS = [{ # Test for video in the comments
'url':... | @@ -0,0 +1,117 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+ | yt_dlp/extractor/koo.py | 4 | Python | 0.643 | suggestion | 90 | 29 | 29 | false | Add KooIE. | 1,044 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'duration': 14000,
'upload_date': '20210921'
},
'params': {'skip_download': True}
}, { # Test for link
'url': 'https://www.kooapp.com/koo/ytdlpTestAccount/01bf5b94-81a5-4d8e-a387-5f732022e15a',
'skip': 'No video/audio found at the provided url.',
'inf... | ```suggestion
item_json = next(content['items'][0] for content in data_json
if try_get(content, lambda x: x['items'][0]['id']) == id)
``` | },
'params': {'skip_download': True}
}, { # Test for link
'url': 'https://www.kooapp.com/koo/ytdlpTestAccount/01bf5b94-81a5-4d8e-a387-5f732022e15a',
'skip': 'No video/audio found at the provided url.',
'info_dict': {
'id': '01bf5b94-81a5-4d8e-a387-5f732022e15a',
... | @@ -0,0 +1,117 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ try_get,
+)
+
+
+class KooIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?kooapp\.com/koo/[^/]+/(?P<id>[^/&#$?]+)'
+ _TESTS = [{ # Test for vi... | yt_dlp/extractor/koo.py | 26 | Python | 0.714 | suggestion | 173 | 51 | 51 | false | Add KooIE. | 1,044 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
class DiscoveryPlusIE(DPlayIE):
_VALID_URL = r'https?://(?:www\.)?discoveryplus\.com/video' + DPlayIE._PATH_REGEX
_TESTS = [{
'url': 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family',
'info_dict': {
'id': '1140794',
'display_id': 'proper... | make sure to test all extractors that depend on `DiscoveryPlusIE` | class DiscoveryPlusIE(DPlayIE):
_VALID_URL = r'https?://(?:www\.)?discoveryplus\.com/video' + DPlayIE._PATH_REGEX
_TESTS = [{
'url': 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family',
'info_dict': {
'id': '1140794',
'display_id': 'proper... | @@ -349,7 +349,7 @@ class DiscoveryPlusIE(DPlayIE):
_API_URL = 'us1-prod-direct.discoveryplus.com'
def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
- headers['x-disco-client'] = f'WEB:UNKNOWN:{self._PRODUCT}:15.0.0'
+ headers['x-disco-client'] = f'WEB:UNKNOWN:{self.... | yt_dlp/extractor/dplay.py | 26 | Python | 0.429 | refactor | 65 | 51 | 51 | false | AnimalPlanet Update | 1,050 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Sipherdrakon |
ret = '\n'.join(''.join(row).rstrip() for row in table)
return ret
def _match_one(filter_part, dct, incomplete):
# TODO: Generalize code with YoutubeDL._build_format_filter
STRING_OPERATORS = {
'*=': operator.contains,
'^=': lambda attr, value: attr.startswith(value),
'$=': lam... | ```suggestion
fcntl.flock(f,
fcntl.LOCK_SH if not exclusive
else fcntl.LOCK_EX if block
else fcntl.LOCK_EX | fcntl.LOCK_NB)
``` | data = [filter_using_list(row, max_lens) for row in data]
table = [header_row] + data
max_lens = get_max_lens(table)
extra_gap += 1
if delim:
table = [header_row, [delim * (ml + extra_gap) for ml in max_lens]] + data
table[1][-1] = table[1][-1][:-extra_gap] # Remove extra_gap from ... | @@ -3462,31 +3464,36 @@ def _unlock_file(f):
try:
import fcntl
- def _lock_file(f, exclusive):
- fcntl.flock(f, fcntl.LOCK_EX if exclusive else fcntl.LOCK_SH)
+ def _lock_file(f, exclusive, block):
+ if block:
+ fcntl.flock(f, fcntl.LOCK_EX if exclusive... | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 216 | 51 | 51 | false | Modify sanitize_open() to use locked_file() | 1,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jakeogh |
""" Render a list of rows, each as a list of values.
Text after a \t will be right aligned """
def width(string):
return len(remove_terminal_sequences(string).replace('\t', ''))
def get_max_lens(table):
return [max(width(str(v)) for v in col) for col in zip(*table)]
def filter_usin... | keep the signatures exactly same. So no `=None` | return 'mms'
elif url.startswith('rtsp'):
return 'rtsp'
ext = determine_ext(url)
if ext == 'm3u8':
return 'm3u8'
elif ext == 'f4m':
return 'f4m'
return compat_urllib_parse_urlparse(url).scheme
def render_table(header_row, data, delim=False, extra_gap=0, hide_empty... | @@ -3439,7 +3441,7 @@ class OVERLAPPED(ctypes.Structure):
whole_low = 0xffffffff
whole_high = 0x7fffffff
- def _lock_file(f, exclusive):
+ def _lock_file(f, exclusive, block=None): # todo: block unused on win32 | yt_dlp/utils.py | 26 | Python | 0.214 | suggestion | 47 | 51 | 51 | false | Modify sanitize_open() to use locked_file() | 1,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jakeogh |
fcntl.LOCK_SH if not exclusive
else fcntl.LOCK_EX if block
else fcntl.LOCK_EX | fcntl.LOCK_NB)
def _unlock_file(f):
fcntl.flock(f, fcntl.LOCK_UN)
except ImportError:
UNSUPPORTED_MSG = 'file locking is not supported... | ```suggestion
exclusive = 'r' not in self.mode
``` | '$=': lambda attr, value: attr.endswith(value),
'~=': lambda attr, value: re.search(value, attr),
}
COMPARISON_OPERATORS = {
**STRING_OPERATORS,
'<=': operator.le, # "<=" must be defined above "<"
'<': operator.lt,
'>=': operator.ge,
'>': operator.gt,
... | @@ -3462,31 +3464,36 @@ def _unlock_file(f):
try:
import fcntl
- def _lock_file(f, exclusive):
- fcntl.flock(f, fcntl.LOCK_EX if exclusive else fcntl.LOCK_SH)
+ def _lock_file(f, exclusive, block):
+ fcntl.flock(f,
+ fcntl.LOCK_SH if not exclusi... | yt_dlp/utils.py | 26 | Python | 0.571 | suggestion | 60 | 51 | 51 | false | Modify sanitize_open() to use locked_file() | 1,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jakeogh |
html = re.sub(r'(?u)<\s*/\s*p\s*>\s*<\s*p[^>]*>', '\n', html)
# Strip html tags
html = re.sub('<.*?>', '', html)
# Replace html entities
html = unescapeHTML(html)
return html.strip()
def sanitize_open(filename, open_mode):
"""Try to open the given filename, and slightly tweak it if this fa... | ```suggestion
stream = locked_file(filename, open_mode, block=False).open()
```
Perhaps this is better syntax (similar to `.close`)
(`encodeFilename` is a no-op) |
def write_string(s, out=None, encoding=None):
if out is None:
out = sys.stderr
assert type(s) == compat_str
if sys.platform == 'win32' and encoding is None and hasattr(out, 'fileno'):
if _windows_write_string(s, out):
return
if ('b' in getattr(out, 'mode', '')
... | @@ -2063,7 +2063,8 @@ def sanitize_open(filename, open_mode):
import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
return (sys.stdout.buffer if hasattr(sys.stdout, 'buffer') else sys.stdout, filename)
- stream = open(encodeFilename(filename), open_mode)
+ ... | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 175 | 51 | 51 | false | Modify sanitize_open() to use locked_file() | 1,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jakeogh |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class ThetaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'info_dict': {
'id': 'DaVirus',
'ex... | Add proper title
If it's big, md5 hash it | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import try_get
class ThetaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'skip': 'The live may have ende... | @@ -0,0 +1,44 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class ThetaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.theta.tv/davirus',
+ 'info_dict': {
+ 'id... | yt_dlp/extractor/theta.py | 14 | Python | 0.071 | suggestion | 42 | 39 | 39 | false | Add Theta stream extractor | 1,068 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | alerikaisattera |
from .common import InfoExtractor
class ThetaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'info_dict': {
'id': 'DaVirus',
'ext': 'mp4',
'title': r're:.+',
'th... | use fstring
```suggestion
info = self._download_json(f'https://api.theta.tv/v1/channel?alias={channel_id}', channel_id)['body']
``` | from .common import InfoExtractor
from ..utils import try_get
class ThetaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'skip': 'The live may have ended',
'info_dict': {
'id': 'DaVirus',
... | @@ -0,0 +1,44 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class ThetaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.theta.tv/davirus',
+ 'info_dict': {
+ 'id... | yt_dlp/extractor/theta.py | 26 | Python | 0.786 | suggestion | 143 | 42 | 49 | false | Add Theta stream extractor | 1,068 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | alerikaisattera |
'url': 'https://www.theta.tv/mst3k',
'info_dict': {
'id': 'MST3K',
'ext': 'mp4',
'title': r're:.+',
'thumbnail': r're:https://user-prod-theta-tv\.imgix\.net/.+\.jpg',
}
}]
def _real_extract(self, url):
channel_id = self._match_id(u... | do not chain .get
Use try_get instead | }
}, {
'url': 'https://www.theta.tv/mst3k',
'note': 'This channel is live 24/7',
'info_dict': {
'id': 'MST3K',
'ext': 'mp4',
'title': 'Mystery Science Theatre 3000 24/7 Powered by the THETA Network.',
'thumbnail': r're:https://user-prod... | @@ -0,0 +1,44 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class ThetaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.theta.tv/davirus',
+ 'info_dict': {
+ 'id... | yt_dlp/extractor/theta.py | 26 | Python | 0.143 | suggestion | 38 | 28 | 35 | false | Add Theta stream extractor | 1,068 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | alerikaisattera |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import try_get
class ThetaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'info_dict': {
'id'... | ```suggestion
'url': 'https://www.theta.tv/davirus',
'skip': 'The live may have ended',
'info_dict': {
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import try_get
class ThetaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'skip': 'The live may have ende... | @@ -0,0 +1,45 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import try_get
+
+
+class ThetaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.theta.tv/davirus',
+ 'i... | yt_dlp/extractor/theta.py | 12 | Python | 0.714 | suggestion | 134 | 37 | 37 | false | Add Theta stream extractor | 1,068 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import try_get
class ThetaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'info_dict': {
'id'... | ```suggestion
'url': 'https://www.theta.tv/mst3k',
'skip': 'The live may have ended',
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import try_get
class ThetaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'skip': 'The live may have ende... | @@ -0,0 +1,45 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import try_get
+
+
+class ThetaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.theta.tv/davirus',
+ 'i... | yt_dlp/extractor/theta.py | 20 | Python | 0.714 | suggestion | 108 | 45 | 45 | false | Add Theta stream extractor | 1,068 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
'info_dict': {
'id': 'MST3K',
'ext': 'mp4',
'title': 'Mystery Science Theatre 3000 24/7 Powered by the THETA Network.',
'thumbnail': r're:https://user-prod-theta-tv\.imgix\.net/.+\.jpg',
}
}]
def _real_extract(self, url):
channel_id = self... | Not mandatory, but add more fields like `channel`/`uploader` etc if possible | 'url': 'https://www.theta.tv/mst3k',
'note': 'This channel is live 24/7',
'info_dict': {
'id': 'MST3K',
'ext': 'mp4',
'title': 'Mystery Science Theatre 3000 24/7 Powered by the THETA Network.',
'thumbnail': r're:https://user-prod-theta-tv\.imgix\.n... | @@ -0,0 +1,45 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import try_get
+
+
+class ThetaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.theta.tv/davirus',
+ 'i... | yt_dlp/extractor/theta.py | 26 | Python | 0.357 | suggestion | 76 | 27 | 33 | false | Add Theta stream extractor | 1,068 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
_VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'info_dict': {
'id': 'DaVirus',
'ext': 'mp4',
'title': 'I choose you - My Community is King -👀 - YO HABLO ESPANOL - CODE DAVIRUS',
't... | ```suggestion
m3u8_playlist = next(
data['url']
if data.get('type') != 'embed' and data.get('resolution') in ('master', 'source')
for data in info['live_stream']['video_urls'])
``` | _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://www.theta.tv/davirus',
'skip': 'The live may have ended',
'info_dict': {
'id': 'DaVirus',
'ext': 'mp4',
'title': 'I choose you - My Community is King -👀 - YO HA... | @@ -0,0 +1,45 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import try_get
+
+
+class ThetaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?theta\.tv/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.theta.tv/davirus',
+ 'i... | yt_dlp/extractor/theta.py | 26 | Python | 0.929 | suggestion | 229 | 38 | 44 | false | Add Theta stream extractor | 1,068 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
login_submit_page, 'error', default=None)
if error:
raise ExtractorError(error, expected=True)
class LinkedInLearningIE(LinkedInLearningBaseIE):
IE_NAME = 'linkedin:learning'
_VALID_URL = r'https?://(?:www\.)?linkedin\.com/learning/(?P<course_slug>[^/]+)/(?P<id>[^/?#]+)'
_T... | ```suggestion
start_time, caption = line_dict['transcriptStartAt'] / 1000, line_dict['caption']
end_time = next_dict['transcriptStartAt'] / 1000 if next_dict else duration or start_time + 1
srt_data += '%d\n%s --> %s\n%s\n' % (line + 1, srt_subtitles_timecode(start_time),
``` | login_submit_page, 'error', default=None)
if error:
raise ExtractorError(error, expected=True)
class LinkedInLearningIE(LinkedInLearningBaseIE):
IE_NAME = 'linkedin:learning'
_VALID_URL = r'https?://(?:www\.)?linkedin\.com/learning/(?P<course_slug>[^/]+)/(?P<id>[^/?#]+)'
_T... | @@ -86,6 +89,16 @@ class LinkedInLearningIE(LinkedInLearningBaseIE):
},
}
+ def json2srt(self, transcript_lines, duration=None):
+ srt_data = ''
+ for line, (line_dict, next_dict) in enumerate(zip_longest(transcript_lines, transcript_lines[1:])):
+ start_time, caption = line_... | yt_dlp/extractor/linkedin.py | 26 | Python | 0.786 | suggestion | 316 | 51 | 51 | false | Add subtitles to LinkedInLearningIE. | 1,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
class LinkedInLearningIE(LinkedInLearningBaseIE):
IE_NAME = 'linkedin:learning'
_VALID_URL = r'https?://(?:www\.)?linkedin\.com/learning/(?P<course_slug>[^/]+)/(?P<id>[^/?#]+)'
_TEST = {
'url': 'https://www.linkedin.com/learning/programming-foundations-fundamentals/welcome?autoplay=true',
... | srt_data += '\n%d\n%s --> %s\n%s\n' % (line + 1, srt_subtitles_timecode(start_time), | login_submit_page, 'error', default=None)
if error:
raise ExtractorError(error, expected=True)
class LinkedInLearningIE(LinkedInLearningBaseIE):
IE_NAME = 'linkedin:learning'
_VALID_URL = r'https?://(?:www\.)?linkedin\.com/learning/(?P<course_slug>[^/]+)/(?P<id>[^/?#]+)'
_T... | @@ -86,6 +89,16 @@ class LinkedInLearningIE(LinkedInLearningBaseIE):
},
}
+ def json2srt(self, transcript_lines, duration=None):
+ srt_data = ''
+ for line, (line_dict, next_dict) in enumerate(zip_longest(transcript_lines, transcript_lines[1:])):
+ start_time, caption = line_... | yt_dlp/extractor/linkedin.py | 26 | Python | 0.214 | suggestion | 84 | 51 | 51 | false | Add subtitles to LinkedInLearningIE. | 1,077 | yt-dlp/yt-dlp | 132,642 | Python | sneezydrag0n | Ashish0804 |
'ext': 'mp4',
'title': 'bgmetrosot2409zta20210924174316682-n1info-rs-worldwide'
}},
{'url': 'https://n1info.si/novice/slovenija/zadnji-dnevi-na-kopaliscu-ilirija-ilirija-ni-umrla-ubili-so-jo/',
'info_dict': {
'id': 'ljsottomazilirija3060921-n1info-si-worldwi... | ```suggestion
entries.append(self.url_result(
video_data.get('data-url'), ie=N1InfoBaseIE.ie_key(),
video_id=video_data.get('id'), video_title=title))
``` | 'info_dict': {
'id': 'L5Hd4hQVUpk',
'ext': 'mp4',
'upload_date': '20210913',
'title': 'Ozmo i USO21, ep. 13: Novak Đoković – Danil Medvedev | Ključevi Poraza, Budućnost | SPORT KLUB TENIS',
'description': 'md5:467f330af1effedd2e290f10dc31bb8e',
... | @@ -0,0 +1,90 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoBaseIE(InfoExtractor):
+ _VALID_URL = r'https?://best-vod\.umn\.cdn\... | yt_dlp/extractor/n1.py | 26 | Python | 0.786 | suggestion | 202 | 44 | 51 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
from .common import InfoExtractor
from ..utils import (
unified_timestamp,
extract_attributes,
)
class N1InfoBaseIE(InfoExtractor):
_VALID_URL = r'https?://best-vod\.umn\.cdn\.united\.cloud/stream\?asset=(?P<id>[^&]+)'
def _real_extract(self, url):
video_id = self._match_id(url)
forma... | ```suggestion
_VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P<id>[^/]+)'
``` | from .reddit import RedditRIE
from .common import InfoExtractor
from ..utils import (
unified_timestamp,
extract_attributes,
)
class N1InfoAssetIE(InfoExtractor):
_VALID_URL = r'https?://best-vod\.umn\.cdn\.united\.cloud/stream\?asset=(?P<id>[^&]+)'
_TESTS = [{
'url': 'https://best-vod.umn.cdn... | @@ -0,0 +1,90 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoBaseIE(InfoExtractor):
+ _VALID_URL = r'https?://best-vod\.umn\.cdn\... | yt_dlp/extractor/n1.py | 26 | Python | 0.714 | suggestion | 115 | 51 | 51 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<h1[^>]+>(.+?)</h1>', webpage, 'title')
timestamp = unified_timestamp(self._html_search_meta('article:published_time... | ```suggestion
entries.append(self.url_result(url, ie=YoutubeIE.ie_key()))
``` | }
}, {
'url': 'https://rs.n1info.com/vesti/djilas-los-plan-za-metro-nece-resiti-nijedan-saobracajni-problem/',
'info_dict': {
'id': 'bgmetrosot2409zta20210924174316682-n1info-rs-worldwide',
'ext': 'mp4',
'title': 'Đilas: Predlog izgradnje metroa besmislen;... | @@ -0,0 +1,90 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoBaseIE(InfoExtractor):
+ _VALID_URL = r'https?://best-vod\.umn\.cdn\... | yt_dlp/extractor/n1.py | 26 | Python | 0.571 | suggestion | 95 | 36 | 51 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
# coding: utf-8
from __future__ import unicode_literals
import re
from .youtube import YoutubeIE
from .common import InfoExtractor
from ..utils import (
unified_timestamp,
extract_attributes,
)
class N1InfoBaseIE(InfoExtractor):
_VALID_URL = r'https?://best-vod\.umn\.cdn\.united\.cloud/stream\?asset=(?P... | dont name it `BaseIE`. Maybe `N1AssetIE`? Also add a test for this | # coding: utf-8
from __future__ import unicode_literals
import re
from .youtube import YoutubeIE
from .reddit import RedditRIE
from .common import InfoExtractor
from ..utils import (
unified_timestamp,
extract_attributes,
)
class N1InfoAssetIE(InfoExtractor):
_VALID_URL = r'https?://best-vod\.umn\.cdn\.... | @@ -0,0 +1,90 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoBaseIE(InfoExtractor): | yt_dlp/extractor/n1.py | 14 | Python | 0.357 | suggestion | 66 | 39 | 39 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
_VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/',
'md5': '01ddb6646d0fd9c4c7d990aa77fe1c5a',
'info_dict': {
'id': 'L5Hd4... | ```suggestion
}, {
'url': 'https://rs.n1info.com/vesti/djilas-los-plan-za-metro-nece-resiti-nijedan-saobracajni-problem/',
'info_dict': {
'id': 'bgmetrosot2409zta20210924174316682-n1info-rs-worldwide',
'ext': 'mp4',
'title': 'bgmetrosot2409zta202109241743166... | self._sort_formats(formats)
return {
'id': video_id,
'title': video_id,
'formats': formats,
}
class N1InfoIIE(InfoExtractor):
IE_NAME = 'N1Info:article'
_VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P<id>[^/]+)'
... | @@ -0,0 +1,88 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoAssetIE(InfoExtractor):
+ _VALID_URL = r'https?://best-vod\.umn\.cdn... | yt_dlp/extractor/n1.py | 26 | Python | 0.786 | suggestion | 699 | 51 | 51 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'id': 'bgmetrosot2409zta20210924174316682-n1info-rs-worldwide',
'ext': 'mp4',
'title': 'bgmetrosot2409zta20210924174316682-n1info-rs-worldwide'
}},
{'url': 'https://n1info.si/novice/slovenija/zadnji-dnevi-na-kopaliscu-ilirija-ilirija-ni-umrla-ubili-so-jo/',
'... | If I already specified video tile, why does the extractor have to return it? | 'md5': '01ddb6646d0fd9c4c7d990aa77fe1c5a',
'info_dict': {
'id': 'L5Hd4hQVUpk',
'ext': 'mp4',
'upload_date': '20210913',
'title': 'Ozmo i USO21, ep. 13: Novak Đoković – Danil Medvedev | Ključevi Poraza, Budućnost | SPORT KLUB TENIS',
'descriptio... | @@ -0,0 +1,88 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoAssetIE(InfoExtractor):
+ _VALID_URL = r'https?://best-vod\.umn\.cdn... | yt_dlp/extractor/n1.py | 26 | Python | 0.286 | refactor | 76 | 43 | 51 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | u-spec-png | u-spec-png |
'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/',
'md5': '01ddb6646d0fd9c4c7d990aa77fe1c5a',
'info_dict': {
'id': 'L5Hd4hQVUpk',
'ext': 'mp4',
'upload_date': '20210913',
'title': 'Ozmo i USO21, ep... | ```suggestion
_TESTS = [{
'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/',
'md5': '01ddb6646d0fd9c4c7d990aa77fe1c5a',
'info_dict': {
'id': 'L5Hd4hQVUpk',
'ext': 'mp4',
'upload_date': '20210913',
... | return {
'id': video_id,
'title': video_id,
'formats': formats,
}
class N1InfoIIE(InfoExtractor):
IE_NAME = 'N1Info:article'
_VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P<id>[^/]+)'
_TESTS = [{
# Youtube embedde... | @@ -0,0 +1,90 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoAssetIE(InfoExtractor):
+ _VALID_URL = r'https?://best-vod\.umn\.cdn... | yt_dlp/extractor/n1.py | 26 | Python | 0.786 | suggestion | 1,283 | 51 | 51 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
_TESTS = [{
'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/',
'md5': '01ddb6646d0fd9c4c7d990aa77fe1c5a',
'info_dict': {
'id': 'L5Hd4hQVUpk',
'ext': 'mp4',
'upload_date': '20210913',
'title': '... | I missed this before
Either add `md5`, or skip download |
return {
'id': video_id,
'title': video_id,
'formats': formats,
}
class N1InfoIIE(InfoExtractor):
IE_NAME = 'N1Info:article'
_VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P<id>[^/]+)'
_TESTS = [{
# Youtube embedd... | @@ -0,0 +1,90 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoAssetIE(InfoExtractor):
+ _VALID_URL = r'https?://best-vod\.umn\.cdn... | yt_dlp/extractor/n1.py | 26 | Python | 0.357 | suggestion | 58 | 51 | 51 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<h1[^>]+>(.+?)</h1>', webpage, 'title')
timestamp = unified_timestamp(self._html_search_meta('article:published_time', webpage))
videos = re.findall(r'(?m)(<video[^>]+>)', webpage)
entries = []
... | If all URLs extracted is sure to point to some video, you can just do this
```py
entries.extend(
self.url_result(extract_attributes(embedded_video).get('src'))
for embedded_video in re.findall(r'(<iframe[^>]+>)', webpage))
```
YoutubeDL code will try and figure out what extractor the URL should go t... | }]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<h1[^>]+>(.+?)</h1>', webpage, 'title')
timestamp = unified_timestamp(self._html_search_meta('article:published_time', webpage))
... | @@ -81,16 +105,23 @@ def _real_extract(self, url):
entries = []
for video in videos:
video_data = extract_attributes(video)
- entries.append(self.url_result(
- video_data.get('data-url'), ie=N1InfoAssetIE.ie_key(),
- video_id=video_data.get('id'), ... | yt_dlp/extractor/n1.py | 26 | Python | 0.857 | refactor | 321 | 36 | 39 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
class N1InfoIIE(InfoExtractor):
IE_NAME = 'N1Info:article'
_VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P<id>[^/]+)'
_TESTS = [{
# Youtube embedded
'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/',
... | ```suggestion
},
'params': {
'skip_download': True,
},
``` |
class N1InfoIIE(InfoExtractor):
IE_NAME = 'N1Info:article'
_VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P<id>[^/]+)'
_TESTS = [{
# Youtube embedded
'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/',
... | @@ -0,0 +1,129 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .youtube import YoutubeIE
+from .reddit import RedditRIE
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+ extract_attributes,
+)
+
+
+class N1InfoAssetIE(InfoExtractor):
+ _VALID_URL... | yt_dlp/extractor/n1.py | 26 | Python | 0.571 | suggestion | 99 | 51 | 51 | false | [N1] Add extractor | 1,080 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
}
def _real_extract(self, url):
video_id = self._match_id(url)
metadata = self._download_json(
'https://app.veo.co/api/app/matches/%s' % video_id, video_id)
video_data = self._download_json(
'https://app.veo.co/api/app/matches/%s/videos' % video_id, video_id, '... | ```suggestion
bitrate = int_or_none(fmt.get('bit_rate'), scale=1000)
```
`bitrate / 1000 if bitrate else None` below can be removed | }]
def _real_extract(self, url):
video_id = self._match_id(url)
metadata = self._download_json(
'https://app.veo.co/api/app/matches/%s' % video_id, video_id)
video_data = self._download_json(
'https://app.veo.co/api/app/matches/%s/videos' % video_id, video_id, ... | @@ -0,0 +1,74 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ mimetype2ext,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VeoIE(InfoExtractor):
+ _VALID_URL = r'https?://app\.veo\.co/matches/(?P<id>[0-9A-Za-z-... | yt_dlp/extractor/veo.py | 26 | Python | 0.786 | suggestion | 146 | 48 | 48 | false | [Veo] Add new extractor | 1,084 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
mimetype2ext,
unified_timestamp,
url_or_none,
)
class VeoIE(InfoExtractor):
_VALID_URL = r'https?://app\.veo\.co/matches/(?P<id>[0-9A-Za-z-]+)'
_TEST = {
'url... | ```suggestion
'thumbnail': 're:https://c.veocdn.com/.+/thumbnail.jpg',
```
no need to hardcode the url | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
mimetype2ext,
unified_timestamp,
url_or_none,
)
class VeoIE(InfoExtractor):
_VALID_URL = r'https?://app\.veo\.co/matches/(?P<id>[0-9A-Za-z-]+)'
_TESTS = [{
'u... | @@ -0,0 +1,74 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ mimetype2ext,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VeoIE(InfoExtractor):
+ _VALID_URL = r'https?://app\.veo\.co/matches/(?P<id>[0-9A-Za-z-... | yt_dlp/extractor/veo.py | 23 | Python | 0.714 | suggestion | 117 | 48 | 48 | false | [Veo] Add new extractor | 1,084 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
mimetype2ext,
unified_timestamp,
url_or_none,
)
class VeoIE(InfoExtractor):
_VALID_URL = r'https?://app\.veo\.co/matches/(?P<id>[0-9A-Za-z-]+)'
_TEST = {
'url... | even though there is only single test, it is recommended to use `_TESTS` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
mimetype2ext,
unified_timestamp,
url_or_none,
)
class VeoIE(InfoExtractor):
_VALID_URL = r'https?://app\.veo\.co/matches/(?P<id>[0-9A-Za-z-]+)'
_TESTS = [{
'u... | @@ -0,0 +1,74 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+from ..utils import (
+ int_or_none,
+ mimetype2ext,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VeoIE(InfoExtractor):
+ _VALID_URL = r'https?://app\.veo\.co/matches/(?P<id>[0-9A-Za-z-... | yt_dlp/extractor/veo.py | 17 | Python | 0.429 | suggestion | 72 | 42 | 42 | false | [Veo] Add new extractor | 1,084 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
class RumbleChannelIE(InfoExtractor):
_VALID_URL = r'(?P<url>https?://(?:www\.)?rumble\.com/(?:c|user)/(?P<id>[^&?#$/]+))'
_TESTS = [{
'url': 'https://rumble.com/c/Styxhexenhammer666',
'playlist_mincount': 1160,
'info_dict': {
'id': 'Styxhexenhammer666',
},
... | instead of ignoring all errors, catch only 404 | }
class RumbleChannelIE(InfoExtractor):
_VALID_URL = r'(?P<url>https?://(?:www\.)?rumble\.com/(?:c|user)/(?P<id>[^&?#$/]+))'
_TESTS = [{
'url': 'https://rumble.com/c/Styxhexenhammer666',
'playlist_mincount': 1160,
'info_dict': {
'id': 'Styxhexenhammer666',
... | @@ -75,3 +76,35 @@ def _real_extract(self, url):
'channel_url': author.get('url'),
'duration': int_or_none(video.get('duration')),
}
+
+
+class RumbleChannelIE(InfoExtractor):
+ _VALID_URL = r'(?P<url>https?://(?:www\.)?rumble\.com/(?:c|user)/(?P<id>[^&?#$/]+))'
+
+ _TESTS = [{
... | yt_dlp/extractor/rumble.py | 26 | Python | 0.286 | suggestion | 46 | 33 | 35 | false | Add RumbleChannelIE. | 1,088 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
videos.append(fallback_info['video'])
formats = []
subtitles = {}
for video in videos:
video_url = video.get('url')
if not video_url:
continue
if is_live is None:
is_live = (try_get(
vide... | -1 is the default. You should set it lower than that. Also, this should be `language_preference` | video_url, video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id=format_id,
fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
elif ext == 'mpd':
fmts, subs = self._extra... | @@ -193,28 +167,26 @@ def sign(manifest_url, manifest_id):
'format_id': format_id,
})
+ # XXX: what is video['captions']?
+ # XXX: video['spritesheets'] contains a list of thumbnail images (storyboard)
+
+ for f in formats:
+ if f.g... | yt_dlp/extractor/francetv.py | 26 | Python | 0.429 | suggestion | 96 | 51 | 51 | false | [francetv] Update extractor | 1,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | fstirlitz |
formats = []
subtitles = {}
for video in videos:
video_url = video.get('url')
if not video_url:
continue
if is_live is None:
is_live = (try_get(
video, lambda x: x['plages_ouverture'][0]['direct'], bool) is ... | ```suggestion
f['format_note'] = 'audio description%s' % format_field(f, 'format_note', ', %s')
``` | entry_protocol='m3u8_native', m3u8_id=format_id,
fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
elif ext == 'mpd':
fmts, subs = self._extract_mpd_formats_and_subtitles(
... | @@ -193,28 +167,26 @@ def sign(manifest_url, manifest_id):
'format_id': format_id,
})
+ # XXX: what is video['captions']?
+ # XXX: video['spritesheets'] contains a list of thumbnail images (storyboard)
+
+ for f in formats:
+ if f.g... | yt_dlp/extractor/francetv.py | 26 | Python | 0.714 | suggestion | 117 | 51 | 51 | false | [francetv] Update extractor | 1,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | fstirlitz |
video_url = video.get('url')
if not video_url:
continue
if is_live is None:
is_live = (try_get(
video, lambda x: x['plages_ouverture'][0]['direct'], bool) is True
or video.get('is_live') is True
... | Tested this on `francetv:162311093`. May find more later.
(I’m not even sure extracting storyboards is worth it in the first place.) | elif ext == 'mpd':
fmts, subs = self._extract_mpd_formats_and_subtitles(
video_url, video_id, mpd_id=format_id, fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
elif video_url.startswith('rtmp'):
... | @@ -174,6 +177,24 @@ def _extract_video(self, video_id, catalogue=None):
f['language_preference'] = -10
f['format_note'] = 'audio description%s' % format_field(f, 'format_note', ', %s')
+ if spritesheets: | yt_dlp/extractor/francetv.py | 26 | Python | 0.571 | refactor | 135 | 51 | 51 | false | [francetv] Update extractor | 1,096 | yt-dlp/yt-dlp | 132,642 | Python | fstirlitz | fstirlitz |
continue
formats.extend(self._extract_f4m_formats(
sign(video_url, format_id) + '&hdcore=3.7.0&plugin=aasp-3.7.0.39.44',
video_id, f4m_id=format_id, fatal=False))
elif ext == 'm3u8':
m3u8_fmts, m3u8_subs = self._extr... | My later measurements revealed the best value is probably closer to 192. But I don’t know the exact value, and I don’t make corrections for an inexact match. | 'url': video_url,
'format_id': format_id,
})
# XXX: what is video['captions']?
for f in formats:
if f.get('acodec') != 'none' and f.get('language') in ('qtz', 'qad'):
f['language_preference'] = -10
... | @@ -193,28 +170,43 @@ def sign(manifest_url, manifest_id):
'format_id': format_id,
})
+ # XXX: what is video['captions']?
+
+ for f in formats:
+ if f.get('acodec') != 'none' and f.get('language') in ('qtz', 'qad'):
+ f['languag... | yt_dlp/extractor/francetv.py | 26 | Python | 0.357 | suggestion | 157 | 51 | 51 | false | [francetv] Update extractor | 1,096 | yt-dlp/yt-dlp | 132,642 | Python | fstirlitz | fstirlitz |
format_id = video.get('format')
ext = determine_ext(video_url)
if ext == 'f4m':
if georestricted:
# See https://github.com/ytdl-org/youtube-dl/issues/3963
# m3u8 urls work fine
continue
format... | The MHTML downloader actually ignores the URL, but intermediate stages require it to be filled. | 'format_id': 'rtmp-%s' % format_id,
'ext': 'flv',
})
else:
if self._is_valid_url(video_url, video_id, format_id):
formats.append({
'url': video_url,
'format_id': format... | @@ -193,28 +170,43 @@ def sign(manifest_url, manifest_id):
'format_id': format_id,
})
+ # XXX: what is video['captions']?
+
+ for f in formats:
+ if f.get('acodec') != 'none' and f.get('language') in ('qtz', 'qad'):
+ f['languag... | yt_dlp/extractor/francetv.py | 26 | Python | 0.214 | suggestion | 95 | 51 | 51 | false | [francetv] Update extractor | 1,096 | yt-dlp/yt-dlp | 132,642 | Python | fstirlitz | fstirlitz |
urljoin(self._MEDIA_BASE_URL, post_data.get('main'))
or self._og_search_thumbnail(webpage))
tags = post_data.get('htgs')
timestamp = int_or_none(post_data.get('cdate'))
duration = float_or_none(post_data.get('vid_dur'))
if not dict_get(post_data, ['vid', 'ovid']... | set increased `quality` and `source_preference`, not `preference` | formats.append({
'url': urljoin(self._MEDIA_BASE_URL, ovid),
'format_id': 'ovid',
'ext': 'mp4',
'width': int_or_none(post_data.get('vid_wid')),
'height': int_or_none(post_data.get('vid_hgt')),
'source_preference'... | @@ -0,0 +1,124 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ dict_get,
+ float_or_none,
+ int_or_none,
+ remove_end,
+ str_or_none,
+ try_get,
+ url_or_none,
+ urljoin,
+)
+
+
+class Ge... | yt_dlp/extractor/gettr.py | 26 | Python | 0.429 | suggestion | 65 | 43 | 29 | false | [Gettr] Add new extractor | 1,120 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
title = '%s - %s' % (uploader, title)
uploader_id = str_or_none(
user_data.get('_id')
or user_data.get('username')
or post_data.get('uid'))
thumbnail = url_or_none(
urljoin(self._MEDIA_BASE_URL, post_data.get('main'))
or self._og_... | ```suggestion
formats = self._extract_m3u8_formats(
urljoin(self._MEDIA_BASE_URL, vid), post_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id='hls') if vid else []
``` | vid = post_data.get('vid')
ovid = post_data.get('ovid')
formats = self._extract_m3u8_formats(
urljoin(self._MEDIA_BASE_URL, vid), post_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id='hls') if vid else []
if ovid:
formats.append({
'u... | @@ -0,0 +1,124 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ dict_get,
+ float_or_none,
+ int_or_none,
+ remove_end,
+ str_or_none,
+ try_get,
+ url_or_none,
+ urljoin,
+)
+
+
+class Ge... | yt_dlp/extractor/gettr.py | 26 | Python | 0.857 | refactor | 203 | 51 | 37 | false | [Gettr] Add new extractor | 1,120 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
raise ExtractorError(post_data.get('txt'), expected=True)
title = description = str_or_none(
post_data.get('txt') or self._og_search_description(webpage))
if title:
# remove link
title = re.sub(r'\s*https?://[^\s]+', '', title)
uploader = str_or_... | since these are not used anywhere, move them closer to the return, or even better, remove the variables for them entirely | title = description = str_or_none(
post_data.get('txt') or self._og_search_description(webpage))
uploader = str_or_none(
user_data.get('nickname')
or remove_end(self._og_search_title(webpage), ' on GETTR'))
if uploader:
title = '%s - %s' % (upload... | @@ -0,0 +1,124 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ dict_get,
+ float_or_none,
+ int_or_none,
+ remove_end,
+ str_or_none,
+ try_get,
+ url_or_none,
+ urljoin,
+)
+
+
+class Ge... | yt_dlp/extractor/gettr.py | 26 | Python | 0.429 | suggestion | 121 | 51 | 49 | false | [Gettr] Add new extractor | 1,120 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
'duration': 58.5585,
}
}, {
'url': 'https://gettr.com/post/p4iahp',
'info_dict': {
'id': 'p4iahp',
'title': 'md5:b03c07883db6fbc1aab88877a6c3b149',
'description': 'md5:741b7419d991c403196ed2ea7749a39d',
'ext': 'mp4',
'up... | ```suggestion
user_data = try_get(api_data, lambda x: x['result']['aux']['uinf'][post_data['uid']]) or {}
```
no point using `.get` inside `try_get` | }, {
'url': 'https://gettr.com/post/p4iahp',
'info_dict': {
'id': 'p4iahp',
'title': 'md5:b03c07883db6fbc1aab88877a6c3b149',
'description': 'md5:741b7419d991c403196ed2ea7749a39d',
'ext': 'mp4',
'uploader': 'Neues Forum Freiheit',
... | @@ -0,0 +1,124 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ dict_get,
+ float_or_none,
+ int_or_none,
+ remove_end,
+ str_or_none,
+ try_get,
+ url_or_none,
+ urljoin,
+)
+
+
+class Ge... | yt_dlp/extractor/gettr.py | 26 | Python | 0.786 | suggestion | 159 | 51 | 51 | false | [Gettr] Add new extractor | 1,120 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
post_data = try_get(api_data, lambda x: x['result']['data'])
user_data = try_get(api_data, lambda x: x['result']['aux']['uinf'][post_data['uid']]) or {}
if post_data.get('nfound'):
raise ExtractorError(post_data.get('txt'), expected=True)
title = description = str_or_none(
... | ```py
formats = []
if vid:
...
```
The point was to get rid of this part
```suggestion
vid = post_data.get('vid')
ovid = post_data.get('ovid')
formats = self._extract_m3u8_formats(
urljoin(self._MEDIA_BASE_URL, vid), post_id, 'mp4',
... | post_data = try_get(api_data, lambda x: x['result']['data'])
user_data = try_get(api_data, lambda x: x['result']['aux']['uinf'][post_data['uid']]) or {}
if post_data.get('nfound'):
raise ExtractorError(post_data.get('txt'), expected=True)
title = description = str_or_none(
... | @@ -0,0 +1,111 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ dict_get,
+ float_or_none,
+ int_or_none,
+ remove_end,
+ str_or_none,
+ try_get,
+ url_or_none,
+ urljoin,
+)
+
+
+class GettrIE(InfoExt... | yt_dlp/extractor/gettr.py | 26 | Python | 0.857 | refactor | 392 | 51 | 51 | false | [Gettr] Add new extractor | 1,120 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
post_data.get('txt') or self._og_search_description(webpage))
uploader = str_or_none(
user_data.get('nickname')
or remove_end(self._og_search_title(webpage), ' on GETTR'))
if uploader:
title = '%s - %s' % (uploader, title)
if not dict_get(post_da... |
Yes, this is technically correct, but is misleading
```suggestion
'source_preference': 1,
'quality': 1,
``` | post_data.get('txt') or self._og_search_description(webpage))
uploader = str_or_none(
user_data.get('nickname')
or remove_end(self._og_search_title(webpage), ' on GETTR'))
if uploader:
title = '%s - %s' % (uploader, title)
if not dict_get(post_da... | @@ -0,0 +1,109 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ dict_get,
+ float_or_none,
+ int_or_none,
+ remove_end,
+ str_or_none,
+ try_get,
+ url_or_none,
+ urljoin,
+)
+
+
+class GettrIE(InfoExt... | yt_dlp/extractor/gettr.py | 26 | Python | 0.786 | suggestion | 147 | 47 | 48 | false | [Gettr] Add new extractor | 1,120 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
def _extract_selected_tab(tabs):
for tab in tabs:
renderer = dict_get(tab, ('tabRenderer', 'expandableTabRenderer')) or {}
if renderer.get('selected') is True:
return renderer
else:
raise ExtractorError('Unable to find selected tab')
@classmet... | I just noticed, this is bad. This sets both to the same list | # Extracting updated visitor data is required to prevent an infinite extraction loop in some cases
# See: https://github.com/ytdl-org/youtube-dl/issues/28702
visitor_data = self._extract_visitor_data(response) or visitor_data
known_continuation_renderers = {
... | @@ -3973,7 +3973,7 @@ def _extract_uploader(cls, data):
try_get(owner, lambda x: x['navigationEndpoint']['browseEndpoint']['canonicalBaseUrl'], compat_str))
return {k: v for k, v in uploader.items() if v is not None}
- def _extract_from_tabs(self, item_id, webpage, data, tabs):
+ def _... | yt_dlp/extractor/youtube.py | 26 | Python | 0.214 | suggestion | 60 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
webpage = self._download_webpage(
url, item_id,
note='Downloading webpage%s' % (' (retry #%d)' % count if count else '',))
data = self.extract_yt_initial_data(item_id, webpage or '', fatal=fatal) or {}
except ExtractorError as e:
... | Reminder to myself: Generalize with extract_response |
@staticmethod
def _extract_sidebar_info_renderer(data, info_renderer, expected_type=dict):
sidebar_renderer = try_get(
data, lambda x: x['sidebar']['playlistSidebarRenderer']['items'], list) or []
for item in sidebar_renderer:
renderer = try_get(item, lambda x: x[info_re... | @@ -4178,28 +4174,76 @@ def _reload_with_unavailable_videos(self, item_id, data, webpage):
check_get_keys='contents', fatal=False, ytcfg=ytcfg,
note='Downloading API JSON with unavailable videos')
- def _extract_webpage(self, url, item_id):
+ def _extract_webpage(self, url, item_id, fa... | yt_dlp/extractor/youtube.py | 26 | Python | 0.286 | refactor | 52 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
url = compat_urlparse.urlunparse(
compat_urlparse.urlparse(url)._replace(netloc='www.youtube.com'))
compat_opts = self.get_param('compat_opts', [])
def get_mobj(url):
mobj = self._url_re.match(url).groupdict()
mobj.update((k, '') for k, v in mobj.items() if v... | Is it possible for us to check this from the cookies? |
if dict_get(data, ('contents', 'currentVideoEndpoint')):
break
last_error = 'Incomplete yt initial data received'
if count >= retries:
if fatal:
raise ExtractorError(last_error)
self.rep... | @@ -4178,28 +4174,76 @@ def _reload_with_unavailable_videos(self, item_id, data, webpage):
check_get_keys='contents', fatal=False, ytcfg=ytcfg,
note='Downloading API JSON with unavailable videos')
- def _extract_webpage(self, url, item_id):
+ def _extract_webpage(self, url, item_id, fa... | yt_dlp/extractor/youtube.py | 26 | Python | 0.214 | question | 53 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
compat_urlparse.urlparse(url)._replace(netloc='www.youtube.com'))
compat_opts = self.get_param('compat_opts', [])
def get_mobj(url):
mobj = self._url_re.match(url).groupdict()
mobj.update((k, '') for k, v in mobj.items() if v is None)
return mobj
... | why only_once? afaik this function is only called once | if dict_get(data, ('contents', 'currentVideoEndpoint')):
break
last_error = 'Incomplete yt initial data received'
if count >= retries:
if fatal:
raise ExtractorError(last_error)
self.repo... | @@ -4178,28 +4174,76 @@ def _reload_with_unavailable_videos(self, item_id, data, webpage):
check_get_keys='contents', fatal=False, ytcfg=ytcfg,
note='Downloading API JSON with unavailable videos')
- def _extract_webpage(self, url, item_id):
+ def _extract_webpage(self, url, item_id, fa... | yt_dlp/extractor/youtube.py | 26 | Python | 0.214 | question | 54 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
return webpage, data
def _extract_data(self, url, item_id, ytcfg=None, fatal=True, webpage_fatal=False, default_client='web'):
data = None
if 'webpage' not in self._configuration_arg('skip'):
webpage, data = self._extract_webpage(url, item_id, fatal=webpage_fatal)
y... | ```suggestion
ep='navigation/resolve_url', note='Downloading API parameters API JSON', default_client=default_client)
``` | text = try_get(
nav_item_renderer, lambda x: x['text']['simpleText'], compat_str)
if not text or text.lower() != 'show unavailable videos':
continue
browse_endpoint = try_get(
nav_item_renderer, lambda x: x['navigationEndpoint']['browse... | @@ -4178,28 +4174,76 @@ def _reload_with_unavailable_videos(self, item_id, data, webpage):
check_get_keys='contents', fatal=False, ytcfg=ytcfg,
note='Downloading API JSON with unavailable videos')
- def _extract_webpage(self, url, item_id):
+ def _extract_webpage(self, url, item_id, fa... | yt_dlp/extractor/youtube.py | 26 | Python | 0.714 | suggestion | 135 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
compat_urlparse.urlparse(url)._replace(netloc='www.youtube.com'))
compat_opts = self.get_param('compat_opts', [])
def get_mobj(url):
mobj = self._url_re.match(url).groupdict()
mobj.update((k, '') for k, v in mobj.items() if v is None)
return mobj
... | why warning, shouldn't this be an error? | if dict_get(data, ('contents', 'currentVideoEndpoint')):
break
last_error = 'Incomplete yt initial data received'
if count >= retries:
if fatal:
raise ExtractorError(last_error)
self.repo... | @@ -4232,20 +4276,21 @@ def get_mobj(url):
mobj = get_mobj(url)
# Youtube returns incomplete data if tabname is not lower case
pre, tab, post, is_channel = mobj['pre'], mobj['tab'].lower(), mobj['post'], not mobj['not_channel']
-
if is_channel:
if smuggled_data.get('is_m... | yt_dlp/extractor/youtube.py | 26 | Python | 0.286 | question | 40 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
url = ''.join((pre, tab, post))
mobj = get_mobj(url)
# Handle both video/playlist URLs
qs = parse_qs(url)
video_id = qs.get('v', [None])[0]
playlist_id = qs.get('list', [None])[0]
if not video_id and mobj['not_channel'].startswith('watch'):
if not pl... | TODO: Pretty sure we still need this | if params:
return self._extract_response(
item_id=item_id, query=params, ep=ep, headers=headers,
ytcfg=ytcfg, fatal=fatal, default_client=default_client,
check_get_keys=('contents', 'currentVideoEndpoint'))
err_note = 'Faile... | @@ -4326,8 +4326,6 @@ def get_mobj(url):
self.to_screen('Downloading playlist %s; add --no-playlist to just download video %s' % (playlist_id, video_id))
data, ytcfg = self._extract_data(url, item_id)
- if not data:
- raise ExtractorError('This playlist or channel does not exis... | yt_dlp/extractor/youtube.py | 26 | Python | 0.071 | suggestion | 36 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | coletdjnz |
'identity token', default=None, fatal=False)
@staticmethod
def _extract_account_syncid(*args):
"""
Extract syncId required to download private playlists of secondary channels
@params response and/or ytcfg
"""
for data in args:
# ytcfg includes... | track session state*
(I think) | 'identity token', default=None, fatal=False)
@staticmethod
def _extract_account_syncid(*args):
"""
Extract syncId required to download private playlists of secondary channels
@params response and/or ytcfg
"""
for data in args:
# ytcfg includes... | @@ -627,6 +627,16 @@ def _extract_account_syncid(*args):
# and just "user_syncid||" for primary channel. We only want the channel_syncid
return sync_ids[0]
+ @staticmethod
+ def _extract_visitor_data(*args):
+ """
+ Extracts visitorData
+ Required to track ... | yt_dlp/extractor/youtube.py | 26 | Python | 0.071 | suggestion | 33 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | coletdjnz |
yield entry
continuation = continuation_list[0]
for page_num in itertools.count(1):
if not continuation:
break
headers = self.generate_api_headers(
ytcfg=ytcfg, account_syncid=account_syncid, visitor_data=visitor_data)
resp... | we can remove this workaround now. But probably not in the scope of this PR | if not isinstance(isr_content, dict):
continue
known_renderers = {
'playlistVideoListRenderer': self._playlist_entries,
'gridRenderer': self._grid_entries,
'shelfRenderer': lambda x: ... | @@ -3874,7 +3894,7 @@ def extract_entries(parent_renderer): # this needs to called again for continua
if not continuation_list[0]:
continuation_list[0] = self._extract_continuation(parent_renderer)
- continuation_list = [None] # Python 2 doesnot support nonlocal
+ continu... | yt_dlp/extractor/youtube.py | 26 | Python | 0.286 | refactor | 75 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
playlist_id = qs.get('list', [None])[0]
if not video_id and mobj['not_channel'].startswith('watch'):
if not playlist_id:
# If there is neither video or playlist ids, youtube redirects to home page, which is undesirable
raise ExtractorError('Unable to recogniz... | Not sure about my explanation here, let me know if you can think of something better |
if dict_get(data, ('contents', 'currentVideoEndpoint')):
break
last_error = 'Incomplete yt initial data received'
if count >= retries:
if fatal:
raise ExtractorError(last_error)
self.rep... | @@ -4178,28 +4231,87 @@ def _reload_with_unavailable_videos(self, item_id, data, webpage):
check_get_keys='contents', fatal=False, ytcfg=ytcfg,
note='Downloading API JSON with unavailable videos')
- def _extract_webpage(self, url, item_id):
+ def _extract_webpage(self, url, item_id, fa... | yt_dlp/extractor/youtube.py | 26 | Python | 0.286 | suggestion | 84 | 51 | 51 | false | [youtube:tab] Fallback to API when webpage fails to download | 1,122 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | coletdjnz |
block_r = [0xE1] + [0] * (BLOCK_SIZE_BYTES - 1)
block_v = block_y[:]
block_z = [0] * BLOCK_SIZE_BYTES
for i in block_x:
for bit in range(7, -1, -1):
if i & (1 << bit):
block_z = xor(block_z, block_v)
do_xor = block_v[-1] & 1
block_v = shift_b... | ```suggestion
block = data[i : i + BLOCK_SIZE_BYTES] # noqa: E203
```
unnecessary change | block_r = [0xE1] + [0] * (BLOCK_SIZE_BYTES - 1)
block_v = block_y[:]
block_z = [0] * BLOCK_SIZE_BYTES
for i in block_x:
for bit in range(7, -1, -1):
if i & (1 << bit):
block_z = xor(block_z, block_v)
do_xor = block_v[-1] & 1
block_v = shift_b... | @@ -476,7 +450,7 @@ def ghash(subkey, data):
last_y = [0] * BLOCK_SIZE_BYTES
for i in range(0, len(data), BLOCK_SIZE_BYTES):
- block = data[i : i + BLOCK_SIZE_BYTES] # noqa: E203
+ block = data[i: i + BLOCK_SIZE_BYTES] # noqa: E203 | yt_dlp/aes.py | 26 | Python | 0.786 | suggestion | 100 | 42 | 42 | false | [aes-generator] Boost performance slightly | 1,135 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sulyi |
data += i['content'] + '\n\n'
return data
def _get_subtitles(self, type, ep_id):
sub_json = self._call_api(type, f'/m/subtitle?ep_id={ep_id}&platform=web', ep_id)
subtitles = {}
for sub in sub_json.get('subtitles', []):
sub_url = sub.get('url')
if... | keep `or`. It handles cases where the `video_resource` is literally `None` | 'data': self.json2srt(sub_data)
})
return subtitles
def _get_formats(self, type, ep_id):
video_json = self._call_api(type, f'/web/playurl?ep_id={ep_id}&platform=web', ep_id)
if not video_json:
self.raise_login_required(method='cookies')
video_... | @@ -802,8 +827,8 @@ def _get_formats(self, type, ep_id):
video_json = video_json['playurl']
formats = []
for vid in video_json.get('video', []):
- video_res = vid.get('video_resource') or {}
- video_info = vid.get('stream_info') or {}
+ video_res = vid.get('vi... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.5 | suggestion | 74 | 51 | 51 | false | [Bilibili] Add subtitle converter | 1,144 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
def json2srt(self, json, ep_id):
def sec2time(sec):
h = int(sec) // 3600
m = int(sec) // 60 % 60
s = sec % 60
f = int(sec * 1000) % 1000
return "%02d:%02d:%02d,%03d" % (h, m, int(s), f)
if json is str:
json = self._parse_json(j... | add a note, make non-fatal and add something like `if not sub_data: continue` | return data
def _get_subtitles(self, type, ep_id):
sub_json = self._call_api(type, f'/m/subtitle?ep_id={ep_id}&platform=web', ep_id)
subtitles = {}
for sub in sub_json.get('subtitles', []):
sub_url = sub.get('url')
if not sub_url:
continue
... | @@ -783,15 +789,34 @@ class BiliIntlBaseIE(InfoExtractor):
def _call_api(self, type, endpoint, id):
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
+ def json2srt(self, json, ep_id):
+ def sec2time(sec):
+ h = int(sec) // 3600
+ m = int(sec) /... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.357 | suggestion | 77 | 51 | 51 | false | [Bilibili] Add subtitle converter | 1,144 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
class BiliIntlBaseIE(InfoExtractor):
_API_URL = 'https://api.bili{}/intl/gateway{}'
def _call_api(self, type, endpoint, id):
return self._download_json(s... | ```suggestion
data = '\n\n'.join(
f'{i + 1}\n{srt_subtitles_timecode(line["from"])} --> {srt_subtitles_timecode(line["to"])}\n{line["content"]}'
for i, line in enumerate(json['body']))
```
u can also replace the fstring with `%`/`format` if u think this is too unwieldy | class BiliIntlBaseIE(InfoExtractor):
_API_URL = 'https://api.bili{}/intl/gateway{}'
def _call_api(self, type, endpoint, id):
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
def json2srt(self, json):
data = '\n\n'.join(
f'{i + 1}\n{srt_subtitles_time... | @@ -783,15 +789,34 @@ class BiliIntlBaseIE(InfoExtractor):
def _call_api(self, type, endpoint, id):
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
+ def json2srt(self, json, ep_id):
+ def sec2time(sec):
+ h = int(sec) // 3600
+ m = int(sec) /... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.857 | suggestion | 308 | 51 | 51 | false | [Bilibili] Add subtitle converter | 1,144 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
entries = []
pageNumber = 0
while True:
pageNumber += 1
# FIXME
api_url = "https://api.bilibili.com/x/web-interface/search/type?context=&page=%s&order=pubdate&keyword=%s&duration=0&tids_2=&__refresh__=true&search_type=video&tids=0&highlight=1" % (
... | ```suggestion
if len(entries) >= n or len(videos) >= BiliBiliSearchIE.MAX_NUMBER_OF_RESULTS:
```
seems like a lot of this file don't follow our coding conventions
Unless you want to clean up the code in this PR, it may be better to get rid of all these unrelated changes | # FIXME
api_url = 'https://api.bilibili.com/x/web-interface/search/type?context=&page=%s&order=pubdate&keyword=%s&duration=0&tids_2=&__refresh__=true&search_type=video&tids=0&highlight=1' % (pageNumber, query)
json_str = self._download_webpage(
api_url, "None", query=... | @@ -642,7 +648,7 @@ def _get_n_results(self, query, n):
e = self.url_result(video['arcurl'], 'BiliBili', compat_str(video['aid']))
entries.append(e)
- if(len(entries) >= n or len(videos) >= BiliBiliSearchIE.MAX_NUMBER_OF_RESULTS):
+ if (len(entries) >= n or len(... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.857 | refactor | 290 | 51 | 51 | false | [Bilibili] Add subtitle converter | 1,144 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
return OnDemandPagedList(functools.partial(
self._fetch_page, api_url, num_pages, query), size)
def _real_extract(self, url):
u = compat_urllib_parse_urlparse(url)
category, subcategory = u.path.split('/')[2:4]
query = '%s: %s' % (category, subcategory)
return s... | ```suggestion
api_url = 'https://api.bilibili.com/x/web-interface/search/type?context=&page=%s&order=pubdate&keyword=%s&duration=0&tids_2=&__refresh__=true&search_type=video&tids=0&highlight=1' % (
```
see above | u = compat_urllib_parse_urlparse(url)
category, subcategory = u.path.split('/')[2:4]
query = '%s: %s' % (category, subcategory)
return self.playlist_result(self._entries(category, subcategory, query), query, query)
class BiliBiliSearchIE(SearchInfoExtractor):
IE_DESC = 'Bilibili v... | @@ -623,7 +628,8 @@ def _get_n_results(self, query, n):
while True:
pageNumber += 1
# FIXME
- api_url = "https://api.bilibili.com/x/web-interface/search/type?context=&page=%s&order=pubdate&keyword=%s&duration=0&tids_2=&__refresh__=true&search_type=video&tids=0&highlight=1" ... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.929 | suggestion | 228 | 51 | 51 | false | [Bilibili] Add subtitle converter | 1,144 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'url': 'http://player.bilibili.com/player.html?aid=92494333&cid=157926707&page=1',
'only_matching': True,
}
def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE... | why?
PS: `json is str` is wrong syntax anyway | video_id = self._match_id(url)
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
class BiliIntlBaseIE(InfoExtractor):
_API_URL = 'https://api.bili{}/intl/gateway{}'
def _call_api(self, type, endpoint, id... | @@ -783,15 +789,34 @@ class BiliIntlBaseIE(InfoExtractor):
def _call_api(self, type, endpoint, id):
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
+ def json2srt(self, json, ep_id):
+ def sec2time(sec):
+ h = int(sec) // 3600
+ m = int(sec) /... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.214 | bug | 48 | 51 | 51 | false | [Bilibili] Add subtitle converter | 1,144 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
video_e = self._html_search_regex(r'\|([a-z0-9]{60})\|', webpage, 'video')
video_url = f'h... | ```suggestion
'url': video_url,
'duration': duration,
'filesize_approx': filesize_approx,
'width': int_or_none(extra_video_info.get('width')),
'height': int_or_none(extra_video_info.get('height')),
'format_id': extra_video_info.get('height', ... |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
video_e = self._html_search_regex(r'\|([a-z0-9]{60})\|', webpage, 'video')
video_url = f'h... | @@ -0,0 +1,53 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ parse_filesize,
+ extract_attributes,
+ int_or_none,
+)
+
+
+class VuploadIE(InfoExtractor):
+ _VALID_URL = r'https://vupload\.com/v/(?P<id>[a-z0-9]+)... | yt_dlp/extractor/vupload.py | 26 | Python | 0.857 | suggestion | 437 | 30 | 28 | false | [Vupload] Add extractor | 1,146 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
_VALID_URL = r'https://vupload\.com/v/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://vupload.com/v/u28d0pl2tphy',
'md5': '9b42a4a193cca64d80248e58527d83c8',
'info_dict': {
'id': 'u28d0pl2tphy',
'ext': 'mp4',
'description': 'md5:e9e6c0045c78cbf0d5bb19a5... | The regexes look like they can be simplified. But I'll need to investigate further | _VALID_URL = r'https://vupload\.com/v/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://vupload.com/v/u28d0pl2tphy',
'md5': '9b42a4a193cca64d80248e58527d83c8',
'info_dict': {
'id': 'u28d0pl2tphy',
'ext': 'mp4',
'description': 'md5:e9e6c0045c78cbf0d5bb19a5... | @@ -0,0 +1,53 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_duration,
+ parse_filesize,
+ extract_attributes,
+ int_or_none,
+)
+
+
+class VuploadIE(InfoExtractor):
+ _VALID_URL = r'https://vupload\.com/v/(?P<id>[a-z0-9]+)... | yt_dlp/extractor/vupload.py | 26 | Python | 0.214 | suggestion | 82 | 41 | 39 | false | [Vupload] Add extractor | 1,146 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
_VALID_URL = r'(?i)https?://(?:www\.)?parliamentlive\.tv/Event/Index/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
_TESTS = [{
'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'info_dict': {
'id': 'c1e9d44d-fd6c-4263-b50f-97ed26c... | generating uuid should go inside `_real_initialize` | _VALID_URL = r'(?i)https?://(?:www\.)?parliamentlive\.tv/Event/Index/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
_TESTS = [{
'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'info_dict': {
'id': 'c1e9d44d-fd6c-4263-b50f-97ed26c... | @@ -11,33 +19,60 @@ class ParliamentLiveUKIE(InfoExtractor):
_TESTS = [{
'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'info_dict': {
- 'id': '1_af9nv9ym',
+ 'id': 'c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'ext': 'mp4',
... | yt_dlp/extractor/parliamentliveuk.py | 26 | Python | 0.429 | suggestion | 51 | 51 | 51 | false | [parliamentlive.tv] Fix extractor | 1,153 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
},
}, {
'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
'only_matching': True,
}]
_DEVICE_ID = str(uuid.uuid4())
_DATA = json.dumps({'device': {
'deviceId': _DEVICE_ID,
'width': 653,
'height': 368,
'type': 'WEB',... | Are you sure the accept and content-type are needed? Generally, the defaults are enough | },
}, {
'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._download_json(f'https://www.parliamentlive.tv/Event/GetShareVideo/{vi... | @@ -11,33 +19,60 @@ class ParliamentLiveUKIE(InfoExtractor):
_TESTS = [{
'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'info_dict': {
- 'id': '1_af9nv9ym',
+ 'id': 'c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'ext': 'mp4',
... | yt_dlp/extractor/parliamentliveuk.py | 26 | Python | 0.357 | suggestion | 87 | 50 | 51 | false | [parliamentlive.tv] Fix extractor | 1,153 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'upload_date': '20140318',
},
'params': {
'format': 'bestvideo',
},
}, {
'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
'only_matching': True,
}]
_DEVICE_ID = str(uuid.uuid4())
_DATA = json.dumps({'devic... | move thumbnails, title and timestamp near the return or maybe even directly inside the return | 'upload_date': '20140318',
},
'params': {
'format': 'bestvideo',
},
}, {
'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match... | @@ -11,33 +19,60 @@ class ParliamentLiveUKIE(InfoExtractor):
_TESTS = [{
'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'info_dict': {
- 'id': '1_af9nv9ym',
+ 'id': 'c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'ext': 'mp4',
... | yt_dlp/extractor/parliamentliveuk.py | 26 | Python | 0.286 | suggestion | 93 | 51 | 51 | false | [parliamentlive.tv] Fix extractor | 1,153 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._download_json(f'https://www.parliamentlive.tv/Event/GetShareVideo/{video_id}', video_id)
thumbnail = video_info.get('thumbnailUrl')
event_title = video_info['event']['title']
timestamp = unified... | ```suggestion
if not format.get('mediaLocator'):
continue
if format.get('format') in ('DASH', 'SMOOTHSTREAMING'):
formats.extend(self._extract_mpd_formats(
format['mediaLocator'], video_id, mpd_id='dash', fatal=False))
elif fo... | 'Origin': 'https://videoplayback.parliamentlive.tv',
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json;charset=utf-8'
}, data=json.dumps({
'deviceId': _DEVICE_ID,
'device': {
'd... | @@ -11,33 +19,60 @@ class ParliamentLiveUKIE(InfoExtractor):
_TESTS = [{
'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'info_dict': {
- 'id': '1_af9nv9ym',
+ 'id': 'c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
'ext': 'mp4',
... | yt_dlp/extractor/parliamentliveuk.py | 26 | Python | 0.857 | refactor | 577 | 37 | 42 | false | [parliamentlive.tv] Fix extractor | 1,153 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
},
'params': {
'format': 'bestvideo',
},
}, {
'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._dow... | ```suggestion
auth = 'Bearer ' + self._download_json(
'https://exposure.api.redbee.live/v2/customer/UKParliament/businessunit/ParliamentLive/auth/anonymous',
video_id, headers={
'Origin': 'https://videoplayback.parliamentlive.tv',
'Accept': 'applicati... | },
'params': {
'format': 'bestvideo',
},
}, {
'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._dow... | @@ -25,19 +35,46 @@ class ParliamentLiveUKIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
- webpage = self._download_webpage(
- 'http://vodplayer.parliamentlive.tv/?mid=' + video_id, video_id)
- widget_config = self._parse_json(self._search_regex(... | yt_dlp/extractor/parliamentliveuk.py | 26 | Python | 0.929 | security | 792 | 51 | 51 | false | [parliamentlive.tv] Fix extractor | 1,153 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
from __future__ import unicode_literals
from .common import InfoExtractor
class ParliamentLiveUKIE(InfoExtractor):
IE_NAME = 'parliamentlive.tv'
IE_DESC = 'UK parliament videos'
_VALID_URL = r'(?i)https?://(?:www\.)?parliamentlive\.tv/Event/Index/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]... | Is the space before Mozilla intentional? | 'params': {
'format': 'bestvideo',
},
}, {
'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._download_json(... | @@ -25,19 +35,49 @@ class ParliamentLiveUKIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
- webpage = self._download_webpage(
- 'http://vodplayer.parliamentlive.tv/?mid=' + video_id, video_id)
- widget_config = self._parse_json(self._search_regex(... | yt_dlp/extractor/parliamentliveuk.py | 26 | Python | 0.071 | question | 40 | 44 | 51 | false | [parliamentlive.tv] Fix extractor | 1,153 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'like_count': int,
'repost_count': int,
'comment_count': int,
}
}]
_APP_VERSION = '9.6.0'
_MANIFEST_APP_VERSION = '960'
_APP_NAME = 'aweme'
_AID = 1128
_API_HOSTNAME = 'aweme.snssdk.com'
_UPLOADER_URL_FORMAT = 'https://www.douyin.com/user/%s'
... | This is not `expected=True` since it is something we want users to report and should fix in future | 'repost_count': int,
'comment_count': int,
}
}]
_APP_VERSION = '9.6.0'
_MANIFEST_APP_VERSION = '960'
_APP_NAME = 'aweme'
_AID = 1128
_API_HOSTNAME = 'aweme.snssdk.com'
_UPLOADER_URL_FORMAT = 'https://www.douyin.com/user/%s'
def _real_extract(self, url):
... | @@ -413,3 +446,123 @@ def _real_extract(self, url):
})
own_id = self._html_search_regex(r'snssdk\d*://user/profile/(\d+)', webpage, 'user ID')
return self.playlist_result(self._entries_api(webpage, own_id, user_id), user_id)
+
+
+class DouyinIE(TikTokIE):
+ _VALID_URL = r'https?://(?:www\.... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.429 | suggestion | 98 | 41 | 32 | false | [Douyin] Fix extractor and merge with TikTokIE | 1,157 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
from __future__ import unicode_literals
from .common import InfoExtractor
class MediaiteIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mediaite.com/(?:tv|sports|politics|podcasts|opinion|news)/[\w-]+/'
_TESTS = [{
'url': 'https://www.mediaite.com/sports/bill-burr-roasts-nfl-for-promoting-black... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?mediaite.com(?!/category)(?:/[\w-]+){2}'
``` | from __future__ import unicode_literals
from .common import InfoExtractor
class MediaiteIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mediaite.com(?!/category)(?:/[\w-]+){2}'
_TESTS = [{
'url': 'https://www.mediaite.com/sports/bill-burr-roasts-nfl-for-promoting-black-lives-matter-while-schedu... | @@ -5,7 +5,7 @@
class MediaiteIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?mediaite.com/(?:tv|sports|politics|podcasts|opinion)/[\w-]+/'
+ _VALID_URL = r'https?://(?:www\.)?mediaite.com/(?:tv|sports|politics|podcasts|opinion|news)/[\w-]+/' | yt_dlp/extractor/mediaite.py | 8 | Python | 0.571 | suggestion | 98 | 33 | 33 | false | [Mediaite] Add support for more categories | 1,158 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
}, {
'url': 'https://gopro.com/v/kVrK9wlJvBMwn',
'info_dict': {
'id': 'kVrK9wlJvBMwn',
'title': 'DARKNESS',
'thumbnail': r're:https?://.+',
'ext': 'mp4',
'timestamp': 1594183735,
'upload_date': '20200708',
'uploader_... | ```suggestion
video_info = metadata['collectionMedia'][0]
media_data = self._download_json(
'https://api.gopro.com/media/%s/download' % video_info['id'], video_id)
```
If you are trying to make this non-fatal (to work with --ignore-no-formats-error), you need to make sure the download_j... | }, {
'url': 'https://gopro.com/v/kVrK9wlJvBMwn',
'info_dict': {
'id': 'kVrK9wlJvBMwn',
'title': 'DARKNESS',
'thumbnail': r're:https?://.+',
'ext': 'mp4',
'timestamp': 1594183735,
'upload_date': '20200708',
'uploader_... | @@ -0,0 +1,110 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ remove_end,
+ str_or_none,
+ try_get,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class GoProIE(InfoExtractor):
+ _VALID_URL = r'https?://(www\.)?... | yt_dlp/extractor/gopro.py | 26 | Python | 1 | suggestion | 388 | 51 | 51 | false | [GoPro] Add extractor | 1,167 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
date=(0, 0),
),
kids=[
StringFileInfo([
StringTable(
'040904B0', [
StringStruct('Comments', 'yt-dlp%s Command Line Interface.' % _x86),
StringStruct('CompanyName', 'https://github.com/yt-dlp'),
StringStruct('... | We should make sure this works correctly when only Crypto is available since that is the one we have been recommending all this time | date=(0, 0),
),
kids=[
StringFileInfo([
StringTable(
'040904B0', [
StringStruct('Comments', 'yt-dlp%s Command Line Interface.' % _x86),
StringStruct('CompanyName', 'https://github.com/yt-dlp'),
StringStruct('... | @@ -76,7 +76,7 @@
]
)
-dependancies = ['Crypto', 'mutagen'] + collect_submodules('websockets')
+dependancies = ['Cryptodome', 'mutagen'] + collect_submodules('websockets') | pyinst.py | 26 | Python | 0.429 | suggestion | 132 | 40 | 40 | false | Use pycryptodomex for PyInstaller | 1,179 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | shirt-dev |
)
)
)
'''
_TESTS = [{
'url': 'https://demosubdomain.webex.com/demositeurl/ldr.php?RCID=e58e803bc0f766bb5f6376d2e86adb5b',
'only_matching': True,
}, {
'url': 'http://demosubdomain.webex.com/demositeur... | Use `self._search_regex`. The note/errnote should also make the above comment redundant | }, {
'url': 'https://demosubdomain.webex.com/recordingservice/sites/demositeurl/recording/88e7a42f7b19f5b423c54754aecc2ce9/playback',
'only_matching': True,
}]
def _real_extract(self, url):
mobj = self._match_valid_url(url)
rcid = mobj.group('rcid')
if rcid:
... | @@ -0,0 +1,117 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get,
+ unified_timestamp,
+)
+
+
+class CiscoWebexIE(InfoExtractor):
+ IE_NAME = 'ciscowebex'
+ IE_DESC = 'Cisco Webex'
+ _VALID_... | yt_dlp/extractor/ciscowebex.py | 26 | Python | 0.429 | suggestion | 87 | 51 | 51 | false | [ciscowebex] Add new extractor | 1,199 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
_TESTS = [{
'url': 'https://demosubdomain.webex.com/demositeurl/ldr.php?RCID=e58e803bc0f766bb5f6376d2e86adb5b',
'only_matching': True,
}, {
'url': 'http://demosubdomain.webex.com/demositeurl/lsr.php?RCID=bc04b4a7b5ea2cc3a493d5ae6aaff5d7',
'only_matching': True,
}, {
... | ```suggestion
return self.url_result(url)
```
OR
I think it is even better to just set the new `mobj` and `rcid` and continue. Since the same extractor is guarenteed to catch the url back, there is no need to go through the handover process |
def _real_extract(self, url):
mobj = self._match_valid_url(url)
rcid = mobj.group('rcid')
if rcid:
webpage = self._download_webpage(url, None, note='Getting video ID')
url = self._search_regex(self._VALID_URL, webpage, 'redirection url', group='url')
url = se... | @@ -0,0 +1,117 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get,
+ unified_timestamp,
+)
+
+
+class CiscoWebexIE(InfoExtractor):
+ IE_NAME = 'ciscowebex'
+ IE_DESC = 'Cisco Webex'
+ _VALID_... | yt_dlp/extractor/ciscowebex.py | 26 | Python | 0.857 | refactor | 260 | 51 | 51 | false | [ciscowebex] Add new extractor | 1,199 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_get,
unified_timestamp,
)
class CiscoWebexIE(InfoExtractor):
IE_NAME = 'ciscowebex'
IE_DESC = 'Cisco Webex'
_VALID_URL = r'''(?x)
(?:
... | Add atleast one proper test. Preferably, also add one for the redirect case | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
try_get,
unified_timestamp,
)
class CiscoWebexIE(InfoExtractor):
IE_NAME = 'ciscowebex'
IE_DESC = 'Cisco Webex'
_VALID_URL = r'''(?x)
(?P<url>https?... | @@ -0,0 +1,117 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get,
+ unified_timestamp,
+)
+
+
+class CiscoWebexIE(InfoExtractor):
+ IE_NAME = 'ciscowebex'
+ IE_DESC = 'Cisco Webex'
+ _VALID_... | yt_dlp/extractor/ciscowebex.py | 25 | Python | 0.286 | suggestion | 75 | 50 | 50 | false | [ciscowebex] Add new extractor | 1,199 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
if mobj is None:
raise ExtractorError('Could not get video ID; visit the URL manually and use the redirection URL')
url = mobj.group()
return {
'_type': 'url',
'url': url
}
# Sometimes the siteurl is an alias, we ge... | Instead of going through a try/except, you can set fatal=False and raise error if stream is None
also, use `raise_login_required(method='cookies')` to give a better error message | video_id = stream.get('recordUUID') or video_id
formats = [{
'format_id': 'video',
'url': stream['fallbackPlaySrc'],
'ext': 'mp4',
'vcodec': 'avc1.640028',
'acodec': 'mp4a.40.2',
}]
if stream.get('preventDownload') is False:
... | @@ -0,0 +1,117 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get,
+ unified_timestamp,
+)
+
+
+class CiscoWebexIE(InfoExtractor):
+ IE_NAME = 'ciscowebex'
+ IE_DESC = 'Cisco Webex'
+ _VALID_... | yt_dlp/extractor/ciscowebex.py | 26 | Python | 0.714 | suggestion | 181 | 51 | 42 | false | [ciscowebex] Add new extractor | 1,199 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
_TESTS = [{
'url': 'https://demosubdomain.webex.com/demositeurl/ldr.php?RCID=e58e803bc0f766bb5f6376d2e86adb5b',
'only_matching': True,
}, {
'url': 'http://demosubdomain.webex.com/demositeurl/lsr.php?RCID=bc04b4a7b5ea2cc3a493d5ae6aaff5d7',
'only_matching': True,
}, {
'... | Are you sure these are always the codecs? It seems oddly specific | def _real_extract(self, url):
mobj = self._match_valid_url(url)
rcid = mobj.group('rcid')
if rcid:
webpage = self._download_webpage(url, None, note='Getting video ID')
url = self._search_regex(self._VALID_URL, webpage, 'redirection url', group='url')
url = sel... | @@ -0,0 +1,117 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get,
+ unified_timestamp,
+)
+
+
+class CiscoWebexIE(InfoExtractor):
+ IE_NAME = 'ciscowebex'
+ IE_DESC = 'Cisco Webex'
+ _VALID_... | yt_dlp/extractor/ciscowebex.py | 26 | Python | 0.214 | suggestion | 65 | 51 | 51 | false | [ciscowebex] Add new extractor | 1,199 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
try_get,
unified_timestamp,
)
class CiscoWebexIE(InfoExtractor):
IE_NAME = 'ciscowebex'
IE_DESC = 'Cisco Webex'
_VALID_URL = r'''(?x)
(?:
https?://(?P<subdomain>.*)\.webex\.com/
... | If I understand correctly, this can be simplified to:
```py
_VALID_URL = r'''(?x)
https?://(?P<subdomain>[^/#?]*)\.webex\.com/(?:
(?P<site_1>[^/#?]*)/(?:ldr|lsr).php\?(?:[^#]*&)*RCID=(?P<rcid>[0-9a-f]{32})|
(?:recordingservice|webappng)/sites... | from ..utils import (
int_or_none,
try_get,
unified_timestamp,
)
class CiscoWebexIE(InfoExtractor):
IE_NAME = 'ciscowebex'
IE_DESC = 'Cisco Webex'
_VALID_URL = r'''(?x)
(?P<url>https?://(?P<subdomain>[^/#?]*)\.webex\.com/(?:
(?P<siteurl_1>[^/#?]*)/(?... | @@ -0,0 +1,117 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ try_get,
+ unified_timestamp,
+)
+
+
+class CiscoWebexIE(InfoExtractor):
+ IE_NAME = 'ciscowebex'
+ IE_DESC = 'Cisco Webex'
+ _VALID_... | yt_dlp/extractor/ciscowebex.py | 26 | Python | 0.786 | suggestion | 423 | 51 | 51 | false | [ciscowebex] Add new extractor | 1,199 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
# Sometimes the siteurl is an alias, we get the real one via HTTP
# redirection (method HEAD does not work here)
url = self._request_webpage(url, None, note='Resolving final URL').geturl()
mobj = re.match(self._VALID_URL, url)
subdomain = mobj.group('subdomain')
siteurl =... | isn't it better to use `if mp4url:` ? | siteurl = mobj.group('siteurl_1') or mobj.group('siteurl_2')
video_id = mobj.group('id')
stream = self._download_json(
'https://%s.webex.com/webappng/api/v1/recordings/%s/stream' % (subdomain, video_id),
video_id, fatal=False, query={'siteurl': siteurl})
if not s... | @@ -0,0 +1,95 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ try_get,
+ unified_timestamp,
+)
+
+
+class CiscoWebexIE(InfoExtractor):
+ IE_NAME = 'ciscowebex'
+ IE_DESC = 'Cisco Webex'
+ _VALID_URL = r'''(?x)
+ ... | yt_dlp/extractor/ciscowebex.py | 26 | Python | 0.286 | question | 37 | 51 | 51 | false | [ciscowebex] Add new extractor | 1,199 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | damianoamatruda |
(?P<site_1>[^/#?]*)/(?:ldr|lsr).php\?(?:[^#]*&)*RCID=(?P<rcid>[0-9a-f]{32})|
(?:recordingservice|webappng)/sites/(?P<site_2>[^/#?]*)/recording/(?:playback/|play/)?(?P<id>[0-9a-f]{32})
))'''
_TESTS = [{
'url': 'https://demosubdomain.webex.c... | ```suggestion
if rcid:
webpage = self._download_webpage(url, None, note='Getting video ID')
url = self._search_regex(self._VALID_URL, webpage, 'redirection url', group='url')
url = self._request_webpage(url, None, note='Resolving final URL').geturl() | (?:recordingservice|webappng)/sites/(?P<siteurl_2>[^/#?]*)/recording/(?:playback/|play/)?(?P<id>[0-9a-f]{32})
))'''
_TESTS = [{
'url': 'https://demosubdomain.webex.com/demositeurl/ldr.php?RCID=e58e803bc0f766bb5f6376d2e86adb5b',
'only_matching': True,
... | @@ -0,0 +1,95 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ try_get,
+ unified_timestamp,
+)
+
+
+class CiscoWebexIE(InfoExtractor):
+ IE_NAME = 'ciscowebex'
+ IE_DESC = 'Cisco Webex'
+ _VALID_URL = r'''(?x)
+ ... | yt_dlp/extractor/ciscowebex.py | 26 | Python | 0.786 | suggestion | 294 | 51 | 51 | false | [ciscowebex] Add new extractor | 1,199 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import strip_or_none
class On24IE(InfoExtractor):
IE_NAME = 'on24'
IE_DESC = 'ON24'
_VALID_URL = r'''(?x)
(?:
... | add all the keys you are returning
if this doesn't have them then add another test which has those | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
strip_or_none,
try_get,
urljoin,
)
class On24IE(InfoExtractor):
IE_NAME = 'on24'
IE_DESC = 'ON24'
_VALID_URL = r'''(?x)
https?://event\.on24\.c... | @@ -0,0 +1,105 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..compat import (
+ compat_str,
+ compat_urlparse,
+)
+from ..utils import strip_or_none
+
+
+class On24IE(InfoExtractor):
+ IE_NAME = 'on24'
+ IE_DESC = 'ON24'
+
+ _VALID_U... | yt_dlp/extractor/on24.py | 26 | Python | 0.357 | suggestion | 101 | 51 | 51 | false | [on24] Add new extractor | 1,200 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | damianoamatruda |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.