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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
},
'playlist_count': 18,
}, {
'url': 'https://allvod.sbs.co.kr/allvod/vodProgramDetail.do?pgmId=P460810577',
'info_dict': {
'_type': 'playlist',
'id': 'P460810577',
},
'playlist_count': 13,
}]
def _real_extract(self, url):
prog... | traversal always returns a list if it branches and you don't pass `get_all=False`
```suggestion
[self.url_result(f'https://allvod.sbs.co.kr/allvod/vodEndPage.do?mdaId={video_id}', SBSCoKrIE),
for video_id in traverse_obj(details, ('list', ..., 'mdaId'))], program_id)
``` | '_type': 'playlist',
'id': '22000010159',
},
'playlist_count': 18,
}, {
'url': 'https://allvod.sbs.co.kr/allvod/vodProgramDetail.do?pgmId=P460810577',
'info_dict': {
'_type': 'playlist',
'id': 'P460810577',
},
'playlist_... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.786 | suggestion | 300 | 51 | 51 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
_TESTS = [{
'url': 'https://programs.sbs.co.kr/culture/morningwide/vods/65007',
'info_dict': {
'_type': 'playlist',
'id': '00000210215',
},
'playlist_mincount': 9782,
}, {
'url': 'https://programs.sbs.co.kr/enter/dongsang2/vods/52006',
'inf... | IMO if/when this breaks, a keyerror would be cleaner than returning a url_result with a malformed url
```suggestion
program_id = self._download_json(
f'https://static.apis.sbs.co.kr/program-api/1.0/menu/{program_slug}', program_slug,
note='Downloading program menu data')['program']['... |
_TESTS = [{
'url': 'https://programs.sbs.co.kr/culture/morningwide/vods/65007',
'info_dict': {
'_type': 'playlist',
'id': '00000210215',
},
'playlist_mincount': 9782,
}, {
'url': 'https://programs.sbs.co.kr/enter/dongsang2/vods/52006',
'in... | @@ -0,0 +1,200 @@
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_resolution,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class SBSCoKrIE(InfoExtractor):
+ IE_NAME = 'sbs.co.kr'
+ _VALID_URL = [r'https?://allvod\... | yt_dlp/extractor/sbscokr.py | 26 | Python | 0.929 | suggestion | 483 | 27 | 27 | false | Add sbs.co.kr extractor | 8,326 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
from yt_dlp.extractor.common import InfoExtractor
import re
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
_TESTS = [
{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
... | Thanks for your PR :)
Please add a 2nd blank line over here, so that the automated linter passes
NOTE: This is not a review, because I don't review PRs. I am just informing you about an issue that the automated linter found, so that that issue doesn't hold back whoever does review this PR | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,72 @@
+from yt_dlp.extractor.common import InfoExtractor
+import re
+
+class MaarivIE(InfoExtractor): | yt_dlp/extractor/maariv.py | 11 | Python | 0.5 | style | 293 | 36 | 36 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | gamer191 | amir16yp |
for thumbnail, src in video_urls:
media_param = re.search(r'media=(\d+)', src).group(1)
info_url = f"https://dal.walla.co.il/media/{media_param}?origin=player.maariv.co.il"
info_json = self._download_json(info_url, video_id)
data = info_json['data']
ma... | [yt-dlp style prefers doing things inline](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#inline-values) when possible, so this would be:
```suggestion
format_list.append({
'format_id': str(format_id),
'url': stream_url,
'res... | 'upload_date': '20231009',
'title': 'מבצע חרבות ברזל',
'timestamp': 1696851301,
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
data = self._download_json(
f'https://dal.walla.co.il/media/{video_id}?origin=player.maariv.... | @@ -0,0 +1,73 @@
+from yt_dlp.extractor.common import InfoExtractor
+import re
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
+ _TESTS = [
+ {
+ 'url': 'https://www.maariv.co.il/news/la... | yt_dlp/extractor/maariv.py | 26 | Python | 0.857 | refactor | 391 | 43 | 32 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | amir16yp |
{
'format_id': '0',
'url': main_video_to_download_url,
'resolution': 'Main Video',
}
]
for format_id, stream_url_object in enumerate(data['video']['stream_urls'], start=1):
stream_url = s... | this should be inline as well
```suggestion
video_info_list.append({
'id': media_param,
'title': main_video_to_download_filename,
'thumbnail': thumbnail,
'duration': duration_seconds,
'formats': format_list,
... | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,73 @@
+from yt_dlp.extractor.common import InfoExtractor
+import re
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
+ _TESTS = [
+ {
+ 'url': 'https://www.maariv.co.il/news/la... | yt_dlp/extractor/maariv.py | 26 | Python | 0.857 | suggestion | 1,600 | 33 | 63 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | amir16yp |
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
'info_dict': {
'id': '1044008',
'title': '.*',
},
}
]
@staticmethod
def extract_resolution(url):
pattern = r'(\d{2,4}x\d{2,4})\.mp4$'
match = re.search(pat... | remove single-use variable
```suggestion
info_json = self._download_json(f"https://dal.walla.co.il/media/{media_param}?origin=player.maariv.co.il",
video_id)
``` |
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#]+&)?media=(?P<id>\d+)'
_EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](?P<url>{_VALID_URL})']
_TESTS = [{
'url': 'https://player.maariv.co.il/public/player.html?player=m... | @@ -0,0 +1,73 @@
+from yt_dlp.extractor.common import InfoExtractor
+import re
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
+ _TESTS = [
+ {
+ 'url': 'https://www.maariv.co.il/news/la... | yt_dlp/extractor/maariv.py | 26 | Python | 0.857 | suggestion | 221 | 51 | 51 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | amir16yp |
from yt_dlp.extractor.common import InfoExtractor
import re
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
_TESTS = [
{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
... | remove single-use variable
```suggestion
match = re.search(r'(\d{2,4}x\d{2,4})\.mp4$', url)
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,73 @@
+from yt_dlp.extractor.common import InfoExtractor
+import re
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
+ _TESTS = [
+ {
+ 'url': 'https://www.maariv.co.il/news/la... | yt_dlp/extractor/maariv.py | 21 | Python | 0.786 | suggestion | 106 | 46 | 46 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | amir16yp |
from yt_dlp.extractor.common import InfoExtractor
import re
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
_TESTS = [
{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
... | ```suggestion
from .common import InfoExtractor
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,73 @@
+from yt_dlp.extractor.common import InfoExtractor | yt_dlp/extractor/maariv.py | 1 | Python | 0.643 | refactor | 53 | 26 | 26 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | amir16yp |
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
_TESTS = [
{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
'info_dict': {
'id': '1044008',
... | your regex matches past the end of the thumbnail url
so it gets `https://img.wcdn.co.il/3/6/1/1/3611585-46.jpg" style="width: 100%; height: 390px; border: 0;" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" mozallowfullscreen="mozallowfullscreen`
trying to download that gives a http 40... | parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#]+&)?media=(?P<id>\d+)'
_EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](?P... | @@ -0,0 +1,73 @@
+from yt_dlp.extractor.common import InfoExtractor
+import re
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
+ _TESTS = [
+ {
+ 'url': 'https://www.maariv.co.il/news/la... | yt_dlp/extractor/maariv.py | 26 | Python | 0.929 | suggestion | 634 | 51 | 51 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | amir16yp |
from .common import InfoExtractor
import re
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
_TESTS = [
{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
'info_dict'... | How about instead of matching the article pages, we match the iframes:
```suggestion
_VALID_URL = r'https?://player.maariv.co.il/public/player.html\?(?:[^#]+&)?media=(?P<id>\d+)'
_EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](?P<url>{_VALID_URL})']
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,70 @@
+from .common import InfoExtractor
+import re
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})' | yt_dlp/extractor/maariv.py | 7 | Python | 0.857 | question | 260 | 32 | 32 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | amir16yp |
}
]
for format_id, stream_url_object in enumerate(data['video']['stream_urls'], start=1):
stream_url = stream_url_object['stream_url']
format_list.append({
'format_id': str(format_id),
'url': stream_url,
... | With that, we can then skip the playlist vs. single video part. I've also made some of the data extraction non-fatal:
```suggestion
data = self._download_json(
f'https://dal.walla.co.il/media/{video_id}?origin=player.maariv.co.il', video_id, fatal=False)['data']
formats = []
h... | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,70 @@
+from .common import InfoExtractor
+import re
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
+ _TESTS = [
+ {
+ 'url': 'https://www.maariv.co.il/news/law/Article-104400... | yt_dlp/extractor/maariv.py | 26 | Python | 0.857 | refactor | 1,106 | 27 | 63 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | amir16yp |
from .common import InfoExtractor
import re
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
_TESTS = [
{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
'info_dict'... | This can be removed, since we can instead use the `parse_resolution` function from `..utils`
```suggestion
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,70 @@
+from .common import InfoExtractor
+import re
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
+ _TESTS = [
+ {
+ 'url': 'https://www.maariv.co.il/news/law/Article-104400... | yt_dlp/extractor/maariv.py | 22 | Python | 0.786 | suggestion | 112 | 47 | 47 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | amir16yp |
from .common import InfoExtractor
import re
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
_TESTS = [
{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
'info_dict'... | And we need updated imports for the helper functions used
```suggestion
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,70 @@
+from .common import InfoExtractor
+import re | yt_dlp/extractor/maariv.py | 2 | Python | 0.857 | refactor | 230 | 27 | 27 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | amir16yp |
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player.maariv.co.il/public/player.html\?(?:[^#]+&)... | ```suggestion
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#]+&)?media=(?P<id>\d+)'
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_resolution,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'https?://player\.maariv\.co\.il/public/player\.html\?(?:[^#... | @@ -0,0 +1,55 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_resolution,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'https?://player.maariv.co.il/... | yt_dlp/extractor/maariv.py | 13 | Python | 0.714 | suggestion | 121 | 38 | 38 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | amir16yp |
'url': 'https://player.maariv.co.il/public/player.html?player=maariv-desktop&media=3611585',
'info_dict': {
'id': '3611585',
'duration': 75,
'ext': 'mp4',
'upload_date': '20231009',
'title': 'מבצע חרבות ברזל',
'timestamp': 169685130... | ```suggestion
f'https://dal.walla.co.il/media/{video_id}?origin=player.maariv.co.il', video_id)['data']
``` | 'url': 'https://player.maariv.co.il/public/player.html?player=maariv-desktop&media=3611585',
'info_dict': {
'id': '3611585',
'duration': 75,
'ext': 'mp4',
'upload_date': '20231009',
'title': 'מבצע חרבות ברזל',
'timestamp': 169685130... | @@ -0,0 +1,63 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_resolution,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'https?://player\.maariv\.co\.... | yt_dlp/extractor/maariv.py | 26 | Python | 0.714 | suggestion | 121 | 49 | 48 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | amir16yp |
'ext': 'mp4',
'upload_date': '20231009',
'title': 'מבצע חרבות ברזל',
'timestamp': 1696851301,
},
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
'info_dict': {
'id': '3611585',
'dur... | ```suggestion
if hls_url := traverse_obj(data, ('video', 'url', {url_or_none})):
``` | 'ext': 'mp4',
'upload_date': '20231009',
'title': 'מבצע חרבות ברזל',
'timestamp': 1696851301,
},
}]
_WEBPAGE_TESTS = [{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
'info_dict': {
'id': '3611585',
'dur... | @@ -0,0 +1,63 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_resolution,
+ unified_timestamp,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class MaarivIE(InfoExtractor):
+ IE_NAME = 'maariv.co.il'
+ _VALID_URL = r'https?://player\.maariv\.co\.... | yt_dlp/extractor/maariv.py | 26 | Python | 0.571 | suggestion | 94 | 45 | 44 | false | [Extractors] Add maariv.co.il extractor | 8,331 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | amir16yp |
f'It will {self._downloader._format_err("NOT", self._downloader.Styles.EMPHASIS)} be supported.{LF}'
f'Please {self._downloader._format_err("DO NOT", self._downloader.Styles.ERROR)} open an issue, '
'unless you have evidence that the video is not DRM protected', expected=True)
clas... | I suggested this url, but why don't we actually just use /favicon.ico for all the piracy sites (eg https://thisav.com/favicon.ico)? That url exists for every website, and stores just the site's logo (which I highly doubt would be copyright, and it's not really our problem if it is) | f'It will {self._downloader._format_err("NOT", self._downloader.Styles.EMPHASIS)} be supported.{LF}'
f'Please {self._downloader._format_err("DO NOT", self._downloader.Styles.ERROR)} open an issue, '
'unless you have evidence that the video is not DRM protected', expected=True)
clas... | @@ -164,11 +164,15 @@ class KnownPiracyIE(UnsupportedInfoExtractor):
r'viewsb\.com',
r'filemoon\.sx',
r'hentai\.animestigma\.com',
+ r'thisav\.com',
)
_TESTS = [{
'url': 'http://dood.to/e/5s1wmbdacezb',
'only_matching': True,
+ }, {
+ 'url': 'htt... | yt_dlp/extractor/unsupported.py | 26 | Python | 0.5 | suggestion | 282 | 30 | 34 | false | [ie/thisav] Remove | 8,346 | yt-dlp/yt-dlp | 132,642 | Python | gamer191 | bashonly |
fp=res.raw, headers=res.headers, url=res.url,
status=res.status_code, reason=res.reason)
self._requests_response = res
def read(self, amt: int = None):
try:
# Interact with urllib3 response directly.
return self.fp.read(amt, decode_content=True)
... | I think we can remove the `except urllib3.exceptions.IncompleteRead ...` block as that is always being wrapped by ProtocolError. | fp=res.raw, headers=res.headers, url=res.url,
status=res.status_code, reason=res.reason)
self._requests_response = res
def read(self, amt: int = None):
try:
# Interact with urllib3 response directly.
return self.fp.read(amt, decode_content=True)
... | @@ -153,7 +153,10 @@ def read(self, amt: int = None):
(err for err in (e.__context__, e.__cause__, *variadic(e.args))
if isinstance(err, http.client.IncompleteRead)), None)
if ir_err is not None:
- raise IncompleteRead(partial=len(ir_err.partial), expected=... | yt_dlp/networking/_requests.py | 26 | Python | 0.714 | suggestion | 129 | 51 | 51 | false | [rh:requests] Handle both `bytes` and `int` for `IncompleteRead.partial` | 8,348 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | Grub4K |
try:
import importlib.metadata # noqa: F401
except Exception:
raise Exception(
f'You are using an unsupported version of Python. Only Python versions 3.8 and above are supported by yt-dlp') # noqa: F541
__license__ = 'Public Domain'
import collections
import getpass
import itertools
import optparse
... | Imo we should `raise ImportError(...) from None` here. `from None` since its not caused by the failing import, and `ImportError` bc thats more aligned with what people would expect:
```py
try:
import yt_dlp
except ImportError:
... # Handle no yt_dlp
```
I also dont understand why we are not doing
```py... | import sys
if sys.version_info < (3, 8):
raise ImportError(
f'You are using an unsupported version of Python. Only Python versions 3.8 and above are supported by yt-dlp') # noqa: F541
__license__ = 'Public Domain'
import collections
import getpass
import itertools
import optparse
import os
import re
imp... | @@ -1,8 +1,8 @@
try:
- import contextvars # noqa: F401
+ import importlib.metadata # noqa: F401
except Exception:
raise Exception(
- f'You are using an unsupported version of Python. Only Python versions 3.7 and above are supported by yt-dlp') # noqa: F541
+ f'You are using an unsupported ... | yt_dlp/__init__.py | 5 | Python | 1 | bug | 379 | 30 | 30 | false | Remove Python 3.7 support | 8,361 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | bashonly |
from ..utils import (
int_or_none,
parse_iso8601,
unescapeHTML,
)
class PeriscopeBaseIE(InfoExtractor):
_M3U8_HEADERS = {
'Referer': 'https://www.periscope.tv/'
}
def _call_api(self, method, query, item_id):
return self._download_json(
'https://api.periscope.tv/api... | ```suggestion
is_live = broadcast.get('state').lower() == 'running'
timestamp = (int_or_none(broadcast.get('created_at_ms'), scale=1000)
or parse_iso8601(broadcast.get('created_at')))
```
or inline below. | from ..utils import (
int_or_none,
parse_iso8601,
unescapeHTML,
)
class PeriscopeBaseIE(InfoExtractor):
_M3U8_HEADERS = {
'Referer': 'https://www.periscope.tv/'
}
def _call_api(self, method, query, item_id):
return self._download_json(
'https://api.periscope.tv/api... | @@ -20,16 +20,20 @@ def _parse_broadcast_data(self, broadcast, video_id):
title = broadcast.get('status') or 'Periscope Broadcast'
uploader = broadcast.get('user_display_name') or broadcast.get('username')
title = '%s - %s' % (uploader, title) if uploader else title
+ timestamp = parse... | yt_dlp/extractor/periscope.py | 26 | Python | 0.929 | suggestion | 246 | 51 | 51 | false | [ie/twitter:broadcast] Update extraction | 8,383 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | HitomaruKonpaku |
IE_NAME = 'twitter:broadcast'
_VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/broadcasts/(?P<id>[0-9a-zA-Z]{13})'
_TEST = {
# untitled Periscope video
'url': 'https://twitter.com/i/broadcasts/1yNGaQLWpejGj',
'info_dict': {
'id': '1yNGaQLWpejGj',
'ext': 'mp4',
... | imo there should be a fallback here. For the test case the title would be `None`. | IE_NAME = 'twitter:broadcast'
_VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/broadcasts/(?P<id>[0-9a-zA-Z]{13})'
_TESTS = [{
# untitled Periscope video
'url': 'https://twitter.com/i/broadcasts/1yNGaQLWpejGj',
'info_dict': {
'id': '1yNGaQLWpejGj',
'ext': 'mp4',
... | @@ -1585,6 +1585,9 @@ def _real_extract(self, url):
if not broadcast:
raise ExtractorError('Broadcast no longer exists', expected=True)
info = self._parse_broadcast_data(broadcast, broadcast_id)
+ info['title'] = broadcast.get('status') | yt_dlp/extractor/twitter.py | 26 | Python | 0.429 | suggestion | 81 | 51 | 51 | false | [ie/twitter:broadcast] Update extraction | 8,383 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | HitomaruKonpaku |
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
unescapeHTML,
)
class PeriscopeBaseIE(InfoExtractor):
_M3U8_HEADERS = {
'Referer': 'https://www.periscope.tv/'
}
def _call_api(self, method, query, item_id):
return self._download_json(
... | move this into the return (inline) | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
unescapeHTML,
)
class PeriscopeBaseIE(InfoExtractor):
_M3U8_HEADERS = {
'Referer': 'https://www.periscope.tv/'
}
def _call_api(self, method, query, item_id):
return self._download_json(
... | @@ -21,15 +21,16 @@ def _parse_broadcast_data(self, broadcast, video_id):
uploader = broadcast.get('user_display_name') or broadcast.get('username')
title = '%s - %s' % (uploader, title) if uploader else title
is_live = broadcast.get('state').lower() == 'running'
+ timestamp = int_or_n... | yt_dlp/extractor/periscope.py | 24 | Python | 0.143 | refactor | 34 | 49 | 49 | false | [ie/twitter:broadcast] Update extraction | 8,383 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | HitomaruKonpaku |
media_key = broadcast['media_key']
source = self._call_api(
f'live_video_stream/status/{media_key}', media_key)['source']
m3u8_url = source.get('noRedirectPlaybackUrl') or source['location']
if '/live_video_stream/geoblocked/' in m3u8_url:
self.raise_geo_restricte... | can you add a test that has a title actually sourced from `broadcast['status']`? | },
}, {
'url': 'https://twitter.com/i/broadcasts/1OyKAVQrgzwGb',
'info_dict': {
'id': '1OyKAVQrgzwGb',
'ext': 'mp4',
'title': 'Starship Flight Test',
'uploader': 'SpaceX',
'uploader_id': 'SpaceX',
'uploader_url': 'https:... | @@ -1585,6 +1587,10 @@ def _real_extract(self, url):
if not broadcast:
raise ExtractorError('Broadcast no longer exists', expected=True)
info = self._parse_broadcast_data(broadcast, broadcast_id)
+ info['title'] = broadcast.get('status') or info.get('title') | yt_dlp/extractor/twitter.py | 26 | Python | 0.5 | question | 80 | 51 | 51 | false | [ie/twitter:broadcast] Update extraction | 8,383 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | HitomaruKonpaku |
'url': 'https://twitter.com/i/broadcasts/1yNGaQLWpejGj',
'info_dict': {
'id': '1yNGaQLWpejGj',
'ext': 'mp4',
'title': 'Andrea May Sahouri - Periscope Broadcast',
'uploader': 'Andrea May Sahouri',
'uploader_id': 'andreamsahouri',
'ti... | IMO we should map the info_dict fields as they are in `TwitterIE`, i.e. no `channel` or `channel_id`
```suggestion
info['uploader_url'] = format_field(broadcast, 'twitter_username', 'https://twitter.com/%s', default=None)
``` | 'url': 'https://twitter.com/i/broadcasts/1yNGaQLWpejGj',
'info_dict': {
'id': '1yNGaQLWpejGj',
'ext': 'mp4',
'title': 'Andrea May Sahouri - Periscope Broadcast',
'uploader': 'Andrea May Sahouri',
'uploader_id': 'andreamsahouri',
'up... | @@ -1585,6 +1587,10 @@ def _real_extract(self, url):
if not broadcast:
raise ExtractorError('Broadcast no longer exists', expected=True)
info = self._parse_broadcast_data(broadcast, broadcast_id)
+ info['title'] = broadcast.get('status') or info.get('title')
+ info['uploader... | yt_dlp/extractor/twitter.py | 26 | Python | 1 | suggestion | 238 | 51 | 51 | false | [ie/twitter:broadcast] Update extraction | 8,383 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | HitomaruKonpaku |
class PeriscopeBaseIE(InfoExtractor):
_M3U8_HEADERS = {
'Referer': 'https://www.periscope.tv/'
}
def _call_api(self, method, query, item_id):
return self._download_json(
'https://api.periscope.tv/api/v2/%s' % method,
item_id, query=query)
def _parse_broadcast_... | new value should be the fallback, and line was too long
```suggestion
'timestamp': parse_iso8601(broadcast.get('created_at')) or int_or_none(
broadcast.get('created_at_ms'), scale=1000),
``` |
class PeriscopeBaseIE(InfoExtractor):
_M3U8_HEADERS = {
'Referer': 'https://www.periscope.tv/'
}
def _call_api(self, method, query, item_id):
return self._download_json(
'https://api.periscope.tv/api/v2/%s' % method,
item_id, query=query)
def _parse_broadcast_... | @@ -24,12 +24,12 @@ def _parse_broadcast_data(self, broadcast, video_id):
thumbnails = [{
'url': broadcast[image],
- } for image in ('image_url', 'image_url_small') if broadcast.get(image)]
+ } for image in ('image_url', 'image_url_medium', 'image_url_small') if broadcast.get(image... | yt_dlp/extractor/periscope.py | 26 | Python | 1 | refactor | 222 | 51 | 51 | false | [ie/twitter:broadcast] Update extraction | 8,383 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | HitomaruKonpaku |
import urllib.parse
from .common import InfoExtractor
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
_VALID_URL = r'''(?x)
(https?://www\.uniqueradio\.jp/agplayer5/player\.php)|
(https?://www\.uniqueradio\.jp/agplayer5/... | you can have multiple `_VALID_URL`s without regex capture workarounds by putting them in a list like this:
```suggestion
_VALID_URL = [r'https?://www\.uniqueradio\.jp/agplayer5/player\.php',
r'https?://www\.uniqueradio\.jp/agplayer5/inc-player-hls\.php',
r'https?://(?:www\.)?... | import datetime
import urllib.parse
from .common import InfoExtractor
from ..utils import (
clean_html,
datetime_from_str,
unified_timestamp,
urljoin,
)
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 (f.k.a. AGQR) Nippon Cultural Broadcasting, Inc. (JOQR)'
_VALID_URL = [r'https?://www\... | @@ -0,0 +1,54 @@
+import urllib.parse
+
+from .common import InfoExtractor
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL = r'''(?x)
+ (https?://www\.uniqueradio\.jp/agplayer5/player\.php)|
+ (https?://www\... | yt_dlp/extractor/joqrag.py | 13 | Python | 0.786 | suggestion | 440 | 38 | 38 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | pzhlkj6612 |
'description': str,
'live_status': 'is_live',
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}]
def _real_extract(self, url):
video_id = 'live'
metadata = self._download_webpage(
'htt... | could you add some more tests for the other urls in `_VALID_URL`?
just something like this is fine, you don't need to put the same details in again and again:
```python3
{
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp... | 'url': 'https://www.uniqueradio.jp/agplayer5/player.php',
'info_dict': {
'id': 'live',
'title': str,
'channel': '超!A&G+',
'description': str,
'live_status': 'is_live',
'release_timestamp': int,
},
'params': {
... | @@ -0,0 +1,54 @@
+import urllib.parse
+
+from .common import InfoExtractor
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL = r'''(?x)
+ (https?://www\.uniqueradio\.jp/agplayer5/player\.php)|
+ (https?://www\... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.857 | question | 397 | 37 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | pzhlkj6612 |
},
}]
def _real_extract(self, url):
video_id = 'live'
metadata = self._download_webpage(
'https://www.uniqueradio.jp/aandg', video_id,
note='Downloading metadata', errnote='Failed to download metadata')
title = urllib.parse.unquote_plus(
self... | personally I'd have the title as just `title`, and put `超!A&G+` in `channel` (and/or `uploader`)
```suggestion
'title': title,
'channel': '超!A&G+',
```
and if i still want 超!A&G+ in the filename i can do `-o "%(title)s - %(channel)s [%(id)s].%(ext)s"` | 'live_status': 'is_live',
'release_timestamp': int,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {... | @@ -0,0 +1,54 @@
+import urllib.parse
+
+from .common import InfoExtractor
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL = r'''(?x)
+ (https?://www\.uniqueradio\.jp/agplayer5/player\.php)|
+ (https?://www\... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.786 | suggestion | 280 | 31 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | pzhlkj6612 |
(https?://(?:www\.)?joqr\.co\.jp/qr/(?:agdailyprogram|agregularprogram)/)
'''
_TESTS = [{
'url': 'https://www.uniqueradio.jp/agplayer5/player.php',
'info_dict': {
'id': 'live',
'title': str,
'description': str,
'... | as i write this the description that gets extracted is `<div>土曜の黄昏時にお届けするノンストップアニソンライブラリー</div><div>ぜひ何かをしながらお聴きください!</div><br>番組へのメール、リクエストは<a href=\"mailto:sag@joqr.net\">sag@joqr.net</a>まで!<br>`
```suggestion
desc = clean_html(urllib.parse.unquote_plus(
self._search_regex(r'var\s+Program_text\... |
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 (f.k.a. AGQR) Nippon Cultural Broadcasting, Inc. (JOQR)'
_VALID_URL = [r'https?://www\.uniqueradio\.jp/agplayer5/(?:player|inc-player-hls)\.php',
r'https?://(?:www\.)?joqr\.co\.jp/ag/',
r'https?://(?:www\.)?joqr\.co\.jp/q... | @@ -0,0 +1,54 @@
+import urllib.parse
+
+from .common import InfoExtractor
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL = r'''(?x)
+ (https?://www\.uniqueradio\.jp/agplayer5/player\.php)|
+ (https?://www\... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.857 | refactor | 556 | 44 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | pzhlkj6612 |
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}]
def _real_extract(self, url):
video_id = 'live'
metadata = self._download_webpage(
'https://www.uniqueradio.jp/aandg', video_id,
note='Downloadin... | the `m3u8_path` starts with a `/` already, so the path ends up as https://www.uniqueradio.jp//agapps/hls/cdn.m3u8
that does work, but this is more future-proof:
```suggestion
formats = self._extract_m3u8_formats(
urljoin('https://www.uniqueradio.jp/', m3u8_path), video_id, fatal=False)
```
`fr... | 'id': 'live',
'title': str,
'channel': '超!A&G+',
'description': str,
'live_status': 'is_live',
'release_timestamp': int,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}... | @@ -0,0 +1,54 @@
+import urllib.parse
+
+from .common import InfoExtractor
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL = r'''(?x)
+ (https?://www\.uniqueradio\.jp/agplayer5/player\.php)|
+ (https?://www\... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.857 | refactor | 346 | 35 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | pzhlkj6612 |
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/... | since it's basically the same thing for both, you could maybe add:
```python3
def _extract_metadata(self, variable, html, name):
text = self._search_regex(fr'var\s+{variable}\s*=\s*["\']([^"\']+)["\']', html, name)
if text:
return clean_html(urllib.parse.unquote_plus(text))
```
th... | 'description': str,
'live_status': 'is_live',
'release_timestamp': int,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
... | @@ -0,0 +1,67 @@
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import clean_html, urljoin
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL = [r'https?://www\.uniqueradio\.jp/agplayer5/player\.php',
+ r'h... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.857 | refactor | 591 | 45 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | pzhlkj6612 |
'channel': '超!A&G+',
'description': str,
'live_status': 'is_live',
'release_timestamp': int,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agpla... | might be safer to use a negative lookahead with a backreference whichever type of quote is used initially:
```suggestion
def _extract_metadata(self, variable, html, name):
return clean_html(urllib.parse.unquote_plus(self._search_regex(
rf'var\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)... | 'description': str,
'live_status': 'is_live',
'release_timestamp': int,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 26 | Python | 1 | refactor | 391 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/... | we can simplify the pattern a bit by being more lenient with the time that we aren't capturing
```suggestion
start_time = self._search_regex(
r'<h3[^>]+\bclass="dailyProgram-itemHeaderTime"[^>]*>[\s\d:]+–\s*(?P<time>\d{1,2}:\d{1,2})',
```
also, why are we capturing the second time? isn'... | },
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agdailyprogram/',
'only_matching': Tr... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.857 | refactor | 395 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': T... | ```suggestion
date = dt.strftime('%Y%m%d')
``` | 'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': True,
}, {
... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.571 | suggestion | 60 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'only_matching': True,
}, {
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agdailyprogram/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agregularprogram/',
'only_matchi... | Looks like this should be non-fatal
```suggestion
self._download_webpage(
f'https://www.joqr.co.jp/qr/agdailyprogram/?date={date}', video_id,
note=f'Downloading program list of {date}', fatal=False,
errnote=f'Failed to download program lis... | }, {
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agdailyprogram/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agregularprogram/',
'only_matching': True,
}]
def _ext... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.857 | bug | 345 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'release_timestamp': int,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {
'url': 'https://www.joqr.co.j... | double underscore isn't necessary imo, could just be named `extract_start_time_from` or something | },
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_m... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.429 | refactor | 97 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
self._download_webpage(
f'https://www.joqr.co.jp/qr/agdailyprogram/?date={date}', video_id,
note=f'Downloading program list of {date}',
errnote=f'Failed to download program list of {date}'),
'start time of the first program', de... | `desc` can be inlined in the return | self._download_webpage(
f'https://www.joqr.co.jp/qr/agdailyprogram/?date={date}', video_id,
note=f'Downloading program list of {date}', fatal=False,
errnote=f'Failed to download program list of {date}') or '',
'start time', defa... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.214 | suggestion | 35 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
start_timestamp = __extract_start_timestamp_of_day('today')
if not start_timestamp:
return None
if not is_live or start_timestamp < datetime_from_str('now').timestamp():
return start_timestamp
else:
return __extract_start_timestamp_of_day('yesterday')... | ```suggestion
msg = 'This stream is not currently live'
if release_timestamp:
msg += (' and will start at '
+ datetime.datetime.fromtimestamp(release_timestamp).strftime('%Y-%m-%d %H:%M:%S'))
``` | start_timestamp = extract_start_time_from('today')
if not start_timestamp:
return None
if not is_live or start_timestamp < datetime_from_str('now').timestamp():
return start_timestamp
else:
return extract_start_time_from('yesterday')
def _real_ex... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.786 | suggestion | 264 | 49 | 48 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
video_id = 'live'
metadata = self._download_webpage(
'https://www.uniqueradio.jp/aandg', video_id,
note='Downloading metadata', errnote='Failed to download metadata')
title = self._extract_metadata('Program_name', metadata, 'program title')
desc = self._extract_m... | This might as well be fatal, but up to you
```suggestion
formats = self._extract_m3u8_formats(
urljoin('https://www.uniqueradio.jp/', m3u8_path), video_id)
``` | video_id = 'live'
metadata = self._download_webpage(
'https://www.uniqueradio.jp/aandg', video_id,
note='Downloading metadata', errnote='Failed to download metadata')
title = self._extract_metadata('Program_name', metadata)
if title == '放送休止':
format... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.786 | refactor | 191 | 39 | 38 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
import urllib.parse
import datetime
from .common import InfoExtractor
from ..utils import (
clean_html,
datetime_from_str,
unified_timestamp,
urljoin,
)
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
_VALID_URL = [r'https?://www\.uniqueradio\.... | ```suggestion
r'https?://(?:www\.)?joqr\.co\.jp/ag/?(?:$|[#?])',
r'https?://(?:www\.)?joqr\.co\.jp/qr/ag(?:daily|regular)program/?(?:$|[#?])']
``` | import datetime
import urllib.parse
from .common import InfoExtractor
from ..utils import (
clean_html,
datetime_from_str,
unified_timestamp,
urljoin,
)
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 (f.k.a. AGQR) Nippon Cultural Broadcasting, Inc. (JOQR)'
_VALID_URL = [r'https?://www\... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
+ _VALID_URL... | yt_dlp/extractor/joqrag.py | 18 | Python | 0.714 | suggestion | 185 | 43 | 43 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
import urllib.parse
import datetime
from .common import InfoExtractor
from ..utils import (
clean_html,
datetime_from_str,
unified_timestamp,
urljoin,
)
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR)'
_VALID_URL = [r'https?://www\.uniqueradio\.... | ```suggestion
import datetime
import urllib.parse
``` | import datetime
import urllib.parse
from .common import InfoExtractor
from ..utils import (
clean_html,
datetime_from_str,
unified_timestamp,
urljoin,
)
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 (f.k.a. AGQR) Nippon Cultural Broadcasting, Inc. (JOQR)'
_VALID_URL = [r'https?://www\... | @@ -0,0 +1,113 @@
+import urllib.parse
+import datetime | yt_dlp/extractor/joqrag.py | 2 | Python | 0.571 | suggestion | 56 | 27 | 27 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
import datetime
import urllib.parse
from .common import InfoExtractor
from ..utils import (
clean_html,
datetime_from_str,
unified_timestamp,
urljoin,
)
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR, AGQR)'
_VALID_URL = [r'https?://www\.uniquer... | ```suggestion
_VALID_URL = [r'https?://www\.uniqueradio\.jp/agplayer5/(?:player|inc-player-hls)\.php',
``` | import datetime
import urllib.parse
from .common import InfoExtractor
from ..utils import (
clean_html,
datetime_from_str,
unified_timestamp,
urljoin,
)
class JoqrAgIE(InfoExtractor):
IE_DESC = '超!A&G+ 文化放送 (f.k.a. AGQR) Nippon Cultural Broadcasting, Inc. (JOQR)'
_VALID_URL = [r'https?://www\... | @@ -0,0 +1,113 @@
+import datetime
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR, AGQR)'
+ _VAL... | yt_dlp/extractor/joqrag.py | 16 | Python | 0.714 | suggestion | 112 | 41 | 41 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'description': str,
'live_status': 'is_live',
'release_timestamp': int,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
... | it's always non-fatal so the `name` param doesn't really matter
```suggestion
def _extract_metadata(self, variable, html):
return clean_html(urllib.parse.unquote_plus(self._search_regex(
rf'var\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1',
html, 'metadata', group='value'... | 'live_status': 'is_live',
'release_timestamp': int,
},
'params': {
'skip_download': True,
'ignore_no_formats_error': True,
},
}, {
'url': 'https://www.uniqueradio.jp/agplayer5/inc-player-hls.php',
'only_matching': True,
}, {... | @@ -0,0 +1,113 @@
+import datetime
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR, AGQR)'
+ _VAL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.857 | refactor | 348 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
r'<h3[^>]+\bclass="dailyProgram-itemHeaderTime"[^>]*>[\s\d:]+–\s*(?P<time>\d{1,2}:\d{1,2})',
self._download_webpage(
f'https://www.joqr.co.jp/qr/agdailyprogram/?date={date}', video_id,
note=f'Downloading program list of {date}', fatal=False,
... | ```suggestion
title = self._extract_metadata('Program_name', metadata)
``` | self._download_webpage(
f'https://www.joqr.co.jp/qr/agdailyprogram/?date={date}', video_id,
note=f'Downloading program list of {date}', fatal=False,
errnote=f'Failed to download program list of {date}') or '',
'start time', defa... | @@ -0,0 +1,113 @@
+import datetime
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR, AGQR)'
+ _VAL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.643 | refactor | 84 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
if title == '放送休止':
formats = []
live_status = 'is_upcoming'
release_timestamp = self._extract_start_timestamp(video_id, False)
msg = 'This stream is not currently live'
if release_timestamp:
msg += (' and will start at '
... | ```suggestion
'description': self._extract_metadata('Program_text', metadata),
``` | formats = []
live_status = 'is_upcoming'
release_timestamp = self._extract_start_timestamp(video_id, False)
msg = 'This stream is not currently live'
if release_timestamp:
msg += (' and will start at '
+ datetime.datetim... | @@ -0,0 +1,113 @@
+import datetime
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR, AGQR)'
+ _VAL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.643 | refactor | 96 | 31 | 30 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'url': 'https://www.joqr.co.jp/ag/article/103760/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agdailyprogram/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agregularprogram/',
'only_matching': True,
}]
def _extract_meta... | could make this a little less busy
```suggestion
start_time = self._search_regex(
r'<h3[^>]+\bclass="dailyProgram-itemHeaderTime"[^>]*>[\s\d:]+–\s*(\d{1,2}:\d{1,2})',
self._download_webpage(
f'https://www.joqr.co.jp/qr/agdailyprogram/?date={date}', vi... | 'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agdailyprogram/',
'only_matching': True,
}, {
'url': 'http://www.joqr.co.jp/qr/agregularprogram/',
'only_matching': True,
}]
def _extract_metadata(self, variable, html):
return clean_html(urllib... | @@ -0,0 +1,113 @@
+import datetime
+import urllib.parse
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ datetime_from_str,
+ unified_timestamp,
+ urljoin,
+)
+
+
+class JoqrAgIE(InfoExtractor):
+ IE_DESC = '超!A&G+ 文化放送 Nippon Cultural Broadcasting, Inc. (JOQR, AGQR)'
+ _VAL... | yt_dlp/extractor/joqrag.py | 26 | Python | 0.857 | bug | 537 | 51 | 51 | false | [ie/joqrag] Add extractor | 8,384 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
import functools
import re
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
ExtractorError,
OnDemandPagedList,
float_or_none,
int_or_none,
join_nonempty,
parse_age_limit,
parse_qs,
random_uuidv4,
unified_strdate,
url_or_none,
)
from ..... | could you add a test (can be `only_matching`) for a url with the `/en/` path? | import functools
import re
import uuid
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
ExtractorError,
OnDemandPagedList,
float_or_none,
int_or_none,
join_nonempty,
parse_age_limit,
parse_qs,
unified_strdate,
url_or_none,
)
from ..utils.t... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 22 | Python | 0.429 | question | 77 | 47 | 47 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'release_date': '20231001',
'series': 'Breakup Probation, A Week',
'series_id': 22912,
'episode_number': 8,
'episode': 'E08',
},
}, {
'url': 'https://www.ondemandkorea.com/player/vod/the-outlaws?contentId=369531',
'md5': 'fa5523b87a... | I would just use `str(uuid.uuid4())`
```suggestion
data = self._download_json(
f'https://odkmedia.io/odx/api/v3/playback/{video_id}/', video_id, fatal=False,
headers={'service-name': 'odk'}, query={'did': str(uuid.uuid4())}, expected_status=(403, 404))
``` | 'release_date': '20231001',
'series': 'Breakup Probation, A Week',
'series_id': 22912,
'episode_number': 8,
'episode': 'E08',
},
}, {
'url': 'https://www.ondemandkorea.com/player/vod/the-outlaws?contentId=369531',
'md5': 'fa5523b87a... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.857 | suggestion | 293 | 51 | 51 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'series_id': 22912,
'episode_number': 8,
'episode': 'E08',
},
}, {
'url': 'https://www.ondemandkorea.com/player/vod/the-outlaws?contentId=369531',
'md5': 'fa5523b87aa1f6d74fc622a97f2b47cd',
'info_dict': {
'id': '369531',
'ex... | I like error handling with traversal, and we only extract from the `result` field afterwards
```suggestion
if not traverse_obj(data, ('result', {dict}))):
msg = traverse_obj(data, ('messages', '__default'), 'title', expected_type=str)
raise ExtractorError(msg or 'Got empty response f... | 'series_id': 22912,
'episode_number': 8,
'episode': 'E08',
},
}, {
'url': 'https://www.ondemandkorea.com/player/vod/the-outlaws?contentId=369531',
'md5': 'fa5523b87aa1f6d74fc622a97f2b47cd',
'info_dict': {
'id': '369531',
'ex... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 1 | refactor | 391 | 51 | 51 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'age_limit': 18,
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
data = self._download_json(f'https://odkmedia.io/odx/api/v3/playback/{video_id}/', video_id,
fatal=False, headers={'service-name': 'odk'},
... | If you want to keep the 3.8+ syntax, then this PR can't be merged until after we remove support for 3.7, and I will come back to review this part afterwards | 'age_limit': 18,
},
}, {
'url': 'https://www.ondemandkorea.com/en/player/vod/capture-the-moment-how-is-that-possible?contentId=1605006',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
data = self._download_json(
... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.429 | suggestion | 156 | 51 | 51 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
data = self._download_json(f'https://odkmedia.io/odx/api/v3/playback/{video_id}/', video_id,
fatal=False, headers={'service-name': 'odk'},
query={'did': random_uuidv4()}, expected_status=(403, 404))
if not data.get('result'):
... | if the `data['result']` suggestion from above is applied
```suggestion
for track in traverse_obj(data, ('text_tracks', lambda _, v: url_or_none(v['url']))):
``` | def _real_extract(self, url):
video_id = self._match_id(url)
data = self._download_json(
f'https://odkmedia.io/odx/api/v3/playback/{video_id}/', video_id, fatal=False,
headers={'service-name': 'odk'}, query={'did': str(uuid.uuid4())}, expected_status=(403, 404))
if n... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.714 | suggestion | 171 | 51 | 51 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
# Try to upgrade quality
potential_urls = [
mod_url if self._request_webpage(
HEADRequest(mod_url := re.sub(r'_720(p?)\.m3u8', r'_1080\1.m3u8', url)), video_id,
note='Checking if higher quality format is available', fatal=False) else url
for url in... | if the `data['result']` suggestion from above is applied
```suggestion
'title': join_nonempty(
('episode', 'program', 'title'),
('episode', 'title'), from_dict=data, delim=': '),
**traverse_obj(data, {
``` | def try_geo_bypass(url):
return traverse_obj(url, ({parse_qs}, 'stream_url', 0, {url_or_none})) or url
def try_upgrade_quality(url):
mod_url = re.sub(r'_720(p?)\.m3u8', r'_1080\1.m3u8', url)
return mod_url if mod_url != url and self._request_webpage(
... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.786 | suggestion | 267 | 51 | 51 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
for url in potential_urls:
formats.extend(self._extract_m3u8_formats(url, video_id, fatal=False))
subtitles = {}
for track in traverse_obj(data, ('result', 'text_tracks', lambda _, v: url_or_none(v['url']))):
subtitles.setdefault(track.get('language', 'und'), []).append(... | if the `data['result']` suggestion from above is applied
```suggestion
}, get_all=False),
``` | formats = []
for m3u8_url in traverse_obj(data, (('sources', 'manifest'), ..., 'url', {url_or_none}, {try_geo_bypass})):
formats.extend(self._extract_m3u8_formats(try_upgrade_quality(m3u8_url), video_id, fatal=False))
subtitles = {}
for track in traverse_obj(data, ('text_tra... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.714 | suggestion | 108 | 51 | 51 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
formats = []
for url in potential_urls:
formats.extend(self._extract_m3u8_formats(url, video_id, fatal=False))
subtitles = {}
for track in traverse_obj(data, ('result', 'text_tracks', lambda _, v: url_or_none(v['url']))):
subtitles.setdefault(track.get('language'... | maybe a helper would be nice for these, e.g.
```py
def if_series(key=None):
def func(obj):
return obj[key] if key and obj['kind'] == 'series' else None
return func
```
```suggestion
'series': ('episode', {if_series(key='program')}, 'title'),
'series_id': ('episod... |
formats = []
for m3u8_url in traverse_obj(data, (('sources', 'manifest'), ..., 'url', {url_or_none}, {try_geo_bypass})):
formats.extend(self._extract_m3u8_formats(try_upgrade_quality(m3u8_url), video_id, fatal=False))
subtitles = {}
for track in traverse_obj(data, ('text_tr... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.857 | refactor | 653 | 51 | 51 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
_TESTS = [{
'url': 'https://www.ondemandkorea.com/player/vod/uskn-news',
'info_dict': {
'id': 'uskn-news',
},
'playlist_mincount': 755,
}, {
'url': 'https://www.ondemandkorea.com/en/player/vod/the-land',
'info_dict': {
'id': 'the-land',
... | branch here to ensure list
you could filter an `'id'` key instead of `...`, if you want, depending if you want the extractor to error or not when it's not found
```suggestion
for episode in traverse_obj(page_data, ('result', 'results', ...)):
``` |
class OnDemandKoreaProgramIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ondemandkorea\.com/(?:en/)?player/vod/(?P<id>[a-z0-9-]+)(?:$|#)'
_GEO_COUNTRIES = ['US', 'CA']
_TESTS = [{
'url': 'https://www.ondemandkorea.com/player/vod/uskn-news',
'info_dict': {
'id': 'uskn-news... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 1 | refactor | 260 | 39 | 42 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'id': 'uskn-news',
},
'playlist_mincount': 755,
}, {
'url': 'https://www.ondemandkorea.com/en/player/vod/the-land',
'info_dict': {
'id': 'the-land',
},
'playlist_count': 52,
}]
_PAGE_SIZE = 100
def _fetch_page(self, display_id, pa... | ```suggestion
ie=OnDemandKoreaIE, video_title=episode.get('title'))
``` |
_TESTS = [{
'url': 'https://www.ondemandkorea.com/player/vod/uskn-news',
'info_dict': {
'id': 'uskn-news',
},
'playlist_mincount': 755,
}, {
'url': 'https://www.ondemandkorea.com/en/player/vod/the-land',
'info_dict': {
'id': 'the-land',
... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.571 | suggestion | 89 | 35 | 38 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
_GEO_COUNTRIES = ['US', 'CA']
_TESTS = [{
'url': 'https://www.ondemandkorea.com/player/vod/uskn-news',
'info_dict': {
'id': 'uskn-news',
},
'playlist_mincount': 755,
}, {
'url': 'https://www.ondemandkorea.com/en/player/vod/the-land',
'info_dict': ... | Have you checked what happens when the playlist has the same total number of entries as the `_PAGE_SIZE`, and we make a request for the next page when there isn't a next page? If the API returns an empty result list, then this is fine. Otherwise we may need to either use an `expected_status` arg or try/catch the `HTTPE... |
class OnDemandKoreaProgramIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ondemandkorea\.com/(?:en/)?player/vod/(?P<id>[a-z0-9-]+)(?:$|#)'
_GEO_COUNTRIES = ['US', 'CA']
_TESTS = [{
'url': 'https://www.ondemandkorea.com/player/vod/uskn-news',
'info_dict': {
'id': 'uskn-new... | @@ -1,87 +1,164 @@
+import functools
import re
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ random_uuidv... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.786 | question | 325 | 40 | 43 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
video_id = self._match_id(url)
data = self._download_json(
f'https://odkmedia.io/odx/api/v3/playback/{video_id}/', video_id, fatal=False,
headers={'service-name': 'odk'}, query={'did': str(uuid.uuid4())}, expected_status=(403, 404))
if not traverse_obj(data, ('result', {... | On second look, I think it'd be better to keep the network requests out of the traversal:
```suggestion
formats = []
for m3u8_url in traverse_obj(data, (('sources', 'manifest'), ..., 'url', {url_or_none}, {try_geo_bypass}):
formats.extend(self._extract_m3u8_formats(try_upgrade_quality(m3... | video_id = self._match_id(url)
data = self._download_json(
f'https://odkmedia.io/odx/api/v3/playback/{video_id}/', video_id, fatal=False,
headers={'service-name': 'odk'}, query={'did': str(uuid.uuid4())}, expected_status=(403, 404))
if not traverse_obj(data, ('result', {... | @@ -1,87 +1,170 @@
+import functools
import re
+import uuid
from .common import InfoExtractor
+from ..networking import HEADRequest
from ..utils import (
ExtractorError,
- js_to_json,
+ OnDemandPagedList,
+ float_or_none,
+ int_or_none,
+ join_nonempty,
+ parse_age_limit,
+ parse_qs,
+ ... | yt_dlp/extractor/ondemandkorea.py | 26 | Python | 0.857 | refactor | 357 | 51 | 51 | false | Rewrite OnDemandKorea Extractor | 8,386 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
note='Downloading stream API information')
api_info = {
'url': self._search_regex(
r'prod:[^;]+\bapiUrl:\s*[\'"]([^\'"]+)[\'"]', movie_player_js, None, 'stream API url'),
'token': self._search_regex(
r'prod:[^;]+\btoken:\s*[\'"]([^\'"]+)[\'"]',... | just formatting things
```suggestion
meta = traverse_obj(
self._download_json(
api_url, vod_id, 'Downloading stream url info', fatal=False, query={
**api_info,
'type': 'json',
'optional_id': vo... | note='Downloading stream API information')
api_info = {
'url': self._search_regex(
r'prod:[^;]+\bapiUrl:\s*[\'"]([^\'"]+)[\'"]', movie_player_js, None, 'stream API url'),
'token': self._search_regex(
r'prod:[^;]+\btoken:\s*[\'"]([^\'"]+)[\'"]',... | @@ -45,24 +47,32 @@ def _get_api_info(self, refresh=True):
self.cache.store('nhk', 'api_info', api_info)
return api_info
- def _extract_formats_and_subtitles(self, vod_id):
+ def _extract_stream_info(self, vod_id):
for refresh in (False, True):
api_info = self._get_api_in... | yt_dlp/extractor/nhk.py | 26 | Python | 0.929 | suggestion | 555 | 51 | 51 | false | NHK metadata fixes/improvements | 8,388 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
def _extract_stream_info(self, vod_id):
for refresh in (False, True):
api_info = self._get_api_info(refresh)
if not api_info:
continue
api_url = api_info.pop('url')
meta = traverse_obj(self._download_json(api_url, vod_id, 'Downloading stream u... | IMO let's transform all the data to an info_dict structure here in this function to make things more readable when we call it
```py
if stream_url:
formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_url, vod_id)
return {
**traverse_... | def _extract_stream_info(self, vod_id):
for refresh in (False, True):
api_info = self._get_api_info(refresh)
if not api_info:
continue
api_url = api_info.pop('url')
meta = traverse_obj(
self._download_json(
... | @@ -45,24 +47,32 @@ def _get_api_info(self, refresh=True):
self.cache.store('nhk', 'api_info', api_info)
return api_info
- def _extract_formats_and_subtitles(self, vod_id):
+ def _extract_stream_info(self, vod_id):
for refresh in (False, True):
api_info = self._get_api_in... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | refactor | 782 | 51 | 51 | false | NHK metadata fixes/improvements | 8,388 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
title = f'{series} - {title}'
elif series and not title:
title = series
series = None
episode_name = None
else: # title, no series
episode_name = None
info = {
'id': episode_id + '-' + lang,
'title': title,
... | if above suggestion is applied, we can do this:
```py
if is_video:
vod_id = episode['vod_id']
info.update({
**self._extract_stream_info(vod_id),
'id': vod_id,
})
``` |
episode_name = title
if series and title:
title = f'{series} - {title}'
elif series and not title:
title = series
series = None
episode_name = None
else: # title, no series
episode_name = None
info = {
'id... | @@ -96,22 +106,33 @@ def get_clean_field(key):
'url': 'https://www3.nhk.or.jp' + img_path,
})
+ episode_name = title
+ if series and title:
+ title = f'{series} - {title}'
+ elif series and not title:
+ title = series
+ series = None
... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | refactor | 251 | 51 | 51 | false | NHK metadata fixes/improvements | 8,388 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'thumbnail': 'md5:67d9ff28009ba379bfa85ad1aaa0e2bd',
'release_date': '20230905',
'timestamp': 1690103400,
'duration': 2939,
'release_timestamp': 1693898699,
'modified_timestamp': 1694223888,
'modified_date': '20230909',
'upl... | ~~is this one still working? are they all expired?~~
nvm I re-read your PR description | 'thumbnail': 'md5:67d9ff28009ba379bfa85ad1aaa0e2bd',
'release_date': '20230905',
'timestamp': 1690103400,
'duration': 2939,
'release_timestamp': 1693898699,
'modified_timestamp': 1698057495,
'modified_date': '20231023',
'upl... | @@ -226,13 +279,15 @@ class NhkVodProgramIE(NhkBaseIE):
'info_dict': {
'id': 'sumo',
'title': 'GRAND SUMO Highlights',
+ 'description': 'md5:fc20d02dc6ce85e4b72e0273aa52fdbf',
},
- 'playlist_mincount': 12,
+ 'playlist_mincount': 0, | yt_dlp/extractor/nhk.py | 26 | Python | 0.214 | suggestion | 89 | 51 | 51 | false | NHK metadata fixes/improvements | 8,388 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
if video:
videos.append(video)
if duration is None:
duration = video.get('duration')
if is_live is None:
is_live = video.get('is_live')
if spritesheets is None:
spritesheets = video.ge... | I would actually match the `S<ID> E<ID>` format like so:
```suggestion
season_number, episode_number = self._search_regex(
r'S(\d+)\s*E(\d+)', meta.get('pre_title'), 'episode info', group=(1, 2), default=(None, None))
``` | if not dinfo:
continue
video = dinfo.get('video')
if video:
videos.append(video)
if duration is None:
duration = video.get('duration')
if is_live is None:
is_live = video.get('is_... | @@ -112,7 +117,14 @@ def _extract_video(self, video_id, catalogue=None):
if meta:
if title is None:
title = meta.get('title')
- # XXX: what is meta['pre_title']?
+ # meta['pre_title'] contains season and episode number for series in format... | yt_dlp/extractor/francetv.py | 26 | Python | 0.786 | suggestion | 269 | 51 | 51 | false | [ie/francetv] Add support for episode and season tagging | 8,409 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Fymyte |
'title': title,
'thumbnail': image,
'duration': duration,
'timestamp': timestamp,
'is_live': is_live,
'formats': formats,
'subtitles': subtitles,
}
def _real_extract(self, url):
mobj = self._match_valid_url(url)
... | This could just be written inline as:
```suggestion
'episode': subtitle if episode_number else None,
'series': title if episode_number else None,
``` | return {
'id': video_id,
'title': join_nonempty(title, subtitle, delim=' - ').strip(),
'thumbnail': image,
'duration': duration,
'timestamp': timestamp,
'is_live': is_live,
'formats': formats,
'subtitles': subtitles,... | @@ -204,6 +221,10 @@ def _extract_video(self, video_id, catalogue=None):
'is_live': is_live,
'formats': formats,
'subtitles': subtitles,
+ 'episode': episode,
+ 'series': series, | yt_dlp/extractor/francetv.py | 26 | Python | 0.786 | suggestion | 177 | 51 | 51 | false | [ie/francetv] Add support for episode and season tagging | 8,409 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Fymyte |
'fragments': [{
'url': sheet,
# XXX: not entirely accurate; each spritesheet seems to be
# a 10×10 grid of thumbnails corresponding to approximately
# 2 seconds of the video; the last spritesheet may be shorter
... | With the suggestions from above, these three segments can be removed:
```suggestion
``` | 'format_note': 'storyboard',
'acodec': 'none',
'vcodec': 'none',
'ext': 'mhtml',
'protocol': 'mhtml',
'url': 'about:invalid',
'fragments': [{
'url': sheet,
# XXX: not e... | @@ -191,6 +203,11 @@ def _extract_video(self, video_id, catalogue=None):
} for sheet in spritesheets]
})
+ # This is an episode from a serie
+ if episode_number and season_number and subtitle:
+ episode = subtitle
+ series = title
+ | yt_dlp/extractor/francetv.py | 26 | Python | 0.643 | suggestion | 89 | 51 | 51 | false | [ie/francetv] Add support for episode and season tagging | 8,409 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Fymyte |
'only_matching': True,
}, {
'url': 'francetv:NI_983319@Info-web',
'only_matching': True,
}, {
'url': 'francetv:NI_983319',
'only_matching': True,
}, {
'url': 'francetv:NI_657393@Regions',
'only_matching': True,
}, {
# france-3 live
... | ```suggestion
season_number = None
episode_number = None
``` | }]
def _extract_video(self, video_id, catalogue=None):
# Videos are identified by idDiffusion so catalogue part is optional.
# However when provided, some extra formats may be returned so we pass
# it if available.
is_live = None
videos = []
title = None
... | @@ -82,6 +98,8 @@ def _extract_video(self, video_id, catalogue=None):
videos = []
title = None
subtitle = None
+ episode = None
+ series = None | yt_dlp/extractor/francetv.py | 26 | Python | 0.571 | suggestion | 79 | 51 | 51 | false | [ie/francetv] Add support for episode and season tagging | 8,409 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Fymyte |
'device_type': device_type,
'browser': 'chrome',
}, fatal=False)
if not dinfo:
continue
print(dinfo)
video = dinfo.get('video')
if video:
videos.append(video)
if dur... | ```suggestion
season_number, episode_number = self._search_regex(
r'S(\d+)\s*E(\d+)', meta.get('pre_title'), 'episode info', group=(1, 2), default=(None, None))
``` | if spritesheets is None:
spritesheets = video.get('spritesheets')
meta = dinfo.get('meta')
if meta:
if title is None:
title = meta.get('title')
# meta['pre_title'] contains season and episode number for seri... | @@ -112,7 +132,9 @@ def _extract_video(self, video_id, catalogue=None):
if meta:
if title is None:
title = meta.get('title')
- # XXX: what is meta['pre_title']?
+ # meta['pre_title'] contains season and episode number for series in format ... | yt_dlp/extractor/francetv.py | 26 | Python | 0.786 | suggestion | 203 | 51 | 51 | false | [ie/francetv] Add support for episode and season tagging | 8,409 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Fymyte |
'vcodec': 'none',
'ext': 'mhtml',
'protocol': 'mhtml',
'url': 'about:invalid',
'fragments': [{
'url': sheet,
# XXX: not entirely accurate; each spritesheet seems to be
# a 10×10 gr... | ```suggestion
'episode_number': int_or_none(episode_number),
'season_number': int_or_none(season_number),
```
Import `int_or_none` from `..utils` | 'thumbnail': image,
'duration': duration,
'timestamp': timestamp,
'is_live': is_live,
'formats': formats,
'subtitles': subtitles,
'episode': subtitle if episode_number else None,
'series': title if episode_number else None,
... | @@ -191,19 +213,19 @@ def _extract_video(self, video_id, catalogue=None):
} for sheet in spritesheets]
})
- if subtitle:
- title += ' - %s' % subtitle
- title = title.strip()
-
return {
'id': video_id,
- 'title': title,
+ ... | yt_dlp/extractor/francetv.py | 26 | Python | 0.714 | suggestion | 173 | 51 | 51 | false | [ie/francetv] Add support for episode and season tagging | 8,409 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Fymyte |
for f in formats:
if f.get('acodec') != 'none' and f.get('language') in ('qtz', 'qad'):
f['language_preference'] = -10
f['format_note'] = 'audio description%s' % format_field(f, 'format_note', ', %s')
if spritesheets:
formats.append({
... | ```suggestion
'title': join_nonempty(title, subtitle, delim=' - ').strip(),
```
Import `join_nonempty` from `..utils` | # XXX: not entirely accurate; each spritesheet seems to be
# a 10×10 grid of thumbnails corresponding to approximately
# 2 seconds of the video; the last spritesheet may be shorter
'duration': 200,
} for sheet in spritesheet... | @@ -191,19 +213,19 @@ def _extract_video(self, video_id, catalogue=None):
} for sheet in spritesheets]
})
- if subtitle:
- title += ' - %s' % subtitle
- title = title.strip()
-
return {
'id': video_id,
- 'title': title,
+ ... | yt_dlp/extractor/francetv.py | 26 | Python | 0.714 | suggestion | 132 | 51 | 51 | false | [ie/francetv] Add support for episode and season tagging | 8,409 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Fymyte |
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
_NETRC_MACHINE = 'laxarxames'
_IS_LOGGED_IN = False
_LOGIN_URL = 'https://www.laxarxames.cat/login'
_TESTS = [{
'url': 'https://www.laxarxames.cat/player/... | Does the User-Agent need to be from macOS? |
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/?#]+/)*?(player|movie-details)/(?P<id>\d+)'
_NETRC_MACHINE = 'laxa... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _IS_LOGGED_IN = False
+ _LOGIN_URL = 'https://www.laxarxames.cat/login'
+ _T... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.143 | question | 42 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
_NETRC_MACHINE = 'laxarxames'
_IS_LOGGED_IN = False
_LOGIN_URL = 'https://www.laxarxames.cat/login'
_TESTS = [{
'url': 'https://www.laxarxames.cat/player/34... | ```suggestion
}, data=json.dumps({
'Username': username,
'Password': password,
'Device': {
'PlatformCode': 'WEB',
'Name': 'Mac OS ()',
},
}).encode('utf-8'))
```
And import json | from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/?#]+/)*?(player|movie-details)/(?P<id>\d+)'
_NETRC_MACHINE = 'laxarxames'
_TOKEN = None
_TESTS = [{... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _IS_LOGGED_IN = False
+ _LOGIN_URL = 'https://www.laxarxames.cat/login'
+ _T... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.857 | suggestion | 315 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
'ext': 'mp4',
'title': 'Resum | UA Horta — UD Viladecans',
'type': 'video/mp4',
},
'skip': 'Requires login',
}]
def _perform_login(self, username, password):
login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', N... | Is this actually used as a cookie, or do you just want to pass the data between the `_perform_login` and `_real_extract` functions?
If it's the latter, you can just write the token to `self._TOKEN` or similar. | 'url': 'https://www.laxarxames.cat/player/3459421',
'md5': '0966f46c34275934c19af78f3df6e2bc',
'info_dict': {
'id': '6339612436112',
'ext': 'mp4',
'title': 'Resum | UA Horta — UD Viladecans',
'timestamp': 1697905186,
'thumbnail': r're:h... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _IS_LOGGED_IN = False
+ _LOGIN_URL = 'https://www.laxarxames.cat/login'
+ _T... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.643 | refactor | 210 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
'url': 'https://www.laxarxames.cat/player/3459421',
'md5': '0966f46c34275934c19af78f3df6e2bc',
'info_dict': {
'id': '3459421',
'ext': 'mp4',
'title': 'Resum | UA Horta — UD Viladecans',
'type': 'video/mp4',
},
'skip': 'Requires logi... | I would add a check to see if the cookie/token is already present. | _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/?#]+/)*?(player|movie-details)/(?P<id>\d+)'
_NETRC_MACHINE = 'laxarxames'
_TOKEN = None
_TESTS = [{
'url': 'https://www.laxarxames.cat/player/3459421',
'md5': '0966f46c34275934c19af78f3df6e2bc',
'info_dict': {
'i... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _IS_LOGGED_IN = False
+ _LOGIN_URL = 'https://www.laxarxames.cat/login'
+ _T... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.214 | suggestion | 66 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
},
'skip': 'Requires login',
}]
def _perform_login(self, username, password):
login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
'X-Tenantorigin': 'https://laxarxames.cat',
'Conte... | ```suggestion
self.raise_login_required()
``` | 'id': '6339612436112',
'ext': 'mp4',
'title': 'Resum | UA Horta — UD Viladecans',
'timestamp': 1697905186,
'thumbnail': r're:https?://.*\.jpg',
'description': '',
'upload_date': '20231021',
'duration': 129.44,
't... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _IS_LOGGED_IN = False
+ _LOGIN_URL = 'https://www.laxarxames.cat/login'
+ _T... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.571 | suggestion | 59 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
def _real_extract(self, url):
video_id = self._match_id(url)
authorization = self._get_cookies('https://www.laxarxames.cat/').get('didomi_token')
if not authorization:
raise Exception('No authorization token found. Log in with --netrc or --username and --password')
medi... | Could this just be handed off to the Brightcove extractor?
I have not tried this, but something like:
```python
return self.url_result(
f'http://players.brightcove.net/5779379807001/default_default/index.html?videoId={contenturl}',
BrightcoveNewIE, video_id, title)
``` | 'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
'X-Tenantorigin': 'https://laxarxames.cat',
'Content-Type': 'application/json',
}, data=json.dumps({
'Username': username,
'Password': password,
... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _IS_LOGGED_IN = False
+ _LOGIN_URL = 'https://www.laxarxames.cat/login'
+ _T... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.857 | refactor | 283 | 51 | 39 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
def _perform_login(self, username, password):
login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
'X-Tenantorigin': 'https://laxarxames.cat',
'Content-Type': 'application/json',
'Accept... | I would use `json.dumps` like above | 'thumbnail': r're:https?://.*\.jpg',
'description': '',
'upload_date': '20231021',
'duration': 129.44,
'tags': ['ott', 'esports', '23-24', ' futbol', ' futbol-partits', 'elit', 'resum'],
'uploader_id': '5779379807001',
},
'skip': 'R... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _IS_LOGGED_IN = False
+ _LOGIN_URL = 'https://www.laxarxames.cat/login'
+ _T... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.286 | suggestion | 35 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
import json
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
_NETRC_MACHINE = 'laxarxames'
_TOKEN = None
_LOGIN_URL = 'https://www.laxarxame... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>\d+)'
``` | import json
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/?#]+/)*?(player|movie-details)/(?P<id>\d+)'
_NETRC_MAC... | @@ -0,0 +1,74 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)' | yt_dlp/extractor/laxarxames.py | 8 | Python | 0.714 | suggestion | 121 | 33 | 33 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
'info_dict': {
'id': '3459421',
'ext': 'mp4',
'title': 'Resum | UA Horta — UD Viladecans',
'type': 'video/mp4',
},
'skip': 'Requires login',
}]
def _perform_login(self, username, password):
if self._TOKEN:
return
... | ```suggestion
}).encode('utf-8'),
expected_status=401,
``` | 'md5': '0966f46c34275934c19af78f3df6e2bc',
'info_dict': {
'id': '6339612436112',
'ext': 'mp4',
'title': 'Resum | UA Horta — UD Viladecans',
'timestamp': 1697905186,
'thumbnail': r're:https?://.*\.jpg',
'description': '',
... | @@ -0,0 +1,74 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _TOKEN = None
+ _LOGIN_... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.571 | suggestion | 85 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
'type': 'video/mp4',
},
'skip': 'Requires login',
}]
def _perform_login(self, username, password):
if self._TOKEN:
return
login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
... | ```suggestion
if not traverse_obj(login, ('AuthorizationToken', 'Token')):
raise ExtractorError('Login failed', expected=True)
```
Add the following imports:
```python
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
``` | 'title': 'Resum | UA Horta — UD Viladecans',
'timestamp': 1697905186,
'thumbnail': r're:https?://.*\.jpg',
'description': '',
'upload_date': '20231021',
'duration': 129.44,
'tags': ['ott', 'esports', '23-24', ' futbol', ' futbol-partits... | @@ -0,0 +1,74 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _TOKEN = None
+ _LOGIN_... | yt_dlp/extractor/laxarxames.py | 26 | Python | 1 | bug | 277 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
video_id = self._match_id(url)
if not self._TOKEN:
self.raise_login_required()
mediaplayinfo = self._download_json(
'https://api.laxarxames.cat/Media/GetMediaPlayInfo',
video_id,
data=json.dumps({
'MediaId': int(video_id),
... | ```suggestion
if not mediaplayinfo.get('ContentUrl'):
self.raise_no_formats('No video found', expected=True)
return self.url_result(
f'http://players.brightcove.net/5779379807001/default_default/index.html?videoId={mediaplayinfo["ContentUrl"]}',
BrightcoveNewIE... | if not self._TOKEN:
raise ExtractorError('Login failed', expected=True)
def _real_extract(self, url):
video_id = self._match_id(url)
if not self._TOKEN:
self.raise_login_required()
media_play_info = self._download_json(
'https://api.laxarxames.ca... | @@ -0,0 +1,74 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _TOKEN = None
+ _LOGIN_... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.786 | suggestion | 364 | 27 | 26 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
'Content-Type': 'application/json',
'Accept': 'application/json, text/plain, */*',
'Origin': 'https://www.laxarxames.cat',
}, data=json.dumps({
'Username': username,
'Password': password,
'Device': {
... | ```suggestion
'https://api.laxarxames.cat/Media/GetMediaPlayInfo', video_id,
``` |
def _perform_login(self, username, password):
if self._TOKEN:
return
login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
'X-Tenantorigin': 'https://laxarxames.cat',
'Content-Type'... | @@ -0,0 +1,74 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _TOKEN = None
+ _LOGIN_... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.571 | suggestion | 94 | 46 | 45 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
import json
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
_NETRC_MACHINE = 'laxarxames'
_TOKEN = None
_LOGIN_URL = 'https://www.laxarxame... | ```suggestion
'id': '6339612436112',
'ext': 'mp4',
'title': 'Resum | UA Horta — UD Viladecans',
'timestamp': 1697905186,
'thumbnail': r're:https?://.*\.jpg',
'description': '',
'upload_date': '20231021',
'duration': ... | import json
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/?#]+/)*?(player|movie-details)/(?P<id>\d+)'
_NETRC_MAC... | @@ -0,0 +1,74 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>[0-9]+)'
+ _NETRC_MACHINE = 'laxarxames'
+ _TOKEN = None
+ _LOGIN_... | yt_dlp/extractor/laxarxames.py | 19 | Python | 0.786 | suggestion | 474 | 44 | 44 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | aniolpages |
import json
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?P<id>\d+)'
_NETRC_MACHI... | don't match query/fragment with the character class
```suggestion
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/?#]+/)*?(player|movie-details)/(?P<id>\d+)'
``` | import json
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/?#]+/)*?(player|movie-details)/(?P<id>\d+)'
_NETRC_MAC... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 10 | Python | 0.714 | suggestion | 176 | 35 | 35 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
'description': '',
'upload_date': '20231021',
'duration': 129.44,
'tags': ['ott', 'esports', '23-24', ' futbol', ' futbol-partits', 'elit', 'resum'],
'uploader_id': '5779379807001',
},
'skip': 'Requires login',
}]
def _perform_login(se... | utf-8 is default, get rid of hanging parenthesis
```suggestion
}).encode(), expected_status=401)
``` | 'upload_date': '20231021',
'duration': 129.44,
'tags': ['ott', 'esports', '23-24', ' futbol', ' futbol-partits', 'elit', 'resum'],
'uploader_id': '5779379807001',
},
'skip': 'Requires login',
}]
def _perform_login(self, username, password):
... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.714 | suggestion | 115 | 51 | 51 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
'duration': 129.44,
'tags': ['ott', 'esports', '23-24', ' futbol', ' futbol-partits', 'elit', 'resum'],
'uploader_id': '5779379807001',
},
'skip': 'Requires login',
}]
def _perform_login(self, username, password):
if self._TOKEN:
return
... | ```suggestion
if not traverse_obj(login, ('AuthorizationToken', 'Token', {str})):
``` | 'tags': ['ott', 'esports', '23-24', ' futbol', ' futbol-partits', 'elit', 'resum'],
'uploader_id': '5779379807001',
},
'skip': 'Requires login',
}]
def _perform_login(self, username, password):
if self._TOKEN:
return
login = self._download_js... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.571 | security | 95 | 51 | 50 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
},
'skip': 'Requires login',
}]
def _perform_login(self, username, password):
if self._TOKEN:
return
login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
'X-Tenantorigin': 'http... | ```suggestion
self._TOKEN = login['AuthorizationToken']['Token']
``` | 'skip': 'Requires login',
}]
def _perform_login(self, username, password):
if self._TOKEN:
return
login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
'X-Tenantorigin': 'https://laxarx... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.571 | security | 78 | 51 | 47 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
'X-Tenantorigin': 'https://laxarxames.cat',
'Content-Type': 'application/json',
}, data=json.dumps({
'Username': username,
... | if adopting the site/API var names, convert camelCase/PascalCase var names to snake_case
```suggestion
video_id = self._match_id(url)
if not self._TOKEN:
self.raise_login_required()
media_play_info = self._download_json(
``` | login = self._download_json(
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
'X-Tenantorigin': 'https://laxarxames.cat',
'Content-Type': 'application/json',
}, data=json.dumps({
'Username': username,
... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.786 | suggestion | 268 | 44 | 40 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
'Password': password,
'Device': {
'PlatformCode': 'WEB',
'Name': 'Mac OS ()',
},
}).encode('utf-8'),
expected_status=401,
)
if not traverse_obj(login, ('AuthorizationToken', 'Token')):
... | ```suggestion
}).encode(), headers={
``` | 'Password': password,
'Device': {
'PlatformCode': 'WEB',
'Name': 'Mac OS ()',
},
}).encode(), expected_status=401)
self._TOKEN = traverse_obj(login, ('AuthorizationToken', 'Token', {str}))
if not self._T... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.571 | suggestion | 54 | 38 | 34 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
'Device': {
'PlatformCode': 'WEB',
'Name': 'Mac OS ()',
},
}).encode('utf-8'),
expected_status=401,
)
if not traverse_obj(login, ('AuthorizationToken', 'Token')):
raise ExtractorError('Login fail... | f-string
```suggestion
'Authorization': f'Bearer {self._TOKEN}',
``` | 'Device': {
'PlatformCode': 'WEB',
'Name': 'Mac OS ()',
},
}).encode(), expected_status=401)
self._TOKEN = traverse_obj(login, ('AuthorizationToken', 'Token', {str}))
if not self._TOKEN:
raise ExtractorError... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.571 | security | 87 | 37 | 33 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
}).encode('utf-8'),
expected_status=401,
)
if not traverse_obj(login, ('AuthorizationToken', 'Token')):
raise ExtractorError('Login failed', expected=True)
else:
self._TOKEN = login['AuthorizationToken']['Token']
def _real_extract(self, url):... | ```suggestion
})
``` | }).encode(), expected_status=401)
self._TOKEN = traverse_obj(login, ('AuthorizationToken', 'Token', {str}))
if not self._TOKEN:
raise ExtractorError('Login failed', expected=True)
def _real_extract(self, url):
video_id = self._match_id(url)
if not self._TOKE... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.429 | suggestion | 34 | 33 | 29 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
)
if not traverse_obj(login, ('AuthorizationToken', 'Token')):
raise ExtractorError('Login failed', expected=True)
else:
self._TOKEN = login['AuthorizationToken']['Token']
def _real_extract(self, url):
video_id = self._match_id(url)
if not self._TOK... | ```suggestion
if not traverse_obj(media_play_info, ('ContentUrl', {str})):
``` | self._TOKEN = traverse_obj(login, ('AuthorizationToken', 'Token', {str}))
if not self._TOKEN:
raise ExtractorError('Login failed', expected=True)
def _real_extract(self, url):
video_id = self._match_id(url)
if not self._TOKEN:
self.raise_login_required()
... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.571 | suggestion | 88 | 31 | 27 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
else:
self._TOKEN = login['AuthorizationToken']['Token']
def _real_extract(self, url):
video_id = self._match_id(url)
if not self._TOKEN:
self.raise_login_required()
mediaplayinfo = self._download_json(
'https://api.laxarxames.cat/Media/GetMediaP... | ```suggestion
self.raise_no_formats('No video found', expected=True)
return self.url_result(
f'https://players.brightcove.net/5779379807001/default_default/index.html?videoId={media_play_info["ContentUrl"]}',
BrightcoveNewIE, video_id, media_play_info.get('Title'))
``` | import json
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils.traversal import traverse_obj
class LaXarxaMesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/?#]+/)*?(player|movie-details)/(?P<id>\d+)'
_NETRC_MAC... | @@ -0,0 +1,77 @@
+import json
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+from ..utils import ExtractorError
+from ..utils.traversal import traverse_obj
+
+
+class LaXarxaMesIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?laxarxames\.cat/(?:[^/]+/)*?(player|movie-details)/(?... | yt_dlp/extractor/laxarxames.py | 26 | Python | 0.786 | suggestion | 320 | 27 | 74 | false | [laxarxames] Add extractor | 8,412 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | aniolpages |
IE_NAME = 'n-tv.de'
_VALID_URL = r'https?://(?:www\.)?n-tv\.de/mediathek/videos/[^/?#]+/[^/?#]+-article(?P<id>.+)\.html'
_TESTS = [{
'url': 'http://www.n-tv.de/mediathek/videos/panorama/Schnee-und-Glaette-fuehren-zu-zahlreichen-Unfaellen-und-Staus-article14438086.html',
'md5': '6bcf2a6638cb... | Can be simpified:
```python
info = self._search_json(
r'article:\s*', webpage, 'info', video_id, transform_source=js_to_json)
``` | class NTVDeIE(InfoExtractor):
IE_NAME = 'n-tv.de'
_VALID_URL = r'https?://(?:www\.)?n-tv\.de/mediathek/(?:videos|magazine)/[^/?#]+/[^/?#]+-article(?P<id>[^/?#]+)\.html'
_TESTS = [{
'url': 'http://www.n-tv.de/mediathek/videos/panorama/Schnee-und-Glaette-fuehren-zu-zahlreichen-Unfaellen-und-Staus-art... | @@ -34,40 +33,36 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id)
info = self._parse_json(self._search_regex(
- r'(?s)ntv\.pageInfo\.article\s*=\s*(\{.*?\});', webpage, 'info'),
+ r'(?s)article:\s*(\{.+?\})', webpage, 'info'),
video_... | yt_dlp/extractor/ntvde.py | 26 | Python | 0.714 | suggestion | 137 | 51 | 51 | false | Fix n-tv.de extractor, website format has changed | 8,414 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 1100101 |
'info_dict': {
'id': '14438086',
'ext': 'mp4',
'thumbnail': r're:^https?://.*\.jpg$',
'title': 'Schnee und Glätte führen zu zahlreichen Unfällen und Staus',
'alt_title': 'Winterchaos auf deutschen Straßen',
'description': 'Schnee und Glätte... | Same here. I would also adjust the `re.sub` call:
```python
player_data = self._search_json(
r'\$\(\s*"\#playerwrapper"\s*\)\s*\.data\(\s*"player",\s*',
webpage, 'player data', video_id,
transform_source=lambda s: js_to_json(re.sub(r'ivw:[^},]+', '', s)))
``` | 'md5': '6bcf2a6638cb83f45d5561659a1cb498',
'info_dict': {
'id': '14438086',
'ext': 'mp4',
'thumbnail': r're:^https?://.*\.jpg$',
'title': 'Schnee und Glätte führen zu zahlreichen Unfällen und Staus',
'alt_title': 'Winterchaos auf deutschen Stra... | @@ -34,40 +33,36 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id)
info = self._parse_json(self._search_regex(
- r'(?s)ntv\.pageInfo\.article\s*=\s*(\{.*?\});', webpage, 'info'),
+ r'(?s)article:\s*(\{.+?\})', webpage, 'info'),
video_... | yt_dlp/extractor/ntvde.py | 26 | Python | 0.786 | suggestion | 277 | 51 | 51 | false | Fix n-tv.de extractor, website format has changed | 8,414 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 1100101 |
'ext': 'mp4',
'thumbnail': r're:^https?://.*\.jpg$',
'title': 'Schnee und Glätte führen zu zahlreichen Unfällen und Staus',
'alt_title': 'Winterchaos auf deutschen Straßen',
'description': 'Schnee und Glätte sorgen deutschlandweit für einen chaotischen Start i... | I would inline `duration` and `timestamp` (see below) | 'id': '14438086',
'ext': 'mp4',
'thumbnail': r're:^https?://.*\.jpg$',
'title': 'Schnee und Glätte führen zu zahlreichen Unfällen und Staus',
'alt_title': 'Winterchaos auf deutschen Straßen',
'description': 'Schnee und Glätte sorgen deutschlandweit... | @@ -34,40 +33,36 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id)
info = self._parse_json(self._search_regex(
- r'(?s)ntv\.pageInfo\.article\s*=\s*(\{.*?\});', webpage, 'info'),
+ r'(?s)article:\s*(\{.+?\})', webpage, 'info'),
video_... | yt_dlp/extractor/ntvde.py | 26 | Python | 0.357 | suggestion | 53 | 50 | 51 | false | Fix n-tv.de extractor, website format has changed | 8,414 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 1100101 |
transform_source=lambda s: js_to_json(re.sub(r'ivw:\s*.+', '', s)))
vdata = traverse_obj(player_data, ('setup', 'source'))
duration = int_or_none(vdata.get('length'))
formats = []
if vdata.get('progressive'):
formats.append({
'format_id': 'mp4-0',... | ```python
return {
'id': video_id,
**traverse_obj(info, {
'title': 'headline',
'description': 'intro',
'alt_title': 'kicker',
'timestamp': ('publishedDateAsUnixTimeStamp', {int_or_none}),
}),
**traverse_obj(vdata, {
'thumbnail': 'poster',
'durat... | },
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
info = self._search_json(
r'article:', webpage, 'info', video_id, transform_source=js_to_json)
vdata = self._search_json(
r'\$\(\s... | @@ -34,40 +33,36 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id)
info = self._parse_json(self._search_regex(
- r'(?s)ntv\.pageInfo\.article\s*=\s*(\{.*?\});', webpage, 'info'),
+ r'(?s)article:\s*(\{.+?\})', webpage, 'info'),
video_... | yt_dlp/extractor/ntvde.py | 26 | Python | 0.786 | style | 394 | 27 | 42 | false | Fix n-tv.de extractor, website format has changed | 8,414 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 1100101 |
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
js_to_json,
traverse_obj,
)
class NTVDeIE(InfoExtractor):
IE_NAME = 'n-tv.de'
_VALID_URL = r'https?://(?:www\.)?n-tv\.de/mediathek/videos/[^/?#]+/[^/?#]+-article(?P<id>.+)\.html'
_TESTS = [{
'url': 'http:/... | ```suggestion
url_or_none,
)
from ..utils.traversal import traverse_obj
``` | import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
js_to_json,
url_or_none,
)
from ..utils.traversal import traverse_obj
class NTVDeIE(InfoExtractor):
IE_NAME = 'n-tv.de'
_VALID_URL = r'https?://(?:www\.)?n-tv\.de/mediathek/(?:videos|magazine)/[^/?#]+/[^/?#]+-article(?... | @@ -1,11 +1,10 @@
import re
from .common import InfoExtractor
-from ..compat import compat_urlparse
from ..utils import (
int_or_none,
js_to_json,
- parse_duration,
+ traverse_obj,
) | yt_dlp/extractor/ntvde.py | 8 | Python | 0.571 | suggestion | 83 | 33 | 33 | false | Fix n-tv.de extractor, website format has changed | 8,414 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 1100101 |
_TESTS = [{
'url': 'http://www.n-tv.de/mediathek/videos/panorama/Schnee-und-Glaette-fuehren-zu-zahlreichen-Unfaellen-und-Staus-article14438086.html',
'md5': '6bcf2a6638cb83f45d5561659a1cb498',
'info_dict': {
'id': '14438086',
'ext': 'mp4',
'thumbnail': r'... | ```suggestion
r'\$\(\s*"#playerwrapper"\s*\)\s*\.data\(\s*"player",\s*',
``` | _VALID_URL = r'https?://(?:www\.)?n-tv\.de/mediathek/(?:videos|magazine)/[^/?#]+/[^/?#]+-article(?P<id>[^/?#]+)\.html'
_TESTS = [{
'url': 'http://www.n-tv.de/mediathek/videos/panorama/Schnee-und-Glaette-fuehren-zu-zahlreichen-Unfaellen-und-Staus-article14438086.html',
'md5': '6bcf2a6638cb83f45d... | @@ -33,41 +32,39 @@ def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- info = self._parse_json(self._search_regex(
- r'(?s)ntv\.pageInfo\.article\s*=\s*(\{.*?\});', webpage, 'info'),
- video_id, transform_source... | yt_dlp/extractor/ntvde.py | 26 | Python | 0.571 | suggestion | 90 | 51 | 51 | false | Fix n-tv.de extractor, website format has changed | 8,414 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 1100101 |
'md5': '6bcf2a6638cb83f45d5561659a1cb498',
'info_dict': {
'id': '14438086',
'ext': 'mp4',
'thumbnail': r're:^https?://.*\.jpg$',
'title': 'Schnee und Glätte führen zu zahlreichen Unfällen und Staus',
'alt_title': 'Winterchaos auf deutschen Stra... | ```suggestion
vdata = traverse_obj(player_data, ('setup', 'source')) or {}
``` | 'url': 'http://www.n-tv.de/mediathek/videos/panorama/Schnee-und-Glaette-fuehren-zu-zahlreichen-Unfaellen-und-Staus-article14438086.html',
'md5': '6bcf2a6638cb83f45d5561659a1cb498',
'info_dict': {
'id': '14438086',
'ext': 'mp4',
'thumbnail': r're:^https?://.*\.... | @@ -33,41 +32,39 @@ def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- info = self._parse_json(self._search_regex(
- r'(?s)ntv\.pageInfo\.article\s*=\s*(\{.*?\});', webpage, 'info'),
- video_id, transform_source... | yt_dlp/extractor/ntvde.py | 26 | Python | 0.571 | suggestion | 88 | 51 | 51 | false | Fix n-tv.de extractor, website format has changed | 8,414 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 1100101 |
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
info = self._search_json(
r'article:\s*', webpage, 'info', video_id, transform_source=js_to_json)
player_data = self._search_json(
... | ```suggestion
vdata['hls'], video_id, 'mp4', m3u8_id='hls', fatal=False))
``` | 'upload_date': '20150202',
},
}, {
'url': 'https://www.n-tv.de/mediathek/magazine/auslandsreport/Juedische-Siedler-wollten-Rache-die-wollten-nur-toeten-article24523089.html',
'md5': 'c5c6014c014ccc3359470e1d34472bfd',
'info_dict': {
'id': '24523089',
... | @@ -33,41 +32,39 @@ def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- info = self._parse_json(self._search_regex(
- r'(?s)ntv\.pageInfo\.article\s*=\s*(\{.*?\});', webpage, 'info'),
- video_id, transform_source... | yt_dlp/extractor/ntvde.py | 26 | Python | 0.571 | suggestion | 95 | 44 | 51 | false | Fix n-tv.de extractor, website format has changed | 8,414 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 1100101 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.