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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065296/preview.jpg',
'duration': 938.0,
'age_limit': 18,
'tags': 'count:50'
}
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
... | ```suggestion
tags = re.findall(r'<a class="tag_item"\s+href="https://rule34video\.com/tags/\d+/"[^>]*>(?P<tag>[^>]*)</a>', webpage)
```
Also, do we really need to check the URL? Isn't the class enough?
```py
'tags': re.findall(r'<a class="tag_item"[^>]*>(?P<tag>[^>]*)</a>', webpage)
``` | 'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065296/preview.jpg',
'duration': 938.0,
'age_limit': 18,
'tags': 'count:50'
}
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
... | @@ -50,12 +52,14 @@ def _real_extract(self, url):
title = self._html_extract_title(webpage)
thumbnail = self._html_search_regex(r'preview_url:\s+\'([^\']+)\'', webpage, 'thumbnail', default=None)
duration = self._html_search_regex(r'"icon-clock"></i>\s+<span>((?:\d+:?)+)', webpage, 'duration'... | yt_dlp/extractor/rule34video.py | 26 | Python | 0.786 | suggestion | 318 | 37 | 37 | false | [rule34video] Extract tags for videos | 7,117 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | soundchaser128 |
webpage = self._download_webpage(url, video_id)
formats = []
for mobj in re.finditer(r'<a[^>]+href="(?P<video_url>[^"]+download=true[^"]+)".*>(?P<ext>[^\s]+) (?P<quality>[^<]+)p</a>', webpage):
url, ext, quality = mobj.groups()
formats.append({
'url': ur... | ```suggestion
'tags': list(map(unescapeHTML, re.findall(
r'<a class="tag_item"[^>]+\bhref="https://rule34video\.com/tags/\d+/"[^>]*>(?P<tag>[^>]*)</a>', webpage))),
``` | webpage = self._download_webpage(url, video_id)
formats = []
for mobj in re.finditer(r'<a[^>]+href="(?P<video_url>[^"]+download=true[^"]+)".*>(?P<ext>[^\s]+) (?P<quality>[^<]+)p</a>', webpage):
url, ext, quality = mobj.groups()
formats.append({
'url': ur... | @@ -50,12 +52,15 @@ def _real_extract(self, url):
title = self._html_extract_title(webpage)
thumbnail = self._html_search_regex(r'preview_url:\s+\'([^\']+)\'', webpage, 'thumbnail', default=None)
duration = self._html_search_regex(r'"icon-clock"></i>\s+<span>((?:\d+:?)+)', webpage, 'duration'... | yt_dlp/extractor/rule34video.py | 26 | Python | 0.714 | security | 199 | 28 | 27 | false | [rule34video] Extract tags for videos | 7,117 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | soundchaser128 |
from .common import InfoExtractor
from ..utils import traverse_obj
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-Episode49',... | Don't use single use variable
```suggestion
_id, _lang, _type = self._match_valid_url(url).group('id', 'lang', 'type')
``` | float_or_none,
int_or_none,
parse_age_limit,
traverse_obj,
unified_timestamp,
url_or_none,
)
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://weyyak.com/en/... | @@ -0,0 +1,50 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/e... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.929 | suggestion | 133 | 49 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | ItIsRain |
},
}
]
def _real_extract(self, url):
match = self._match_valid_url(url)
# Extract the video id, language and type from the url
_id = match.group('id')
_lang = match.group('lang')
_type = match.group('type')
base_url = f'https://msapifo-prod-... | inline `video_duration` in return | 'info_dict': {
'id': '1341952',
'ext': 'mp4',
'title': 'Ribat Al Hob',
'duration': 2771,
'alt_title': 'رباط الحب',
'season': 'Season 1',
'season_number': 1,
'episode': 'Episode 49'... | @@ -0,0 +1,50 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/e... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.214 | suggestion | 33 | 34 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | ItIsRain |
'duration': 2771,
},
}
]
def _real_extract(self, url):
match = self._match_valid_url(url)
# Extract the video id, language and type from the url
_id = match.group('id')
_lang = match.group('lang')
_type = match.group('type')
... | in yt-dlp, we expect "real" video in output so we need to parse any manifest file. You can use `_extract_m3u8_formats_and_subtitles` from `utils` to parse m3u8 file. It should like this:
```python
video_url = ...
formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_url, _id)
...
```
and then add `... | 'md5': '0caf55c1a615531c8fe60f146ae46849',
'info_dict': {
'id': '1341952',
'ext': 'mp4',
'title': 'Ribat Al Hob',
'duration': 2771,
'alt_title': 'رباط الحب',
'season': 'Season 1',
'sea... | @@ -0,0 +1,50 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/e... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.857 | refactor | 478 | 35 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | ItIsRain |
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-Episode49',
'md5': '0caf55c1a615531c8fe60f146ae46849',
'info_dict': {
'id': '1341952',
'ext': 'm3u8',
'title': 'Ribat Al Hob',
'd... | ```suggestion
video_id = video_info['data']['video_id']
```
mandatory field. | )
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-Episode49',
'md5': '0caf55c1a615531c8fe60f146ae46849',
... | @@ -0,0 +1,50 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/e... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.571 | suggestion | 89 | 43 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-Episode49',
'md5': '0caf55c1a615531c8fe60f146ae46849',
'info_dict': {
'... | ```suggestion
path = 'episode/' if _type == 'episode' else 'contents/moviedetails?contentkey='
video_info = self._download_json(
f'https://msapifo-prod-me.weyyak.z5.com/v1/{_lang}/{path}{_id}', _id,
headers={'Content-Type': 'application/json'})
``` | url_or_none,
)
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-Episode49',
'md5': '0caf55c1a615531c8fe60f146ae468... | @@ -0,0 +1,50 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/e... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.929 | suggestion | 293 | 44 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
'ext': 'm3u8',
'title': 'Ribat Al Hob',
'duration': 2771,
},
}
]
def _real_extract(self, url):
match = self._match_valid_url(url)
# Extract the video id, language and type from the url
_id = match.group('id')
_... | ```suggestion
video_details = self._download_json(
f'https://api-weyyak.akamaized.net/get_info/{video_id}', _id,
'Extracting video details', headers={'Content-Type': 'application/json'})
``` | {
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-Episode49',
'md5': '0caf55c1a615531c8fe60f146ae46849',
'info_dict': {
'id': '1341952',
'ext': 'mp4',
'title': 'Ribat Al Hob',
'duration': 2771,
... | @@ -0,0 +1,50 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/e... | yt_dlp/extractor/weyyak.py | 26 | Python | 1 | refactor | 226 | 37 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
import re
from .common import InfoExtractor
from ..utils import traverse_obj
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-... | Wrong. Should be mp4/ts. See HobbyistDev's comment | from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
parse_age_limit,
traverse_obj,
unified_timestamp,
url_or_none,
)
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
_TESTS ... | @@ -0,0 +1,50 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/e... | yt_dlp/extractor/weyyak.py | 15 | Python | 0.286 | bug | 50 | 40 | 40 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
import re
from .common import InfoExtractor
from ..utils import traverse_obj
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-... | ```suggestion
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)'
```
It does nothing | from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
parse_age_limit,
traverse_obj,
unified_timestamp,
url_or_none,
)
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
_TESTS ... | @@ -0,0 +1,50 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?' | yt_dlp/extractor/weyyak.py | 8 | Python | 0.857 | suggestion | 134 | 33 | 33 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
'info_dict': {
'id': '1341952',
'ext': 'm3u8',
'title': 'Ribat Al Hob',
'duration': 2771,
},
},
{
'url': 'https://weyyak.com/en/movie/233255/8-Seconds',
'md5': 'fe740ae0f63e4d1c8a7fc147a410c56... | since this is not a POST request, the `content-type` header is not needed
```suggestion
video_info = self._download_json(
f'https://msapifo-prod-me.weyyak.z5.com/v1/{_lang}/{path}{_id}', _id)
``` | _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-Episode49',
'md5': '0caf55c1a615531c8fe60f146ae46849',
'info_dict': {
'id'... | @@ -0,0 +1,55 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/epis... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.929 | suggestion | 219 | 44 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
'url': 'https://weyyak.com/en/movie/233255/8-Seconds',
'md5': 'fe740ae0f63e4d1c8a7fc147a410c564',
'info_dict': {
'id': '233255',
'ext': 'm3u8',
'title': '8 Seconds',
'duration': 6490,
},
},
]
... | - if we are not returning the `video_id` var in the info_dict, it's better to not use a var at all
- if there is only 1 video/format URL, it can be fatal
- do not do `re.sub`, we want to extract the master m3u8, not a single media playlist
```suggestion
video_details = self._download_json(
f... | 'title': 'Ribat Al Hob',
'duration': 2771,
'alt_title': 'رباط الحب',
'season': 'Season 1',
'season_number': 1,
'episode': 'Episode 49',
'episode_number': 49,
'timestamp': 1485907200,
... | @@ -0,0 +1,55 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/epis... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.857 | refactor | 552 | 36 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
'title': '8 Seconds',
'duration': 6490,
},
},
]
def _real_extract(self, url):
_id, _lang, _type = self._match_valid_url(url).group('id', 'lang', 'type')
path = 'episode/' if _type == 'episode' else 'contents/moviedetails?contentkey='
... | we do not want this if we are returning `formats`
```suggestion
``` | 'episode': 'Episode 49',
'episode_number': 49,
'timestamp': 1485907200,
'upload_date': '20170201',
'thumbnail': r're:^https://content\.weyyak\.com/.+/poster-image',
'categories': ['Drama', 'Thrillers', 'Romance'],
... | @@ -0,0 +1,55 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/epis... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.571 | suggestion | 69 | 31 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
'duration': 6490,
},
},
]
def _real_extract(self, url):
_id, _lang, _type = self._match_valid_url(url).group('id', 'lang', 'type')
path = 'episode/' if _type == 'episode' else 'contents/moviedetails?contentkey='
video_info = self._download_json(
... | import `float_or_none` from utils
```suggestion
'duration': float_or_none(video_details.get('duration')),
``` | 'episode_number': 49,
'timestamp': 1485907200,
'upload_date': '20170201',
'thumbnail': r're:^https://content\.weyyak\.com/.+/poster-image',
'categories': ['Drama', 'Thrillers', 'Romance'],
'tags': 'count:8',
},
... | @@ -0,0 +1,55 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/epis... | yt_dlp/extractor/weyyak.py | 26 | Python | 0.714 | suggestion | 124 | 30 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
import re
from .common import InfoExtractor
from ..utils import traverse_obj, float_or_none
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/R... | sort
```suggestion
from ..utils import float_or_none, traverse_obj
``` | from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
parse_age_limit,
traverse_obj,
unified_timestamp,
url_or_none,
)
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
_TESTS ... | @@ -0,0 +1,49 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj, float_or_none | yt_dlp/extractor/weyyak.py | 4 | Python | 0.571 | suggestion | 73 | 29 | 29 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
},
{
'url': 'https://weyyak.com/en/movie/233255/8-Seconds',
'md5': 'fe740ae0f63e4d1c8a7fc147a410c564',
'info_dict': {
'id': '233255',
'ext': 'mp4',
'title': '8 Seconds',
'duration': 6490,
},
... | ```suggestion
video_id, lang, type_ = self._match_valid_url(url).group('id', 'lang', 'type')
path = 'episode/' if type_ == 'episode' else 'contents/moviedetails?contentkey='
video_info = self._download_json(
f'https://msapifo-prod-me.weyyak.z5.com/v1/{lang}/{path}{video_id}', v... | 'md5': '0caf55c1a615531c8fe60f146ae46849',
'info_dict': {
'id': '1341952',
'ext': 'mp4',
'title': 'Ribat Al Hob',
'duration': 2771,
'alt_title': 'رباط الحب',
'season': 'Season 1',
'sea... | @@ -0,0 +1,47 @@
+from .common import InfoExtractor
+from ..utils import float_or_none, traverse_obj
+
+
+class WeyyakIE(InfoExtractor):
+ _VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/(?:player/)?(?P<type>episode|movie)/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://weyyak.com/en/player/ep... | yt_dlp/extractor/weyyak.py | 26 | Python | 1 | refactor | 680 | 32 | 51 | false | Weyyak latest | 7,124 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
def _extract_audio(self, entry, audio_id):
formats = []
for audio in traverse_obj(entry, ('audioLinks', lambda _, v: url_or_none(v['url']))):
ext = audio.get('variant')
try:
if ext == 'dash':
formats.extend(self._extract_mpd_formats(
... | this could cause an infinite loop, use `RetryManager` instead | }, {
'md5': '6e729fa39b647325b868d419c76f3efa',
'info_dict': {
'id': '9890734',
'ext': 'mp3',
'title': 'Neklid #5',
'description': '5. díl: Neklid: 5. díl',
'duration': 908,
'artist': 'Josef K... | @@ -166,27 +169,42 @@ class RozhlasVltavaIE(InfoExtractor):
}],
'params': {'skip_download': 'dash'},
}]
+ _429_TIMEOUT = 1
- def _extract_video(self, entry):
+ def _extract_audio(self, entry, audio_id):
formats = []
- audio_id = entry['meta']['ga']['contentId']
... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.429 | bug | 61 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
'title': ('meta', 'ga', 'contentName'),
'description': 'title',
'duration': ('duration', {int_or_none}),
'artist': ('meta', 'ga', 'contentAuthor'),
'channel_id': ('meta', 'ga', 'contentCreator'),
})
}
def _real_extr... | do not subclass from concrete IE, add a base class instead | **traverse_obj(entry, {
'title': ('meta', 'ga', 'contentName'),
'description': 'title',
'duration': ('duration', {int_or_none}),
'artist': ('meta', 'ga', 'contentAuthor'),
'channel_id': ('meta', 'ga', 'contentCreator'),
... | @@ -219,3 +237,133 @@ def _real_extract(self, url):
'title': traverse_obj(data, ('series', 'title')),
'entries': map(self._extract_video, data['playlist']),
}
+
+
+class MujRozhlasIE(RozhlasVltavaIE): | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.286 | suggestion | 58 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
from .common import InfoExtractor
from ..utils import (
extract_attributes,
int_or_none,
remove_start,
str_or_none,
traverse_obj,
url_or_none,
ExtractorError,
unified_timestamp,
)
from urllib.error import HTTPError
class RozhlasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?p... | sort these (use `isort`, or manually sort alphabetically with classes first, then functions) | import itertools
import urllib.error
from .common import InfoExtractor
from ..utils import (
ExtractorError,
extract_attributes,
int_or_none,
remove_start,
str_or_none,
traverse_obj,
unified_timestamp,
url_or_none,
)
class RozhlasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.... | @@ -6,7 +6,10 @@
str_or_none,
traverse_obj,
url_or_none,
+ ExtractorError,
+ unified_timestamp, | yt_dlp/extractor/rozhlas.py | 10 | Python | 0.429 | style | 92 | 35 | 35 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
from .common import InfoExtractor
from ..utils import (
extract_attributes,
int_or_none,
remove_start,
str_or_none,
traverse_obj,
url_or_none,
ExtractorError,
unified_timestamp,
)
from urllib.error import HTTPError
class RozhlasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?p... | `import urllib.error` and move to top of file | import itertools
import urllib.error
from .common import InfoExtractor
from ..utils import (
ExtractorError,
extract_attributes,
int_or_none,
remove_start,
str_or_none,
traverse_obj,
unified_timestamp,
url_or_none,
)
class RozhlasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.... | @@ -6,7 +6,10 @@
str_or_none,
traverse_obj,
url_or_none,
+ ExtractorError,
+ unified_timestamp,
)
+from urllib.error import HTTPError | yt_dlp/extractor/rozhlas.py | 12 | Python | 0.429 | suggestion | 45 | 37 | 37 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
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_search_title(webpage), 'Radio Wave - ')
description = self._html_search_regex(
r'<p[^>]+title=(... | ```suggestion
def _extract_formats(self, entry, audio_id):
```
Remove vars. `_VALID_URL` is not necessary in base class
Also, `_extract_formats` is the conventional name for this kind of method | 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_... | @@ -51,7 +54,45 @@ def _real_extract(self, url):
}
-class RozhlasVltavaIE(InfoExtractor):
+class RozhlasBaseIE(InfoExtractor):
+ _VALID_URL = None
+ _429_TIMEOUT = 1
+
+ def _extract_audio(self, entry, audio_id): | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.857 | refactor | 201 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
formats = []
for audio in traverse_obj(entry, ('audioLinks', lambda _, v: url_or_none(v['url']))):
ext = audio.get('variant')
for retry in self.RetryManager():
try:
if ext == 'dash':
formats.extend(self._extract_mpd_form... | ```suggestion
for retry in self.RetryManager():
if retry.attempt > 1:
self._sleep(1, audio_id)
try:
if ext == 'dash':
formats.extend(self._extract_mpd_formats(
audio['url'], aud... | for audio in traverse_obj(entry, ('audioLinks', lambda _, v: url_or_none(v['url']))):
ext = audio.get('variant')
for retry in self.RetryManager():
if retry.attempt > 1:
self._sleep(1, audio_id)
try:
if ext == 'dash':... | @@ -51,7 +54,45 @@ def _real_extract(self, url):
}
-class RozhlasVltavaIE(InfoExtractor):
+class RozhlasBaseIE(InfoExtractor):
+ _VALID_URL = None
+ _429_TIMEOUT = 1
+
+ def _extract_audio(self, entry, audio_id):
+ formats = []
+ for audio in traverse_obj(entry, ('audioLinks', lambda... | yt_dlp/extractor/rozhlas.py | 26 | Python | 1 | refactor | 1,187 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
formats.extend(self._extract_mpd_formats(
audio['url'], audio_id, mpd_id=ext))
elif ext == 'hls':
formats.extend(self._extract_m3u8_formats(
audio['url'], audio_id, 'm4a', m3u8_id=ext))
... | not necessary
```suggestion
``` | if ext == 'dash':
formats.extend(self._extract_mpd_formats(
audio['url'], audio_id, mpd_id=ext))
elif ext == 'hls':
formats.extend(self._extract_m3u8_formats(
audio['url'], aud... | @@ -51,7 +54,45 @@ def _real_extract(self, url):
}
-class RozhlasVltavaIE(InfoExtractor):
+class RozhlasBaseIE(InfoExtractor):
+ _VALID_URL = None
+ _429_TIMEOUT = 1
+
+ def _extract_audio(self, entry, audio_id):
+ formats = []
+ for audio in traverse_obj(entry, ('audioLinks', lambda... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.429 | suggestion | 35 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
}]
}, {
'url': 'https://dvojka.rozhlas.cz/karel-siktanc-cerny-jezdec-bily-kun-napinava-pohadka-o-tajemnem-prizraku-8946969',
'info_dict': {
'id': '8946969',
'title': 'Karel Šiktanc: Černý jezdec, bílý kůň. Napínavá pohádka o tajemném přízraku',
},
'pla... | inline `formats` in return and change to new method name | 'info_dict': {
'id': '8946969',
'title': 'Karel Šiktanc: Černý jezdec, bílý kůň. Napínavá pohádka o tajemném přízraku',
},
'playlist_count': 1,
'playlist': [{
'info_dict': {
'id': '10631121',
'ext': 'm4a',
... | @@ -168,25 +209,9 @@ class RozhlasVltavaIE(InfoExtractor):
}]
def _extract_video(self, entry):
- formats = []
audio_id = entry['meta']['ga']['contentId']
- for audio in traverse_obj(entry, ('audioLinks', lambda _, v: url_or_none(v['url']))):
- ext = audio.get('variant')
- ... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.429 | style | 56 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
'channel_id': ('meta', 'ga', 'contentCreator'),
})
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
# FIXME: Use get_element_text_and_html_by_tag when it accepts less strict html
data ... | This test fails. No `ext` field. Also, this formatting is wrong. Use the info_dict that the test_download script outputs | webpage = self._download_webpage(url, video_id)
# FIXME: Use get_element_text_and_html_by_tag when it accepts less strict html
data = self._parse_json(extract_attributes(self._search_regex(
r'(<div class="mujRozhlasPlayer" data-player=\'[^\']+\'>)',
webpage, 'player'))['... | @@ -219,3 +244,133 @@ def _real_extract(self, url):
'title': traverse_obj(data, ('series', 'title')),
'entries': map(self._extract_video, data['playlist']),
}
+
+
+class MujRozhlasIE(RozhlasBaseIE):
+ _VALID_URL = r'https?://(?:www\.)?mujrozhlas\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
+ ... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.571 | bug | 120 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
class MujRozhlasIE(RozhlasBaseIE):
_VALID_URL = r'https?://(?:www\.)?mujrozhlas\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.mujrozhlas.cz/vykopavky/ach-jo-zase-teleci-rizek-je-mnohem-min-cesky-nez-jsme-si-mysleli',
'info_dict': {'id': '10739193',
'title... | Are these playlists? Add `playlist_count` or `playlist_mincount` to them. Also would help to add notes/comments of which test is a `show` and which test is a `serial` | 'info_dict': {
'id': '10739193',
'ext': 'mp3',
'title': 'Ach jo, zase to telecí! Řízek je mnohem míň český, než jsme si mysleli',
'description': 'md5:db7141e9caaedc9041ec7cefb9a62908',
'timestamp': 1684915200,
'modified_timestamp': 16849224... | @@ -219,3 +244,133 @@ def _real_extract(self, url):
'title': traverse_obj(data, ('series', 'title')),
'entries': map(self._extract_video, data['playlist']),
}
+
+
+class MujRozhlasIE(RozhlasBaseIE):
+ _VALID_URL = r'https?://(?:www\.)?mujrozhlas\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
+ ... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.5 | suggestion | 166 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
'url': 'https://www.mujrozhlas.cz/vykopavky/ach-jo-zase-teleci-rizek-je-mnohem-min-cesky-nez-jsme-si-mysleli',
'info_dict': {'id': '10739193',
'title': 'Ach jo, zase to telecí! Řízek je mnohem míň český, než jsme si mysleli',
'description': 'md5:db7141e9caaedc... | A `_call_api` method would help simplify
```suggestion
def _call_api(self, path, item_id, msg='API JSON'):
return self._download_json(
f'https://api.mujrozhlas.cz/{path}/{item_id}', item_id,
note=f'Downloading {msg}', errnote=f'Failed to download {msg}')['data']
``` | 'title': 'Ach jo, zase to telecí! Řízek je mnohem míň český, než jsme si mysleli',
'description': 'md5:db7141e9caaedc9041ec7cefb9a62908',
'timestamp': 1684915200,
'modified_timestamp': 1684922446,
'series': 'Vykopávky',
'thumbnail': 'https://portal... | @@ -219,3 +244,133 @@ def _real_extract(self, url):
'title': traverse_obj(data, ('series', 'title')),
'entries': map(self._extract_video, data['playlist']),
}
+
+
+class MujRozhlasIE(RozhlasBaseIE):
+ _VALID_URL = r'https?://(?:www\.)?mujrozhlas\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
+ ... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.857 | bug | 308 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
thumbnail = traverse_obj(entry, ('attributes', 'asset', 'url'))
# these can be pretty large, e.g. https://api.mujrozhlas.cz/episodes/8ad147a0-d971-3fb2-9e6b-552a60f335fb
# with a 2100x1400 jpeg
timestamp = unified_timestamp(traverse_obj(entry, ('attributes', 'since')))
modified... | ```suggestion
def _extract_audio_entry(self, entry):
audio_id = entry['meta']['ga']['contentId']
return {
'id': audio_id,
'formats': self._extract_formats(entry['attributes'], audio_id),
**traverse_obj(entry, {
'title': ('attributes', 'tit... |
def _extract_audio_entry(self, entry):
audio_id = entry['meta']['ga']['contentId']
return {
'id': audio_id,
'formats': self._extract_formats(entry['attributes'], audio_id),
**traverse_obj(entry, {
'title': ('attributes', 'title'),
... | @@ -219,3 +244,133 @@ def _real_extract(self, url):
'title': traverse_obj(data, ('series', 'title')),
'entries': map(self._extract_video, data['playlist']),
}
+
+
+class MujRozhlasIE(RozhlasBaseIE):
+ _VALID_URL = r'https?://(?:www\.)?mujrozhlas\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
+ ... | yt_dlp/extractor/rozhlas.py | 26 | Python | 0.857 | security | 983 | 51 | 51 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
entity = info['siteEntityBundle']
if entity == 'show':
uuid = info['contentShow'].split(':')[0]
return self._get_episodes(f'{self._API_ROOT}/shows/{uuid}', uuid)
elif entity == 'serial':
uuid = info['contentId']
return self._get_episodes(f'{self._A... | Rewrite to simplify. `import itertools`
```suggestion
def _entries(self, api_url, playlist_id):
for page in itertools.count(1):
episodes = self._download_json(
api_url, playlist_id, note=f'Downloading episodes page {page}',
errnote=f'Failed to download episo... | import itertools
import urllib.error
from .common import InfoExtractor
from ..utils import (
ExtractorError,
extract_attributes,
int_or_none,
remove_start,
str_or_none,
traverse_obj,
unified_timestamp,
url_or_none,
)
class RozhlasIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.... | @@ -219,3 +244,133 @@ def _real_extract(self, url):
'title': traverse_obj(data, ('series', 'title')),
'entries': map(self._extract_video, data['playlist']),
}
+
+
+class MujRozhlasIE(RozhlasBaseIE):
+ _VALID_URL = r'https?://(?:www\.)?mujrozhlas\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
+ ... | yt_dlp/extractor/rozhlas.py | 26 | Python | 1 | bug | 1,942 | 27 | 344 | false | [extractor/rozhlas] Add `MujRozhlas` extractor | 7,129 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | stanoarn |
},
}]
def _extract_formats(self, video_id, fileurl):
up = urllib.parse.urlparse(fileurl)
q = urllib.parse.parse_qs(up.query)
paths = up.path.rstrip('/').split('/')
# https://github.com/yt-dlp/yt-dlp/issues/6549#issuecomment-1473771047
x_version = hashlib.sha1('_'... | line too long
```suggestion
video_data = self._download_json(
f'https://api.iwara.tv/video/{video_id}', video_id,
expected_status=lambda x: True, headers=self._prepare_auth_header())
``` | 'id': 'blggmfno8ghl725bg',
'ext': 'mp4',
'age_limit': 18,
'title': 'お外でおしっこしちゃう猫耳ロリメイド',
'description': 'md5:0342ba9bf6db09edbbb28729657c3611',
'uploader': 'Fe_Kurosabi',
'uploader_id': 'fekurosabi',
'tags': [
... | @@ -142,11 +145,8 @@ def _extract_formats(self, video_id, fileurl):
def _real_extract(self, url):
video_id = self._match_id(url)
- username, password = self._get_login_info()
- headers = {
- 'Authorization': f'Bearer {self._get_media_token()}',
- } if username and passwor... | yt_dlp/extractor/iwara.py | 26 | Python | 0.786 | security | 223 | 51 | 51 | false | [extractor/iwara] Fix and improve authentication | 7,137 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | toomyzoom |
def _get_user_token(self, invalidate=False):
if not invalidate and self._USERTOKEN:
return self._USERTOKEN
username, password = self._get_login_info()
IwaraBaseIE._USERTOKEN = username and self.cache.load(self._NETRC_MACHINE, username)
if not IwaraBaseIE._USERTOKEN or i... | ```suggestion
if not invalidate and self._MEDIATOKEN:
return self._MEDIATOKEN
elif invalidate:
IwaraBaseIE._MEDIATOKEN = None
```
or else an expired(?) token will still be returned if the exception below is caught | _NETRC_MACHINE = 'iwara'
_USERTOKEN = None
_MEDIATOKEN = None
def _is_token_expired(self, token, token_type):
# User token TTL == ~3 weeks, Media token TTL == ~1 hour
if (try_call(lambda: jwt_decode_hs256(token)['exp']) or 0) <= int(time.time() - 120):
self.to_screen(f'{toke... | @@ -46,14 +46,17 @@ def _get_media_token(self, invalidate=False):
if not invalidate and self._MEDIATOKEN:
return self._MEDIATOKEN
| yt_dlp/extractor/iwara.py | 26 | Python | 0.929 | suggestion | 259 | 51 | 51 | false | [extractor/iwara] Fix and improve authentication | 7,137 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | toomyzoom |
'email': username,
'password': password
}).encode('utf-8'),
headers={
'Content-Type': 'application/json'
})['token']
self.cache.store(self._NETRC_MACHINE, username, IwaraBaseIE._USERTOKEN)
r... | make sure to `import urllib.error`
```suggestion
except ExtractorError as e:
if not isinstance(e.cause, urllib.error.HTTPError) and e.cause.code == 403:
raise
self.to_screen('User token has expired')
``` | username, password = self._get_login_info()
if not username or not password:
return
user_token = IwaraBaseIE._USERTOKEN or self.cache.load(self._NETRC_MACHINE, username)
if not user_token or self._is_token_expired(user_token, 'User'):
response = self._download_js... | @@ -46,14 +46,17 @@ def _get_media_token(self, invalidate=False):
if not invalidate and self._MEDIATOKEN:
return self._MEDIATOKEN
- IwaraBaseIE._MEDIATOKEN = self._download_json(
- 'https://api.iwara.tv/user/token', None, note='Fetching media token',
- data=b'', # N... | yt_dlp/extractor/iwara.py | 26 | Python | 1 | refactor | 257 | 51 | 51 | false | [extractor/iwara] Fix and improve authentication | 7,137 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | toomyzoom |
'view_count': 'numViews',
'comment_count': 'numComments',
'timestamp': ('createdAt', {unified_timestamp}),
'modified_timestamp': ('updatedAt', {unified_timestamp}),
'thumbnail': ('file', 'id', {str}, {
lambda x: f'https:... | ```suggestion
if username and password:
self._get_media_token()
return {'Authorization': f'Bearer {self._MEDIATOKEN}'} if self._MEDIATOKEN else None
``` | self.raise_login_required('Private video. Login if you have permissions to watch', method='password')
elif errmsg == 'errors.notFound' and not username:
self.raise_login_required('Video may need login to view', method='password')
elif errmsg: # None if success
raise ... | @@ -190,8 +190,16 @@ def _perform_login(self, username, password):
self._get_media_token(True)
self.cache.store(self._NETRC_MACHINE, username, IwaraBaseIE._USERTOKEN)
+ def _prepare_auth_header(self):
+ username, password = self._get_login_info()
+ headers = {
+ 'Authoriz... | yt_dlp/extractor/iwara.py | 26 | Python | 0.786 | security | 186 | 51 | 51 | false | [extractor/iwara] Fix and improve authentication | 7,137 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | toomyzoom |
def test_cookiejar(self):
with FakeYDL() as ydl:
ydl.cookiejar.set_cookie(http.cookiejar.Cookie(
0, 'test', 'ytdlp', None, False, '127.0.0.1', True,
False, '/headers', True, False, None, False, None, None, {}))
data = ydl.urlopen(sanitized_Request(f'ht... | Maybe instead of checking the response, how about doing
```suggestion
@skipUnless(brotli, 'brotli support is not installed')
def test_brotli(self):
```
for all tests that use brotli? | def test_cookiejar(self):
with FakeYDL() as ydl:
ydl.cookiejar.set_cookie(http.cookiejar.Cookie(
0, 'test', 'ytdlp', None, False, '127.0.0.1', True,
False, '/headers', True, False, None, False, None, None, {}))
data = ydl.urlopen(sanitized_Request(f'ht... | @@ -302,6 +329,58 @@ def test_gzip_trailing_garbage(self):
data = ydl.urlopen(sanitized_Request(f'http://localhost:{self.http_port}/trailing_garbage')).read().decode('utf-8')
self.assertEqual(data, '<html><video src="/vid.mp4" /></html>')
+ def test_brotli(self): | test/test_http.py | 26 | Python | 0.786 | question | 195 | 51 | 51 | false | [core] Support decoding multiple content encodings | 7,142 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | coletdjnz |
return self.do_open(functools.partial(
_create_http_connection, self, conn_class, False),
req)
@staticmethod
def deflate(data):
if not data:
return data
try:
return zlib.decompress(data, -zlib.MAX_WBITS)
except zlib.error:
... | Maybe this should be renamed to `os_error` or it should catch `IOError`? Not sure which one it is since the `gzip` docs are not that clear... |
return self.do_open(functools.partial(
_create_http_connection, self, conn_class, False),
req)
@staticmethod
def deflate(data):
if not data:
return data
try:
return zlib.decompress(data, -zlib.MAX_WBITS)
except zlib.error:
... | @@ -1361,6 +1361,23 @@ def brotli(data):
return data
return brotli.decompress(data)
+ @staticmethod
+ def gz(data):
+ gz = gzip.GzipFile(fileobj=io.BytesIO(data), mode='rb')
+ try:
+ return gz.read()
+ except OSError as original_ioerror: | yt_dlp/utils/_utils.py | 26 | Python | 0.714 | suggestion | 141 | 51 | 51 | false | [core] Support decoding multiple content encodings | 7,142 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | coletdjnz |
elif self.path.startswith('/method'):
self._method('GET')
elif self.path.startswith('/headers'):
self._headers()
elif self.path == '/trailing_garbage':
payload = b'<html><video src="/vid.mp4" /></html>'
self.send_response(200)
self.send... | It seems strange to `str.split` here and then `",".join` them later down.
```suggestion
encodings = self.headers.get('ytdl-encoding')
payload = b'<html><video src="/vid.mp4" /></html>'
for encoding in filter(None, (encodings or '').split(',')):
```
```diff
- el... | elif self.path.startswith('/method'):
self._method('GET')
elif self.path.startswith('/headers'):
self._headers()
elif self.path == '/trailing_garbage':
payload = b'<html><video src="/vid.mp4" /></html>'
self.send_response(200)
self.send... | @@ -148,6 +150,31 @@ def do_GET(self):
self.send_header('Location', new_url)
self.send_header('Content-Length', '0')
self.end_headers()
+ elif self.path == '/content-encoding':
+ encodings = self.headers.get('ytdl-encoding', '').split(',')
+ payload = ... | test/test_http.py | 26 | Python | 0.786 | suggestion | 608 | 51 | 51 | false | [core] Support decoding multiple content encodings | 7,142 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | coletdjnz |
return data
try:
return zlib.decompress(data, -zlib.MAX_WBITS)
except zlib.error:
return zlib.decompress(data)
@staticmethod
def brotli(data):
if not data:
return data
return brotli.decompress(data)
@staticmethod
def gz(da... | Could you introspect the error object and see if we have access to the required offset? I don't like the idea of re-reading in a loop if it can be helped. | return data
try:
return zlib.decompress(data, -zlib.MAX_WBITS)
except zlib.error:
return zlib.decompress(data)
@staticmethod
def brotli(data):
if not data:
return data
return brotli.decompress(data)
@staticmethod
def gz(da... | @@ -1361,6 +1361,23 @@ def brotli(data):
return data
return brotli.decompress(data)
+ @staticmethod
+ def gz(data):
+ gz = gzip.GzipFile(fileobj=io.BytesIO(data), mode='rb')
+ try:
+ return gz.read()
+ except OSError as original_ioerror:
+ # There... | yt_dlp/utils/_utils.py | 26 | Python | 0.571 | question | 154 | 51 | 51 | false | [core] Support decoding multiple content encodings | 7,142 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
_USER_TOKEN = None
def _extract_app_token(self, webpage):
config_js_path = self._search_regex(
r'<script[^>]+src\s*=\s*"([^"]+coreConfig.js[^"]+)', webpage, 'config_js_url', fatal=False)
mediation_config = {} if not config_js_path else self._search_json(
r'mediation\s*... | `data={}` will not work with networking overhaul
```suggestion
bearer_token = self._download_json(
'https://eu-gateway.inmobly.com/applications/oauth', None, data=b'', note='Retrieving bearer token',
headers={'Authorization': f'Basic {app_token}'})['token']
``` |
_USER_TOKEN = None
def _extract_app_token(self, webpage):
config_js_path = self._search_regex(
r'<script[^>]+src\s*=\s*"([^"]+coreConfig.js[^"]+)', webpage, 'config js url', fatal=False)
mediation_config = {} if not config_js_path else self._search_json(
r'mediation\s*... | @@ -0,0 +1,139 @@
+import base64
+import itertools
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?]+)'
+ _NE... | yt_dlp/extractor/caracoltv.py | 26 | Python | 0.786 | security | 298 | 51 | 51 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
'description': 'md5:bc49c6d64d20610ea1e7daf079a0d013',
'thumbnail': r're:^https?://[^?#]+63b39f6b354977084b85ab54',
'ext': 'mp4',
},
}, {
'url': 'https://noticias.canal1.com.co/noticias/tres-i-el-triste-record-que-impuso-elon-musk-el-dueno-de-tesla-y-de-twitter/',... | ```suggestion
self._search_regex(r'"embedUrl"\s*:\s*"([^"]+)', webpage, 'embed url'),
``` | 'description': 'md5:bc49c6d64d20610ea1e7daf079a0d013',
'thumbnail': r're:^https?://[^?#]+63b39f6b354977084b85ab54',
'ext': 'mp4',
},
}, {
'url': 'https://noticias.canal1.com.co/noticias/tres-i-el-triste-record-que-impuso-elon-musk-el-dueno-de-tesla-y-de-twitter/',... | @@ -0,0 +1,39 @@
+from .common import InfoExtractor
+
+
+class Canal1IE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|noticias\.)?canal1\.com\.co/(?:[^?&])+/(?P<id>[\w-]+)'
+
+ _TESTS = [{
+ 'url': 'https://canal1.com.co/noticias/napa-i-una-cadena-de-produccion-de-arroz-que-se-quedo-en-veremos-y-aband... | yt_dlp/extractor/canal1.py | 26 | Python | 0.714 | suggestion | 103 | 28 | 28 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
from .common import InfoExtractor
class Canal1IE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.|noticias\.)?canal1\.com\.co/(?:[^?&])+/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://canal1.com.co/noticias/napa-i-una-cadena-de-produccion-de-arroz-que-se-quedo-en-veremos-y-abandonada-en-el-departamento-... | ```suggestion
_VALID_URL = r'https?://(?:www\.|noticias\.)?canal1\.com\.co/(?:[^?#&])+/(?P<id>[\w-]+)'
``` | from .common import InfoExtractor
class Canal1IE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.|noticias\.)?canal1\.com\.co/(?:[^?#&])+/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://canal1.com.co/noticias/napa-i-una-cadena-de-produccion-de-arroz-que-se-quedo-en-veremos-y-abandonada-en-el-departamento... | @@ -0,0 +1,39 @@
+from .common import InfoExtractor
+
+
+class Canal1IE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|noticias\.)?canal1\.com\.co/(?:[^?&])+/(?P<id>[\w-]+)' | yt_dlp/extractor/canal1.py | 5 | Python | 0.714 | suggestion | 112 | 30 | 30 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
import base64
import itertools
import json
import uuid
from .common import InfoExtractor
from ..utils import (
js_to_json,
traverse_obj,
urljoin,
)
class CaracolTvPlayIE(InfoExtractor):
_VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?]+)'
_NETRC_MACHINE = 'caracoltv-play'
... | ```suggestion
_VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?#]+)'
``` | import base64
import json
import uuid
from .common import InfoExtractor
from ..utils import (
int_or_none,
js_to_json,
traverse_obj,
urljoin,
)
class CaracolTvPlayIE(InfoExtractor):
_VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?#]+)'
_NETRC_MACHINE = 'caracoltv-play'
... | @@ -0,0 +1,139 @@
+import base64
+import itertools
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?]+)' | yt_dlp/extractor/caracoltv.py | 15 | Python | 0.571 | suggestion | 98 | 40 | 40 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
}, {
'url': 'https://play.caracoltv.com/videoDetails/OTo3OWM4ZTliYzQxMmM0MTMxYTk4Mjk2YjdjNGQ4NGRkOQ==/ella?season=0',
'info_dict': {
'id': 'OTo3OWM4ZTliYzQxMmM0MTMxYTk4Mjk2YjdjNGQ4NGRkOQ==',
'title': 'Ella',
'description': 'md5:a639b1feb5ddcc0cff92a489b4e544b8',
... | ```suggestion
r'<script[^>]+src\s*=\s*"([^"]+coreConfig\.js[^"]+)', webpage, 'config js url', fatal=False)
``` | }, {
'url': 'https://play.caracoltv.com/videoDetails/OTo3OWM4ZTliYzQxMmM0MTMxYTk4Mjk2YjdjNGQ4NGRkOQ==/ella?season=0',
'info_dict': {
'id': 'OTo3OWM4ZTliYzQxMmM0MTMxYTk4Mjk2YjdjNGQ4NGRkOQ==',
'title': 'Ella',
'description': 'md5:a639b1feb5ddcc0cff92a489b4e544b8',
... | @@ -0,0 +1,139 @@
+import base64
+import itertools
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?]+)'
+ _NE... | yt_dlp/extractor/caracoltv.py | 26 | Python | 0.714 | suggestion | 124 | 51 | 51 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
},
'login_data': {
'enabled': True,
'email': email,
'password': password,
}
}).encode())['user_token']
def _perform_login(self, username, password):
self._login(username, password)
d... | ```suggestion
'season_number': int_or_none(season_number),
'episode_number': int_or_none(video_data.get('item_order')),
``` | },
'login_data': {
'enabled': True,
'email': email,
'password': password,
}
}).encode())['user_token']
def _extract_video(self, video_data, series_id=None, season_id=None, season_number=None):
... | @@ -0,0 +1,139 @@
+import base64
+import itertools
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?]+)'
+ _NE... | yt_dlp/extractor/caracoltv.py | 26 | Python | 0.714 | suggestion | 150 | 51 | 51 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
},
'playlist_count': 17,
}, {
'url': 'https://play.caracoltv.com/videoDetails/MzoxX3BwbjRmNjB1',
'only_matching': True,
}]
_USER_TOKEN = None
def _extract_app_token(self, webpage):
config_js_path = self._search_regex(
r'<script[^>]+src\s*=\s*"([^"]+c... | ```suggestion
def _perform_login(self, email, password):
``` | },
'playlist_count': 17,
}, {
'url': 'https://play.caracoltv.com/videoDetails/MzoxX3BwbjRmNjB1',
'only_matching': True,
}]
_USER_TOKEN = None
def _extract_app_token(self, webpage):
config_js_path = self._search_regex(
r'<script[^>]+src\s*=\s*"([^"]+c... | @@ -0,0 +1,139 @@
+import base64
+import itertools
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?]+)'
+ _NE... | yt_dlp/extractor/caracoltv.py | 26 | Python | 0.571 | suggestion | 66 | 51 | 51 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
'title': video_data.get('name'),
'description': video_data.get('description'),
'formats': formats,
'subtitles': subtitles,
'thumbnails': traverse_obj(
video_data, ('extra_thumbs', ..., {'url': 'thumb_url', 'height': 'height', 'width': 'width'})... | ```suggestion
self._perform_login('guest@inmobly.com', 'Test@gus1')
``` | 'subtitles': subtitles,
'thumbnails': traverse_obj(
video_data, ('extra_thumbs', ..., {'url': 'thumb_url', 'height': 'height', 'width': 'width'})),
'series_id': series_id,
'season_id': season_id,
'season_number': int_or_none(season_number),
... | @@ -0,0 +1,139 @@
+import base64
+import itertools
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?]+)'
+ _NE... | yt_dlp/extractor/caracoltv.py | 26 | Python | 0.571 | suggestion | 85 | 43 | 40 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
r'<script[^>]+src\s*=\s*"([^"]+coreConfig.js[^"]+)', webpage, 'config js url', fatal=False)
mediation_config = {} if not config_js_path else self._search_json(
r'mediation\s*:', self._download_webpage(
urljoin('https://play.caracoltv.com/', config_js_path), None, fatal=F... | ```suggestion
'Authorization': f'Bearer {bearer_token}',
``` | r'<script[^>]+src\s*=\s*"([^"]+coreConfig.js[^"]+)', webpage, 'config js url', fatal=False)
mediation_config = {} if not config_js_path else self._search_json(
r'mediation\s*:', self._download_webpage(
urljoin('https://play.caracoltv.com/', config_js_path), None, fatal=F... | @@ -0,0 +1,136 @@
+import base64
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?#]+)'
+ _N... | yt_dlp/extractor/caracoltv.py | 26 | Python | 0.571 | security | 78 | 51 | 51 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
}
}).encode())['user_token']
def _extract_video(self, video_data, series_id=None, season_id=None, season_number=None):
formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_data['stream_url'], series_id, 'mp4')
return {
'id': video_data['id'],
... | ```suggestion
headers={'Authorization': f'Bearer {self._USER_TOKEN}'})
``` | }
}).encode())['user_token']
def _extract_video(self, video_data, series_id=None, season_id=None, season_number=None):
formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_data['stream_url'], series_id, 'mp4')
return {
'id': video_data['id'],
... | @@ -0,0 +1,136 @@
+import base64
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?#]+)'
+ _N... | yt_dlp/extractor/caracoltv.py | 26 | Python | 0.643 | security | 92 | 51 | 51 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
'series_id': series_id,
'season_id': season_id,
'season_number': int_or_none(season_number),
'episode_number': int_or_none(video_data.get('item_order')),
'is_live': video_data.get('entry_type') == 3,
}
def _extract_series_seasons(self, seasons, se... | ```suggestion
headers={'Authorization': f'Bearer {self._USER_TOKEN}'})['items'][0]
``` | 'series_id': series_id,
'season_id': season_id,
'season_number': int_or_none(season_number),
'episode_number': int_or_none(video_data.get('item_order')),
'is_live': video_data.get('entry_type') == 3,
}
def _extract_series_seasons(self, seasons, se... | @@ -0,0 +1,136 @@
+import base64
+import json
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ js_to_json,
+ traverse_obj,
+ urljoin,
+)
+
+
+class CaracolTvPlayIE(InfoExtractor):
+ _VALID_URL = r'https?://play\.caracoltv\.com/videoDetails/(?P<id>[^/?#]+)'
+ _N... | yt_dlp/extractor/caracoltv.py | 26 | Python | 0.786 | security | 100 | 37 | 37 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
'description': 'md5:bc49c6d64d20610ea1e7daf079a0d013',
'thumbnail': r're:^https?://[^?#]+63b39f6b354977084b85ab54',
'ext': 'mp4',
},
}, {
'url': 'https://noticias.canal1.com.co/noticias/tres-i-el-triste-record-que-impuso-elon-musk-el-dueno-de-tesla-y-de-twitter/',... | ```suggestion
self._search_regex(r'"embedUrl"\s*:\s*"([^"]+)', webpage, 'embed url'),
``` | 'description': 'md5:bc49c6d64d20610ea1e7daf079a0d013',
'thumbnail': r're:^https?://[^?#]+63b39f6b354977084b85ab54',
'ext': 'mp4',
},
}, {
'url': 'https://noticias.canal1.com.co/noticias/tres-i-el-triste-record-que-impuso-elon-musk-el-dueno-de-tesla-y-de-twitter/',... | @@ -0,0 +1,39 @@
+from .common import InfoExtractor
+
+
+class Canal1IE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|noticias\.)?canal1\.com\.co/(?:[^?#&])+/(?P<id>[\w-]+)'
+
+ _TESTS = [{
+ 'url': 'https://canal1.com.co/noticias/napa-i-una-cadena-de-produccion-de-arroz-que-se-quedo-en-veremos-y-aban... | yt_dlp/extractor/canal1.py | 26 | Python | 0.714 | suggestion | 103 | 28 | 28 | false | Add extractors for CaracolTvPlay and Canal1 | 7,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elyse0 |
def _fetch_nebula_bearer_token(self):
"""
Get a Bearer token for the Nebula API. This will be required to fetch video meta data.
"""
response = self._call_nebula_api('https://api.watchnebula.com/api/v1/authorization/',
method='POST',
... | non-fatally though
```suggestion
zype_id = episode.get('zype_id')
``` | """
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):
str... | @@ -76,8 +80,12 @@ def _build_video_info(self, episode):
fmts, subs = self._fetch_video_formats(episode['slug'])
channel_slug = episode['channel_slug']
channel_title = episode['channel_title']
+ if episode['zype_id']:
+ zype_id = episode['zype_id']
+ else:
+ ... | yt_dlp/extractor/nebula.py | 26 | Python | 0.571 | suggestion | 80 | 51 | 51 | false | [nebula] change to new API URL, fix up tests | 7,156 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rohieb |
import itertools
import json
import urllib.error
from .common import InfoExtractor
from ..utils import (
ExtractorError,
parse_iso8601,
make_archive_id
)
_BASE_URL_RE = r'https?://(?:www\.|beta\.)?(?:watchnebula\.com|nebula\.app|nebula\.tv)'
class NebulaBaseIE(InfoExtractor):
_NETRC_MACHINE = 'watch... | ```suggestion
from ..utils import ExtractorError, make_archive_id, parse_iso8601, remove_start
``` | import itertools
import json
import urllib.error
from .common import InfoExtractor
from ..utils import ExtractorError, make_archive_id, parse_iso8601, remove_start
_BASE_URL_RE = r'https?://(?:www\.|beta\.)?(?:watchnebula\.com|nebula\.app|nebula\.tv)'
class NebulaBaseIE(InfoExtractor):
_NETRC_MACHINE = 'watchne... | @@ -3,7 +3,11 @@
import urllib.error
from .common import InfoExtractor
-from ..utils import ExtractorError, parse_iso8601
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ make_archive_id
+) | yt_dlp/extractor/nebula.py | 10 | Python | 0.929 | refactor | 100 | 35 | 35 | false | [nebula] change to new API URL, fix up tests | 7,156 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rohieb |
else:
zype_id = None
return {
'id': episode['id'].replace('video_episode:', ''),
'display_id': episode['slug'],
'formats': fmts,
'subtitles': subs,
'webpage_url': f'https://nebula.tv/{episode["slug"]}',
'title': episode[... | The playlist classes yield from this method, so ~~we want to specify video extractor in the old archive id~~
```py
'_old_archive_ids': [make_archive_id(NebulaIE, zype_id)] if zype_id else None,
``` | 'webpage_url': f'https://nebula.tv/{episode["slug"]}',
'title': episode['title'],
'description': episode['description'],
'timestamp': parse_iso8601(episode['published_at']),
'thumbnails': [{
# 'id': tn.get('name'), # this appears to be null
... | @@ -99,6 +107,7 @@ def _build_video_info(self, episode):
'uploader_url': f'https://nebula.tv/{channel_slug}',
'series': channel_title,
'creator': channel_title,
+ '_old_archive_ids': [make_archive_id(self, zype_id)] if zype_id else None, | yt_dlp/extractor/nebula.py | 26 | Python | 0.857 | refactor | 212 | 51 | 51 | false | [nebula] change to new API URL, fix up tests | 7,156 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rohieb |
"""
Get a Bearer token for the Nebula API. This will be required to fetch video meta data.
"""
response = self._call_nebula_api('https://api.watchnebula.com/api/v1/authorization/',
method='POST',
note='Auth... | This isn't absolutely necessary, but it's more precise (remove from the start) and would give us a more descriptive error if something goes wrong (`Extractor failed to obtain "id"` instead of `NoneType has no attr replace`)
```suggestion
'id': remove_start(episode['id'], 'video_episode:'),
``` | method='POST',
note='Authorizing to Nebula')
return response['token']
def _fetch_video_formats(self, slug):
stream_info = self._call_nebula_api(f'https://content.api.nebula.app/video/{slug}/stream/',
... | @@ -76,8 +80,12 @@ def _build_video_info(self, episode):
fmts, subs = self._fetch_video_formats(episode['slug'])
channel_slug = episode['channel_slug']
channel_title = episode['channel_title']
+ if episode['zype_id']:
+ zype_id = episode['zype_id']
+ else:
+ ... | yt_dlp/extractor/nebula.py | 26 | Python | 1 | bug | 309 | 51 | 51 | false | [nebula] change to new API URL, fix up tests | 7,156 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rohieb |
from .common import InfoExtractor
from ..utils import (
parse_age_limit,
parse_duration,
traverse_obj,
url_or_none,
)
class MzaaloIE(InfoExtractor):
_VALID_URL = r'https?:\/\/www\.mzaalo\.com\/play\/(?P<type>movie|original|clip)\/(?P<id>[a-fA-F0-9-]+)\/[a-zA-Z0-9_-]+'
_TESTS = [{
# Mov... | * Unnecessary escape for `/`
* `[a-zA-Z0-9_-]` => `[\w-]` | from .common import InfoExtractor
from ..utils import (
parse_age_limit,
parse_duration,
traverse_obj,
url_or_none,
)
class MzaaloIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mzaalo\.com/play/(?P<type>movie|original|clip)/(?P<id>[a-fA-F0-9-]+)/[\w-]+'
_TESTS = [{
# Movies
... | @@ -0,0 +1,89 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_age_limit,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class MzaaloIE(InfoExtractor):
+ _VALID_URL = r'https?:\/\/www\.mzaalo\.com\/play\/(?P<type>movie|original|clip)\/(?P<id>[a-fA-F0-9-]+)\/[a-zA-Z0-9_-]+' | yt_dlp/extractor/mzaalo.py | 11 | Python | 0.357 | security | 58 | 36 | 36 | false | Support for Mzaalo | 7,163 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
'language': 'hin',
'categories': ['Drama'],
'asset_type': 'ORIGINAL',
'age_limit': 13,
'content_discriptor': 'Frightening Scenes',
},
}, {
# Streams/Clips
'url': 'https://www.mzaalo.com/play/clip/83cdbcb5-400a-42f1-a1d2-459053cfbda5... | ```suggestion
path = (f'partner/streamurl?&assetId={video_id}&getClipDetails=YES' if type_ == 'clip'
else f'api/v2/player/details?assetType={type_.upper()}&assetId={video_id}')
```
line too long | },
'params': {'skip_download': 'm3u8'}
}, {
# Streams/Clips
'url': 'https://www.mzaalo.com/play/clip/83cdbcb5-400a-42f1-a1d2-459053cfbda5/Manto-Ki-Kahaaniya',
'info_dict': {
'id': '83cdbcb5-400a-42f1-a1d2-459053cfbda5',
'title': 'Manto Ki Kahaaniya',
... | @@ -0,0 +1,89 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_age_limit,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class MzaaloIE(InfoExtractor):
+ _VALID_URL = r'https?:\/\/www\.mzaalo\.com\/play\/(?P<type>movie|original|clip)\/(?P<id>[a-fA-F0-9-]+)\/[a-zA-Z0-9_-]+'
+... | yt_dlp/extractor/mzaalo.py | 26 | Python | 0.929 | refactor | 222 | 49 | 51 | false | Support for Mzaalo | 7,163 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
}, {
# Streams/Clips
'url': 'https://www.mzaalo.com/play/clip/83cdbcb5-400a-42f1-a1d2-459053cfbda5/Manto-Ki-Kahaaniya',
'md5': '9a20e6603c83a799543af8ec1a52d7ef',
'info_dict': {
'id': '83cdbcb5-400a-42f1-a1d2-459053cfbda5',
'title': 'Manto Ki Kahaaniya',
... | single-quote
```suggestion
formats, subtitles = self._extract_m3u8_formats_and_subtitles(data['streamURL'], video_id)
```
Also, it looks like there aren't any subtitles to be extracted from the m3u8, but there are webvtt subtitles in the API JSON / `data` var, e.g.:
```json
"subtitles": {
... | 'id': '83cdbcb5-400a-42f1-a1d2-459053cfbda5',
'title': 'Manto Ki Kahaaniya',
'ext': 'mp4',
'description': 'md5:c3c5f1d05f0fd1bfcb05b673d1cc9f2f',
'thumbnails': 'count:3',
'thumbnail': r're:^https?://.*\.jpg$',
'duration': 1937.0,
... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_age_limit,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class MzaaloIE(InfoExtractor):
+ _VALID_URL = r'https?:\/\/www\.mzaalo\.com\/play\/(?P<type>movie|original|clip)\/(?P<id>[a-fA-F0-9-]+)\/[a-zA-Z0-9_-]+'
+... | yt_dlp/extractor/mzaalo.py | 26 | Python | 0.857 | refactor | 523 | 44 | 46 | false | Support for Mzaalo | 7,163 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
from .common import InfoExtractor
from ..utils import (
parse_age_limit,
parse_duration,
traverse_obj,
url_or_none,
)
class MzaaloIE(InfoExtractor):
_VALID_URL = r'https?://www.mzaalo.com/play/(?P<type>movie|original|clip)/(?P<id>[a-fA-F0-9-]+)/[\w-]+'
_TESTS = [{
# Movies
'url... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?mzaalo\.com/play/(?P<type>movie|original|clip)/(?P<id>[a-fA-F0-9-]+)/[\w-]+'
```
we do want to escape dots in hostnames, and make the subdomain optional | from .common import InfoExtractor
from ..utils import (
parse_age_limit,
parse_duration,
traverse_obj,
url_or_none,
)
class MzaaloIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mzaalo\.com/play/(?P<type>movie|original|clip)/(?P<id>[a-fA-F0-9-]+)/[\w-]+'
_TESTS = [{
# Movies
... | @@ -0,0 +1,96 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_age_limit,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class MzaaloIE(InfoExtractor):
+ _VALID_URL = r'https?://www.mzaalo.com/play/(?P<type>movie|original|clip)/(?P<id>[a-fA-F0-9-]+)/[\w-]+' | yt_dlp/extractor/mzaalo.py | 11 | Python | 0.929 | security | 207 | 36 | 36 | false | Support for Mzaalo | 7,163 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
else f'api/v2/player/details?assetType={type_.upper()}&assetId={video_id}')
data = self._download_json(
f'https://production.mzaalo.com/platform/{path}', video_id, headers={
'Ocp-Apim-Subscription-Key': '1d0caac2702049b89a305929fdf4cbae',
})['data']
... | ```suggestion
```
this is not a common field |
formats = self._extract_m3u8_formats(data['streamURL'], video_id)
subtitles = {}
for subs_lang, subs_url in traverse_obj(data, ('subtitles', {dict.items}, ...)):
if url_or_none(subs_url):
subtitles[subs_lang] = [{'url': subs_url, 'ext': 'vtt'}]
lang = trave... | @@ -0,0 +1,96 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_age_limit,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class MzaaloIE(InfoExtractor):
+ _VALID_URL = r'https?://www.mzaalo.com/play/(?P<type>movie|original|clip)/(?P<id>[a-fA-F0-9-]+)/[\w-]+'
+ _TESTS = [{
... | yt_dlp/extractor/mzaalo.py | 26 | Python | 0.429 | suggestion | 46 | 30 | 26 | false | Support for Mzaalo | 7,163 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
path = (f'partner/streamurl?&assetId={video_id}&getClipDetails=YES' if type_ == 'clip'
else f'api/v2/player/details?assetType={type_.upper()}&assetId={video_id}')
data = self._download_json(
f'https://production.mzaalo.com/platform/{path}', video_id, headers={
... | language should be set for each applicable format, not for the video as a whole. | path = (f'partner/streamurl?&assetId={video_id}&getClipDetails=YES' if type_ == 'clip'
else f'api/v2/player/details?assetType={type_.upper()}&assetId={video_id}')
data = self._download_json(
f'https://production.mzaalo.com/platform/{path}', video_id, headers={
... | @@ -0,0 +1,89 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_age_limit,
+ parse_duration,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class MzaaloIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mzaalo\.com/play/(?P<type>movie|original|clip)/(?P<id>[a-fA-F0-9-]+)/[\w-]+'
+ _TEST... | yt_dlp/extractor/mzaalo.py | 26 | Python | 0.286 | suggestion | 80 | 29 | 32 | false | Support for Mzaalo | 7,163 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
from .common import InfoExtractor
class CrtvgIE(InfoExtractor):
_VALID_URL = r'https?://www\.crtvg\.es/tvg/a-carta/[^/]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
'md5': 'c0958d9ff90e4503a75544358758921d',
'info_dict': {
'... | If the page loads in browser without the subdomain, we want to make it optional in the `_VALID_URL`.
We also want to make sure we're not matching a fragment (`#`) or query (`?`)
```suggestion
_VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)'
``` | from .common import InfoExtractor
from ..utils import remove_end
class CrtvgIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
'md5': 'c0958d9ff90e4503a75544358758921d'... | @@ -0,0 +1,32 @@
+from .common import InfoExtractor
+
+
+class CrtvgIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.crtvg\.es/tvg/a-carta/[^/]+-(?P<id>\d+)' | yt_dlp/extractor/crtvg.py | 5 | Python | 0.786 | suggestion | 280 | 30 | 30 | false | [Crtvg] Add Extractor | 7,168 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
from .common import InfoExtractor
class CrtvgIE(InfoExtractor):
_VALID_URL = r'https?://www\.crtvg\.es/tvg/a-carta/[^/]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
'md5': 'c0958d9ff90e4503a75544358758921d',
'info_dict': {
'... | make this a bit more descriptive since the user will see it if the regex search throws
```suggestion
video_url = self._search_regex(r'var\s+url\s*=\s*["\']([^"\']+)', webpage, 'video url')
``` | from .common import InfoExtractor
from ..utils import remove_end
class CrtvgIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
'md5': 'c0958d9ff90e4503a75544358758921d'... | @@ -0,0 +1,32 @@
+from .common import InfoExtractor
+
+
+class CrtvgIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.crtvg\.es/tvg/a-carta/[^/]+-(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
+ 'md5': 'c0958d9ff90e4503a75544358758921d',
+ 'i... | yt_dlp/extractor/crtvg.py | 22 | Python | 0.857 | suggestion | 203 | 33 | 35 | false | [Crtvg] Add Extractor | 7,168 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
class CrtvgIE(InfoExtractor):
_VALID_URL = r'https?://www\.crtvg\.es/tvg/a-carta/[^/]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
'md5': 'c0958d9ff90e4503a75544358758921d',
'info_dict': {
'id': '5839623',
'title':... | Not absolutely necessary, but I'd remove the ` | CRTVG` suffix from the video title. You'll need to import `remove_end` from utils
```suggestion
'title': remove_end(self._html_search_meta(
['og:title', 'twitter:title'], webpage, 'title', default=None), ' | CRTVG'),
``` |
class CrtvgIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
'md5': 'c0958d9ff90e4503a75544358758921d',
'info_dict': {
'id': '5839623',
... | @@ -0,0 +1,32 @@
+from .common import InfoExtractor
+
+
+class CrtvgIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.crtvg\.es/tvg/a-carta/[^/]+-(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
+ 'md5': 'c0958d9ff90e4503a75544358758921d',
+ 'i... | yt_dlp/extractor/crtvg.py | 26 | Python | 0.857 | suggestion | 301 | 30 | 32 | false | [Crtvg] Add Extractor | 7,168 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
from .common import InfoExtractor
from ..utils import remove_end
class CrtvgIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
'md5': 'c0958d9ff90e4503a75544358758921d'... | either extract subtitles or change the method being used
```suggestion
formats = self._extract_m3u8_formats(video_url + '/playlist.m3u8', video_id, fatal=False)
``` | from .common import InfoExtractor
from ..utils import remove_end
class CrtvgIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
'md5': 'c0958d9ff90e4503a75544358758921d'... | @@ -0,0 +1,34 @@
+from .common import InfoExtractor
+from ..utils import remove_end
+
+
+class CrtvgIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?crtvg\.es/tvg/a-carta/[^/#?]+-(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://www.crtvg.es/tvg/a-carta/os-caimans-do-tea-5839623',
+ 'md5': 'c0958d9... | yt_dlp/extractor/crtvg.py | 24 | Python | 0.786 | refactor | 175 | 35 | 35 | false | [Crtvg] Add Extractor | 7,168 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
ViewSourceIE,
)
from .condenast import CondeNastIE
from .contv import CONtvIE
from .corus import CorusIE
from .cpac import (
CPACIE,
CPACPlaylistIE,
)
from .cozytv import CozyTVIE
from .cracked import CrackedIE
from .crackle import CrackleIE
from .craftsy import CraftsyIE
from .crooksandliars import CrooksA... | you should look into why this sort of thing keeps happening with your PRs
```suggestion
``` | ViewSourceIE,
)
from .condenast import CondeNastIE
from .contv import CONtvIE
from .corus import CorusIE
from .cpac import (
CPACIE,
CPACPlaylistIE,
)
from .cozytv import CozyTVIE
from .cracked import CrackedIE
from .crackle import CrackleIE
from .craftsy import CraftsyIE
from .crooksandliars import CrooksA... | @@ -414,6 +414,7 @@
CrunchyrollArtistIE,
)
from .cspan import CSpanIE, CSpanCongressIE
+from .crtvg import CrtvgIE | yt_dlp/extractor/_extractors.py | 26 | Python | 0.643 | suggestion | 93 | 51 | 51 | false | [ElevenSports] Add Extractor | 7,172 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
'description': 'md5:03b5238d6549f4ea1fddadf69b5e0b58',
'upload_date': '20230323',
'timestamp': 1679612400,
'thumbnail': r're:^https?://.*\.(?:jpg|png)',
},
'params': {'skip_download': 'm3u8'}
}, {
'url': 'https://elevensports.com/view/event/clh... | Since we can't extract any formats or any metadata without `event_id`, it can be fatal.
And having it default to `{}` doesn't make sense.
```suggestion
event_id = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['event']['mclsEventId']
``` | 'upload_date': '20230323',
'timestamp': 1679612400,
'thumbnail': r're:^https?://.*\.(?:jpg|png)',
},
'params': {'skip_download': 'm3u8'}
}, {
'url': 'https://elevensports.com/view/event/clhpyd53b06160jez74qhgkmf',
'md5': 'c0958d9ff90e4503a755443587... | @@ -0,0 +1,62 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ElevenSportsIE(InfoExtractor):
+ _VALID_URL = r'https://elevensports\.com/view/event/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://ele... | yt_dlp/extractor/elevensports.py | 26 | Python | 0.857 | refactor | 268 | 45 | 42 | false | [ElevenSports] Add Extractor | 7,172 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
'timestamp': 1679612400,
'thumbnail': r're:^https?://.*\.(?:jpg|png)',
},
'params': {'skip_download': 'm3u8'}
}, {
'url': 'https://elevensports.com/view/event/clhpyd53b06160jez74qhgkmf',
'md5': 'c0958d9ff90e4503a75544358758921d',
'info_dict': {
... | single quote
```suggestion
event_data = self._download_json(
f'https://mcls-api.mycujoo.tv/bff/events/v1beta1/{event_id}', video_id,
headers={'Authorization': 'Bearer FBVKACGN37JQC5SFA0OVK8KKSIOP153G'})
``` | 'thumbnail': r're:^https?://.*\.(?:jpg|png)',
},
'params': {'skip_download': 'm3u8'}
}, {
'url': 'https://elevensports.com/view/event/clhpyd53b06160jez74qhgkmf',
'md5': 'c0958d9ff90e4503a75544358758921d',
'info_dict': {
'id': 'clhpyd53b06160jez74qhgkmf... | @@ -0,0 +1,62 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ElevenSportsIE(InfoExtractor):
+ _VALID_URL = r'https://elevensports\.com/view/event/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://ele... | yt_dlp/extractor/elevensports.py | 26 | Python | 0.786 | security | 243 | 43 | 40 | false | [ElevenSports] Add Extractor | 7,172 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
'params': {'skip_download': 'm3u8'}
}, {
'url': 'https://elevensports.com/view/event/clhpyd53b06160jez74qhgkmf',
'md5': 'c0958d9ff90e4503a75544358758921d',
'info_dict': {
'id': 'clhpyd53b06160jez74qhgkmf',
'title': 'AJNLF vs ARRAF',
'ext': 'mp4',
... | There's no reason for this to be `fatal=False`, esp since `event_data['streams']...` is already fatal.
Also, don't do hanging parenthesis
```suggestion
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
event_data['streams'][0]['full_url'], video_id, 'mp4', m3u8_id='hls')
``` | }, {
'url': 'https://elevensports.com/view/event/clhpyd53b06160jez74qhgkmf',
'md5': 'c0958d9ff90e4503a75544358758921d',
'info_dict': {
'id': 'clhpyd53b06160jez74qhgkmf',
'title': 'AJNLF vs ARRAF',
'ext': 'mp4',
'description': 'md5:c8c5e75c78f37... | @@ -0,0 +1,62 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ElevenSportsIE(InfoExtractor):
+ _VALID_URL = r'https://elevensports\.com/view/event/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://ele... | yt_dlp/extractor/elevensports.py | 26 | Python | 0.857 | refactor | 313 | 40 | 37 | false | [ElevenSports] Add Extractor | 7,172 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
'upload_date': '20230521',
'timestamp': 1684684800,
'thumbnail': r're:^https?://.*\.(?:jpg|png)',
},
'params': {'skip_download': 'm3u8'}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, vide... | `upload_date` will be calculated from `timestamp`, you don't need to extract the same value twice
```suggestion
``` | 'timestamp': 1684684800,
'thumbnail': r're:^https?://.*\.(?:jpg|png)',
},
'params': {'skip_download': 'm3u8'}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
event_id = self._search_n... | @@ -0,0 +1,62 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ElevenSportsIE(InfoExtractor):
+ _VALID_URL = r'https://elevensports\.com/view/event/(?P<id>[a-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://ele... | yt_dlp/extractor/elevensports.py | 26 | Python | 0.786 | refactor | 117 | 31 | 28 | false | [ElevenSports] Add Extractor | 7,172 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
from .common import InfoExtractor
from ..utils import (
parse_iso8601,
traverse_obj,
unified_strdate,
url_or_none,
)
class ElevenSportsIE(InfoExtractor):
_VALID_URL = r'https://elevensports\.com/view/event/(?P<id>[a-z0-9]+)'
_TESTS = [{
'url': 'https://elevensports.com/view/event/clf46... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?elevensports\.com/view/event/(?P<id>\w+)'
``` | from .common import InfoExtractor
from ..utils import (
parse_iso8601,
traverse_obj,
url_or_none,
)
class ElevenSportsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?elevensports\.com/view/event/(?P<id>\w+)'
_TESTS = [{
'url': 'https://elevensports.com/view/event/clf46yr3kenn80jgrqsjm... | @@ -0,0 +1,62 @@
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+)
+
+
+class ElevenSportsIE(InfoExtractor):
+ _VALID_URL = r'https://elevensports\.com/view/event/(?P<id>[a-z0-9]+)' | yt_dlp/extractor/elevensports.py | 11 | Python | 0.571 | suggestion | 99 | 36 | 36 | false | [ElevenSports] Add Extractor | 7,172 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ItIsRain |
'end_time': {lambda x: (x['timeRangeStartMillis'] + x['markerDurationMillis']) / 1000},
'value': ('heatMarkerIntensityScoreNormalized', {float_or_none}),
})) for contents in content_list)), None)
def _extract_comment(self, comment_renderer, parent=None):
comment_... | ```suggestion
'_time_text': time_text,
```
so that hopefully nobody starts relying on it. | 'end_time': {lambda x: (x['timeRangeStartMillis'] + x['markerDurationMillis']) / 1000},
'value': ('heatMarkerIntensityScoreNormalized', {float_or_none}),
})) for contents in content_list)), None)
def _extract_comment(self, comment_renderer, parent=None):
comment_... | @@ -3271,37 +3271,50 @@ def _extract_comment(self, comment_renderer, parent=None):
if not comment_id:
return
- text = self._get_text(comment_renderer, 'contentText')
+ info = {
+ 'id': comment_id,
+ 'text': self._get_text(comment_renderer, 'contentText'),
+ ... | yt_dlp/extractor/youtube.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | [extractor/youtube] Extract more metadata for comments | 7,179 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
}, {
'url': 'https://www3.nhk.or.jp/nhkworld/fr/ondemand/audio/plugin-20190404-1/',
'only_matching': True,
}, {
'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/audio/j_art-20150903-1/',
'only_matching': True,
}, {
# video, alphabetic character in ID #29670
... | Do not subclass from concrete IE. This is not a change we want to port from upstream | 'url': 'https://www3.nhk.or.jp/nhkworld/fr/ondemand/audio/plugin-20190404-1/',
'only_matching': True,
}, {
'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/audio/j_art-20150903-1/',
'only_matching': True,
}, {
# video, alphabetic character in ID #29670
'url': '... | @@ -149,10 +163,18 @@ def _real_extract(self, url):
return self._extract_episode_info(url)
-class NhkVodProgramIE(NhkBaseIE):
- _VALID_URL = r'%s/program%s(?P<id>[0-9a-z]+)(?:.+?\btype=(?P<episode_type>clip|(?:radio|tv)Episode))?' % (NhkBaseIE._BASE_URL_REGEX, NhkBaseIE._TYPE_REGEX)
+class NhkVodProgram... | yt_dlp/extractor/nhk.py | 26 | Python | 0.286 | suggestion | 84 | 51 | 51 | false | [extractor/nhk] merge YouTube-dl changes for NHK | 7,180 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | sjthespian |
{
# Original source: http://www.uscourts.gov/cameras-courts/state-washington-vs-donald-j-trump-et-al
'url': 'https://player.piksel.com/v/v80kqp41',
'md5': '753ddcd8cc8e4fa2dda4b7be0e77744d',
'info_dict': {
'id': 'v80kqp41',
'ext': '... | ```suggestion
url = urljoin(host, f'/ws/ws_{resource}/api/{app_token}/mode/json/apiv/5')
response = traverse_obj(
self._download_json(url, display_id, query=query, fatal=fatal), ('response', {dict})) or {}
failure = traverse_obj(response, ('failure', 'reason')) if response else '... | {
# Original source: http://www.uscourts.gov/cameras-courts/state-washington-vs-donald-j-trump-et-al
'url': 'https://player.piksel.com/v/v80kqp41',
'md5': '753ddcd8cc8e4fa2dda4b7be0e77744d',
'info_dict': {
'id': 'v80kqp41',
'ext': '... | @@ -63,10 +65,10 @@ class PikselIE(InfoExtractor):
}
]
- def _call_api(self, app_token, resource, display_id, query, fatal=True):
- response = (self._download_json(
- 'http://player.piksel.com/ws/ws_%s/api/%s/mode/json/apiv/5' % (resource, app_token),
- display_id, query=... | yt_dlp/extractor/piksel.py | 26 | Python | 0.786 | bug | 370 | 51 | 51 | false | [extractor/nhk] merge YouTube-dl changes for NHK | 7,180 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | sjthespian |
'url': url,
})
return info
class NhkVodIE(NhkBaseIE):
# the 7-character IDs can have alphabetic chars too: assume [a-z] rather than just [a-f], eg
_VALID_URL = r'%s%s(?P<id>[0-9a-z]{7}|[^/]+?-\d{8}-[0-9a-z]+)' % (NhkBaseIE._BASE_URL_REGEX, NhkBaseIE._TYPE_REGEX)
... | is the link dead? then use `skip` instead | 'url': url,
})
return info
class NhkVodIE(NhkBaseIE):
# the 7-character IDs can have alphabetic chars too: assume [a-z] rather than just [a-f], eg
_VALID_URL = r'%s%s(?P<id>[0-9a-z]{7}|[^/]+?-\d{8}-[0-9a-z]+)' % (NhkBaseIE._BASE_URL_REGEX, NhkBaseIE._TYPE_REGEX)
... | @@ -94,8 +94,21 @@ class NhkVodIE(NhkBaseIE):
# Content available only for a limited period of time. Visit
# https://www3.nhk.or.jp/nhkworld/en/ondemand/ for working samples.
_TESTS = [{
+ 'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/2061601/',
+ 'info_dict': {
+ 'id... | yt_dlp/extractor/nhk.py | 26 | Python | 0.286 | suggestion | 41 | 51 | 51 | false | [extractor/nhk] merge YouTube-dl changes for NHK | 7,180 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | sjthespian |
import hashlib
import hmac
import itertools
import json
import urllib.parse
from .common import InfoExtractor
from ..utils import (
traverse_obj,
ExtractorError,
int_or_none,
try_call,
urljoin
)
class ZingMp3BaseIE(InfoExtractor):
_VALID_URL_TMPL = r'https?://(?:mp3\.zing|zingmp3)\.vn/(?P<typ... | Ran isort
```suggestion
from ..utils import (
ExtractorError,
int_or_none,
try_call,
urljoin,
)
from ..utils.traversal import traverse_obj
``` | import hashlib
import hmac
import itertools
import json
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
try_call,
urljoin,
url_or_none
)
from ..utils.traversal import traverse_obj
class ZingMp3BaseIE(InfoExtractor):
_... | @@ -5,7 +5,13 @@
import urllib.parse
from .common import InfoExtractor
-from ..utils import int_or_none, traverse_obj, try_call, urljoin
+from ..utils import (
+ traverse_obj,
+ ExtractorError,
+ int_or_none,
+ try_call,
+ urljoin
+) | yt_dlp/extractor/zingmp3.py | 14 | Python | 0.929 | refactor | 167 | 39 | 39 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | hatienl0i2612 |
continue
formats.append({
'format_id': f'mp4-{res}',
'url': video_url,
'height': int_or_none(res),
})
if not formats:
if item.get('msg') == 'Sorry, this content is not available in your c... | Pretty sure this is identical to:
```suggestion
'artist': traverse_obj(item, 'artistsNames', 'artists_names', ('artists', 0, 'name')),
'album': traverse_obj(item, ('album', ('name', 'title')), ('genres', 0, 'name'), get_all=False),
'album_artist': traverse_obj(item, ('album', ('a... | if k == 'hls':
formats.extend(self._extract_m3u8_formats(video_url, item_id, 'mp4', m3u8_id=k, fatal=False))
continue
formats.append({
'format_id': f'mp4-{res}',
'url': video_url,
'height'... | @@ -189,9 +223,11 @@ def _real_extract(self, url):
'thumbnail': traverse_obj(item, 'thumbnail', 'thumbnailM'),
'duration': int_or_none(item.get('duration')),
'track': traverse_obj(item, 'title', 'alias'),
- 'artist': traverse_obj(item, 'artistsNames', 'artists_names'),
... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.857 | suggestion | 621 | 51 | 51 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | hatienl0i2612 |
},
'playlist_mincount': 50,
}, {
'url': 'https://zingmp3.vn/podcast-discover',
'info_dict': {
'id': 'podcast-discover',
},
'playlist_mincount': 150,
}]
def _real_extract(self, url):
url_type = self._match_id(url)
params = {'id': ur... | Pretty sure `IE_NAME` should not be changed during runtime.
As the `podcast-discover` case is the same as the default case this can be simplified to:
(see suggestions by bashonly) | 'id': 'top100',
},
'playlist_mincount': 50,
}, {
'url': 'https://zingmp3.vn/podcast-discover',
'info_dict': {
'id': 'podcast-discover',
},
'playlist_mincount': 4,
}]
IE_NAME = 'zingmp3:chart-home'
def _real_extract(self, url):
... | @@ -244,13 +280,36 @@ class ZingMp3ChartHomeIE(ZingMp3BaseIE):
'id': 'moi-phat-hanh',
},
'playlist_mincount': 100,
+ }, {
+ 'url': 'https://zingmp3.vn/top100',
+ 'info_dict': {
+ 'id': 'top100',
+ },
+ 'playlist_mincount': 50,
+ }, {
+ '... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.714 | suggestion | 181 | 51 | 51 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | hatienl0i2612 |
},
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
url_type, live_radio_id = self._match_valid_url(url).group('type', 'id')
info = self._call_api(url_type, {'id': live_radio_id})
manifest_url = info.get('streaming')
if n... | Is this (and other instances) supposed to be Podcast? | },
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
url_type, live_radio_id = self._match_valid_url(url).group('type', 'id')
info = self._call_api(url_type, {'id': live_radio_id})
manifest_url = info.get('streaming')
if n... | @@ -424,3 +504,134 @@ def _real_extract(self, url):
'sections', lambda _, v: v['sectionId'] == 'hub', 'items', ...)))
return self.playlist_result(
entries, song_id, hub_detail.get('title'), hub_detail.get('description'))
+
+
+class ZingMp3LiveRadioIE(ZingMp3BaseIE):
+ IE_NAME = 'zi... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.357 | question | 53 | 51 | 51 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | hatienl0i2612 |
return self.playlist_result(
entries, post_cast_id, post_cast_info.get('title'), post_cast_info.get('description'))
class ZingMp3PostCastCategoriesIE(ZingMp3BaseIE):
IE_NAME = 'zingmp3:postcast-categories'
_VALID_URL = r'https?://(?:mp3\.zing|zingmp3)\.vn/(?P<id>(?:cgr|top-podcast))/?(?:[#... | ```suggestion
return self.playlist_result(self._parse_items(data.get('items')), url_type)
``` | podcast_id, url_type = self._match_valid_url(url).group('id', 'type')
podcast_info = self._call_api(url_type, {'id': podcast_id})
entries = self._paged_list(podcast_id, 'pgr-list' if url_type == 'pgr' else 'cgr-list')
return self.playlist_result(
entries, podcast_id, podcast_... | @@ -424,3 +504,134 @@ def _real_extract(self, url):
'sections', lambda _, v: v['sectionId'] == 'hub', 'items', ...)))
return self.playlist_result(
entries, song_id, hub_detail.get('title'), hub_detail.get('description'))
+
+
+class ZingMp3LiveRadioIE(ZingMp3BaseIE):
+ IE_NAME = 'zi... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.857 | suggestion | 103 | 45 | 38 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | hatienl0i2612 |
'playlist_mincount': 50,
}]
def _real_extract(self, url):
url_type = self._match_id(url)
data = self._call_api('cgrs' if url_type == 'cgr' else url_type, {'id': url_type})
items = traverse_obj(data, 'items')
return self.playlist_result(self._parse_items(items), url_type)... | ```suggestion
return self.playlist_result(self._parse_items(data.get('items')), url_type)
``` | import hashlib
import hmac
import itertools
import json
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
try_call,
urljoin,
url_or_none
)
from ..utils.traversal import traverse_obj
class ZingMp3BaseIE(InfoExtractor):
_... | @@ -424,3 +504,134 @@ def _real_extract(self, url):
'sections', lambda _, v: v['sectionId'] == 'hub', 'items', ...)))
return self.playlist_result(
entries, song_id, hub_detail.get('title'), hub_detail.get('description'))
+
+
+class ZingMp3LiveRadioIE(ZingMp3BaseIE):
+ IE_NAME = 'zi... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.857 | suggestion | 103 | 27 | 631 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | hatienl0i2612 |
'ext': 'm4a',
'view_count': int,
'thumbnail': r're:^https?://.*\.jpg',
'like_count': int,
},
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
url_type, live_radio_id = self._match_valid_url(url).gr... | Need to set `'is_live': True` since the native m3u8 downloader currently does not support livestreams and instead ffmpeg needs to be used.
The `traverse_obj` calls can also be combined
```suggestion
'id': live_radio_id,
'is_live': True,
'formats': fmts,
'subtitles':... | 'view_count': int,
'thumbnail': r're:^https?://.*\.jpg',
'like_count': int,
'live_status': 'is_live',
},
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
url_type, live_radio_id = self._match_valid... | @@ -424,3 +504,134 @@ def _real_extract(self, url):
'sections', lambda _, v: v['sectionId'] == 'hub', 'items', ...)))
return self.playlist_result(
entries, song_id, hub_detail.get('title'), hub_detail.get('description'))
+
+
+class ZingMp3LiveRadioIE(ZingMp3BaseIE):
+ IE_NAME = 'zi... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.857 | suggestion | 724 | 51 | 51 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | hatienl0i2612 |
'url': 'https://zingmp3.vn/new-release/album',
'info_dict': {
'id': 'new-release-album',
},
'playlist_mincount': 20,
}]
def _fetch_page(self, user_id, url_type, page):
url_type = 'user-list-song' if url_type == 'bai-hat' else 'user-list-video'
return ... | as discussed in a previous comment, we should not change the `IE_NAME` during extraction
```suggestion
``` | },
'playlist_mincount': 50,
}, {
'url': 'https://zingmp3.vn/new-release/album',
'info_dict': {
'id': 'new-release-album',
},
'playlist_mincount': 20,
}]
def _fetch_page(self, user_id, url_type, page):
url_type = 'user-list-song' if url_typ... | @@ -380,20 +447,29 @@ def _fetch_page(self, user_id, url_type, page):
})
def _real_extract(self, url):
- user_alias, url_type = self._match_valid_url(url).group('user', 'type')
+ alias, url_type = self._match_valid_url(url).group('user', 'type')
if not url_type:
url_t... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.786 | refactor | 108 | 51 | 51 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hatienl0i2612 |
},
'playlist_mincount': 20,
}]
def _fetch_page(self, user_id, url_type, page):
url_type = 'user-list-song' if url_type == 'bai-hat' else 'user-list-video'
return self._call_api(url_type, {
'id': user_id,
'type': 'artist',
'page': page,
... | ```suggestion
return self.playlist_result(self._parse_items(
self._call_api('new-release', params={'type': url_type}, display_id=_id)), _id)
``` | 'url': 'https://zingmp3.vn/new-release/album',
'info_dict': {
'id': 'new-release-album',
},
'playlist_mincount': 20,
}]
def _fetch_page(self, user_id, url_type, page):
url_type = 'user-list-song' if url_type == 'bai-hat' else 'user-list-video'
return ... | @@ -380,20 +447,29 @@ def _fetch_page(self, user_id, url_type, page):
})
def _real_extract(self, url):
- user_alias, url_type = self._match_valid_url(url).group('user', 'type')
+ alias, url_type = self._match_valid_url(url).group('user', 'type')
if not url_type:
url_t... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.857 | suggestion | 175 | 51 | 51 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hatienl0i2612 |
'ext': 'm4a',
'view_count': int,
'thumbnail': r're:^https?://.*\.jpg',
'like_count': int,
'live_status': 'is_live',
},
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
url_type, live_ra... | ```suggestion
'thumbnail': (('thumbnail', 'thumbnailM', 'thumbnailV', 'thumbnailH'), {url_or_none}),
```
import `utils.url_or_none` | 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
'protocol': 'm3u8_native',
'ext': 'm4a',
'view_count': int,
'thumbnail': r're:^https?://.*\.jpg',
'like_count': int,
'live_status': 'is_live',
},
'params': {
... | @@ -424,3 +500,137 @@ def _real_extract(self, url):
'sections', lambda _, v: v['sectionId'] == 'hub', 'items', ...)))
return self.playlist_result(
entries, song_id, hub_detail.get('title'), hub_detail.get('description'))
+
+
+class ZingMp3LiveRadioIE(ZingMp3BaseIE):
+ IE_NAME = 'zi... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.714 | suggestion | 150 | 51 | 51 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hatienl0i2612 |
'id': 'top-podcast',
},
'playlist_mincount': 7,
}]
def _real_extract(self, url):
url_type = self._match_id(url)
data = self._call_api('cgrs' if url_type == 'cgr' else url_type, {'id': url_type})
return self.playlist_result(self._parse_items(data.get('items'))... | could these two be condensed into one extractor? they seem very similar | import hashlib
import hmac
import itertools
import json
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
try_call,
urljoin,
url_or_none
)
from ..utils.traversal import traverse_obj
class ZingMp3BaseIE(InfoExtractor):
_... | @@ -424,3 +500,137 @@ def _real_extract(self, url):
'sections', lambda _, v: v['sectionId'] == 'hub', 'items', ...)))
return self.playlist_result(
entries, song_id, hub_detail.get('title'), hub_detail.get('description'))
+
+
+class ZingMp3LiveRadioIE(ZingMp3BaseIE):
+ IE_NAME = 'zi... | yt_dlp/extractor/zingmp3.py | 26 | Python | 0.286 | refactor | 71 | 27 | 631 | false | [extractor/zingmp3]: add live radio extractor | 7,189 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | hatienl0i2612 |
stream_info = self._download_json(
self._proto_relative_url(item['_links']['streams']['href']), video_id, headers={
'Accept': 'application/json',
'Authorization': f'Bearer {self._ACCESS_TOKEN}',
'Accept-Language': language
... | ```suggestion
} for chapter in item['cuepoints']] if item.get('cuepoints') and type_ == 'concert' else None,
``` | stream_info = self._download_json(
self._proto_relative_url(item['_links']['streams']['href']), video_id, headers={
'Accept': 'application/json',
'Authorization': f'Bearer {self._ACCESS_TOKEN}',
'Accept-Language': language
... | @@ -103,11 +116,11 @@ def _entries(self, items, language, **kwargs):
'start_time': chapter.get('time'),
'end_time': try_get(chapter, lambda x: x['time'] + x['duration']),
'title': chapter.get('text'),
- } for chapter in item['cuepoints']] if ... | yt_dlp/extractor/digitalconcerthall.py | 26 | Python | 0.857 | suggestion | 130 | 51 | 51 | false | [DigitalConcertHall] Support for Films | 7,202 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ItIsRain |
age_limit = self._rta_search(webpage)
view_count = str_to_int(self._html_search_regex(
(r'>([\d,.]+)\s+Views<', r'<strong>Views</strong>\s+([^<]+)<'),
webpage, 'view count', fatal=False))
like_count = str_to_int(self._html_search_regex(
(r'>([\d,.]+)\s+Favorit... | revert this, the lenient regex approach is better imo | age_limit = self._rta_search(webpage)
view_count = str_to_int(self._html_search_regex(
(r'>([\d,.]+)\s+Views<', r'<strong>Views</strong>\s+([^<]+)<'),
webpage, 'view count', fatal=False))
like_count = str_to_int(self._html_search_regex(
(r'>([\d,.]+)\s+Favorit... | @@ -123,15 +153,14 @@ def _real_extract(self, url):
kwargs = {_AGO_UNITS.get(uploaded_ago[-1]): delta}
upload_date = (datetime.datetime.utcnow() - datetime.timedelta(**kwargs)).strftime('%Y%m%d')
- comment_count = len(re.findall(r'''class\s*=\s*['"]media-comment-contents\b''',... | yt_dlp/extractor/motherless.py | 26 | Python | 0.286 | suggestion | 53 | 51 | 51 | false | [extractor/motherless] Adding Gallery and fixing | 7,211 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rexlambert22 |
webpage, 'view count', fatal=False))
like_count = str_to_int(self._html_search_regex(
(r'>([\d,.]+)\s+Favorites<',
r'<strong>Favorited</strong>\s+([^<]+)<'),
webpage, 'like count', fatal=False))
upload_date = unified_strdate(self._search_regex(
... | why change this? was the more relaxed regex causing problems? if not, it should be reverted. is it important to reverse the order? then only reverse the order, don't change the patterns | webpage, 'view count', fatal=False))
like_count = str_to_int(self._html_search_regex(
(r'>([\d,.]+)\s+Favorites<',
r'<strong>Favorited</strong>\s+([^<]+)<'),
webpage, 'like count', fatal=False))
upload_date = unified_strdate(self._search_regex(
... | @@ -123,15 +153,14 @@ def _real_extract(self, url):
kwargs = {_AGO_UNITS.get(uploaded_ago[-1]): delta}
upload_date = (datetime.datetime.utcnow() - datetime.timedelta(**kwargs)).strftime('%Y%m%d')
- comment_count = len(re.findall(r'''class\s*=\s*['"]media-comment-contents\b''',... | yt_dlp/extractor/motherless.py | 26 | Python | 0.429 | question | 185 | 51 | 51 | false | [extractor/motherless] Adding Gallery and fixing | 7,211 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rexlambert22 |
r'<span\b[^>]+\bclass="username">([^<]+)</span>'),
webpage, 'uploader_id', fatal=False)
categories = self._html_search_meta('keywords', webpage, default=None)
if categories:
categories = [cat.strip() for cat in categories.split(',') if cat.strip()]
return {
... | ```suggestion
raise NotImplementedError('This method must be implemented by subclasses')
```
is the convention | r'''(?s)['"](?:media-meta-member|thumb-member-username)\b[^>]+>\s*<a\b[^>]+\bhref\s*=\s*['"]/m/([^"']+)'''),
webpage, 'uploader_id', fatal=False)
categories = self._html_search_meta('keywords', webpage, default='')
categories = [cat.strip() for cat in categories.split(',') if ca... | @@ -148,102 +177,110 @@ def _real_extract(self, url):
}
-class MotherlessGroupIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?motherless\.com/gv?/(?P<id>[a-z0-9_]+)'
+class MotherlessPaginatedIE(InfoExtractor):
+ _PAGE_SIZE = 60
+
+ def _correct_path(self, url, item_id):
+ pass | yt_dlp/extractor/motherless.py | 26 | Python | 0.857 | suggestion | 121 | 51 | 51 | false | [extractor/motherless] Adding Gallery and fixing | 7,211 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rexlambert22 |
webpage):
video_url = urllib.parse.urljoin(base, mobj.group('href'))
video_id = MotherlessIE.get_temp_id(video_url)
if video_id:
yield self.url_result(video_url, MotherlessIE, video_id, mobj.group('title'))
def _real_extract(self,... | avoid downloading the first page twice
inline the playlist title, and regex seemed pretty inexact, better to use `utils.remove_end`
```suggestion
webpage = self._download_webpage(real_url, item_id, 'Downloading page 1')
def get_page(idx):
page = idx + 1
current_page = web... | video_url = urllib.parse.urljoin(base, mobj.group('href'))
video_id = MotherlessIE.get_temp_id(video_url)
if video_id:
yield self.url_result(video_url, MotherlessIE, video_id, mobj.group('title'))
def _real_extract(self, url):
item_id = self._match_id(ur... | @@ -148,102 +177,110 @@ def _real_extract(self, url):
}
-class MotherlessGroupIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?motherless\.com/gv?/(?P<id>[a-z0-9_]+)'
+class MotherlessPaginatedIE(InfoExtractor):
+ _PAGE_SIZE = 60
+
+ def _correct_path(self, url, item_id):
+ pass
+
+ ... | yt_dlp/extractor/motherless.py | 26 | Python | 0.857 | refactor | 723 | 51 | 51 | false | [extractor/motherless] Adding Gallery and fixing | 7,211 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rexlambert22 |
if video_id:
yield self.url_result(video_url, MotherlessIE, video_id, mobj.group('title'))
def _real_extract(self, url):
item_id = self._match_id(url)
real_url = self._correct_path(url, item_id)
title = self._search_regex(
r'^([\w\s]+)\s+', self._html... | I know the old code was doing it, but I *think* redefining `suitable` is unnecessary, you could just do this:
```suggestion
_VALID_URL = r'https?://(?:www\.)?motherless\.com/g[vifm]?/(?P<id>[a-z0-9_]+)/?(?:$|[#?])'
``` | yield self.url_result(video_url, MotherlessIE, video_id, mobj.group('title'))
def _real_extract(self, url):
item_id = self._match_id(url)
real_url = self._correct_path(url, item_id)
webpage = self._download_webpage(real_url, item_id, 'Downloading page 1')
def get_pa... | @@ -148,102 +177,110 @@ def _real_extract(self, url):
}
-class MotherlessGroupIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?motherless\.com/gv?/(?P<id>[a-z0-9_]+)'
+class MotherlessPaginatedIE(InfoExtractor):
+ _PAGE_SIZE = 60
+
+ def _correct_path(self, url, item_id):
+ pass
+
+ ... | yt_dlp/extractor/motherless.py | 26 | Python | 0.857 | suggestion | 225 | 51 | 51 | false | [extractor/motherless] Adding Gallery and fixing | 7,211 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rexlambert22 |
}, {
'url': 'http://motherless.com/g/sex_must_be_funny',
'info_dict': {
'id': 'sex_must_be_funny',
'title': 'Sex must be funny',
},
'playlist_count': 0,
}, {
'url': 'https://motherless.com/gv/beautiful_cock',
'info_dict': {
'id'... | same as above, instead of redefining `suitable`, I think this would work:
```suggestion
_VALID_URL = r'https?://(?:www\.)?motherless\.com/G[VIG]?(?P<id>[A-F0-9]+)/?(?:$|[#?])'
``` | 'playlist_count': 0,
}, {
'url': 'https://motherless.com/gv/beautiful_cock',
'info_dict': {
'id': 'beautiful_cock',
'title': 'Beautiful Cock',
},
'playlist_mincount': 2040,
}]
def _correct_path(self, url, item_id):
return urllib.parse.... | @@ -148,102 +177,110 @@ def _real_extract(self, url):
}
-class MotherlessGroupIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?motherless\.com/gv?/(?P<id>[a-z0-9_]+)'
+class MotherlessPaginatedIE(InfoExtractor):
+ _PAGE_SIZE = 60
+
+ def _correct_path(self, url, item_id):
+ pass
+
+ ... | yt_dlp/extractor/motherless.py | 26 | Python | 0.786 | suggestion | 186 | 51 | 49 | false | [extractor/motherless] Adding Gallery and fixing | 7,211 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rexlambert22 |
import datetime
import re
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
str_to_int,
unified_strdate,
remove_end,
)
class MotherlessIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?motherless\.com/(?:g/[a-z0-9_]+/|G[VIG]?[A-F... | sort
```suggestion
remove_end,
str_to_int,
unified_strdate,
``` | import datetime
import re
import urllib.parse
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
remove_end,
str_to_int,
unified_strdate,
)
class MotherlessIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?motherless\.com/(?:g/[a-z0-9_]+/|G[VIG]?[A-F... | @@ -1,32 +1,38 @@
import datetime
import re
+import urllib.parse
from .common import InfoExtractor
-from ..compat import compat_urlparse
from ..utils import (
ExtractorError,
- InAdvancePagedList,
- orderedSet,
+ OnDemandPagedList,
str_to_int,
unified_strdate,
+ remove_end, | yt_dlp/extractor/motherless.py | 11 | Python | 0.643 | suggestion | 80 | 36 | 36 | false | [extractor/motherless] Adding Gallery and fixing | 7,211 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rexlambert22 |
(r'>([\d,.]+)\s+Favorites<',
r'<strong>Favorited</strong>\s+([^<]+)<'),
webpage, 'like count', fatal=False))
upload_date = unified_strdate(self._search_regex(
r'class=["\']count[^>]+>(\d+\s+[a-zA-Z]{3}\s+\d{4})<', webpage,
'upload date', default=None... | single quote
```suggestion
categories = self._html_search_meta('keywords', webpage, default='')
``` | r'<strong>Favorited</strong>\s+([^<]+)<'),
webpage, 'like count', fatal=False))
upload_date = unified_strdate(self._search_regex(
r'class=["\']count[^>]+>(\d+\s+[a-zA-Z]{3}\s+\d{4})<', webpage,
'upload date', default=None))
if not upload_date:
... | @@ -128,10 +159,8 @@ def _real_extract(self, url):
(r'''<span\b[^>]+\bclass\s*=\s*["']username\b[^>]*>([^<]+)</span>''',
r'''(?s)['"](?:media-meta-member|thumb-member-username)\b[^>]+>\s*<a\b[^>]+\bhref\s*=\s*['"]/m/([^"']+)'''),
webpage, 'uploader_id', fatal=False)
-
- ca... | yt_dlp/extractor/motherless.py | 26 | Python | 0.714 | suggestion | 110 | 51 | 51 | false | [extractor/motherless] Adding Gallery and fixing | 7,211 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | rexlambert22 |
'id': '2932705602075',
'ext': 'mp4',
'thumbnail': 'https://i.mycdn.me/videoPreview?id=1369902483995&type=37&idx=2&tkn=fqlnoQD_xwq5ovIlKfgNyU08qmM&fn=external_8',
'title': 'Boosty для тебя!',
'uploader_id': '597811038747',
'like_count': 0,
... | ```suggestion
def _clear_cookies(self, cdn_url):
# Direct http downloads will fail if CDN cookies are set
# so we need to reset them after each format extraction
``` | 'id': '2932705602075',
'ext': 'mp4',
'thumbnail': 'https://i.mycdn.me/videoPreview?id=1369902483995&type=37&idx=2&tkn=fqlnoQD_xwq5ovIlKfgNyU08qmM&fn=external_8',
'title': 'Boosty для тебя!',
'uploader_id': '597811038747',
'like_count': 0,
... | @@ -226,6 +235,13 @@ class OdnoklassnikiIE(InfoExtractor):
'skip': 'Site no longer embeds',
}]
+ # Direct http downloads will fail if CDN cookies are set from extraction
+ def _clear_cookies(self, cdn_url): | yt_dlp/extractor/odnoklassniki.py | 26 | Python | 0.786 | bug | 189 | 51 | 51 | false | [extractor/odnoklassniki] Fix formats extraction | 7,217 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | bashonly |
'duration': 35,
},
}]
_WEBPAGE_TESTS = [{
'url': 'https://boosty.to/ikakprosto/posts/56cedaca-b56a-4dfd-b3ed-98c79cfa0167',
'info_dict': {
'id': '3950343629563',
'ext': 'mp4',
'thumbnail': 'https://i.mycdn.me/videoPreview?id=2776238394107&... | I don't think the if should be needed here. But I'll investigate it separately. | 'duration': 35,
},
}]
_WEBPAGE_TESTS = [{
'url': 'https://boosty.to/ikakprosto/posts/56cedaca-b56a-4dfd-b3ed-98c79cfa0167',
'info_dict': {
'id': '3950343629563',
'ext': 'mp4',
'thumbnail': 'https://i.mycdn.me/videoPreview?id=2776238394107&... | @@ -226,6 +235,14 @@ class OdnoklassnikiIE(InfoExtractor):
'skip': 'Site no longer embeds',
}]
+ def _clear_cookies(self, cdn_url):
+ # Direct http downloads will fail if CDN cookies are set
+ # so we need to reset them after each format extraction
+ if self._get_cookies('https:/... | yt_dlp/extractor/odnoklassniki.py | 26 | Python | 0.286 | suggestion | 79 | 51 | 51 | false | [extractor/odnoklassniki] Fix formats extraction | 7,217 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
traverse_obj,
url_or_none,
)
class SverigesRadioBaseIE(InfoExtractor):
_BASE_URL = 'https://sverigesradio.se/sida/playerajax/'
_QUALITIES = ['low', 'medium', 'high']
_EXT_TO_CODEC_MAP = {
'mp3': 'mp3',
'm4a': 'aac',
}
_CODING_FORMAT_TO_ABR_MAP = {
5: 128,
11... | Cosmetic, but I like having the `or` branch clearly separated. inlining `extract_attributes` could be done either way, since it gets `try_call`ed we need not `or ''`:
```suggestion
audio_id = (
traverse_obj(
get_element_html_by_class('audio-button', webpage),
... | traverse_obj,
url_or_none,
)
class SverigesRadioBaseIE(InfoExtractor):
_BASE_URL = 'https://sverigesradio.se/sida/playerajax/'
_QUALITIES = ['low', 'medium', 'high']
_EXT_TO_CODEC_MAP = {
'mp3': 'mp3',
'm4a': 'aac',
}
_CODING_FORMAT_TO_ABR_MAP = {
5: 128,
11... | @@ -21,7 +26,13 @@ class SverigesRadioBaseIE(InfoExtractor):
}
def _real_extract(self, url):
- audio_id = self._match_id(url)
+ audio_id, display_id = self._match_valid_url(url).group('id', 'slug')
+ if not audio_id:
+ webpage = self._download_webpage(url, display_id)
+ ... | yt_dlp/extractor/sverigesradio.py | 26 | Python | 0.857 | refactor | 522 | 51 | 51 | false | [extractor/sverigesradio] Support slug URLs | 7,220 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | bashonly |
import json
import html
import re
from .common import InfoExtractor
from ..utils import traverse_obj
class ZaikoIE(InfoExtractor):
_VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
_TESTS = [{
'url': 'https://zaiko.io/event/324868/stream/20571/20571',
'info_dict': {
... | Match `http` and `www.` too since they work/redirect in browser
```suggestion
_VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
extract_attributes,
int_or_none,
str_or_none,
traverse_obj,
unescapeHTML,
url_or_none,
)
class ZaikoIE(InfoExtractor):
_VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
_TESTS = ... | @@ -0,0 +1,55 @@
+import json
+import html
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class ZaikoIE(InfoExtractor):
+ _VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' | yt_dlp/extractor/zaiko.py | 10 | Python | 0.714 | suggestion | 167 | 35 | 35 | false | [extractor/zaiko] Adding new extractor for zaiko.io | 7,254 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
from ..utils import traverse_obj
class ZaikoIE(InfoExtractor):
_VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
_TESTS = [{
'url': 'https://zaiko.io/event/324868/stream/20571/20571',
'info_dict': {
'id': 324868,
'ext': 'mp4',
'title': 'ZAI... | I like the idea here. We should use the tools already in the yt-dlp toolbox, though:
- non-fatal lenient JSON parsing with `_parse_json()`
- and utils imports: `extract_attributes`, `remove_start`, `unescapeHTML`
```suggestion
def _parse_vue_element_attr(self, name, string, video_id):
page_elem = sel... | str_or_none,
traverse_obj,
unescapeHTML,
url_or_none,
)
class ZaikoIE(InfoExtractor):
_VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
_TESTS = [{
'url': 'https://zaiko.io/event/324868/stream/20571/20571',
'info_dict': {
'id': '32486... | @@ -0,0 +1,55 @@
+import json
+import html
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class ZaikoIE(InfoExtractor):
+ _VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
+ _TESTS = [{
+ 'url': 'https://zaiko.io/event/324868/stream/20571/20571',
+ ... | yt_dlp/extractor/zaiko.py | 26 | Python | 0.857 | security | 624 | 51 | 51 | false | [extractor/zaiko] Adding new extractor for zaiko.io | 7,254 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
_TESTS = [{
'url': 'https://zaiko.io/event/324868/stream/20571/20571',
'info_dict': {
'id': 324868,
'ext': 'mp4',
'title': 'ZAIKO STREAMING TEST',
'uploader_id': 454,
'timestamp': 1583809200,
}
}]
def _parse_vue_element_att... | Without cookies, users will be redirected. We can check for this and `raise_login_required`
```suggestion
webpage, urlh = self._download_webpage_handle(url, video_id)
if 'zaiko.io/login' in urlh.geturl():
self.raise_login_required()
``` |
class ZaikoIE(InfoExtractor):
_VALID_URL = r'https?://(?:[\w-]+\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
_TESTS = [{
'url': 'https://zaiko.io/event/324868/stream/20571/20571',
'info_dict': {
'id': '324868',
'ext': 'mp4',
'title': 'ZAIKO STREAMING TEST... | @@ -0,0 +1,55 @@
+import json
+import html
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class ZaikoIE(InfoExtractor):
+ _VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
+ _TESTS = [{
+ 'url': 'https://zaiko.io/event/324868/stream/20571/20571',
+ ... | yt_dlp/extractor/zaiko.py | 26 | Python | 1 | suggestion | 269 | 46 | 51 | false | [extractor/zaiko] Adding new extractor for zaiko.io | 7,254 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
'title': 'ZAIKO STREAMING TEST',
'uploader_id': 454,
'timestamp': 1583809200,
}
}]
def _parse_vue_element_attr(self, name, string):
page_elem = self._search_regex(r'<' + name + '([^>]+)>', string, name)
attr = {}
for m in re.finditer(r'(:?[\w\... | Just eliminating a one-time use variable and adding `video_id` args to the `_parse_vue` calls
```suggestion
stream_meta = self._parse_vue_element_attr('stream-page', webpage, video_id)
player_page = self._download_webpage(
stream_meta['stream-access']['video_source'], video_id,
... | 'url': 'https://zaiko.io/event/324868/stream/20571/20571',
'info_dict': {
'id': '324868',
'ext': 'mp4',
'title': 'ZAIKO STREAMING TEST',
'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)',
'uploader_id': '454',
'uploa... | @@ -0,0 +1,55 @@
+import json
+import html
+import re
+
+from .common import InfoExtractor
+from ..utils import traverse_obj
+
+
+class ZaikoIE(InfoExtractor):
+ _VALID_URL = r'https://zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+'
+ _TESTS = [{
+ 'url': 'https://zaiko.io/event/324868/stream/20571/20571',
+ ... | yt_dlp/extractor/zaiko.py | 26 | Python | 0.857 | suggestion | 484 | 41 | 51 | false | [extractor/zaiko] Adding new extractor for zaiko.io | 7,254 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.