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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'md5': '71459c5375c617c265a22f083facce67',
'info_dict': {
'id': 'a00269ix3l8',
'ext': 'mp4',
'title': '鸡毛飞上天 第01集',
'description': 'md5:8cae3534327315b3872fbef5e51b5c5b',
'thumbnail': r're:^https?://[^?#]+7ce5noezvafma27',
'series':... | Do you have a link where vqq has drm? | video_id, transform_source=js_to_json, fatal=False)
class VQQVideoIE(VQQBaseIE):
IE_NAME = 'vqq:video'
_VALID_URL = VQQBaseIE._VALID_URL_BASE + r'/x/(?:page|cover/(?P<series_id>\w+))/(?P<id>\w+)'
_TESTS = [{
'url': 'https://v.qq.com/x/page/q326831cny0.html',
'md5': '84568b3722... | @@ -147,45 +166,53 @@ class VQQVideoIE(VQQBaseIE):
_TESTS = [{
'url': 'https://v.qq.com/x/page/q326831cny0.html',
- 'md5': '826ef93682df09e3deac4a6e6e8cdb6e',
+ 'md5': '84568b3722e15e9cd023b5594558c4a7',
'info_dict': {
'id': 'q326831cny0',
'ext': 'mp4',
... | yt_dlp/extractor/tencent.py | 26 | Python | 0.071 | question | 37 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
'platform': self._PLATFORM,
# For VQQ
'guid': guid,
'flowid': ''.join(random.choices(string.digits + string.ascii_lowercase, k=32)),
}
return self._search_json(r'QZOutputJson=', self._download_webpage(
self._API_URL, video_id, query=query), 'a... | How about something like this for this function?
```py
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
formats, subtitles = [], {}
for video_format in video_response['ul']['ui']:
if video_format.get('hls... | 'dtype': '3' if video_format == 'hls' else '0',
'defn': video_quality,
'spsrt': '2', # Enable subtitles
'sphttps': '1', # Enable HTTPS
'otype': 'json',
'spwm': '1',
'hevclv': '28', # Enable HEVC
'drm': '40', # Enable DRM... | @@ -63,7 +70,9 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id): | yt_dlp/extractor/tencent.py | 26 | Python | 1 | refactor | 2,270 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | Hill-98 |
subtitles.setdefault(subtitle['lang'].lower(), []).append({
'url': subtitle['url'],
'ext': subtitles_format,
'protocol': 'm3u8_native' if determine_ext(subtitle['url']) == 'm3u8' else 'http',
})
return subtitles
def _extract_all_video... | The current yt-dlp is able to get 480p direct links, now those are missing
yt-dlp 2022.10.04
```bash
[debug] Command-line config: ['https://wetv.vip/play/7csb8h9c79p8idi/a0041yw44yk', '-F', '--verbose']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp ver... | 'url': subtitle['url'],
'ext': 'srt' if subtitle.get('captionType') == 1 else 'vtt',
'protocol': 'm3u8_native' if determine_ext(subtitle['url']) == 'm3u8' else 'http',
})
return subtitles
def _extract_all_video_formats_and_subtitles(self, url, vi... | @@ -97,21 +128,29 @@ def _extract_video_native_subtitles(self, api_response, subtitles_format):
return subtitles
- def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
- formats, subtitles = [], {}
- for video_format, subtitle_format, video_quality in (
- ... | yt_dlp/extractor/tencent.py | 26 | Python | 1 | bug | 4,603 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
return subtitles
def _extract_all_video_quality(self, api_response):
quality = []
formats_response = api_response['fl']['fi']
for f in formats_response:
quality.append(f.get('name'))
return quality
def _extract_all_video_formats_and_subtitles(self, url, vid... | And also srt subtitles are missing
yt-dlp 2022.10.04
```bash
[debug] Command-line config: ['https://wetv.vip/play/7csb8h9c79p8idi/a0041yw44yk', '--verbose', '--list-subs']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.10.04 [4e0511f27] (de... | return subtitles
def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
api_responses = [self._get_video_api_response(url, video_id, series_id, 'srt', 'hls', 'hd')]
self._check_api_response(api_responses[0])
qualities = traverse_obj(api_responses, (0, 'fl', 'f... | @@ -97,21 +128,29 @@ def _extract_video_native_subtitles(self, api_response, subtitles_format):
return subtitles
- def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
- formats, subtitles = [], {}
- for video_format, subtitle_format, video_quality in (
- ... | yt_dlp/extractor/tencent.py | 26 | Python | 1 | bug | 4,160 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
subtitles = {}
for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
subtitles.setdefault(subtitle['lang'].lower(), []).append({
'url': subtitle['url'],
'ext': subtitles_format,
'protocol': 'm3u8_native' if determine_ext(subtitle['ur... | Could you try changing the first request from 'hd' to 'ld'? And try to reuse the response? I'd like to keep the number of requests at the minimum
I think this can be easier to read
```python
qualities = self._extract_all_video_qualities(first_api_response)
for quality in qualities:
if quality not in ('sd',... | for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
subtitles.setdefault(subtitle['lang'].lower(), []).append({
'url': subtitle['url'],
'ext': 'srt' if subtitle.get('captionType') == 1 else 'vtt',
'protocol': 'm3u8_native' if determine_ext... | @@ -97,21 +128,29 @@ def _extract_video_native_subtitles(self, api_response, subtitles_format):
return subtitles
- def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
- formats, subtitles = [], {}
- for video_format, subtitle_format, video_quality in (
- ... | yt_dlp/extractor/tencent.py | 26 | Python | 0.857 | refactor | 400 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
return self._search_json(r'QZOutputJson=', self._download_webpage(
self._API_URL, video_id, query=query), 'api_response', video_id)
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
formats, subtitles = [], {}
... | Avoid variables only used once |
return self._search_json(r'QZOutputJson=', self._download_webpage(
self._API_URL, video_id, query=query), 'api_response', video_id)
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
formats, subtitles = [], {}
... | @@ -63,27 +78,45 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.143 | suggestion | 30 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
else:
formats.append({
'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
'ext': 'mp4',
})
identifier = video_response.get('br')
format_response = traverse_obj(
api_respons... | format_id and fornat_name can be inlined
format_response.get('drm') != 0 should be enough for has_drm | self._merge_subtitles(subs, target=subtitles)
else:
formats.append({
'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
'ext': 'mp4',
})
identifier = video_response.get('br')
... | @@ -63,27 +78,45 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.429 | suggestion | 104 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
self._merge_subtitles(subs, target=subtitles)
else:
formats.append({
'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
'ext': 'mp4',
})
identifier = video_response.get('br')
... | Inline the whole common_info here
```python
for f in formats:
f.update({
....
})
``` | formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
else:
formats.append({
'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
'ext': 'mp4',
})
id... | @@ -63,27 +78,45 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.714 | style | 106 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
'format_note': format_name,
'dynamic_range': 'hdr10' if is_hdr else None,
'has_drm': True if drm is not None and drm != 0 else False,
}
for f in formats:
f.update(common_info)
return formats, subtitles
def _extract_video_native_subtitles(self... | It's really needed this function? You only use it once
maybe it can be:
```python
qualities = [format['name'] for format in api_response['fl']['fi']]
``` | }
for f in formats:
f.update(common_info)
return formats, subtitles
def _extract_video_native_subtitles(self, api_response):
subtitles = {}
for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
subtitles.setdefault(subtitle['lang'].lower()... | @@ -97,21 +130,36 @@ def _extract_video_native_subtitles(self, api_response, subtitles_format):
return subtitles
- def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
- formats, subtitles = [], {}
- for video_format, subtitle_format, video_quality in (
- ... | yt_dlp/extractor/tencent.py | 26 | Python | 0.786 | style | 159 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
def _extract_video_native_subtitles(self, api_response, subtitles_format):
subtitles = {}
for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
subtitles.setdefault(subtitle['lang'].lower(), []).append({
'url': subtitle['url'],
'ext': subtitles... | I know you didn't modify _extract_video_native_subtitles but I think we can avoid passing 'subtitle_format' if we check its 'captionType'.
I think it would simplify this, using only a list of api_responses
```python
def _extract_video_native_subtitles(self, api_response):
subtitles = {}
f... | for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
subtitles.setdefault(subtitle['lang'].lower(), []).append({
'url': subtitle['url'],
'ext': 'srt' if subtitle.get('captionType') == 1 else 'vtt',
'protocol': 'm3u8_native' if determine_ext... | @@ -97,21 +130,36 @@ def _extract_video_native_subtitles(self, api_response, subtitles_format):
return subtitles
- def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
- formats, subtitles = [], {}
- for video_format, subtitle_format, video_quality in (
- ... | yt_dlp/extractor/tencent.py | 26 | Python | 1 | refactor | 726 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
import functools
import random
import re
import string
import time
from .common import InfoExtractor
from ..aes import aes_cbc_encrypt_bytes
from ..utils import (
ExtractorError,
float_or_none,
determine_ext,
int_or_none,
js_to_json,
traverse_obj,
urljoin,
)
class TencentBaseIE(InfoExtrac... | Avoid variables only used once
```python
if api_response.get('code') != '0.0' and msg is not None:
``` | import functools
import random
import re
import string
import time
from .common import InfoExtractor
from ..aes import aes_cbc_encrypt_bytes
from ..utils import (
ExtractorError,
float_or_none,
determine_ext,
int_or_none,
js_to_json,
traverse_obj,
urljoin,
)
class TencentBaseIE(InfoExtrac... | @@ -19,6 +20,15 @@
class TencentBaseIE(InfoExtractor):
"""Subclasses must set _API_URL, _APP_VERSION, _PLATFORM, _HOST, _REFERER"""
+ def _check_api_response(self, api_response):
+ code = api_response.get('code')
+ msg = api_response.get('msg')
+ if code != '0.0' and msg is not None: | yt_dlp/extractor/tencent.py | 26 | Python | 0.786 | suggestion | 107 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
else:
formats.append({
'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
'ext': 'mp4',
})
id... | My bad, on second thought we need to provide 0 as fallback because if 'format_response.get('drm')' is None, it will missmark it as 'has_drm'
```python
'has_drm': True if format_response.get('drm', 0) != 0 else False,
``` | video_format['url'] + traverse_obj(video_format, ('hls', 'pt'), default=''),
video_id, 'mp4', fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
else:
formats.append({
'u... | @@ -63,55 +76,73 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.857 | style | 225 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
_HOST = 'v.qq.com'
_REFERER = 'v.qq.com'
def _get_webpage_metadata(self, webpage, video_id):
return self._parse_json(
self._search_regex(
r'(?s)<script[^>]*>[^<]*window\.__pinia\s*=\s*([^<]+)</script>',
webpage, 'pinia data', fatal=False),
vid... | VQQVideo tests are failing because you have a blank space at the end of the keys
Also multiple cases below
```python
'format_id ' -> 'format_id'
'has_drm ' -> 'has_drm'
``` |
def _get_webpage_metadata(self, webpage, video_id):
return self._parse_json(
self._search_regex(
r'(?s)<script[^>]*>[^<]*window\.__pinia\s*=\s*([^<]+)</script>',
webpage, 'pinia data', fatal=False),
video_id, transform_source=js_to_json, fatal=False)
... | @@ -147,45 +178,53 @@ class VQQVideoIE(VQQBaseIE):
_TESTS = [{
'url': 'https://v.qq.com/x/page/q326831cny0.html',
- 'md5': '826ef93682df09e3deac4a6e6e8cdb6e',
+ 'md5': '84568b3722e15e9cd023b5594558c4a7',
'info_dict': {
'id': 'q326831cny0',
'ext': 'mp4',
... | yt_dlp/extractor/tencent.py | 26 | Python | 0.786 | bug | 183 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
'ext': 'mp4',
'title': '欧阳娜娜VLOG',
'description': 'md5:29fe847497a98e04a8c3826e499edd2e',
'thumbnail': r're:^https?://[^?#]+o3013za7cse',
'format_id': r're:^shd',
'has_drm': False,
},
}, {
'url': 'https://v.qq.com/x/cover/7ce5no... | This doesn't need to be regex, but otherwise it looks good to me | 'thumbnail': r're:^https?://[^?#]+o3013za7cse',
'format_id': r're:^shd',
},
}, {
'url': 'https://v.qq.com/x/cover/7ce5noezvafma27/a00269ix3l8.html',
'md5': '87968df6238a65d2478f19c25adf850b',
'info_dict': {
'id': 'a00269ix3l8',
'ext': '... | @@ -147,45 +178,53 @@ class VQQVideoIE(VQQBaseIE):
_TESTS = [{
'url': 'https://v.qq.com/x/page/q326831cny0.html',
- 'md5': '826ef93682df09e3deac4a6e6e8cdb6e',
+ 'md5': '84568b3722e15e9cd023b5594558c4a7',
'info_dict': {
'id': 'q326831cny0',
'ext': 'mp4',
... | yt_dlp/extractor/tencent.py | 26 | Python | 0.214 | suggestion | 64 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | Hill-98 |
video_id, 'mp4', fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
else:
formats.append({
'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
... | ```suggestion
common_info = {
'width': video_response.get('vw'),
'height': video_response.get('vh'),
'abr': float_or_none(format_response.get('audiobandwidth'), scale=1000),
'vbr': float_or_none(format_response.get('bandwidth'), scale=1000),
'fps... | if video_format.get('hls') or determine_ext(video_format['url']) == 'm3u8':
fmts, subs = self._extract_m3u8_formats_and_subtitles(
video_format['url'] + traverse_obj(video_format, ('hls', 'pt'), default=''),
video_id, 'mp4', fatal=False)
... | @@ -63,55 +76,73 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.786 | suggestion | 509 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Hill-98 |
'format_id': format_id,
'format_note': format_name,
'dynamic_range': 'hdr10' if is_hdr else None,
'has_drm': format_response.get('drm', 0) != 0,
}
for f in formats:
f.update(common_info)
return formats, subtitles
def _extract_vide... | ```suggestion
api_responses = [self._get_video_api_response(url, video_id, series_id, 'srt', 'hls', 'hd')]
self._check_api_response(api_responses[0])
qualities = traverse_obj(api_responses, (0, 'fl', 'fi', ..., 'name')) or ('shd', 'fhd')
``` | 'format_id': format_response.get('name'),
'format_note': format_response.get('resolution'),
'dynamic_range': {'hdr10': 'hdr10'}.get(format_response.get('name'), 'sdr'),
'has_drm': format_response.get('drm', 0) != 0,
}
for f in formats:
f.update... | @@ -63,55 +76,73 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.786 | suggestion | 269 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Hill-98 |
f.update(common_info)
return formats, subtitles
def _extract_video_native_subtitles(self, api_response):
subtitles = {}
for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
subtitles.setdefault(subtitle['lang'].lower(), []).append({
'url'... | ```suggestion
api_responses.append(self._get_video_api_response(
url, video_id, series_id, 'vtt', 'hls', q))
self._check_api_response(api_responses[-1])
``` | f.update(common_info)
return formats, subtitles
def _extract_video_native_subtitles(self, api_response):
subtitles = {}
for subtitle in traverse_obj(api_response, ('sfl', 'fi')) or ():
subtitles.setdefault(subtitle['lang'].lower(), []).append({
'url'... | @@ -63,55 +76,73 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.786 | suggestion | 212 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Hill-98 |
import functools
import random
import re
import string
import time
from .common import InfoExtractor
from ..aes import aes_cbc_encrypt_bytes
from ..utils import (
ExtractorError,
float_or_none,
determine_ext,
int_or_none,
js_to_json,
traverse_obj,
urljoin,
)
class TencentBaseIE(InfoExtrac... | ```suggestion
if msg in (
'您所在区域暂无此内容版权(如设置VPN请关闭后重试)',
'This content is not available in your area due to copyright restrictions. Please choose other videos.'
):
``` | import functools
import random
import re
import string
import time
from .common import InfoExtractor
from ..aes import aes_cbc_encrypt_bytes
from ..utils import (
ExtractorError,
float_or_none,
determine_ext,
int_or_none,
js_to_json,
traverse_obj,
urljoin,
)
class TencentBaseIE(InfoExtrac... | @@ -19,6 +20,13 @@
class TencentBaseIE(InfoExtractor):
"""Subclasses must set _API_URL, _APP_VERSION, _PLATFORM, _HOST, _REFERER"""
+ def _check_api_response(self, api_response):
+ msg = api_response.get('msg')
+ if api_response.get('code') != '0.0' and msg is not None:
+ if msg in (... | yt_dlp/extractor/tencent.py | 26 | Python | 0.786 | suggestion | 227 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Hill-98 |
fmts, subs = self._extract_m3u8_formats_and_subtitles(
video_format['url'] + traverse_obj(video_format, ('hls', 'pt'), default=''),
video_id, 'mp4', fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
... | ```suggestion
common_info = {
'width': video_response.get('vw'),
'height': video_response.get('vh'),
'abr': float_or_none(format_response.get('audiobandwidth'), scale=1000),
'vbr': float_or_none(format_response.get('bandwidth'), scale=1000),
'fps... | fmts, subs = self._extract_m3u8_formats_and_subtitles(
video_format['url'] + traverse_obj(video_format, ('hls', 'pt'), default=''),
video_id, 'mp4', fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
... | @@ -63,55 +79,70 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.786 | suggestion | 464 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Hill-98 |
video_id, 'mp4', fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
else:
formats.append({
'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
... | ```suggestion
'dynamic_range': {'hdr10': 'hdr10'}.get(format_response.get('name'), 'sdr'),
``` | video_id, 'mp4', fatal=False)
formats.extend(fmts)
self._merge_subtitles(subs, target=subtitles)
else:
formats.append({
'url': f'{video_format["url"]}{video_response["fn"]}?vkey={video_response["fvkey"]}',
... | @@ -63,55 +79,70 @@ def _get_video_api_response(self, video_url, video_id, series_id, subtitle_forma
def _extract_video_formats_and_subtitles(self, api_response, video_id):
video_response = api_response['vl']['vi'][0]
- video_width, video_height = video_response.get('vw'), video_response.get('vh'... | yt_dlp/extractor/tencent.py | 26 | Python | 0.714 | suggestion | 108 | 51 | 51 | false | [extractor/tencent]: Add more formats and info | 5,950 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Hill-98 |
self._og_search_title(webpage), 'Radio Wave - ')
description = self._html_search_regex(
r'<p[^>]+title=(["\'])(?P<url>(?:(?!\1).)+)\1[^>]*>.*?</p>\s*<div[^>]+id=["\']player-track',
webpage, 'description', fatal=False, group='url')
duration = int_or_none(self._search_r... | ```py
'title': 'md5:xxx',
``` | r'data-duration=["\'](\d+)', webpage, 'duration', default=None))
return {
'id': audio_id,
'url': 'http://media.rozhlas.cz/_audio/%s.mp3' % audio_id,
'title': title,
'description': description,
'duration': duration,
'vcodec': 'n... | @@ -45,3 +47,70 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://((vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+)'
+... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.429 | suggestion | 43 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
'md5': 'ba2fdbc1242fc16771c7695d271ec355',
'info_dict': {
'id': '8891337',
'ext': 'mp3',
'title': 'Máte po celé sezóně poslouchání Čelistí právo na wellness, nebo můžete být rádi, že jste vůbec naživu? Poslechněte si filmově kritickou bilanci všeho, co v uplynulých mě... | use regex if get_element_text_and_html_by_tag doesnt work | 'playlist_count': 1,
'playlist': [{
'md5': 'ba2fdbc1242fc16771c7695d271ec355',
'info_dict': {
'id': '10520988',
'ext': 'mp3',
'title': 'Papej masíčko! Porcujeme a bilancujeme filmy a seriály, které to letos zabily',
... | @@ -45,3 +47,70 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://((vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+)'
+... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.286 | suggestion | 57 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
webpage = self._download_webpage(url, None)
playerDiv = self.find_element(webpage)
jsonString = extract_attributes(playerDiv).get('data-player')
jsonData = json.loads(jsonString)
entries = []
for entry in jsonData.get("data").get('playlist'):
entry0 = entry... | ```py
entries.append({
...
'formats': [{
...
}],
})
``` | 'artist': 'Josef Kokta',
'channel_id': 'radio-wave',
'chapter': 'Neklid #1',
'chapter_number': 1,
},
}, {
'md5': 'e9763235be4a6dcf94bc8a5bac1ca126',
'info_dict': {
'id': '9890716',
... | @@ -45,3 +47,70 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://((vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+)'
+... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.714 | style | 154 | 34 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
jsonString = extract_attributes(playerDiv).get('data-player')
jsonData = json.loads(jsonString)
entries = []
for entry in jsonData.get("data").get('playlist'):
entry0 = entry.get('audioLinks')[0]
format = {
'url': entry0.get('url'),
... | https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#mandatory-and-optional-metafields | },
}, {
'md5': 'e9763235be4a6dcf94bc8a5bac1ca126',
'info_dict': {
'id': '9890716',
'ext': 'mp3',
'title': 'Neklid #2',
'description': '2. díl: Neklid: 2. díl',
'duration': 768,
'ar... | @@ -45,3 +47,70 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://((vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+)'
+... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.214 | suggestion | 94 | 30 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
'ext': 'mp3',
'title': 'Máte po celé sezóně poslouchání Čelistí právo na wellness, nebo můžete být rádi, že jste vůbec naživu? Poslechněte si filmově kritickou bilanci všeho, co v uplynulých měsících stálo za vidění',
'description': '8888928: Vánoce s Radiem Wave | 7702992: Český roz... | ```suggestion
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
``` | 'info_dict': {
'id': '10520988',
'ext': 'mp3',
'title': 'Papej masíčko! Porcujeme a bilancujeme filmy a seriály, které to letos zabily',
'description': 'md5:1c6d29fb9564e1f17fc1bb83ae7da0bc',
'duration': 1574,
'a... | @@ -45,3 +47,70 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://((vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+)'
+... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.714 | suggestion | 115 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
'description': '8888928: Vánoce s Radiem Wave | 7702992: Český rozhlas má nadílku pro každého',
'duration': 1574
}
}]
def find_element(self, webpage):
# Use utils.get_element_text_and_html_by_tag() instead when it accepts less strict html.
playerDiv = ''
... | Does this need to be a function? (see comment about using regex) | 'ext': 'mp3',
'title': 'Papej masíčko! Porcujeme a bilancujeme filmy a seriály, které to letos zabily',
'description': 'md5:1c6d29fb9564e1f17fc1bb83ae7da0bc',
'duration': 1574,
'artist': 'Aleš Stuchlý',
'channel_id': 'radio-... | @@ -45,3 +47,70 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://((vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+)'
+... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.214 | question | 64 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
# Use utils.get_element_text_and_html_by_tag() instead when it accepts less strict html.
playerDiv = ''
for k, line in enumerate(webpage.split("\n")):
if line.find('mujRozhlasPlayer') != -1:
playerDiv = line.strip()
break
if playerDiv.count('... | ```suggestion
data = self._parse_json(
extract_attributes(playerDiv)['data-player'], video_id)['data']
entries = []
for entry in data['playlist']:
``` | },
}]
}, {
'url': 'https://wave.rozhlas.cz/poslechnete-si-neklid-podcastovy-thriller-o-vine-strachu-a-vztahu-ktery-zasel-8554744',
'info_dict': {
'id': 8554744,
'title': 'Poslechněte si Neklid. Podcastový thriller o vině, strachu a vztahu, který zašel příl... | @@ -45,3 +47,70 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://((vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+)'
+... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.786 | refactor | 193 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
webpage = self._download_webpage(
'http://prehravac.rozhlas.cz/audio/%s' % audio_id, audio_id)
title = self._html_search_regex(
r'<h3>(.+?)</h3>\s*<p[^>]*>.*?</p>\s*<div[^>]+id=["\']player-track',
webpage, 'title', default=None) or remove_start(
self._og... | https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#dont-capture-groups-you-dont-use | r'<h3>(.+?)</h3>\s*<p[^>]*>.*?</p>\s*<div[^>]+id=["\']player-track',
webpage, 'title', default=None) or remove_start(
self._og_search_title(webpage), 'Radio Wave - ')
description = self._html_search_regex(
r'<p[^>]+title=(["\'])(?P<url>(?:(?!\1).)+)\1[^>]*>.*?</p>... | @@ -45,3 +47,70 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://((vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+)' | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.286 | suggestion | 93 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
duration = int_or_none(self._search_regex(
r'data-duration=["\'](\d+)', webpage, 'duration', default=None))
return {
'id': audio_id,
'url': 'http://media.rozhlas.cz/_audio/%s.mp3' % audio_id,
'title': title,
'description': description,
... | Definition is wrong. This happens to pass the test due to a quirk (bug?) in the test runner. Add `playlist` key to the definition. E.g. https://github.com/yt-dlp/yt-dlp/blob/ce03e9b90acef7a8b59b1193e32cbd9898c93ad0/yt_dlp/extractor/afreecatv.py#L51-L79 | 'url': 'http://media.rozhlas.cz/_audio/%s.mp3' % audio_id,
'title': title,
'description': description,
'duration': duration,
'vcodec': 'none',
}
class RozhlasVltavaIE(InfoExtractor):
_VALID_URL = r'https?://(?:\w+\.rozhlas|english\.radio)\.cz/[\w... | @@ -45,3 +47,54 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d+... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.786 | bug | 252 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
webpage = self._download_webpage(
'http://prehravac.rozhlas.cz/audio/%s' % audio_id, audio_id)
title = self._html_search_regex(
r'<h3>(.+?)</h3>\s*<p[^>]*>.*?</p>\s*<div[^>]+id=["\']player-track',
webpage, 'title', default=None) or remove_start(
self._og... | ```suggestion
_VALID_URL = r'https?://(?:\w+\.rozhlas|english\.radio)\.cz/[\w-]+-(?P<id>\d+)'
``` | webpage, 'title', default=None) or remove_start(
self._og_search_title(webpage), 'Radio Wave - ')
description = self._html_search_regex(
r'<p[^>]+title=(["\'])(?P<url>(?:(?!\1).)+)\1[^>]*>.*?</p>\s*<div[^>]+id=["\']player-track',
webpage, 'description', fatal=Fals... | @@ -45,3 +48,142 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
'url': 'http://media.rozhlas.cz/_audio/%s.mp3' % audio_id,
'title': title,
'description': description,
'duration': duration,
'vcodec': 'none',
}
class RozhlasVltavaIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|pl... | use md5
```suggestion
'description': 'md5:xxx',
```
Same for any other long strings in tests |
class RozhlasVltavaIE(InfoExtractor):
_VALID_URL = r'https?://(?:\w+\.rozhlas|english\.radio)\.cz/[\w-]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://wave.rozhlas.cz/papej-masicko-porcujeme-a-bilancujeme-filmy-a-serialy-ktere-letos-zabily-8891337',
'md5': 'ba2fdbc1242fc16771c7695d271ec355',
... | @@ -45,3 +48,142 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.786 | suggestion | 112 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
'chapter': 'Neklid #4',
'chapter_number': 4,
},
}, {
'md5': '6e729fa39b647325b868d419c76f3efa',
'info_dict': {
'id': '9890734',
'ext': 'mp3',
'title': 'Neklid #5',
'description': '... | ```suggestion
# FIXME: Use get_element_text_and_html_by_tag when it accepts less strict html
player_div = self._parse_json(extract_attributes(self._search_regex(
'<div class="mujRozhlasPlayer" data-player=\'[^>]+\'>',
webpage, 'player'))['data-player'], video_id)['data']
``` | 'ext': 'mp3',
'title': 'Neklid #5',
'description': '5. díl: Neklid: 5. díl',
'duration': 908,
'artist': 'Josef Kokta',
'channel_id': 'radio-wave',
'chapter': 'Neklid #5',
'chapter_number': 5,
... | @@ -45,3 +48,142 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.857 | refactor | 320 | 51 | 49 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
player_div = re.findall("<div class=\"mujRozhlasPlayer\" data-player='.*'>", webpage)[0] # Use utils.get_element_text_and_html_by_tag() instead when it accepts less strict html.
data = self._parse_json(extract_attributes(player_div).get('data-player'), video_id).get('data')
entries = []
... | WHAT??
```suggestion
'chapter': traverse_obj(entry, ('meta', 'ga', 'contentNameShort')),
'chapter_number': int_or_none(traverse_obj(entry, ('meta', 'ga', 'contentSerialPart')),
``` | 'formats': [{
'url': audio_link['url'],
'ext': audio_link.get('variant'),
'format_id': audio_link.get('variant'),
'abr': audio_link.get('bitrate'),
'acodec': audio_link.get('variant'),
'vcodec': 'none',
... | @@ -45,3 +48,142 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.786 | question | 216 | 36 | 26 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
for audio_link in entry.get('audioLinks'):
formats.append({
'url': audio_link.get('url'),
'ext': audio_link.get('variant'),
'format_id': audio_link.get('variant'),
'abr': audio_link.get('bitrate'),
... | how would playlists have formats??
```suggestion
``` | from .common import InfoExtractor
from ..utils import extract_attributes, int_or_none, remove_start, traverse_obj
class RozhlasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prehravac\.rozhlas\.cz/audio/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'http://prehravac.rozhlas.cz/audio/3421320',
'md5'... | @@ -45,3 +48,142 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.571 | question | 54 | 29 | 180 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
'url': audio_link.get('url'),
'ext': audio_link.get('variant'),
'format_id': audio_link.get('variant'),
'abr': audio_link.get('bitrate'),
'acodec': audio_link.get('variant'),
'vcodec': 'none',
... | ```suggestion
return {
'_type': 'playlist',
'id': data.get('embedId'),
'title': traverse_obj(data, ('series', 'title')),
'entries': [{
'id': entry['meta']['ga']['contentId'],
'title': traverse_obj(entry, ('meta', 'ga', 'con... | from .common import InfoExtractor
from ..utils import extract_attributes, int_or_none, remove_start, traverse_obj
class RozhlasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?prehravac\.rozhlas\.cz/audio/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'http://prehravac.rozhlas.cz/audio/3421320',
'md5'... | @@ -45,3 +48,142 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.929 | security | 1,262 | 27 | 180 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
return {
'id': audio_id,
'url': 'http://media.rozhlas.cz/_audio/%s.mp3' % audio_id,
'title': title,
'description': description,
'duration': duration,
'vcodec': 'none',
}
class RozhlasVltavaIE(InfoExtractor):
_VALID_URL = r'htt... | ```suggestion
'title': 'Papej masíčko! Porcujeme a bilancujeme filmy a seriály, které to letos zabily',
``` | 'vcodec': 'none',
}
class RozhlasVltavaIE(InfoExtractor):
_VALID_URL = r'https?://(?:\w+\.rozhlas|english\.radio)\.cz/[\w-]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://wave.rozhlas.cz/papej-masicko-porcujeme-a-bilancujeme-filmy-a-serialy-ktere-letos-zabily-8891337',
'md5': 'b... | @@ -45,3 +48,142 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.714 | suggestion | 125 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
_TESTS = [{
'url': 'https://wave.rozhlas.cz/papej-masicko-porcujeme-a-bilancujeme-filmy-a-serialy-ktere-letos-zabily-8891337',
'md5': 'ba2fdbc1242fc16771c7695d271ec355',
'info_dict': {
'id': 8891337,
'title': 'md5:21f99739d04ab49d8c189ec711eef4ec',
},
... | ```suggestion
'title': 'Poslechněte si Neklid. Podcastový thriller o vině, strachu a vztahu, který zašel příliš daleko',
``` | },
'playlist_count': 1,
'playlist': [{
'md5': 'ba2fdbc1242fc16771c7695d271ec355',
'info_dict': {
'id': '10520988',
'ext': 'mp3',
'title': 'Papej masíčko! Porcujeme a bilancujeme filmy a seriály, které to letos zabily',
... | @@ -45,3 +48,142 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:vltava|wave|radiozurnal|dvojka|plus|sport|d-dur|jazz|junior|pohoda)\.rozhlas|english\.radio)\.cz/[a-z|-]*-(?P<id>\d... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.857 | suggestion | 138 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
'channel_id': 'radio-wave',
'chapter': 'Neklid #4',
'chapter_number': 4,
},
}, {
'md5': '6e729fa39b647325b868d419c76f3efa',
'info_dict': {
'id': '9890734',
'ext': 'mp3',
'title': '... | ```suggestion
data = self._parse_json(extract_attributes(self._search_regex(
``` | 'info_dict': {
'id': '9890734',
'ext': 'mp3',
'title': 'Neklid #5',
'description': '5. díl: Neklid: 5. díl',
'duration': 908,
'artist': 'Josef Kokta',
'channel_id': 'radio-wave',
'... | @@ -45,3 +48,135 @@ def _real_extract(self, url):
'duration': duration,
'vcodec': 'none',
}
+
+
+class RozhlasVltavaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:\w+\.rozhlas|english\.radio)\.cz/[\w-]+-(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://wave.rozhlas.cz/papej-m... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.643 | refactor | 90 | 51 | 51 | false | [rozhlas] Support the site update | 5,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | amra |
'title': 'Müllers Büro',
'ext': 'mp4',
'description': 'md5:4d23a8f4ca035196cd4523863c4fe5a4',
'timestamp': 1604958457,
'age_limit': 0,
'duration': 82,
'upload_date': '20201109',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/Sa... | It doesnt make sense for this to be non-fatal | 'ext': 'mp4',
'description': 'md5:4d23a8f4ca035196cd4523863c4fe5a4',
'timestamp': 1604958457,
'age_limit': 0,
'duration': 82,
'upload_date': '20201109',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaMes1Zg3lxLv9j5u/x1080',
'... | @@ -91,22 +86,21 @@ def _real_extract(self, url):
webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id)
- duration = try_get(
- re.match(r'P(?P<hours>\d+)H(?P<mins>\d+)M(?P<secs>\d+)S',
- self._html_search_meta('duration', w... | yt_dlp/extractor/moviepilot.py | 26 | Python | 0.071 | suggestion | 45 | 40 | 31 | false | [extractor/moviepilot] Fix extractor | 5,954 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | panatexxa |
'tags': ['Alle Trailer', 'Movie', 'Verleih'],
'uploader_id': 'x6nd9k',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id)
clip_store = sel... | ```suggestion
'title': clip.get('title'),
'url': f'https://www.dailymotion.com/video/{clip["videoRemoteId"]}',
``` | from .dailymotion import DailymotionIE
from .common import InfoExtractor
class MoviepilotIE(InfoExtractor):
_IE_NAME = 'moviepilot'
_IE_DESC = 'Moviepilot trailer'
_VALID_URL = r'https?://(?:www\.)?moviepilot\.de/movies/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.moviepilot.de/movies/inter... | @@ -91,22 +86,21 @@ def _real_extract(self, url):
webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id)
- duration = try_get(
- re.match(r'P(?P<hours>\d+)H(?P<mins>\d+)M(?P<secs>\d+)S',
- self._html_search_meta('duration', w... | yt_dlp/extractor/moviepilot.py | 26 | Python | 0.714 | suggestion | 141 | 29 | 98 | false | [extractor/moviepilot] Fix extractor | 5,954 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | panatexxa |
'uploader_id': 'x6nd9k',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id)
clip_store = self._search_json(
r'<script id="__NEXT_DATA__" t... | ```suggestion
'description': clip.get('summary'),
``` | from .dailymotion import DailymotionIE
from .common import InfoExtractor
class MoviepilotIE(InfoExtractor):
_IE_NAME = 'moviepilot'
_IE_DESC = 'Moviepilot trailer'
_VALID_URL = r'https?://(?:www\.)?moviepilot\.de/movies/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.moviepilot.de/movies/inter... | @@ -91,22 +86,21 @@ def _real_extract(self, url):
webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id)
- duration = try_get(
- re.match(r'P(?P<hours>\d+)H(?P<mins>\d+)M(?P<secs>\d+)S',
- self._html_search_meta('duration', w... | yt_dlp/extractor/moviepilot.py | 26 | Python | 0.571 | suggestion | 67 | 28 | 98 | false | [extractor/moviepilot] Fix extractor | 5,954 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | panatexxa |
'duration': 82,
'upload_date': '20201109',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaMes1Zg3lxLv9j5u/x1080',
'uploader': 'Moviepilot',
'like_count': int,
'view_count': int,
'tags': ['Alle Trailer', 'Movie', 'Verleih'],
'... | ```suggestion
clip = clip_store['props']['initialProps']['pageProps']
``` | 'upload_date': '20201109',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaMes1Zg3lxLv9j5u/x1080',
'uploader': 'Moviepilot',
'like_count': int,
'view_count': int,
'tags': ['Alle Trailer', 'Movie', 'Verleih'],
'uploader_id': 'x6nd9k',
... | @@ -91,22 +86,22 @@ def _real_extract(self, url):
webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id)
- duration = try_get(
- re.match(r'P(?P<hours>\d+)H(?P<mins>\d+)M(?P<secs>\d+)S',
- self._html_search_meta('duration', w... | yt_dlp/extractor/moviepilot.py | 26 | Python | 0.571 | suggestion | 83 | 36 | 26 | false | [extractor/moviepilot] Fix extractor | 5,954 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | panatexxa |
'title': 'Müllers Büro',
'ext': 'mp4',
'description': 'md5:4d23a8f4ca035196cd4523863c4fe5a4',
'timestamp': 1604958457,
'age_limit': 0,
'duration': 82,
'upload_date': '20201109',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/Sa... | ```suggestion
clip = self._search_nextjs_data(webpage, video_id)['props']['initialProps']['pageProps']
``` | 'ext': 'mp4',
'description': 'md5:4d23a8f4ca035196cd4523863c4fe5a4',
'timestamp': 1604958457,
'age_limit': 0,
'duration': 82,
'upload_date': '20201109',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaMes1Zg3lxLv9j5u/x1080',
'... | @@ -91,22 +86,17 @@ def _real_extract(self, url):
webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id)
- duration = try_get(
- re.match(r'P(?P<hours>\d+)H(?P<mins>\d+)M(?P<secs>\d+)S',
- self._html_search_meta('duration', w... | yt_dlp/extractor/moviepilot.py | 26 | Python | 0.714 | suggestion | 116 | 36 | 31 | false | [extractor/moviepilot] Fix extractor | 5,954 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | panatexxa |
try_get,
unified_timestamp,
)
class DaftsexIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?daft\.sex/watch/(?P<id>-?\d+_\d+)'
_TESTS = [{
'url': 'https://daft.sex/watch/-35370899_456246186',
'md5': '64c04ef7b4c7b04b308f3b0c78efe7cd',
'info_dict': {
'id': '-3537... | dont delete, just add `'skip': 'deleted/private'` | try_get,
unified_timestamp,
)
class DaftsexIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?daft\.sex/watch/(?P<id>-?\d+_\d+)'
_TESTS = [{
'url': 'https://daft.sex/watch/-35370899_456246186',
'md5': '64c04ef7b4c7b04b308f3b0c78efe7cd',
'info_dict': {
'id': '-3537... | @@ -15,27 +16,22 @@ class DaftsexIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?daft\.sex/watch/(?P<id>-?\d+_\d+)'
_TESTS = [{
'url': 'https://daft.sex/watch/-35370899_456246186',
- 'md5': 'd95135e6cea2d905bea20dbe82cda64a',
+ 'md5': '64c04ef7b4c7b04b308f3b0c78efe7cd',
'i... | yt_dlp/extractor/daftsex.py | 26 | Python | 0.214 | suggestion | 49 | 51 | 51 | false | [daftsex] fix: update domain and embed player url | 5,966 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
'ext': ext,
})
return {
'id': video_id,
'title': title,
'formats': formats,
'description': description,
'duration': duration,
'thumbnail': try_get(video_params, lambda vi: 'ht... | ```suggestion
if not items:
raise ExtractorError('Video is not available', video_id=video_id, expected=True)
``` | cdn_files = traverse_obj(video_params, ('video', 'cdn_files')) or {}
if cdn_files:
formats = []
for format_id, format_data in cdn_files.items():
ext, height = format_id.split('_')
formats.append({
'format_id': format_id,
... | @@ -94,15 +90,19 @@ def _real_extract(self, url):
'age_limit': 18,
}
- item = self._download_json(
+ items = self._download_json(
f'{server_domain}/method/video.get/{video_id}', video_id,
headers={'Referer': url}, query={
'token': ... | yt_dlp/extractor/daftsex.py | 26 | Python | 0.929 | refactor | 135 | 51 | 51 | false | [daftsex] fix: update domain and embed player url | 5,966 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
class XanimuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?:(?P<id>\d+)-)?(?P<display_id>[^/]+)/?'
_TESTS = [{
'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
'md5': '899b88091d753d92dad4cb63bbf357a7',
'info_dict': {
'id': '51944',
... | ```suggestion
video_id, diplay_id = self._match_valid_url(url).group('id', 'display_id')
video_id = video_id or display_id
``` |
class XanimuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?P<id>[^/]+)/?'
_TESTS = [{
'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
'md5': '899b88091d753d92dad4cb63bbf357a7',
'info_dict': {
'id': '51944-the-princess-the-frog-hentai',
... | @@ -0,0 +1,64 @@
+import re
+
+from ..utils import int_or_none
+from .common import InfoExtractor
+
+
+class XanimuIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?:(?P<id>\d+)-)?(?P<display_id>[^/]+)/?'
+ _TESTS = [{
+ 'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
+ ... | yt_dlp/extractor/xanimu.py | 26 | Python | 0.714 | suggestion | 145 | 51 | 48 | false | [xanimu] Add extractor | 5,969 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
import re
from ..utils import int_or_none
from .common import InfoExtractor
class XanimuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?:(?P<id>\d+)-)?(?P<display_id>[^/]+)/?'
_TESTS = [{
'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
'md5': '899b88091d753... | does this not have a numeric id? | import re
from ..utils import int_or_none
from .common import InfoExtractor
class XanimuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?P<id>[^/]+)/?'
_TESTS = [{
'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
'md5': '899b88091d753d92dad4cb63bbf357a7',
... | @@ -0,0 +1,64 @@
+import re
+
+from ..utils import int_or_none
+from .common import InfoExtractor
+
+
+class XanimuIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?:(?P<id>\d+)-)?(?P<display_id>[^/]+)/?'
+ _TESTS = [{
+ 'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
+ ... | yt_dlp/extractor/xanimu.py | 24 | Python | 0.071 | question | 32 | 49 | 49 | false | [xanimu] Add extractor | 5,969 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
'info_dict': {
'id': '51944',
'display_id': 'the-princess-the-frog-hentai',
'ext': 'mp4',
'title': 'The Princess + The Frog Hentai',
'thumbnail': 'https://xanimu.com/storage/2020/09/the-princess-and-the-frog-hentai.jpg',
'description': r're... | ```suggestion
title = self._search_regex(
r'[\'"]headline[\'"]:\s*[\'"]([^"]+)[\'"]', webpage, 'title',
default=None) or self._html_extract_title(webpage)
``` | 'info_dict': {
'id': '51944-the-princess-the-frog-hentai',
'ext': 'mp4',
'title': 'The Princess + The Frog Hentai',
'thumbnail': 'https://xanimu.com/storage/2020/09/the-princess-and-the-frog-hentai.jpg',
'description': r're:^Enjoy The Princess \+ The F... | @@ -0,0 +1,64 @@
+import re
+
+from ..utils import int_or_none
+from .common import InfoExtractor
+
+
+class XanimuIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?:(?P<id>\d+)-)?(?P<display_id>[^/]+)/?'
+ _TESTS = [{
+ 'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
+ ... | yt_dlp/extractor/xanimu.py | 26 | Python | 0.786 | refactor | 194 | 51 | 41 | false | [xanimu] Add extractor | 5,969 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
'thumbnail': 'https://xanimu.com/storage/2020/09/the-princess-and-the-frog-hentai.jpg',
'description': r're:^Enjoy The Princess \+ The Frog Hentai',
'duration': 207.0,
'age_limit': 18
}
}, {
'url': 'https://xanimu.com/huge-expansion/',
'only_ma... | single use variables. Inline in the return | 'description': r're:^Enjoy The Princess \+ The Frog Hentai',
'duration': 207.0,
'age_limit': 18
}
}, {
'url': 'https://xanimu.com/huge-expansion/',
'only_matching': True
}]
def _real_extract(self, url):
video_id = self._match_id(url)
... | @@ -0,0 +1,64 @@
+import re
+
+from ..utils import int_or_none
+from .common import InfoExtractor
+
+
+class XanimuIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?:(?P<id>\d+)-)?(?P<display_id>[^/]+)/?'
+ _TESTS = [{
+ 'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
+ ... | yt_dlp/extractor/xanimu.py | 26 | Python | 0.143 | suggestion | 42 | 49 | 36 | false | [xanimu] Add extractor | 5,969 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
_TESTS = [{
'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
'md5': '899b88091d753d92dad4cb63bbf357a7',
'info_dict': {
'id': '51944-the-princess-the-frog-hentai',
'ext': 'mp4',
'title': 'The Princess + The Frog Hentai',
'thumbna... | ```suggestion
video_id, default=None, contains_pattern=r'[\'"]([^\'"]+)[\'"]')
``` | _TESTS = [{
'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
'md5': '899b88091d753d92dad4cb63bbf357a7',
'info_dict': {
'id': '51944-the-princess-the-frog-hentai',
'ext': 'mp4',
'title': 'The Princess + The Frog Hentai',
'thumbna... | @@ -0,0 +1,52 @@
+import re
+
+from ..utils import int_or_none
+from .common import InfoExtractor
+
+
+class XanimuIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?P<id>[^/]+)/?'
+ _TESTS = [{
+ 'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
+ 'md5': '899b88091d... | yt_dlp/extractor/xanimu.py | 26 | Python | 0.714 | suggestion | 127 | 45 | 44 | false | [xanimu] Add extractor | 5,969 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
from ..utils import int_or_none
from .common import InfoExtractor
class XanimuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?P<id>[^/]+)/?'
_TESTS = [{
'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
'md5': '899b88091d753d92dad4cb63bbf357a7',
'info_... | ```suggestion
video_id = self._match_id(url)
``` | from ..utils import int_or_none
from .common import InfoExtractor
class XanimuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?P<id>[^/]+)/?'
_TESTS = [{
'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
'md5': '899b88091d753d92dad4cb63bbf357a7',
'info_... | @@ -0,0 +1,52 @@
+import re
+
+from ..utils import int_or_none
+from .common import InfoExtractor
+
+
+class XanimuIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?P<id>[^/]+)/?'
+ _TESTS = [{
+ 'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
+ 'md5': '899b88091d... | yt_dlp/extractor/xanimu.py | 26 | Python | 0.571 | suggestion | 58 | 51 | 50 | false | [xanimu] Add extractor | 5,969 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | JChris246 |
'upload_date': '20200327',
'timestamp': 1585348140,
'channel': 'Real Engineering',
'channel_id': 'realengineering',
'uploader': 'Real Engineering',
'uploader_id': 'realengineering',
'series': 'Real Engineerin... | Why's every site removing rating information :( | 'channel_id': 'realengineering',
'uploader': 'Real Engineering',
'uploader_id': 'realengineering',
'series': 'Real Engineering',
'display_id': 'the-logistics-of-d-day-landing-craft-how-the-allies-got-ashore',
'creator': 'Rea... | @@ -169,12 +129,10 @@ class NebulaIE(NebulaBaseIE):
'timestamp': 1533009600,
'uploader_url': 'https://nebula.app/lindsayellis',
'series': 'Lindsay Ellis',
- 'average_rating': int, | yt_dlp/extractor/nebula.py | 26 | Python | 0.071 | style | 47 | 51 | 51 | false | [extractor/nebula] Remove broken cookie support | 5,979 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
response = self._call_nebula_api('https://api.watchnebula.com/api/v1/authorization/',
method='POST',
note='Authorizing to Nebula')
return response['token']
def _fetch_video_formats(self, slug):
stream_info = s... | ```suggestion
'url_result': f'https://nebula.app/{episode["slug"]}' if not fetch_formats_and_subs else '',
```
did u mean `webpage_url`? | response = self._call_nebula_api('https://api.watchnebula.com/api/v1/authorization/',
method='POST',
note='Authorizing to Nebula')
return response['token']
def _fetch_video_formats(self, slug):
stream_info = s... | @@ -95,35 +64,27 @@ def _fetch_nebula_bearer_token(self):
note='Authorizing to Nebula')
return response['token']
- def _fetch_zype_access_token(self):
- """
- Get a Zype access token, which is required to access video streams -- in our case: to
- ... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | question | 151 | 51 | 51 | false | [extractor/nebula] Remove broken cookie support | 5,979 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | hheimbuerger |
webpage_json_data = self._search_json(
r'var\s*BOXCAST_PRELOAD\s*=', webpage, 'BOXCAST_PRELOAD', display_id,
transform_source=js_to_json, default={})
formats, subtitles = [], {}
broadcast_json_data = traverse_obj(webpage_json_data, ('broadcast', 'data'), default={})
... | Isn't this better?
```suggestion
# Ref: https://support.boxcast.com/en/articles/4235158-build-a-custom-viewer-experience-with-boxcast-api
broadcast_json_data = (
traverse_obj(webpage_json_data, ('broadcast', 'data'))
or self._download_json(f'https://api.boxcast.com/broadcast... | webpage = self._download_webpage(url, display_id)
webpage_json_data = self._search_json(
r'var\s*BOXCAST_PRELOAD\s*=', webpage, 'broadcast data', display_id,
transform_source=js_to_json, default={})
# Ref: https://support.boxcast.com/en/articles/4235158-build-a-custom-vi... | @@ -0,0 +1,110 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ unified_timestamp
+)
+
+
+class BoxCastVideoIE(InfoExtractor):
+ _VALID_URL = r'''(?x)(?:
+ https?://boxcast\.tv/
+ (?:view-embed/|channel/\w+\?(?:[^/#&]+&?)?b=|v... | yt_dlp/extractor/boxcast.py | 26 | Python | 1 | refactor | 850 | 43 | 35 | false | [extractor/boxcast] Add extractor | 5,983 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
from .common import InfoExtractor
from ..utils import (
js_to_json,
traverse_obj,
unified_timestamp
)
class BoxCastVideoIE(InfoExtractor):
_VALID_URL = r'''(?x)(?:
https?://boxcast\.tv/
(?:view-embed/|channel/\w+\?(?:[^/#&]+&?)?b=|video-portal/(?:\w+/?){2})
... | ```suggestion
_VALID_URL = r'''(?x)(
https?://boxcast\.tv/(?:
view-embed/|
channel/\w+\?(?:[^#]+&)?b=|
video-portal/(?:\w+/){2}
)(?P<id>[\w-]+)
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
traverse_obj,
unified_timestamp
)
class BoxCastVideoIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://boxcast\.tv/(?:
view-embed/|
channel/\w+\?(?:[^#]+&)?b=|
video-portal/(?:\w+/){2}
... | @@ -0,0 +1,110 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ unified_timestamp
+)
+
+
+class BoxCastVideoIE(InfoExtractor):
+ _VALID_URL = r'''(?x)(?:
+ https?://boxcast\.tv/
+ (?:view-embed/|channel/\w+\?(?:[^/#&]+&?)?b=|v... | yt_dlp/extractor/boxcast.py | 13 | Python | 0.929 | suggestion | 210 | 38 | 38 | false | [extractor/boxcast] Add extractor | 5,983 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'uploader_id': 'ds25vaazhlu4ygcvffid',
'release_timestamp': 1672543201,
'uploader': 'Lighthouse Ministries International - Beltsville, Maryland',
'description': 'md5:ac23e3d01b0b0be592e8f7fe0ec3a340',
'title': 'New Year\'s Eve CROSSOVER Service at LHMI | Dece... | ```suggestion
r'var\s*BOXCAST_PRELOAD\s*=', webpage, 'broadcast data', display_id,
``` | 'release_timestamp': 1672543201,
'uploader': 'Lighthouse Ministries International - Beltsville, Maryland',
'description': 'md5:ac23e3d01b0b0be592e8f7fe0ec3a340',
'title': 'New Year\'s Eve CROSSOVER Service at LHMI | December 31, 2022',
}
}]
_WEBPAGE_TESTS... | @@ -0,0 +1,103 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ unified_timestamp
+)
+
+
+class BoxCastVideoIE(InfoExtractor):
+ _VALID_URL = r'''(?x)(
+ https?://boxcast\.tv/(?:
+ view-embed/|
+ channel/\w+\?(?:[^#]+&)?b=|... | yt_dlp/extractor/boxcast.py | 26 | Python | 0.857 | suggestion | 100 | 51 | 51 | false | [extractor/boxcast] Add extractor | 5,983 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
from .common import InfoExtractor
from ..utils import (
js_to_json,
traverse_obj,
unified_timestamp
)
class BoxCastVideoIE(InfoExtractor):
_VALID_URL = r'''(?x)(
https?://boxcast\.tv/(?:
view-embed/|
channel/\w+\?(?:[^#]+&)?b=|
video-portal/(... | ```suggestion
_VALID_URL = r'''(?x)
https?://boxcast\.tv/(?:
view-embed/|
channel/\w+\?(?:[^#]+&)?b=|
video-portal/(?:\w+/){2}
)(?P<id>[\w-]+)'''
``` | from .common import InfoExtractor
from ..utils import (
js_to_json,
traverse_obj,
unified_timestamp
)
class BoxCastVideoIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://boxcast\.tv/(?:
view-embed/|
channel/\w+\?(?:[^#]+&)?b=|
video-portal/(?:\w+/){2}
... | @@ -0,0 +1,103 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ unified_timestamp
+)
+
+
+class BoxCastVideoIE(InfoExtractor):
+ _VALID_URL = r'''(?x)(
+ https?://boxcast\.tv/(?:
+ view-embed/|
+ channel/\w+\?(?:[^#]+&)?b=|... | yt_dlp/extractor/boxcast.py | 16 | Python | 0.929 | suggestion | 212 | 41 | 41 | false | [extractor/boxcast] Add extractor | 5,983 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
If `True`, any non-compatible object will first be
converted into a string and then traversed into.
@returns The result of the object traversal.
If successful, `get_all=True`, and the path branches at least once,
... | ```suggestion
assert len(key) == 1, 'Set should only be used to wrap transformations'
``` | @param is_user_input Whether the keys are generated from user input.
If `True` strings get converted to `int`/`slice` if needed.
@param traverse_string Whether to traverse into objects as strings.
If `True`, any non-compatible object will first be
... | @@ -5473,6 +5477,10 @@ def apply_key(key, obj):
elif key is None:
yield obj
+ elif isinstance(key, set):
+ assert len(key) == 1 | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 103 | 51 | 51 | false | [utils] `traverse_obj`: Add `set` transformations/filters and `re.Match` group names | 5,988 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
has_branched = True
if __debug__ and callable(key):
inspect.signature(key).bind(None, None)
key_func = functools.partial(apply_key, key)
objs = itertools.chain.from_iterable(map(key_func, objs))
return has_branched, objs
def _traverse_o... | ```suggestion
inspect.signature(key).bind(None, None) # Verify function signature
``` | return
for item in iterator:
yield False, prev
prev = item
yield True, prev
def apply_path(start_obj, path, test_type=False):
objs = (start_obj,)
has_branched = False
key = None
for last, key in lazy_last(variadic(path, (str, by... | @@ -5551,6 +5561,9 @@ def apply_path(start_obj, path):
if key is ... or isinstance(key, (list, tuple)) or callable(key):
has_branched = True
+ if __debug__ and callable(key):
+ inspect.signature(key).bind(None, None) | yt_dlp/utils.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | [utils] `traverse_obj`: Add `set` transformations/filters and `re.Match` group names | 5,988 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
self.assertEqual(traverse_obj(_TEST_DATA, 'str'), 'str',
msg='single items should be treated as a path')
self.assertEqual(traverse_obj(_TEST_DATA, None), _TEST_DATA)
self.assertEqual(traverse_obj(_TEST_DATA, 100), 100)
self.assertEqual(traverse_obj(_TEST_DATA, 1.... | ```suggestion
# Test wrong function signature
if __debug__:
``` | msg='allow iterable path')
self.assertEqual(traverse_obj(_TEST_DATA, 'str'), 'str',
msg='single items should be treated as a path')
self.assertEqual(traverse_obj(_TEST_DATA, None), _TEST_DATA)
self.assertEqual(traverse_obj(_TEST_DATA, 100), 100)
... | @@ -2015,6 +2015,27 @@ def test_traverse_obj(self):
msg='function as query key should perform a filter based on (key, value)')
self.assertCountEqual(traverse_obj(_TEST_DATA, lambda _, x: isinstance(x[0], str)), {'str'},
msg='exceptions in the query funct... | test/test_utils.py | 26 | Python | 0.714 | bug | 84 | 51 | 51 | false | [utils] `traverse_obj`: Add `set` transformations/filters and `re.Match` group names | 5,988 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
self._search_json(r'window\.__INITIAL_(?:DATA|STATE)__\s*=', webpage, 'preload state', video_id, default={})
or self._search_nuxt_data(webpage, video_id, '__initialState', fatal=False, traverse=None))
video_data = traverse_obj(
initial_data, ('OgvVideo', 'epDetail'), ('UgcVid... | This should be `fatal=False`, but call_api doesnt have the param, so you'll have to add it
```py
def _call_api(self, path, room_id, **kwargs):
api_result = self._download_json(..., **kwargs)
```
```suggestion
intro_ending_json = self._call_api(
f'/web/v2/ogv/play/episode?e... | self._search_json(r'window\.__INITIAL_(?:DATA|STATE)__\s*=', webpage, 'preload state', video_id, default={})
or self._search_nuxt_data(webpage, video_id, '__initialState', fatal=False, traverse=None))
video_data = traverse_obj(
initial_data, ('OgvVideo', 'epDetail'), ('UgcVid... | @@ -1028,12 +1068,29 @@ def _extract_video_metadata(self, url, video_id, season_id):
def _real_extract(self, url):
season_id, ep_id, aid = self._match_valid_url(url).group('season_id', 'ep_id', 'aid')
video_id = ep_id or aid
+ chapters = None
+
+ if ep_id:
+ intro_ending_... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.857 | suggestion | 403 | 51 | 51 | false | [extractor/biliInt] Add intro and ending chapter | 6,018 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
# Some values are stringified JSON arrays
for key in ('video_servers', 'subtitles'):
if key in m3u8_dict:
m3u8_dict[key] = self._parse_json(m3u8_dict[key], None, fatal=False) or []
return m3u8_dict
def _parse_m3u8_vod_duration(self, m3u8_vod, video_id):
... | Is this useful enough to move to `extractor/common.py` to be with `_extract_m3u8_vod_duration`? If not, I can simplify it for this single use case | # Some values are stringified JSON arrays
for key in ('video_servers', 'subtitles'):
if key in m3u8_dict:
m3u8_dict[key] = self._parse_json(m3u8_dict[key], None, fatal=False) or []
return m3u8_dict
def _extract_formats_and_duration(self, cdn_hostname, path, vide... | @@ -369,15 +398,47 @@ def _extract_custom_m3u8_info(self, m3u8_data):
return m3u8_dict
- def _extract_formats(self, cdn_hostname, path, video_id):
- formats = []
- formats.extend(self._extract_m3u8_formats(
+ def _parse_m3u8_vod_duration(self, m3u8_vod, video_id):
+ # SlidesLive ... | yt_dlp/extractor/slideslive.py | 26 | Python | 0.571 | refactor | 146 | 51 | 51 | false | [extractor/slideslive] Fix thumbnails and chapters/duration | 6,024 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'VOD-VIDEO-ID': 'service_id',
'VOD-VIDEO-SERVERS': 'video_servers',
'VOD-SUBTITLES': 'subtitles',
'VOD-SLIDES-JSON-URL': 'slides_json_url',
'VOD-SLIDES-XML-URL': 'slides_xml_url',
}
for line in m3u8_data.splitlines():
if not line.s... | I'm also wondering if this is a change that should be made to `InfoExtractor._parse_m3u8_vod_duration` instead of overriding it here. Duration can be determined if the m3u8 contains `#EXT-X-ENDLIST`, but not all VOD m3u8s contain `#EXT-X-PLAYLIST-TYPE:VOD` | 'VOD-VIDEO-SERVERS': 'video_servers',
'VOD-SUBTITLES': 'subtitles',
'VOD-SLIDES-JSON-URL': 'slides_json_url',
'VOD-SLIDES-XML-URL': 'slides_xml_url',
}
for line in m3u8_data.splitlines():
if not line.startswith('#EXT-SL-'):
con... | @@ -369,15 +398,47 @@ def _extract_custom_m3u8_info(self, m3u8_data):
return m3u8_dict
- def _extract_formats(self, cdn_hostname, path, video_id):
- formats = []
- formats.extend(self._extract_m3u8_formats(
+ def _parse_m3u8_vod_duration(self, m3u8_vod, video_id):
+ # SlidesLive ... | yt_dlp/extractor/slideslive.py | 26 | Python | 0.786 | refactor | 256 | 51 | 51 | false | [extractor/slideslive] Fix thumbnails and chapters/duration | 6,024 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
subtitles.setdefault(sub.get('language') or 'en', []).append({
'url': webvtt_url,
'ext': 'vtt',
})
info = {
'id': video_id,
'title': player_info.get('title') or self._html_search_meta('title', webpage, default=''),
'tim... | This is wrong? Can you explain? | info.update({
'duration': duration,
'formats': formats,
})
else:
info.update({
'_type': 'url_transparent',
'url': service_id,
'ie_key': service_name.capitalize(),
'display_id': vid... | @@ -473,7 +532,18 @@ def _real_extract(self, url):
if service_name == 'url':
info['url'] = service_id
elif service_name == 'yoda':
- info['formats'] = self._extract_formats(player_info['video_servers'][0], service_id, video_id)
+ formats, duration = self._extract_for... | yt_dlp/extractor/slideslive.py | 26 | Python | 0.071 | bug | 31 | 51 | 51 | false | [extractor/slideslive] Fix thumbnails and chapters/duration | 6,024 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'info_dict': {
'id': '6196747868001',
'ext': 'mp4',
'title': 'Emmanuel Macron: "L\'Islam est une religion qui vit une crise aujourd’hui, partout dans le monde"',
'description': 'Le Président s\'exprime sur la question du séparatisme depuis les Mureaux, dans les Yv... | this test just needs to go in `BFMTVArticleIE` | 'info_dict': {
'id': '6196747868001',
'ext': 'mp4',
'title': 'Emmanuel Macron: "L\'Islam est une religion qui vit une crise aujourd’hui, partout dans le monde"',
'description': 'Le Président s\'exprime sur la question du séparatisme depuis les Mureaux, dans les Yv... | @@ -31,7 +31,24 @@ class BFMTVIE(BFMTVBaseIE):
'uploader_id': '876450610001',
'upload_date': '20201002',
'timestamp': 1601629620,
+ 'duration': 44.757,
+ 'tags': ['bfmactu', 'politique'],
+ 'thumbnail': 'https://cf-images.eu-west-1.prod.boltdns.net... | yt_dlp/extractor/bfmtv.py | 26 | Python | 0.214 | suggestion | 46 | 51 | 51 | false | added support for rmc prefix to bfmtv | 6,025 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | carusocr |
import re
from .common import InfoExtractor
from ..utils import extract_attributes
class BFMTVBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:(www|rmc)\.)?bfmtv\.com/'
_VALID_URL_TMPL = _VALID_URL_BASE + r'(?:[^/]+/)*[^/?&#]+_%s[A-Z]-(?P<id>\d{12})\.html'
_VIDEO_BLOCK_REGEX = r'(<div[^>]+class="vi... | ```suggestion
_VALID_URL_BASE = r'https?://(?:www\.|rmc\.)?bfmtv\.com/'
``` | import re
from .common import InfoExtractor
from ..utils import extract_attributes
class BFMTVBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.|rmc\.)?bfmtv\.com/'
_VALID_URL_TMPL = _VALID_URL_BASE + r'(?:[^/]+/)*[^/?&#]+_%s[A-Z]-(?P<id>\d{12})\.html'
_VIDEO_BLOCK_REGEX = r'(<div[^>]+class="vi... | @@ -5,7 +5,7 @@
class BFMTVBaseIE(InfoExtractor):
- _VALID_URL_BASE = r'https?://(?:www\.)?bfmtv\.com/'
+ _VALID_URL_BASE = r'https?://(?:(www|rmc)\.)?bfmtv\.com/' | yt_dlp/extractor/bfmtv.py | 8 | Python | 0.571 | suggestion | 81 | 33 | 33 | false | added support for rmc prefix to bfmtv | 6,025 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | carusocr |
from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
unified_timestamp,
)
class ServusIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
(?:www\.)?
(?:
servus\.com/(?:(?:at|de... | > @[pukkandan](https://github.com/pukkandan) pukkandan [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917382041)
This change wasn't necessary imo, but you dont have to revert it either
> @[pukkandan](https://github.com/pukkandan) pukkandan [on Jul 10, 2022](https://github.com/yt-dlp/yt-d... | from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
format_field,
int_or_none,
join_nonempty,
traverse_obj,
unescapeHTML,
unified_timestamp,
)
class ServusIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 17 | Python | 0.5 | suggestion | 393 | 42 | 42 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
'season': 'Season 11',
'season_number': 11,
'episode': 'Episode 8 - Vie Ferrate – Klettersteige in den Alpen',
'episode_number': 8,
},
'params': {'skip_download': 'm3u8'}
}, {
'url': 'https://www.pm-wissen.com/videos/aa-24mus4g2w2112/',
... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917382328)
return None is invalid. You should raise an exception instead | 'description': 'md5:25e47ddd83a009a0f9789ba18f2850ce',
'thumbnail': r're:^https?://.*\.jpg',
'duration': 2823,
'timestamp': 1655752333,
'upload_date': '20220620',
'series': 'Bergwelten',
'season': 'Season 11',
'season_number... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.571 | suggestion | 190 | 51 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
'episode_number': 8,
},
'params': {'skip_download': 'm3u8'}
}, {
'url': 'https://www.pm-wissen.com/videos/aa-24mus4g2w2112/',
'only_matching': True,
}, {
'url': 'https://www.servustv.com/natur/v/aa-1xg5xwmgw2112/',
'only_matching': True,
}, {
... | ```suggestion
video['videoUrl'], video_id, 'mp4', m3u8_id='hls')
```
It is the default | 'timestamp': 1655752333,
'upload_date': '20220620',
'series': 'Bergwelten',
'season': 'Season 11',
'season_number': 11,
'episode': 'Episode 8 - Vie Ferrate – Klettersteige in den Alpen',
'episode_number': 8,
},
'params':... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.714 | suggestion | 101 | 51 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
'description': self._get_description(video, video_id),
'thumbnail': video.get('poster'),
'duration': float_or_none(video.get('duration')),
'timestamp': unified_timestamp(video.get('currentSunrise')),
'series': season,
'season': video.get('season'),... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917393276)
raise ExtractorError. Same below. When the error does not indicate a bug (eg: only playable from ...), set expected=true | def _real_extract(self, url):
video_id = self._match_id(url).upper()
video = self._download_json(
'https://api-player.redbull.com/stv/servus-tv?timeZone=Europe/Berlin',
video_id, 'Downloading video JSON', query={'videoId': video_id})
if not video.get('videoUrl'):
... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.643 | bug | 249 | 39 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
season = video.get('season')
season_number = int_or_none(self._search_regex(
r'Season (\d+)', season or '', 'season number', default=None))
episode = video.get('chapter')
episode_number = int_or_none(self._search_regex(
r'Episode (\d+)', episode or '', 'episode nu... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917393564)
I don't think a description is useful enough to make an additional API call for it. But I leave it to your discretion | 'url': 'https://www.servus.com/tv/videos/aa-1t6vbu5pw1w12/',
'only_matching': True,
}, {
'url': 'https://www.servus.com/tv/videos/1380889096408-1235196658/',
'only_matching': True,
}, {
'url': 'https://www.pm-wissen.com/videos/aa-24mus4g2w2112/',
'only_matching': ... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.5 | suggestion | 246 | 49 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
video = self._download_json(
'https://api-player.redbull.com/stv/servus-tv?timeZone=Europe/Berlin&videoId=%s' % video_id,
video_id, 'Downloading video JSON')
if 'videoUrl' not in video:
self._report_errors(video)
return None
formats, subtitles = s... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917393754)
typo? | # URL schema v2
'url': 'https://www.servustv.com/videos/aa-1t6vbu5pw1w12/',
'only_matching': True,
}, {
# URL schema v1
'url': 'https://www.servus.com/de/p/Die-Gr%C3%BCnen-aus-Sicht-des-Volkes/AA-1T6VBU5PW1W12/',
'only_matching': True,
}, {
'url': 'https:/... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.357 | question | 134 | 51 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
video = self._download_json(
'https://api-player.redbull.com/stv/servus-tv?timeZone=Europe/Berlin&videoId=%s' % video_id,
video_id, 'Downloading video JSON')
if 'videoUrl' not in video:
self._report_errors(video)
return None
formats, subtitles = se... | ```suggestion
'season': season,
``` | 'url': 'https://www.servustv.com/videos/aa-1t6vbu5pw1w12/',
'only_matching': True,
}, {
# URL schema v1
'url': 'https://www.servus.com/de/p/Die-Gr%C3%BCnen-aus-Sicht-des-Volkes/AA-1T6VBU5PW1W12/',
'only_matching': True,
}, {
'url': 'https://www.servus.com/at/p/Wie... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.429 | suggestion | 49 | 51 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
'id': 'AA-28BYCQNH92111',
'ext': 'mp4',
'title': 'Klettersteige in den Alpen',
'description': 'md5:bab622a45e44872fdaea7f90b56f0ce8',
'thumbnail': r're:^https?://.*\.jpg',
'duration': 2823,
'timestamp': 1655752333,
'upload_d... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917394085)
The existing tests are meant to test those URL schemes. Don't replace them | /(?P<id>[aA]{2}-?\w+|\d+-\d+)
'''
_TESTS = [{
# URL schema v3
'url': 'https://www.servustv.com/natur/v/aa-28bycqnh92111/',
'info_dict': {
'id': 'AA-28BYCQNH92111',
'ext': 'mp4',
'title': 'Klettersteige in den Alp... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.5 | suggestion | 203 | 51 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
season = video.get('season')
season_number = int_or_none(self._search_regex(
r'Season (\d+)', season or '', 'season number', default=None))
episode = video.get('chapter')
episode_number = int_or_none(self._search_regex(
r'Episode (\d+)', episode or '', 'episode n... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917394342)
Use single quotes everywhere | }, {
'url': 'https://www.servus.com/tv/videos/aa-1t6vbu5pw1w12/',
'only_matching': True,
}, {
'url': 'https://www.servus.com/tv/videos/1380889096408-1235196658/',
'only_matching': True,
}, {
'url': 'https://www.pm-wissen.com/videos/aa-24mus4g2w2112/',
'only_ma... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.429 | suggestion | 157 | 50 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
return {
'id': video_id,
'title': video.get('title'),
'description': self._get_description(video, video_id),
'thumbnail': video.get('poster'),
'duration': float_or_none(video.get('duration')),
'timestamp': unified_timestamp(video.get('curr... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917394552)
Actually, passing video here only to do a .get on it seems unnecessary. Do this instead:
```suggestion
def _get_description(self, video_id):
info = self._download_json(
... | 'url': 'https://www.pm-wissen.com/videos/aa-24mus4g2w2112/',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url).upper()
video = self._download_json(
'https://api-player.redbull.com/stv/servus-tv?timeZone=Europe/Berlin',
... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.857 | suggestion | 646 | 43 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
'episode': episode,
'episode_number': episode_number,
'formats': formats,
'subtitles': subtitles,
}
def _get_description(self, video, video_id):
info = self._download_json("https://backend.servustv.com/wp-json/rbmh/v2/media_asset/aa_id/%s?fieldset=pag... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917394792)
format it like:
```suggestion
raise ExtractorError(
f'Only playable from {details["minEveningHour"]}:00 to {details["maxMorningHour"]}:00',
... | self._report_errors(video)
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
video['videoUrl'], video_id, 'mp4', m3u8_id='hls')
season = video.get('season')
season_number = int_or_none(self._search_regex(
r'Season (\d+)', season or '', 'season nu... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 1 | refactor | 362 | 32 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
'timestamp': 1655752333,
'upload_date': '20220620',
'series': 'Bergwelten',
'season': 'Season 11',
'season_number': 11,
'episode': 'Episode 8 - Vie Ferrate – Klettersteige in den Alpen',
'episode_number': 8,
},
'params':... | > [pukkandan](https://github.com/pukkandan) [on Jul 10, 2022](https://github.com/yt-dlp/yt-dlp/pull/4240#discussion_r917395041)
Use query param | 'id': 'AA-28BYCQNH92111',
'ext': 'mp4',
'title': 'Klettersteige in den Alpen',
'description': 'md5:25e47ddd83a009a0f9789ba18f2850ce',
'thumbnail': r're:^https?://.*\.jpg',
'duration': 2823,
'timestamp': 1655752333,
'upload_d... | @@ -15,130 +12,97 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 0.429 | suggestion | 144 | 51 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
'episode': episode,
'episode_number': episode_number,
'formats': formats,
'subtitles': subtitles,
}
def _get_description(self, video_id):
info = self._download_json(
f'https://backend.servustv.com/wp-json/rbmh/v2/media_asset/aa_id/{video_i... | I actually disagree with this for loop. Instead the logic should be check for if something is in a set. But I am not quite sure how to do it in python, because I am a stupid java developer (and I am used to static typing) 😛
```suggestion
playability_errors = video.get('playabilityErrors')
if 'F... | if not video.get('videoUrl'):
self._report_errors(video)
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
video['videoUrl'], video_id, 'mp4', m3u8_id='hls')
season = video.get('season')
season_number = int_or_none(self._search_regex(
r'S... | @@ -15,130 +13,90 @@ class ServusIE(InfoExtractor):
(?:www\.)?
(?:
servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)|
- (?:servustv|pm-wissen)\.com/videos
+ (?:servustv|pm-wissen)\.com/(?:[^/]+... | yt_dlp/extractor/servus.py | 26 | Python | 1 | refactor | 894 | 27 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | StefanLobbenmeier | StefanLobbenmeier |
from .common import InfoExtractor
from .. import traverse_obj
from ..utils import (
float_or_none,
int_or_none,
unified_timestamp, ExtractorError,
)
class ServusIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
(?:www\.)?
(?:
... | Make sure to sort the imports, format them correctly (isort?) and also import `traverse_obj` from `..utils`. | from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
format_field,
int_or_none,
join_nonempty,
traverse_obj,
unescapeHTML,
unified_timestamp,
)
class ServusIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
... | @@ -1,11 +1,9 @@
from .common import InfoExtractor
+from .. import traverse_obj
from ..utils import (
- determine_ext,
float_or_none,
int_or_none,
- unified_timestamp,
- urlencode_postdata,
- url_or_none,
+ unified_timestamp, ExtractorError,
) | yt_dlp/extractor/servus.py | 7 | Python | 0.5 | style | 108 | 32 | 32 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | StefanLobbenmeier |
}
}, {
# URL schema v1
'url': 'https://www.servus.com/de/p/Die-Gr%C3%BCnen-aus-Sicht-des-Volkes/AA-1T6VBU5PW1W12/',
'only_matching': True,
}, {
'url': 'https://www.servus.com/at/p/Wie-das-Leben-beginnt/1309984137314-381415152/',
'only_matching': True,
}, {
... | ```suggestion
if video.get('videoUrl):
``` | 'only_matching': True,
}, {
'url': 'https://www.pm-wissen.com/videos/aa-24mus4g2w2112/',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url).upper()
video = self._download_json(
'https://api-player.redbull.com/stv/servu... | @@ -60,85 +84,54 @@ class ServusIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url).upper()
- token = self._download_json(
- 'https://auth.redbullmediahouse.com/token', video_id,
- 'Downloading token', data=urlencode_postdata({
- 'g... | yt_dlp/extractor/servus.py | 26 | Python | 0.571 | suggestion | 52 | 51 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | StefanLobbenmeier |
# URL schema v1
'url': 'https://www.servus.com/de/p/Die-Gr%C3%BCnen-aus-Sicht-des-Volkes/AA-1T6VBU5PW1W12/',
'only_matching': True,
}, {
'url': 'https://www.servus.com/at/p/Wie-das-Leben-beginnt/1309984137314-381415152/',
'only_matching': True,
}, {
'url': 'https:... | Since _get_description makes an additional API call, wouldn't it be better to do
```suggestion
'description': video.get('description') or self._get_description(video_id),
```
or is there some issue with it? | 'url': 'https://www.pm-wissen.com/videos/aa-24mus4g2w2112/',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url).upper()
video = self._download_json(
'https://api-player.redbull.com/stv/servus-tv?timeZone=Europe/Berlin',
... | @@ -60,85 +84,54 @@ class ServusIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url).upper()
- token = self._download_json(
- 'https://auth.redbullmediahouse.com/token', video_id,
- 'Downloading token', data=urlencode_postdata({
- 'g... | yt_dlp/extractor/servus.py | 26 | Python | 0.857 | question | 223 | 51 | 51 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | StefanLobbenmeier |
r'Season (\d+)', season or '', 'season number', default=None))
episode = video.get('chapter')
episode_number = int_or_none(self._search_regex(
r'Episode (\d+)', episode or '', 'episode number', default=None))
return {
'id': video_id,
'title': vide... | single use function. This could go directly in _real_extract imo, but I won't insist | 'season': season,
'season_number': season_number,
'episode': episode,
'episode_number': episode_number,
'formats': formats,
'subtitles': subtitles,
}
def _get_description(self, video_id):
info = self._download_json(
... | @@ -60,85 +84,54 @@ class ServusIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url).upper()
- token = self._download_json(
- 'https://auth.redbullmediahouse.com/token', video_id,
- 'Downloading token', data=urlencode_postdata({
- 'g... | yt_dlp/extractor/servus.py | 26 | Python | 0.286 | refactor | 84 | 42 | 40 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | StefanLobbenmeier |
'episode': episode,
'episode_number': episode_number,
'formats': formats,
'subtitles': subtitles,
}
def _get_description(self, video_id):
info = self._download_json(
f'https://backend.servustv.com/wp-json/rbmh/v2/media_asset/aa_id/{video_i... | ```suggestion
elif 'FSK_BLOCKED' in playability_errors:
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
format_field,
int_or_none,
join_nonempty,
traverse_obj,
unescapeHTML,
unified_timestamp,
)
class ServusIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
... | @@ -60,85 +85,80 @@ class ServusIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url).upper()
- token = self._download_json(
- 'https://auth.redbullmediahouse.com/token', video_id,
- 'Downloading token', data=urlencode_postdata({
- 'g... | yt_dlp/extractor/servus.py | 26 | Python | 0.714 | suggestion | 69 | 51 | 136 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | StefanLobbenmeier |
assert isinstance(playability_errors, list)
if not playability_errors:
raise ExtractorError('No videoUrl and no information about errors')
if 'FSK_BLOCKED' in playability_errors:
details = traverse_obj(video, ('playabilityErrorDetails', 'FSK_BLOCKED'), expected_type=dict... | ```suggestion
details = traverse_obj(video, ('playabilityErrorDetails', 'FSK_BLOCKED'), expected_type=dict)
message = format_field(''.join(
format_field(details, 'minEveningHour', ' from %02d:00'),
format_field(details, 'maxMorningHour', ' to %02d:00'),
... | from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
format_field,
int_or_none,
join_nonempty,
traverse_obj,
unescapeHTML,
unified_timestamp,
)
class ServusIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
... | @@ -60,85 +85,80 @@ class ServusIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url).upper()
- token = self._download_json(
- 'https://auth.redbullmediahouse.com/token', video_id,
- 'Downloading token', data=urlencode_postdata({
- 'g... | yt_dlp/extractor/servus.py | 26 | Python | 0.929 | suggestion | 794 | 32 | 136 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | StefanLobbenmeier |
'title': video.get('title'),
'description': self._get_description(video_id) or video.get('description'),
'thumbnail': video.get('poster'),
'duration': float_or_none(video.get('duration')),
'timestamp': unified_timestamp(video.get('currentSunrise')),
... | ```suggestion
return join_nonempty(*traverse_obj(info, (
('stv_short_description', 'stv_long_description'),
{lambda x: unescapeHTML(x.replace('\n\n', '\n'))})), delim='\n\n')
``` | 'id': video_id,
'title': video.get('title'),
'description': self._get_description(video_id) or video.get('description'),
'thumbnail': video.get('poster'),
'duration': float_or_none(video.get('duration')),
'timestamp': unified_timestamp(video.get('c... | @@ -60,85 +70,69 @@ class ServusIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url).upper()
- token = self._download_json(
- 'https://auth.redbullmediahouse.com/token', video_id,
- 'Downloading token', data=urlencode_postdata({
- 'g... | yt_dlp/extractor/servus.py | 26 | Python | 0.857 | security | 211 | 50 | 47 | false | Draft: New servus extractor logic | 6,036 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | StefanLobbenmeier |
import time
import datetime
from .common import InfoExtractor
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://sportdeutschland\.tv/(?P<id>(?:[^/]+/)?[^?#/&]+)'
_TESTS = [{
'url': 'https://sportdeutschland.tv/blauweissbuchholztanzsport/buchholzer-formationswochenende-2023-samstag-1-bu... | ```suggestion
'description': 'md5:xxx',
``` | from .common import InfoExtractor
from ..utils import (
format_field,
traverse_obj,
unified_timestamp,
strip_or_none
)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://sportdeutschland\.tv/(?P<id>(?:[^/]+/)?[^?#/&]+)'
_TESTS = [{
'url': 'https://sportdeutschland.tv/bla... | @@ -1,95 +1,110 @@
+import time
+import datetime
+
from .common import InfoExtractor
-from ..utils import (
- clean_html,
- float_or_none,
- int_or_none,
- parse_iso8601,
- parse_qs,
- strip_or_none,
- try_get,
-)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://sportdeut... | yt_dlp/extractor/sportdeutschland.py | 15 | Python | 0.571 | suggestion | 57 | 40 | 40 | false | Fix/SportDeutschland extractor | 6,041 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | FriedrichRehren |
'channel_id': '93ca5866-2551-49fc-8424-6db35af58920',
'display_id': '95c80c52-6b9a-4ae9-9197-984145adfced',
'duration': 41097,
'upload_date': '20220309',
'timestamp': 1646860727.0,
}
}]
def _real_extract(self, url):
display_id = self._... | ```suggestion
asset_id = traverse_obj(meta, 'id', 'uuid')
info = {
'id': asset_id,
'channel_url': format_field(meta, ('profile', 'name'), 'https://sportdeutschland.tv/%s'),
**traverse_obj(meta, {
'title': (('title', 'name'), {strip_or_none}),
... | 'description': 'md5:2afb5996ceb9ac0b2ac81f563d3a883e',
'live_status': 'was_live',
'channel': 'Deutscher Badminton Verband',
'channel_url': 'https://sportdeutschland.tv/deutscherbadmintonverband',
'channel_id': '93ca5866-2551-49fc-8424-6db35af58920',
... | @@ -1,95 +1,110 @@
+import time
+import datetime
+
from .common import InfoExtractor
-from ..utils import (
- clean_html,
- float_or_none,
- int_or_none,
- parse_iso8601,
- parse_qs,
- strip_or_none,
- try_get,
-)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://sportdeut... | yt_dlp/extractor/sportdeutschland.py | 26 | Python | 0.786 | suggestion | 585 | 51 | 51 | false | Fix/SportDeutschland extractor | 6,041 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | FriedrichRehren |
elif len(videos) == 1:
info.update(
self.processVideoOrStream(asset_id, videos[0])
)
livestream = meta.get('livestream')
if livestream is not None:
info.update(
self.processVideoOrStream(asset_id, livestream)
)
... | * use fstring
* Don't cancat query, use `query={...}` | if len(videos) > 1:
info.update({
'_type': 'multi_video',
'entries': self.processVideoOrStream(asset_id, video)
} for video in enumerate(videos) if video.get('formats'))
elif len(videos) == 1:
info.update(
self.processV... | @@ -1,95 +1,110 @@
+import time
+import datetime
+
from .common import InfoExtractor
-from ..utils import (
- clean_html,
- float_or_none,
- int_or_none,
- parse_iso8601,
- parse_qs,
- strip_or_none,
- try_get,
-)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://sportdeut... | yt_dlp/extractor/sportdeutschland.py | 26 | Python | 0.429 | suggestion | 54 | 42 | 42 | false | Fix/SportDeutschland extractor | 6,041 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | FriedrichRehren |
self.processVideoOrStream(asset_id, videos[0])
)
livestream = meta.get('livestream')
if livestream is not None:
info.update(
self.processVideoOrStream(asset_id, livestream)
)
return info
def processVideoOrStream(self, as... | ```suggestion
token = self._download_json(
f'https://api.sportdeutschland.tv/api/frontend/asset-token/{asset_id}',
video_id, query={'type': video_type, 'playback_id': video_src})['token']
formats = self._extract_m3u8_formats(f'https://stream.mux.com/{video_src}.m3u8?token={to... | 'entries': self.processVideoOrStream(asset_id, video)
} for video in enumerate(videos) if video.get('formats'))
elif len(videos) == 1:
info.update(
self.processVideoOrStream(asset_id, videos[0])
)
livestream = meta.get('livestream')
... | @@ -1,95 +1,110 @@
+import time
+import datetime
+
from .common import InfoExtractor
-from ..utils import (
- clean_html,
- float_or_none,
- int_or_none,
- parse_iso8601,
- parse_qs,
- strip_or_none,
- try_get,
-)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://sportdeut... | yt_dlp/extractor/sportdeutschland.py | 26 | Python | 1 | refactor | 341 | 39 | 39 | false | Fix/SportDeutschland extractor | 6,041 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | FriedrichRehren |
return info
def processVideoOrStream(self, asset_id, video):
video_id = video.get('id')
video_src = video.get('src')
video_type = video.get('type')
token_data = self._download_json(
'https://api.sportdeutschland.tv/api/frontend/asset-token/' + asset_id
... | ```suggestion
'timestamp': unified_timestamp(video.get('created_at'))
``` |
if livestream is not None:
info.update(
self.processVideoOrStream(asset_id, livestream)
)
return info
def process_video_or_stream(self, asset_id, video):
video_id = video['id']
video_src = video['src']
video_type = video['type']
... | @@ -1,95 +1,110 @@
+import time
+import datetime
+
from .common import InfoExtractor
-from ..utils import (
- clean_html,
- float_or_none,
- int_or_none,
- parse_iso8601,
- parse_qs,
- strip_or_none,
- try_get,
-)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://sportdeut... | yt_dlp/extractor/sportdeutschland.py | 26 | Python | 0.571 | suggestion | 91 | 30 | 30 | false | Fix/SportDeutschland extractor | 6,041 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | FriedrichRehren |
'tags': [],
'like_count': int,
'repost_count': int,
},
'playlist_count': 2,
}, {
# twitch_live provider - error when linked account is not live
'url': 'https://www.tumblr.com/anarcho-skamunist/722224493650722816/hollow-knight-stream-right-now-going... | I think we can simplify by moving `_ambiguous_providers` into `_providers` with values of `None`, see below follow-up suggestions | 'duration': 59,
},
}, {
'note': 'tumblr video AND youtube embed',
'url': 'https://www.tumblr.com/anyaboz/765332564457209856/my-music-video-for-selkie-by-nobodys-wolf-child',
'info_dict': {
'id': '765332564457209856',
'uploader_id': 'anyaboz',
... | @@ -232,13 +216,160 @@ class TumblrIE(InfoExtractor):
'upload_date': '20140429',
},
'add_ie': ['Instagram'],
+ }, {
+ 'note': 'new url scheme',
+ 'url': 'https://www.tumblr.com/catgirldick/706354197596078080?source=share',
+ 'info_dict': {
+ 'id': '70635... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.571 | refactor | 129 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
r'"API_TOKEN":\s*"(\w+)"', login_page, 'API access token', fatal=False)
if not self._ACCESS_TOKEN:
self.report_warning('Failed to get access token; metadata will be missing and some videos may not work')
def _perform_login(self, username, password):
if not self._ACCESS_T... | ```suggestion
expected_status=lambda s: 400 <= s < 500)
``` |
_ACCESS_TOKEN = None
def _initialize_pre_login(self):
login_page = self._download_webpage(
self._LOGIN_URL, None, 'Downloading login page', fatal=False)
if login_page:
self._ACCESS_TOKEN = self._search_regex(
r'"API_TOKEN":\s*"(\w+)"', login_page, 'API a... | @@ -256,23 +387,41 @@ def _perform_login(self, username, password):
if not self._ACCESS_TOKEN:
return
- self._download_json(
- self._OAUTH_URL, None, 'Logging in',
- data=urlencode_postdata({
- 'password': password,
- 'grant_type': 'pass... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
def _perform_login(self, username, password):
if not self._ACCESS_TOKEN:
return
data = {
'password': password,
'grant_type': 'password',
'username': username,
}
if self.get_param('twofactor'):
data['tfa_token'] = self.get_... | Could be better to make error handling non-fatal itself:
```suggestion
if traverse_obj(response, 'error') == 'tfa_required':
``` | def _initialize_pre_login(self):
login_page = self._download_webpage(
self._LOGIN_URL, None, 'Downloading login page', fatal=False)
if login_page:
self._ACCESS_TOKEN = self._search_regex(
r'"API_TOKEN":\s*"(\w+)"', login_page, 'API access token', fatal=False)
... | @@ -256,23 +387,41 @@ def _perform_login(self, username, password):
if not self._ACCESS_TOKEN:
return
- self._download_json(
- self._OAUTH_URL, None, 'Logging in',
- data=urlencode_postdata({
- 'password': password,
- 'grant_type': 'pass... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.929 | suggestion | 139 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
return
data = {
'password': password,
'grant_type': 'password',
'username': username,
}
if self.get_param('twofactor'):
data['tfa_token'] = self.get_param('twofactor')
def _call_login():
return self._download_json(... | ```suggestion
if traverse_obj(response, 'error'):
``` | if login_page:
self._ACCESS_TOKEN = self._search_regex(
r'"API_TOKEN":\s*"(\w+)"', login_page, 'API access token', fatal=False)
if not self._ACCESS_TOKEN:
self.report_warning('Failed to get access token; metadata will be missing and some videos may not work')
... | @@ -256,23 +387,41 @@ def _perform_login(self, username, password):
if not self._ACCESS_TOKEN:
return
- self._download_json(
- self._OAUTH_URL, None, 'Logging in',
- data=urlencode_postdata({
- 'password': password,
- 'grant_type': 'pass... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.714 | suggestion | 63 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
data = {
'password': password,
'grant_type': 'password',
'username': username,
}
if self.get_param('twofactor'):
data['tfa_token'] = self.get_param('twofactor')
def _call_login():
return self._download_json(
sel... | IMO we should raise here
```suggestion
raise ExtractorError(
f'API returned error {': '.join(traverse_obj(response, (("error", "error_description"), {str})))}')
``` | r'"API_TOKEN":\s*"(\w+)"', login_page, 'API access token', fatal=False)
if not self._ACCESS_TOKEN:
self.report_warning('Failed to get access token; metadata will be missing and some videos may not work')
def _perform_login(self, username, password):
if not self._ACCESS_T... | @@ -256,23 +387,41 @@ def _perform_login(self, username, password):
if not self._ACCESS_TOKEN:
return
- self._download_json(
- self._OAUTH_URL, None, 'Logging in',
- data=urlencode_postdata({
- 'password': password,
- 'grant_type': 'pass... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.929 | refactor | 196 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
return self._download_json(
self._OAUTH_URL, None, 'Logging in',
data=urlencode_postdata(data),
headers={
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': f'Bearer {self._ACCESS_TOKEN}',
... | ```suggestion
webpage, urlh = self._download_webpage_handle(
url, video_id, headers={'User-Agent': 'WhatsApp/2.0'}) # whatsapp ua bypasses problems
``` | 'password': password,
'grant_type': 'password',
'username': username,
}
if self.get_param('twofactor'):
data['tfa_token'] = self.get_param('twofactor')
def _call_login():
return self._download_json(
self._OAUTH_URL, Non... | @@ -256,23 +387,41 @@ def _perform_login(self, username, password):
if not self._ACCESS_TOKEN:
return
- self._download_json(
- self._OAUTH_URL, None, 'Logging in',
- data=urlencode_postdata({
- 'password': password,
- 'grant_type': 'pass... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.929 | suggestion | 175 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
def _real_extract(self, url):
blog_1, blog_2, video_id = self._match_valid_url(url).groups()
blog = blog_2 or blog_1
url = f'http://{blog}.tumblr.com/post/{video_id}'
# whatsapp ua makes iab tcf shut the fuck up
webpage, urlh = self._download_webpage_handle(url, video_id, he... | since we have code below attempting to be non-fatal, let's be as safe as possible here
```suggestion
('response', 'timeline', 'elements', 0, {dict})) or {}
content_json = traverse_obj(
post_json, ('trail', 0, 'content', ...), ('content', ...), expected_type=dict)
``` | response = _call_login()
if traverse_obj(response, 'error') == 'tfa_required':
data['tfa_token'] = self._get_tfa_info()
response = _call_login()
if traverse_obj(response, 'error'):
raise ExtractorError(
f'API returned error {": ".join(traverse_... | @@ -291,21 +440,70 @@ def _real_extract(self, url):
video_id, headers={'Authorization': f'Bearer {self._ACCESS_TOKEN}'}, fatal=False),
('response', 'timeline', 'elements', 0)) or {}
content_json = traverse_obj(post_json, ('trail', 0, 'content'), ('content')) or [] | yt_dlp/extractor/tumblr.py | 26 | Python | 0.929 | suggestion | 308 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
info_dict = {
'id': video_id,
'title': post_json.get('summary') or (blog if api_only else self._html_search_regex(
r'(?s)<title>(?P<title>.*?)(?: \| Tumblr)?</title>', webpage, 'title', default=blog)),
'description': description,
'uploader_id': up... | I think we can do this, and reduce indentation below
```suggestion
for video_json in traverse_obj(content_json, lambda _, v: v['type'] in ('video', 'audio')):
``` | # content_json is always the op, so if it exists but has no text, there's no description
if content_json:
description = '\n\n'.join(
item.get('text') for item in content_json if item.get('type') == 'text') or None
else:
description = self._og_search_descri... | @@ -291,21 +440,70 @@ def _real_extract(self, url):
video_id, headers={'Authorization': f'Bearer {self._ACCESS_TOKEN}'}, fatal=False),
('response', 'timeline', 'elements', 0)) or {}
content_json = traverse_obj(post_json, ('trail', 0, 'content'), ('content')) or []
- ... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.857 | suggestion | 173 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
'description': description,
'uploader_id': uploader_id,
'uploader_url': f'https://{uploader_id}.tumblr.com/' if uploader_id else None,
'like_count': post_json.get('like_count'),
'repost_count': post_json.get('reblog_count'),
'age_limit': {True: 18,... | This can be removed if applying the above suggestion about folding `_ambiguous_providers` into `_providers`
```suggestion
``` | description = self._og_search_description(webpage, default=None)
uploader_id = traverse_obj(post_json, 'reblogged_root_name', 'blog_name')
info_dict = {
'id': video_id,
'title': post_json.get('summary') or (blog if api_only else self._html_search_regex(
... | @@ -291,21 +440,70 @@ def _real_extract(self, url):
video_id, headers={'Authorization': f'Bearer {self._ACCESS_TOKEN}'}, fatal=False),
('response', 'timeline', 'elements', 0)) or {}
content_json = traverse_obj(post_json, ('trail', 0, 'content'), ('content')) or []
- ... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.786 | suggestion | 127 | 51 | 51 | false | [ie/Tumblr] Support more URLs | 6,057 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | selfisekai |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.