mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 09:11:25 +01:00
Compare commits
11 Commits
b161a75648
...
e9c0c720f6
Author | SHA1 | Date | |
---|---|---|---|
|
e9c0c720f6 | ||
|
f2a4983df7 | ||
|
bacc31b05a | ||
|
a9f85670d0 | ||
|
6b43a8d84b | ||
|
2db8c2e7d5 | ||
|
f9c8deb4e5 | ||
|
0ec9bfed4d | ||
|
7fa603bcc3 | ||
|
29964cb9a5 | ||
|
48160e64c6 |
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
@ -411,7 +411,7 @@ jobs:
|
||||||
run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds
|
run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds
|
||||||
python devscripts/install_deps.py -o --include build
|
python devscripts/install_deps.py -o --include build
|
||||||
python devscripts/install_deps.py --include curl-cffi
|
python devscripts/install_deps.py --include curl-cffi
|
||||||
python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-6.10.0-py3-none-any.whl"
|
python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-6.11.1-py3-none-any.whl"
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
|
@ -460,7 +460,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
python devscripts/install_deps.py -o --include build
|
python devscripts/install_deps.py -o --include build
|
||||||
python devscripts/install_deps.py
|
python devscripts/install_deps.py
|
||||||
python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-6.10.0-py3-none-any.whl"
|
python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-6.11.1-py3-none-any.whl"
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -83,7 +83,7 @@ test = [
|
||||||
"pytest-rerunfailures~=14.0",
|
"pytest-rerunfailures~=14.0",
|
||||||
]
|
]
|
||||||
pyinstaller = [
|
pyinstaller = [
|
||||||
"pyinstaller>=6.10.0", # Windows temp cleanup fixed in 6.10.0
|
"pyinstaller>=6.11.1", # Windows temp cleanup fixed in 6.11.1
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
|
|
@ -1156,6 +1156,7 @@ from .mitele import MiTeleIE
|
||||||
from .mixch import (
|
from .mixch import (
|
||||||
MixchArchiveIE,
|
MixchArchiveIE,
|
||||||
MixchIE,
|
MixchIE,
|
||||||
|
MixchMovieIE,
|
||||||
)
|
)
|
||||||
from .mixcloud import (
|
from .mixcloud import (
|
||||||
MixcloudIE,
|
MixcloudIE,
|
||||||
|
|
|
@ -205,6 +205,26 @@ class ArchiveOrgIE(InfoExtractor):
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
}, {
|
||||||
|
# The reviewbody is None for one of the reviews; just need to extract data without crashing
|
||||||
|
'url': 'https://archive.org/details/gd95-04-02.sbd.11622.sbeok.shnf/gd95-04-02d1t04.shn',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'gd95-04-02.sbd.11622.sbeok.shnf/gd95-04-02d1t04.shn',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'Stuck Inside of Mobile with the Memphis Blues Again',
|
||||||
|
'creators': ['Grateful Dead'],
|
||||||
|
'duration': 338.31,
|
||||||
|
'track': 'Stuck Inside of Mobile with the Memphis Blues Again',
|
||||||
|
'description': 'md5:764348a470b986f1217ffd38d6ac7b72',
|
||||||
|
'display_id': 'gd95-04-02d1t04.shn',
|
||||||
|
'location': 'Pyramid Arena',
|
||||||
|
'uploader': 'jon@archive.org',
|
||||||
|
'album': '1995-04-02 - Pyramid Arena',
|
||||||
|
'upload_date': '20040519',
|
||||||
|
'track_number': 4,
|
||||||
|
'release_date': '19950402',
|
||||||
|
'timestamp': 1084927901,
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -335,7 +355,7 @@ class ArchiveOrgIE(InfoExtractor):
|
||||||
info['comments'].append({
|
info['comments'].append({
|
||||||
'id': review.get('review_id'),
|
'id': review.get('review_id'),
|
||||||
'author': review.get('reviewer'),
|
'author': review.get('reviewer'),
|
||||||
'text': str_or_none(review.get('reviewtitle'), '') + '\n\n' + review.get('reviewbody'),
|
'text': join_nonempty('reviewtitle', 'reviewbody', from_dict=review, delim='\n\n'),
|
||||||
'timestamp': unified_timestamp(review.get('createdate')),
|
'timestamp': unified_timestamp(review.get('createdate')),
|
||||||
'parent': 'root'})
|
'parent': 'root'})
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class ChaturbateIE(InfoExtractor):
|
class ChaturbateIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.com/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)'
|
_VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.(?P<tld>com|eu|global)/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.chaturbate.com/siswet19/',
|
'url': 'https://www.chaturbate.com/siswet19/',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -29,15 +29,24 @@ class ChaturbateIE(InfoExtractor):
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://en.chaturbate.com/siswet19/',
|
'url': 'https://en.chaturbate.com/siswet19/',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://chaturbate.eu/siswet19/',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://chaturbate.eu/fullvideo/?b=caylin',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://chaturbate.global/siswet19/',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
_ROOM_OFFLINE = 'Room is currently offline'
|
_ROOM_OFFLINE = 'Room is currently offline'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id, tld = self._match_valid_url(url).group('id', 'tld')
|
||||||
|
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
f'https://chaturbate.com/{video_id}/', video_id,
|
f'https://chaturbate.{tld}/{video_id}/', video_id,
|
||||||
headers=self.geo_verification_headers())
|
headers=self.geo_verification_headers())
|
||||||
|
|
||||||
found_m3u8_urls = []
|
found_m3u8_urls = []
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CloudflareStreamIE(InfoExtractor):
|
||||||
_DOMAIN_RE = r'(?:cloudflarestream\.com|(?:videodelivery|bytehighway)\.net)'
|
_DOMAIN_RE = r'(?:cloudflarestream\.com|(?:videodelivery|bytehighway)\.net)'
|
||||||
_EMBED_RE = rf'(?:embed\.|{_SUBDOMAIN_RE}){_DOMAIN_RE}/embed/[^/?#]+\.js\?(?:[^#]+&)?video='
|
_EMBED_RE = rf'(?:embed\.|{_SUBDOMAIN_RE}){_DOMAIN_RE}/embed/[^/?#]+\.js\?(?:[^#]+&)?video='
|
||||||
_ID_RE = r'[\da-f]{32}|eyJ[\w-]+\.[\w-]+\.[\w-]+'
|
_ID_RE = r'[\da-f]{32}|eyJ[\w-]+\.[\w-]+\.[\w-]+'
|
||||||
_VALID_URL = rf'https?://(?:{_SUBDOMAIN_RE}{_DOMAIN_RE}/|{_EMBED_RE})(?P<id>{_ID_RE})'
|
_VALID_URL = rf'https?://(?:{_SUBDOMAIN_RE}(?P<domain>{_DOMAIN_RE})/|{_EMBED_RE})(?P<id>{_ID_RE})'
|
||||||
_EMBED_REGEX = [
|
_EMBED_REGEX = [
|
||||||
rf'<script[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//{_EMBED_RE}(?:{_ID_RE})(?:(?!\1).)*)\1',
|
rf'<script[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//{_EMBED_RE}(?:{_ID_RE})(?:(?!\1).)*)\1',
|
||||||
rf'<iframe[^>]+\bsrc=["\'](?P<url>https?://{_SUBDOMAIN_RE}{_DOMAIN_RE}/[\da-f]{{32}})',
|
rf'<iframe[^>]+\bsrc=["\'](?P<url>https?://{_SUBDOMAIN_RE}{_DOMAIN_RE}/[\da-f]{{32}})',
|
||||||
|
@ -19,7 +19,7 @@ class CloudflareStreamIE(InfoExtractor):
|
||||||
'id': '31c9291ab41fac05471db4e73aa11717',
|
'id': '31c9291ab41fac05471db4e73aa11717',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': '31c9291ab41fac05471db4e73aa11717',
|
'title': '31c9291ab41fac05471db4e73aa11717',
|
||||||
'thumbnail': 'https://videodelivery.net/31c9291ab41fac05471db4e73aa11717/thumbnails/thumbnail.jpg',
|
'thumbnail': 'https://cloudflarestream.com/31c9291ab41fac05471db4e73aa11717/thumbnails/thumbnail.jpg',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': 'm3u8',
|
'skip_download': 'm3u8',
|
||||||
|
@ -30,7 +30,7 @@ class CloudflareStreamIE(InfoExtractor):
|
||||||
'id': '0e8e040aec776862e1d632a699edf59e',
|
'id': '0e8e040aec776862e1d632a699edf59e',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': '0e8e040aec776862e1d632a699edf59e',
|
'title': '0e8e040aec776862e1d632a699edf59e',
|
||||||
'thumbnail': 'https://videodelivery.net/0e8e040aec776862e1d632a699edf59e/thumbnails/thumbnail.jpg',
|
'thumbnail': 'https://cloudflarestream.com/0e8e040aec776862e1d632a699edf59e/thumbnails/thumbnail.jpg',
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://watch.cloudflarestream.com/9df17203414fd1db3e3ed74abbe936c1',
|
'url': 'https://watch.cloudflarestream.com/9df17203414fd1db3e3ed74abbe936c1',
|
||||||
|
@ -54,7 +54,7 @@ class CloudflareStreamIE(InfoExtractor):
|
||||||
'id': 'eaef9dea5159cf968be84241b5cedfe7',
|
'id': 'eaef9dea5159cf968be84241b5cedfe7',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'eaef9dea5159cf968be84241b5cedfe7',
|
'title': 'eaef9dea5159cf968be84241b5cedfe7',
|
||||||
'thumbnail': 'https://videodelivery.net/eaef9dea5159cf968be84241b5cedfe7/thumbnails/thumbnail.jpg',
|
'thumbnail': 'https://cloudflarestream.com/eaef9dea5159cf968be84241b5cedfe7/thumbnails/thumbnail.jpg',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': 'm3u8',
|
'skip_download': 'm3u8',
|
||||||
|
@ -62,8 +62,9 @@ class CloudflareStreamIE(InfoExtractor):
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id, domain = self._match_valid_url(url).group('id', 'domain')
|
||||||
domain = 'bytehighway.net' if 'bytehighway.net/' in url else 'videodelivery.net'
|
if domain != 'bytehighway.net':
|
||||||
|
domain = 'cloudflarestream.com'
|
||||||
base_url = f'https://{domain}/{video_id}/'
|
base_url = f'https://{domain}/{video_id}/'
|
||||||
if '.' in video_id:
|
if '.' in video_id:
|
||||||
video_id = self._parse_json(base64.urlsafe_b64decode(
|
video_id = self._parse_json(base64.urlsafe_b64decode(
|
||||||
|
|
|
@ -563,13 +563,13 @@ class FacebookIE(InfoExtractor):
|
||||||
return extract_video_data(try_get(
|
return extract_video_data(try_get(
|
||||||
js_data, lambda x: x['jsmods']['instances'], list) or [])
|
js_data, lambda x: x['jsmods']['instances'], list) or [])
|
||||||
|
|
||||||
def extract_dash_manifest(video, formats):
|
def extract_dash_manifest(vid_data, formats, mpd_url=None):
|
||||||
dash_manifest = traverse_obj(
|
dash_manifest = traverse_obj(
|
||||||
video, 'dash_manifest', 'playlist', 'dash_manifest_xml_string', expected_type=str)
|
vid_data, 'dash_manifest', 'playlist', 'dash_manifest_xml_string', 'manifest_xml', expected_type=str)
|
||||||
if dash_manifest:
|
if dash_manifest:
|
||||||
formats.extend(self._parse_mpd_formats(
|
formats.extend(self._parse_mpd_formats(
|
||||||
compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)),
|
compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)),
|
||||||
mpd_url=url_or_none(video.get('dash_manifest_url'))))
|
mpd_url=url_or_none(video.get('dash_manifest_url')) or mpd_url))
|
||||||
|
|
||||||
def process_formats(info):
|
def process_formats(info):
|
||||||
# Downloads with browser's User-Agent are rate limited. Working around
|
# Downloads with browser's User-Agent are rate limited. Working around
|
||||||
|
@ -619,9 +619,12 @@ class FacebookIE(InfoExtractor):
|
||||||
video = video['creation_story']
|
video = video['creation_story']
|
||||||
video['owner'] = traverse_obj(video, ('short_form_video_context', 'video_owner'))
|
video['owner'] = traverse_obj(video, ('short_form_video_context', 'video_owner'))
|
||||||
video.update(reel_info)
|
video.update(reel_info)
|
||||||
fmt_data = traverse_obj(video, ('videoDeliveryLegacyFields', {dict})) or video
|
|
||||||
formats = []
|
formats = []
|
||||||
q = qualities(['sd', 'hd'])
|
q = qualities(['sd', 'hd'])
|
||||||
|
|
||||||
|
# Legacy formats extraction
|
||||||
|
fmt_data = traverse_obj(video, ('videoDeliveryLegacyFields', {dict})) or video
|
||||||
for key, format_id in (('playable_url', 'sd'), ('playable_url_quality_hd', 'hd'),
|
for key, format_id in (('playable_url', 'sd'), ('playable_url_quality_hd', 'hd'),
|
||||||
('playable_url_dash', ''), ('browser_native_hd_url', 'hd'),
|
('playable_url_dash', ''), ('browser_native_hd_url', 'hd'),
|
||||||
('browser_native_sd_url', 'sd')):
|
('browser_native_sd_url', 'sd')):
|
||||||
|
@ -629,7 +632,7 @@ class FacebookIE(InfoExtractor):
|
||||||
if not playable_url:
|
if not playable_url:
|
||||||
continue
|
continue
|
||||||
if determine_ext(playable_url) == 'mpd':
|
if determine_ext(playable_url) == 'mpd':
|
||||||
formats.extend(self._extract_mpd_formats(playable_url, video_id))
|
formats.extend(self._extract_mpd_formats(playable_url, video_id, fatal=False))
|
||||||
else:
|
else:
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
|
@ -638,6 +641,28 @@ class FacebookIE(InfoExtractor):
|
||||||
'url': playable_url,
|
'url': playable_url,
|
||||||
})
|
})
|
||||||
extract_dash_manifest(fmt_data, formats)
|
extract_dash_manifest(fmt_data, formats)
|
||||||
|
|
||||||
|
# New videoDeliveryResponse formats extraction
|
||||||
|
fmt_data = traverse_obj(video, ('videoDeliveryResponseFragment', 'videoDeliveryResponseResult'))
|
||||||
|
mpd_urls = traverse_obj(fmt_data, ('dash_manifest_urls', ..., 'manifest_url', {url_or_none}))
|
||||||
|
dash_manifests = traverse_obj(fmt_data, ('dash_manifests', lambda _, v: v['manifest_xml']))
|
||||||
|
for idx, dash_manifest in enumerate(dash_manifests):
|
||||||
|
extract_dash_manifest(dash_manifest, formats, mpd_url=traverse_obj(mpd_urls, idx))
|
||||||
|
if not dash_manifests:
|
||||||
|
# Only extract from MPD URLs if the manifests are not already provided
|
||||||
|
for mpd_url in mpd_urls:
|
||||||
|
formats.extend(self._extract_mpd_formats(mpd_url, video_id, fatal=False))
|
||||||
|
for prog_fmt in traverse_obj(fmt_data, ('progressive_urls', lambda _, v: v['progressive_url'])):
|
||||||
|
format_id = traverse_obj(prog_fmt, ('metadata', 'quality', {str.lower}))
|
||||||
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
|
# sd, hd formats w/o resolution info should be deprioritized below DASH
|
||||||
|
'quality': q(format_id) - 3,
|
||||||
|
'url': prog_fmt['progressive_url'],
|
||||||
|
})
|
||||||
|
for m3u8_url in traverse_obj(fmt_data, ('hls_playlist_urls', ..., 'hls_playlist_url', {url_or_none})):
|
||||||
|
formats.extend(self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', fatal=False, m3u8_id='hls'))
|
||||||
|
|
||||||
if not formats:
|
if not formats:
|
||||||
# Do not append false positive entry w/o any formats
|
# Do not append false positive entry w/o any formats
|
||||||
return
|
return
|
||||||
|
|
|
@ -5,56 +5,63 @@ import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
|
js_to_json,
|
||||||
|
remove_end,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
unescapeHTML,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class GoPlayIE(InfoExtractor):
|
class GoPlayIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(www\.)?goplay\.be/video/([^/]+/[^/]+/|)(?P<display_id>[^/#]+)'
|
_VALID_URL = r'https?://(www\.)?goplay\.be/video/([^/?#]+/[^/?#]+/|)(?P<id>[^/#]+)'
|
||||||
|
|
||||||
_NETRC_MACHINE = 'goplay'
|
_NETRC_MACHINE = 'goplay'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.goplay.be/video/de-container-cup/de-container-cup-s3/de-container-cup-s3-aflevering-2#autoplay',
|
'url': 'https://www.goplay.be/video/de-slimste-mens-ter-wereld/de-slimste-mens-ter-wereld-s22/de-slimste-mens-ter-wereld-s22-aflevering-1',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '9c4214b8-e55d-4e4b-a446-f015f6c6f811',
|
'id': '2baa4560-87a0-421b-bffc-359914e3c387',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'S3 - Aflevering 2',
|
'title': 'S22 - Aflevering 1',
|
||||||
'series': 'De Container Cup',
|
'description': r're:In aflevering 1 nemen Daan Alferink, Tess Elst en Xander De Rycke .{66}',
|
||||||
'season': 'Season 3',
|
'series': 'De Slimste Mens ter Wereld',
|
||||||
'season_number': 3,
|
'episode': 'Episode 1',
|
||||||
'episode': 'Episode 2',
|
'season_number': 22,
|
||||||
'episode_number': 2,
|
'episode_number': 1,
|
||||||
|
'season': 'Season 22',
|
||||||
},
|
},
|
||||||
|
'params': {'skip_download': True},
|
||||||
'skip': 'This video is only available for registered users',
|
'skip': 'This video is only available for registered users',
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.goplay.be/video/a-family-for-thr-holidays-s1-aflevering-1#autoplay',
|
'url': 'https://www.goplay.be/video/1917',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '74e3ed07-748c-49e4-85a0-393a93337dbf',
|
'id': '40cac41d-8d29-4ef5-aa11-75047b9f0907',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'A Family for the Holidays',
|
'title': '1917',
|
||||||
|
'description': r're:Op het hoogtepunt van de Eerste Wereldoorlog krijgen twee jonge .{94}',
|
||||||
},
|
},
|
||||||
|
'params': {'skip_download': True},
|
||||||
'skip': 'This video is only available for registered users',
|
'skip': 'This video is only available for registered users',
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.goplay.be/video/de-mol/de-mol-s11/de-mol-s11-aflevering-1#autoplay',
|
'url': 'https://www.goplay.be/video/de-mol/de-mol-s11/de-mol-s11-aflevering-1#autoplay',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '03eb8f2f-153e-41cb-9805-0d3a29dab656',
|
'id': 'ecb79672-92b9-4cd9-a0d7-e2f0250681ee',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'S11 - Aflevering 1',
|
'title': 'S11 - Aflevering 1',
|
||||||
|
'description': r're:Tien kandidaten beginnen aan hun verovering van Amerika en ontmoeten .{102}',
|
||||||
'episode': 'Episode 1',
|
'episode': 'Episode 1',
|
||||||
'series': 'De Mol',
|
'series': 'De Mol',
|
||||||
'season_number': 11,
|
'season_number': 11,
|
||||||
'episode_number': 1,
|
'episode_number': 1,
|
||||||
'season': 'Season 11',
|
'season': 'Season 11',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {'skip_download': True},
|
||||||
'skip_download': True,
|
|
||||||
},
|
|
||||||
'skip': 'This video is only available for registered users',
|
'skip': 'This video is only available for registered users',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@ -69,27 +76,42 @@ class GoPlayIE(InfoExtractor):
|
||||||
if not self._id_token:
|
if not self._id_token:
|
||||||
raise self.raise_login_required(method='password')
|
raise self.raise_login_required(method='password')
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _find_json(self, s):
|
||||||
url, display_id = self._match_valid_url(url).group(0, 'display_id')
|
return self._search_json(
|
||||||
webpage = self._download_webpage(url, display_id)
|
r'\w+\s*:\s*', s, 'next js data', None, contains_pattern=r'\[(?s:.+)\]', default=None)
|
||||||
video_data_json = self._html_search_regex(r'<div\s+data-hero="([^"]+)"', webpage, 'video_data')
|
|
||||||
video_data = self._parse_json(unescapeHTML(video_data_json), display_id).get('data')
|
|
||||||
|
|
||||||
movie = video_data.get('movie')
|
def _real_extract(self, url):
|
||||||
if movie:
|
display_id = self._match_id(url)
|
||||||
video_id = movie['videoUuid']
|
webpage = self._download_webpage(url, display_id)
|
||||||
info_dict = {
|
|
||||||
'title': movie.get('title'),
|
nextjs_data = traverse_obj(
|
||||||
}
|
re.findall(r'<script[^>]*>\s*self\.__next_f\.push\(\s*(\[.+?\])\s*\);?\s*</script>', webpage),
|
||||||
else:
|
(..., {js_to_json}, {json.loads}, ..., {self._find_json}, ...))
|
||||||
episode = traverse_obj(video_data, ('playlists', ..., 'episodes', lambda _, v: v['pageInfo']['url'] == url), get_all=False)
|
meta = traverse_obj(nextjs_data, (
|
||||||
video_id = episode['videoUuid']
|
..., lambda _, v: v['meta']['path'] == urllib.parse.urlparse(url).path, 'meta', any))
|
||||||
info_dict = {
|
|
||||||
'title': episode.get('episodeTitle'),
|
video_id = meta['uuid']
|
||||||
'series': traverse_obj(episode, ('program', 'title')),
|
info_dict = traverse_obj(meta, {
|
||||||
'season_number': episode.get('seasonNumber'),
|
'title': ('title', {str}),
|
||||||
'episode_number': episode.get('episodeNumber'),
|
'description': ('description', {str.strip}),
|
||||||
}
|
})
|
||||||
|
|
||||||
|
if traverse_obj(meta, ('program', 'subtype')) != 'movie':
|
||||||
|
for season_data in traverse_obj(nextjs_data, (..., 'children', ..., 'playlists', ...)):
|
||||||
|
episode_data = traverse_obj(
|
||||||
|
season_data, ('videos', lambda _, v: v['videoId'] == video_id, any))
|
||||||
|
if not episode_data:
|
||||||
|
continue
|
||||||
|
|
||||||
|
episode_title = traverse_obj(
|
||||||
|
episode_data, 'contextualTitle', 'episodeTitle', expected_type=str)
|
||||||
|
info_dict.update({
|
||||||
|
'title': episode_title or info_dict.get('title'),
|
||||||
|
'series': remove_end(info_dict.get('title'), f' - {episode_title}'),
|
||||||
|
'season_number': traverse_obj(season_data, ('season', {int_or_none})),
|
||||||
|
'episode_number': traverse_obj(episode_data, ('episodeNumber', {int_or_none})),
|
||||||
|
})
|
||||||
|
break
|
||||||
|
|
||||||
api = self._download_json(
|
api = self._download_json(
|
||||||
f'https://api.goplay.be/web/v1/videos/long-form/{video_id}',
|
f'https://api.goplay.be/web/v1/videos/long-form/{video_id}',
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
import uuid
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
@ -12,19 +13,21 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class LiTVIE(InfoExtractor):
|
class LiTVIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?litv\.tv/(?:vod|promo)/[^/]+/(?:content\.do)?\?.*?\b(?:content_)?id=(?P<id>[^&]+)'
|
_VALID_URL = r'https?://(?:www\.)?litv\.tv/(?:[^/]+/watch/|vod/[^/]+/content\.do\?content_id=)(?P<id>[a-z\-A-Z0-9]+)'
|
||||||
|
|
||||||
_URL_TEMPLATE = 'https://www.litv.tv/vod/%s/content.do?content_id=%s'
|
_URL_TEMPLATE = 'https://www.litv.tv/%s/watch/%s'
|
||||||
|
|
||||||
|
_GEO_COUNTRIES = ['TW']
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.litv.tv/vod/drama/content.do?brc_id=root&id=VOD00041610&isUHEnabled=true&autoPlay=1',
|
'url': 'https://www.litv.tv/drama/watch/VOD00041610',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'VOD00041606',
|
'id': 'VOD00041606',
|
||||||
'title': '花千骨',
|
'title': '花千骨',
|
||||||
},
|
},
|
||||||
'playlist_count': 51, # 50 episodes + 1 trailer
|
'playlist_count': 51, # 50 episodes + 1 trailer
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.litv.tv/vod/drama/content.do?brc_id=root&id=VOD00041610&isUHEnabled=true&autoPlay=1',
|
'url': 'https://www.litv.tv/drama/watch/VOD00041610',
|
||||||
'md5': 'b90ff1e9f1d8f5cfcd0a44c3e2b34c7a',
|
'md5': 'b90ff1e9f1d8f5cfcd0a44c3e2b34c7a',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'VOD00041610',
|
'id': 'VOD00041610',
|
||||||
|
@ -32,16 +35,15 @@ class LiTVIE(InfoExtractor):
|
||||||
'title': '花千骨第1集',
|
'title': '花千骨第1集',
|
||||||
'thumbnail': r're:https?://.*\.jpg$',
|
'thumbnail': r're:https?://.*\.jpg$',
|
||||||
'description': '《花千骨》陸劇線上看。十六年前,平靜的村莊內,一名女嬰隨異相出生,途徑此地的蜀山掌門清虛道長算出此女命運非同一般,她體內散發的異香易招惹妖魔。一念慈悲下,他在村莊周邊設下結界阻擋妖魔入侵,讓其年滿十六後去蜀山,並賜名花千骨。',
|
'description': '《花千骨》陸劇線上看。十六年前,平靜的村莊內,一名女嬰隨異相出生,途徑此地的蜀山掌門清虛道長算出此女命運非同一般,她體內散發的異香易招惹妖魔。一念慈悲下,他在村莊周邊設下結界阻擋妖魔入侵,讓其年滿十六後去蜀山,並賜名花千骨。',
|
||||||
'categories': ['奇幻', '愛情', '中國', '仙俠'],
|
'categories': ['奇幻', '愛情', '仙俠', '古裝'],
|
||||||
'episode': 'Episode 1',
|
'episode': 'Episode 1',
|
||||||
'episode_number': 1,
|
'episode_number': 1,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'noplaylist': True,
|
'noplaylist': True,
|
||||||
},
|
},
|
||||||
'skip': 'Georestricted to Taiwan',
|
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.litv.tv/promo/miyuezhuan/?content_id=VOD00044841&',
|
'url': 'https://www.litv.tv/drama/watch/VOD00044841',
|
||||||
'md5': '88322ea132f848d6e3e18b32a832b918',
|
'md5': '88322ea132f848d6e3e18b32a832b918',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'VOD00044841',
|
'id': 'VOD00044841',
|
||||||
|
@ -55,11 +57,11 @@ class LiTVIE(InfoExtractor):
|
||||||
def _extract_playlist(self, playlist_data, content_type):
|
def _extract_playlist(self, playlist_data, content_type):
|
||||||
all_episodes = [
|
all_episodes = [
|
||||||
self.url_result(smuggle_url(
|
self.url_result(smuggle_url(
|
||||||
self._URL_TEMPLATE % (content_type, episode['contentId']),
|
self._URL_TEMPLATE % (content_type, episode['content_id']),
|
||||||
{'force_noplaylist': True})) # To prevent infinite recursion
|
{'force_noplaylist': True})) # To prevent infinite recursion
|
||||||
for episode in traverse_obj(playlist_data, ('seasons', ..., 'episode', lambda _, v: v['contentId']))]
|
for episode in traverse_obj(playlist_data, ('seasons', ..., 'episodes', lambda _, v: v['content_id']))]
|
||||||
|
|
||||||
return self.playlist_result(all_episodes, playlist_data['contentId'], playlist_data.get('title'))
|
return self.playlist_result(all_episodes, playlist_data['content_id'], playlist_data.get('title'))
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
url, smuggled_data = unsmuggle_url(url, {})
|
url, smuggled_data = unsmuggle_url(url, {})
|
||||||
|
@ -68,73 +70,63 @@ class LiTVIE(InfoExtractor):
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
if self._search_regex(
|
vod_data = self._parse_json(self._search_regex(
|
||||||
r'(?i)<meta\s[^>]*http-equiv="refresh"\s[^>]*content="[0-9]+;\s*url=https://www\.litv\.tv/"',
|
r'<script\s+id="__NEXT_DATA__"[^>]*>(.+)</script>', webpage, 'VOD data', default='{}'),
|
||||||
webpage, 'meta refresh redirect', default=False, group=0):
|
|
||||||
raise ExtractorError('No such content found', expected=True)
|
|
||||||
|
|
||||||
program_info = self._parse_json(self._search_regex(
|
|
||||||
r'var\s+programInfo\s*=\s*([^;]+)', webpage, 'VOD data', default='{}'),
|
|
||||||
video_id)
|
video_id)
|
||||||
|
|
||||||
# In browsers `getProgramInfo` request is always issued. Usually this
|
program_info = traverse_obj(
|
||||||
# endpoint gives the same result as the data embedded in the webpage.
|
vod_data,
|
||||||
# If, for some reason, there are no embedded data, we do an extra request.
|
('props', 'pageProps', 'programInformation'),
|
||||||
if 'assetId' not in program_info:
|
default={}, expected_type=dict)
|
||||||
program_info = self._download_json(
|
series_id = program_info.get('series_id')
|
||||||
'https://www.litv.tv/vod/ajax/getProgramInfo', video_id,
|
playlist_data = traverse_obj(vod_data, ('props', 'pageProps', 'seriesTree'))
|
||||||
query={'contentId': video_id},
|
if playlist_data is not None and self._yes_playlist(series_id, video_id, smuggled_data):
|
||||||
headers={'Accept': 'application/json'})
|
content_type = program_info.get('content_type')
|
||||||
|
return self._extract_playlist(playlist_data, content_type)
|
||||||
|
|
||||||
series_id = program_info['seriesId']
|
asset_id = traverse_obj(program_info, ('assets', 0, 'asset_id'))
|
||||||
if self._yes_playlist(series_id, video_id, smuggled_data):
|
if asset_id is None: # live stream case
|
||||||
playlist_data = self._download_json(
|
asset_id = program_info.get('content_id')
|
||||||
'https://www.litv.tv/vod/ajax/getSeriesTree', video_id,
|
media_type = program_info.get('content_type')
|
||||||
query={'seriesId': series_id}, headers={'Accept': 'application/json'})
|
else: # vod case
|
||||||
return self._extract_playlist(playlist_data, program_info['contentType'])
|
media_type = 'vod'
|
||||||
|
puid = try_call(lambda: self._get_cookies('https://www.litv.tv/')['PUID'].value)
|
||||||
|
if puid is None:
|
||||||
|
puid = str(uuid.uuid4())
|
||||||
|
endpoint = 'get-urls-no-auth'
|
||||||
|
else:
|
||||||
|
endpoint = 'get-urls'
|
||||||
|
payload = {'AssetId': asset_id, 'MediaType': media_type, 'puid': puid}
|
||||||
|
video_data = self._download_json(
|
||||||
|
f'https://www.litv.tv/api/{endpoint}', video_id,
|
||||||
|
data=json.dumps(payload).encode(),
|
||||||
|
headers={'Content-Type': 'application/json'})
|
||||||
|
|
||||||
video_data = self._parse_json(self._search_regex(
|
if video_data.get('error'):
|
||||||
r'uiHlsUrl\s*=\s*testBackendData\(([^;]+)\);',
|
error_msg = traverse_obj(video_data, ('error', 'message'))
|
||||||
webpage, 'video data', default='{}'), video_id)
|
if error_msg == 'OutsideRegionError: ':
|
||||||
if not video_data:
|
|
||||||
payload = {'assetId': program_info['assetId']}
|
|
||||||
puid = try_call(lambda: self._get_cookies('https://www.litv.tv/')['PUID'].value)
|
|
||||||
if puid:
|
|
||||||
payload.update({
|
|
||||||
'type': 'auth',
|
|
||||||
'puid': puid,
|
|
||||||
})
|
|
||||||
endpoint = 'getUrl'
|
|
||||||
else:
|
|
||||||
payload.update({
|
|
||||||
'watchDevices': program_info['watchDevices'],
|
|
||||||
'contentType': program_info['contentType'],
|
|
||||||
})
|
|
||||||
endpoint = 'getMainUrlNoAuth'
|
|
||||||
video_data = self._download_json(
|
|
||||||
f'https://www.litv.tv/vod/ajax/{endpoint}', video_id,
|
|
||||||
data=json.dumps(payload).encode(),
|
|
||||||
headers={'Content-Type': 'application/json'})
|
|
||||||
|
|
||||||
if not video_data.get('fullpath'):
|
|
||||||
error_msg = video_data.get('errorMessage')
|
|
||||||
if error_msg == 'vod.error.outsideregionerror':
|
|
||||||
self.raise_geo_restricted('This video is available in Taiwan only')
|
self.raise_geo_restricted('This video is available in Taiwan only')
|
||||||
if error_msg:
|
if error_msg:
|
||||||
raise ExtractorError(f'{self.IE_NAME} said: {error_msg}', expected=True)
|
raise ExtractorError(f'{self.IE_NAME} said: {error_msg}', expected=True)
|
||||||
raise ExtractorError(f'Unexpected result from {self.IE_NAME}')
|
raise ExtractorError(f'Unexpected error from {self.IE_NAME}')
|
||||||
|
|
||||||
|
try:
|
||||||
|
asset_url = video_data['result']['AssetURLs'][0]
|
||||||
|
except KeyError:
|
||||||
|
raise ExtractorError(f'Unexpected result from {self.IE_NAME}')
|
||||||
formats = self._extract_m3u8_formats(
|
formats = self._extract_m3u8_formats(
|
||||||
video_data['fullpath'], video_id, ext='mp4',
|
asset_url, video_id, ext='mp4',
|
||||||
entry_protocol='m3u8_native', m3u8_id='hls')
|
entry_protocol='m3u8_native', m3u8_id='hls')
|
||||||
for a_format in formats:
|
for a_format in formats:
|
||||||
# LiTV HLS segments doesn't like compressions
|
# LiTV HLS segments doesn't like compressions
|
||||||
a_format.setdefault('http_headers', {})['Accept-Encoding'] = 'identity'
|
a_format.setdefault('http_headers', {})['Accept-Encoding'] = 'identity'
|
||||||
|
|
||||||
title = program_info['title'] + program_info.get('secondaryMark', '')
|
title = program_info['title'] + program_info.get('secondary_mark', '')
|
||||||
description = program_info.get('description')
|
description = program_info.get('description')
|
||||||
thumbnail = program_info.get('imageFile')
|
thumbnail = program_info.get('picture')
|
||||||
categories = [item['name'] for item in program_info.get('category', [])]
|
if thumbnail is not None:
|
||||||
|
thumbnail = 'https://p-cdnstatic.svc.litv.tv/' + thumbnail
|
||||||
|
categories = [item['name'] for item in program_info.get('genres', [])]
|
||||||
episode = int_or_none(program_info.get('episode'))
|
episode = int_or_none(program_info.get('episode'))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -12,7 +12,7 @@ from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
class MixchIE(InfoExtractor):
|
class MixchIE(InfoExtractor):
|
||||||
IE_NAME = 'mixch'
|
IE_NAME = 'mixch'
|
||||||
_VALID_URL = r'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
|
_VALID_URL = r'https?://mixch\.tv/u/(?P<id>\d+)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://mixch.tv/u/16943797/live',
|
'url': 'https://mixch.tv/u/16943797/live',
|
||||||
|
@ -74,7 +74,7 @@ class MixchIE(InfoExtractor):
|
||||||
|
|
||||||
class MixchArchiveIE(InfoExtractor):
|
class MixchArchiveIE(InfoExtractor):
|
||||||
IE_NAME = 'mixch:archive'
|
IE_NAME = 'mixch:archive'
|
||||||
_VALID_URL = r'https?://(?:www\.)?mixch\.tv/archive/(?P<id>\d+)'
|
_VALID_URL = r'https?://mixch\.tv/archive/(?P<id>\d+)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://mixch.tv/archive/421',
|
'url': 'https://mixch.tv/archive/421',
|
||||||
|
@ -116,3 +116,56 @@ class MixchArchiveIE(InfoExtractor):
|
||||||
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
|
'formats': self._extract_m3u8_formats(info_json['archiveURL'], video_id),
|
||||||
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
|
'thumbnail': traverse_obj(info_json, ('thumbnailURL', {url_or_none})),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MixchMovieIE(InfoExtractor):
|
||||||
|
IE_NAME = 'mixch:movie'
|
||||||
|
_VALID_URL = r'https?://mixch\.tv/m/(?P<id>\w+)'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://mixch.tv/m/Ve8KNkJ5',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'Ve8KNkJ5',
|
||||||
|
'title': '夏☀️\nムービーへのポイントは本イベントに加算されないので配信にてお願い致します🙇🏻\u200d♀️\n#TGCCAMPUS #ミス東大 #ミス東大2024 ',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'uploader': 'ミス東大No.5 松藤百香🍑💫',
|
||||||
|
'uploader_id': '12299174',
|
||||||
|
'channel_follower_count': int,
|
||||||
|
'view_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
'comment_count': int,
|
||||||
|
'timestamp': 1724070828,
|
||||||
|
'uploader_url': 'https://mixch.tv/u/12299174',
|
||||||
|
'live_status': 'not_live',
|
||||||
|
'upload_date': '20240819',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://mixch.tv/m/61DzpIKE',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
data = self._download_json(
|
||||||
|
f'https://mixch.tv/api-web/movies/{video_id}', video_id)
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'formats': [{
|
||||||
|
'format_id': 'mp4',
|
||||||
|
'url': data['movie']['file'],
|
||||||
|
'ext': 'mp4',
|
||||||
|
}],
|
||||||
|
**traverse_obj(data, {
|
||||||
|
'title': ('movie', 'title', {str}),
|
||||||
|
'thumbnail': ('movie', 'thumbnailURL', {url_or_none}),
|
||||||
|
'uploader': ('ownerInfo', 'name', {str}),
|
||||||
|
'uploader_id': ('ownerInfo', 'id', {int}, {str_or_none}),
|
||||||
|
'channel_follower_count': ('ownerInfo', 'fan', {int_or_none}),
|
||||||
|
'view_count': ('ownerInfo', 'view', {int_or_none}),
|
||||||
|
'like_count': ('movie', 'favCount', {int_or_none}),
|
||||||
|
'comment_count': ('movie', 'commentCount', {int_or_none}),
|
||||||
|
'timestamp': ('movie', 'published', {int_or_none}),
|
||||||
|
'uploader_url': ('ownerInfo', 'id', {lambda x: x and f'https://mixch.tv/u/{x}'}, filter),
|
||||||
|
}),
|
||||||
|
'live_status': 'not_live',
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user