Compare commits

...

6 Commits

Author SHA1 Message Date
dirkf
50c7e46cbb
Merge 1231ce7d561f7a269ccc7d4b404b47184b63f826 into 3eb8d22ddb8982ca4fb56bb7a8d6517538bf14c6 2025-04-01 09:04:56 +02:00
dirkf
3eb8d22ddb
[JSInterp] Temporary fix for #33102 2025-03-31 04:21:09 +01:00
dirkf
4e714f9df1 [Misc] Correct [_]IE_DESC/NAME in a few IEs
* thx seproDev, yt-dlp/yt-dlp/pull/12694/commits/ae69e3c
* also add documenting comment in `InfoExtractor`
2025-03-26 12:47:19 +00:00
dirkf
c1ea7f5a24 [ITV] Mark ITVX not working
* update old shim
* correct [_]IE_DESC
2025-03-26 12:17:49 +00:00
dirkf
1231ce7d56 [Go] Improve error handling and diagnostics for missing pages
* fix tests
2022-05-21 16:06:55 +01:00
dirkf
54e9d638f2 [Go] Update extractor and tests for current sites and API version
Fixes yt-dl version of https://github.com/yt-dlp/yt-dlp/issues/2764
2022-02-15 10:53:33 +00:00
7 changed files with 128 additions and 51 deletions

View File

@ -32,7 +32,7 @@ class BokeCCBaseIE(InfoExtractor):
class BokeCCIE(BokeCCBaseIE):
_IE_DESC = 'CC视频'
IE_DESC = 'CC视频'
_VALID_URL = r'https?://union\.bokecc\.com/playvideo\.bo\?(?P<query>.*)'
_TESTS = [{

View File

@ -9,7 +9,7 @@ from ..utils import (
class CloudyIE(InfoExtractor):
_IE_DESC = 'cloudy.ec'
IE_DESC = 'cloudy.ec'
_VALID_URL = r'https?://(?:www\.)?cloudy\.ec/(?:v/|embed\.php\?.*?\bid=)(?P<id>[A-Za-z0-9]+)'
_TESTS = [{
'url': 'https://www.cloudy.ec/v/af511e2527aac',

View File

@ -422,6 +422,8 @@ class InfoExtractor(object):
_GEO_COUNTRIES = None
_GEO_IP_BLOCKS = None
_WORKING = True
# supply this in public subclasses: used in supported sites list, etc
# IE_DESC = 'short description of IE'
def __init__(self, downloader=None):
"""Constructor. Receives an optional downloader."""

View File

@ -20,10 +20,12 @@ class GoIE(AdobePassIE):
'abc': {
'brand': '001',
'requestor_id': 'ABC',
'go': True,
},
'freeform': {
'brand': '002',
'requestor_id': 'ABCFamily',
'go': True,
},
'watchdisneychannel': {
'brand': '004',
@ -40,6 +42,7 @@ class GoIE(AdobePassIE):
'disneynow': {
'brand': '011',
'resource_id': 'Disney',
'go': True,
},
'fxnow.fxnetworks': {
'brand': '025',
@ -48,15 +51,19 @@ class GoIE(AdobePassIE):
}
_VALID_URL = r'''(?x)
https?://
(?:
(?:(?P<sub_domain>%s)\.)?go|
(?P<sub_domain_2>abc|freeform|disneynow|fxnow\.fxnetworks)
(?P<sub_domain>
(?:(?:%(sites)s)\.)?go|fxnow\.fxnetworks|
(?:www\.)?(?:%(sites)s)
)\.com/
(?:
(?:[^/]+/)*(?P<id>[Vv][Dd][Kk][Aa]\w+)|
(?:[^/]+/)*(?P<display_id>[^/?\#]+)
)
''' % '|'.join(list(_SITE_INFO.keys()))
''' % {
'sites':
# keep _SITE_INFO in scope
(lambda s: '|'.join(re.escape(k) for k in s.keys() if s[k].get('go')))(_SITE_INFO),
}
_TESTS = [{
'url': 'http://abc.go.com/shows/designated-survivor/video/most-recent/VDKA3807643',
'info_dict': {
@ -70,14 +77,9 @@ class GoIE(AdobePassIE):
'skip_download': True,
},
'skip': 'This content is no longer available.',
}, {
'url': 'http://watchdisneyxd.go.com/doraemon',
'info_dict': {
'title': 'Doraemon',
'id': 'SH55574025',
},
'playlist_mincount': 51,
}, {
},
# Disney XD app withdrawn 2018: 'http://watchdisneyxd.go.com/doraemon',
{
'url': 'http://freeform.go.com/shows/shadowhunters/episodes/season-2/1-this-guilty-blood',
'info_dict': {
'id': 'VDKA3609139',
@ -85,23 +87,37 @@ class GoIE(AdobePassIE):
'title': 'This Guilty Blood',
'description': 'md5:f18e79ad1c613798d95fdabfe96cd292',
'age_limit': 14,
'duration': 2544,
'episode': 'Episode 1',
'thumbnail': r're:https?://.*?\.jpg',
'season_number': 2,
'episode_number': 1,
'season': 'Season 2',
'series': 'Shadowhunters',
},
'params': {
'geo_bypass_ip_block': '3.244.239.0/24',
'geo_bypass_ip_block': '6.48.97.0/24',
# m3u8 download
'skip_download': True,
},
}, {
'url': 'https://abc.com/shows/the-rookie/episode-guide/season-02/03-the-bet',
'url': 'https://abc.com/shows/the-rookie/episode-guide/season-04/13-fight-or-flight',
'info_dict': {
'id': 'VDKA13435179',
'id': 'VDKA26139487',
'ext': 'mp4',
'title': 'The Bet',
'description': 'md5:c66de8ba2e92c6c5c113c3ade84ab404',
'title': 'Fight or Flight',
'episode': 'Episode 13',
'thumbnail': r're:https?://.*?\.jpg',
'series': 'The Rookie',
'description': 'md5:8caf91de9806a1c5f79823059fe80267',
'duration': 2575,
'episode_number': 13,
'season_number': 4,
'season': 'Season 4',
'age_limit': 14,
},
'params': {
'geo_bypass_ip_block': '3.244.239.0/24',
'geo_bypass_ip_block': '6.48.97.0/24',
# m3u8 download
'skip_download': True,
},
@ -112,9 +128,13 @@ class GoIE(AdobePassIE):
'ext': 'mp4',
'title': 'First Look: Better Things - Season 2',
'description': 'md5:fa73584a95761c605d9d54904e35b407',
'duration': 161,
'series': 'Better Things',
'age_limit': 14,
'thumbnail': r're:https?://.*?\.jpg',
},
'params': {
'geo_bypass_ip_block': '3.244.239.0/24',
'geo_bypass_ip_block': '6.48.97.0/24',
# m3u8 download
'skip_download': True,
},
@ -125,11 +145,20 @@ class GoIE(AdobePassIE):
'ext': 'mp4',
'title': 'Pilot',
'description': 'md5:74306df917cfc199d76d061d66bebdb4',
'season': 'Season 1',
'episode': 'Episode 1',
'series': 'Modern Family',
'season_number': 1,
'duration': 1301,
'episode_number': 1,
'age_limit': 0,
'thumbnail': r're:https?://.*?\.jpg',
},
'params': {
# m3u8 download
'skip_download': True,
},
'skip': 'The content youre looking for is not available',
}, {
'url': 'http://abc.go.com/shows/the-catch/episode-guide/season-01/10-the-wedding',
'only_matching': True,
@ -147,28 +176,66 @@ class GoIE(AdobePassIE):
}, {
'url': 'https://disneynow.com/shows/minnies-bow-toons/video/happy-campers/vdka4872013',
'only_matching': True,
}, {
'url': 'https://www.freeform.com/shows/cruel-summer/episode-guide/season-01/01-happy-birthday-jeanette-turner',
'only_matching': True,
}, {
# will expire and need to be replaced by a newer episode
'url': 'https://disneynow.com/shows/ducktales-disney-channel/season-03/episode-22-the-last-adventure/vdka22464554',
'info_dict': {
'id': 'VDKA22464554',
'ext': 'mp4',
'title': 'The Last Adventure!',
'description': 'The Duck Family uncovers earth-shattering secrets in a final standoff with FOWL, with the future of adventure hanging in the balance.',
'season_number': 3,
'episode': 'Episode 22',
'season': 'Season 3',
'episode_number': 22,
'age_limit': 7,
'series': 'DuckTales',
'thumbnail': r're:https?://.*?\.jpg',
},
'params': {
# AES-128: ffmpeg
'skip_download': True,
},
}, {
'url': 'https://disneynow.com/shows/ducktales-disney-channel',
'info_dict': {
'title': 'DuckTales TV Show',
'id': 'SH553923438',
},
'playlist_mincount': 30,
'expected_warnings': ['Ignoring subtitle tracks', ],
}]
def _extract_videos(self, brand, video_id='-1', show_id='-1'):
display_id = video_id if video_id != '-1' else show_id
return self._download_json(
'http://api.contents.watchabc.go.com/vp2/ws/contents/3000/videos/%s/001/-1/%s/-1/%s/-1/-1.json' % (brand, show_id, video_id),
display_id)['video']
data = self._download_json(
'http://api.contents.watchabc.go.com/vp2/ws/contents/4000/videos/%s/001/-1/%s/-1/%s/-1/-1.json' % (brand, show_id, video_id),
display_id, fatal=False)
return try_get(data, lambda x: x['video'], list)
def _raise_extractor_error(self, video_id, msg, expected=True):
raise ExtractorError('%s said: %s: %s' % (self.IE_NAME, video_id, msg), expected=expected)
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
sub_domain = mobj.group('sub_domain') or mobj.group('sub_domain_2')
sub_domain = re.sub(r'^(?:www\.)?(.+?)(?:\.go)?$', r'\1', mobj.group('sub_domain') or '')
video_id, display_id = mobj.group('id', 'display_id')
display_id = display_id or video_id
site_info = self._SITE_INFO.get(sub_domain, {})
brand = site_info.get('brand')
if not video_id or not site_info:
webpage = self._download_webpage(url, display_id or video_id)
webpage = self._download_webpage(url, display_id, expected_status=[404])
if re.search(r'(?:>|=\s*")Page not found\s', webpage):
self._raise_extractor_error(display_id, 'Page not found')
data = self._parse_json(
self._search_regex(
r'["\']__abc_com__["\']\s*\]\s*=\s*({.+?})\s*;', webpage,
'data', default='{}'),
display_id or video_id, fatal=False)
# https://abc.com/shows/modern-family/episode-guide/season-01/101-pilot
display_id, fatal=False)
# https://abc.com/shows/ExtractorErrmodern-family/episode-guide/season-01/101-pilot
layout = try_get(data, lambda x: x['page']['content']['video']['layout'], dict)
video_id = None
if layout:
@ -181,34 +248,46 @@ class GoIE(AdobePassIE):
(
# There may be inner quotes, e.g. data-video-id="'VDKA3609139'"
# from http://freeform.go.com/shows/shadowhunters/episodes/season-2/1-this-guilty-blood
r'data-video-id=["\']*(VDKA\w+)',
r'data-video-id\s*=\s*["\']{,2}(VDKA\w+)',
# page.analytics.videoIdCode
r'\bvideoIdCode["\']\s*:\s*["\']((?:vdka|VDKA)\w+)',
# This obsolete pattern, if matched, overrides detection of DisneyNow show pages
# https://abc.com/shows/the-rookie/episode-guide/season-02/03-the-bet
r'\b(?:video)?id["\']\s*:\s*["\'](VDKA\w+)'
# r'\b(?:video)?id["\']\s*:\s*["\'](VDKA\w+)'
), webpage, 'video id', default=video_id)
if not site_info:
brand = self._search_regex(
(r'data-brand=\s*["\']\s*(\d+)',
r'data-page-brand=\s*["\']\s*(\d+)'), webpage, 'brand',
default='004')
r'data-page-brand=\s*["\']\s*(\d+)',
r'"brand"\s*:\s*"(\d+)"'), webpage, 'brand',
# default to a brand that has an active domain
default='011')
site_info = next(
si for _, si in self._SITE_INFO.items()
si for si in self._SITE_INFO.values()
if si.get('brand') == brand)
if not video_id:
# show extraction works for Disney, DisneyJunior and DisneyXD
# ABC and Freeform has different layout
show_id = self._search_regex(r'data-show-id=["\']*(SH\d+)', webpage, 'show id')
videos = self._extract_videos(brand, show_id=show_id)
show_title = self._search_regex(r'data-show-title="([^"]+)"', webpage, 'show title', fatal=False)
show_title = (
self._search_regex(r'data-show-title="([^"]+)"', webpage, 'show title', default=None)
or self._og_search_title(webpage, fatal=False))
if show_title:
show_title = re.sub(r'^(?:Watch\s+)?(.+?)(?:\s*\|\s*Disney.*)?$', r'\1', show_title)
entries = []
for video in videos:
entries.append(self.url_result(
video['url'], 'Go', video.get('id'), video.get('title')))
entries.reverse()
return self.playlist_result(entries, show_id, show_title)
video_data = self._extract_videos(brand, video_id)[0]
video_id = video_data['id']
video_data = self._extract_videos(brand, video_id)
if not video_data:
self._raise_extractor_error(video_id, 'No video found')
video_id = try_get(video_data, lambda x: x[0]['id'], compat_str)
if not video_id:
self._raise_extractor_error(video_id, 'No video data', expected=False)
video_data = video_data[0]
title = video_data['title']
formats = []
@ -249,7 +328,7 @@ class GoIE(AdobePassIE):
self.raise_geo_restricted(
error['message'], countries=['US'])
error_message = ', '.join([error['message'] for error in errors])
raise ExtractorError('%s said: %s' % (self.IE_NAME, error_message), expected=True)
self._raise_extractor_error(video_id, error_message)
asset_url += '?' + entitlement['uplynkData']['sessionKey']
formats.extend(self._extract_m3u8_formats(
asset_url, video_id, 'mp4', m3u8_id=format_id or 'hls', fatal=False))
@ -262,7 +341,8 @@ class GoIE(AdobePassIE):
if re.search(r'(?:/mp4/source/|_source\.mp4)', asset_url):
f.update({
'format_id': ('%s-' % format_id if format_id else '') + 'SOURCE',
'preference': 1,
'quality': 1,
# 'preference': 1,
})
else:
mobj = re.search(r'/(\d+)x(\d+)/', asset_url)

View File

@ -35,15 +35,6 @@ from ..utils import (
class ITVBaseIE(InfoExtractor):
def _search_nextjs_data(self, webpage, video_id, **kw):
transform_source = kw.pop('transform_source', None)
fatal = kw.pop('fatal', True)
return self._parse_json(
self._search_regex(
r'''<script\b[^>]+\bid=('|")__NEXT_DATA__\1[^>]*>(?P<js>[^<]+)</script>''',
webpage, 'next.js data', group='js', fatal=fatal, **kw),
video_id, transform_source=transform_source, fatal=fatal)
def __handle_request_webpage_error(self, err, video_id=None, errnote=None, fatal=True):
if errnote is False:
return False
@ -109,7 +100,9 @@ class ITVBaseIE(InfoExtractor):
class ITVIE(ITVBaseIE):
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?:(?P<w>watch)|hub)/[^/]+/(?(w)[\w-]+/)(?P<id>\w+)'
_IE_DESC = 'ITVX'
IE_DESC = 'ITVX'
_WORKING = False
_TESTS = [{
'note': 'Hub URLs redirect to ITVX',
'url': 'https://www.itv.com/hub/liar/2a4547a0012',
@ -270,7 +263,7 @@ class ITVIE(ITVBaseIE):
'ext': determine_ext(href, 'vtt'),
})
next_data = self._search_nextjs_data(webpage, video_id, fatal=False, default='{}')
next_data = self._search_nextjs_data(webpage, video_id, fatal=False, default={})
video_data.update(traverse_obj(next_data, ('props', 'pageProps', ('title', 'episode')), expected_type=dict)[0] or {})
title = traverse_obj(video_data, 'headerTitle', 'episodeTitle')
info = self._og_extract(webpage, require_title=not title)
@ -323,7 +316,7 @@ class ITVIE(ITVBaseIE):
class ITVBTCCIE(ITVBaseIE):
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?!(?:watch|hub)/)(?:[^/]+/)+(?P<id>[^/?#&]+)'
_IE_DESC = 'ITV articles: News, British Touring Car Championship'
IE_DESC = 'ITV articles: News, British Touring Car Championship'
_TESTS = [{
'note': 'British Touring Car Championship',
'url': 'https://www.itv.com/btcc/articles/btcc-2018-all-the-action-from-brands-hatch',

View File

@ -47,7 +47,7 @@ class SenateISVPIE(InfoExtractor):
['vetaff', '76462', 'http://vetaff-f.akamaihd.net'],
['arch', '', 'http://ussenate-f.akamaihd.net/']
]
_IE_NAME = 'senate.gov'
IE_NAME = 'senate.gov'
_VALID_URL = r'https?://(?:www\.)?senate\.gov/isvp/?\?(?P<qs>.+)'
_TESTS = [{
'url': 'http://www.senate.gov/isvp/?comm=judiciary&type=live&stt=&filename=judiciary031715&auto_play=false&wmode=transparent&poster=http%3A%2F%2Fwww.judiciary.senate.gov%2Fthemes%2Fjudiciary%2Fimages%2Fvideo-poster-flash-fit.png',

View File

@ -686,6 +686,8 @@ class JSInterpreter(object):
raise self.Exception('Cannot get index {idx!r:.100}'.format(**locals()), expr=repr(obj), cause=e)
def _dump(self, obj, namespace):
if obj is JS_Undefined:
return 'undefined'
try:
return json.dumps(obj)
except TypeError: