mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-07-13 15:04:14 +09:00
Compare commits
7 Commits
953259c844
...
4396ce648e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4396ce648e | ||
![]() |
3eb8d22ddb | ||
![]() |
4e714f9df1 | ||
![]() |
c1ea7f5a24 | ||
![]() |
08202a62a7 | ||
![]() |
a15f994677 | ||
![]() |
5997ce694a |
@ -32,7 +32,7 @@ class BokeCCBaseIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class BokeCCIE(BokeCCBaseIE):
|
class BokeCCIE(BokeCCBaseIE):
|
||||||
_IE_DESC = 'CC视频'
|
IE_DESC = 'CC视频'
|
||||||
_VALID_URL = r'https?://union\.bokecc\.com/playvideo\.bo\?(?P<query>.*)'
|
_VALID_URL = r'https?://union\.bokecc\.com/playvideo\.bo\?(?P<query>.*)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
|
@ -9,7 +9,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class CloudyIE(InfoExtractor):
|
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]+)'
|
_VALID_URL = r'https?://(?:www\.)?cloudy\.ec/(?:v/|embed\.php\?.*?\bid=)(?P<id>[A-Za-z0-9]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.cloudy.ec/v/af511e2527aac',
|
'url': 'https://www.cloudy.ec/v/af511e2527aac',
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
from ..compat import (
|
||||||
|
compat_str,
|
||||||
|
compat_urlparse,
|
||||||
|
)
|
||||||
|
from ..utils import urljoin
|
||||||
|
|
||||||
from .mtv import MTVServicesInfoExtractor
|
from .mtv import MTVServicesInfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class ComedyCentralIE(MTVServicesInfoExtractor):
|
class ComedyCentralIE(MTVServicesInfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?cc\.com/(?:episodes|video(?:-clips)?)/(?P<id>[0-9a-z]{6})'
|
_VALID_URL = r'https?://(?:www\.)?cc\.com/(?:episodes|video(?:-clips)?|collection-playlist/[0-9a-z]+/[^/]+)/(?P<id>[0-9a-z]{6})'
|
||||||
_FEED_URL = 'http://comedycentral.com/feeds/mrss/'
|
_FEED_URL = 'http://comedycentral.com/feeds/mrss/'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.cc.com/video-clips/5ke9v2/the-daily-show-with-trevor-noah-doc-rivers-and-steve-ballmer---the-nba-player-strike',
|
'url': 'http://www.cc.com/video-clips/5ke9v2/the-daily-show-with-trevor-noah-doc-rivers-and-steve-ballmer---the-nba-player-strike',
|
||||||
'md5': 'b8acb347177c680ff18a292aa2166f80',
|
'md5': '58e7caf5c7c0c865d9d79f7d151e5090',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '89ccc86e-1b02-4f83-b0c9-1d9592ecd025',
|
'id': '89ccc86e-1b02-4f83-b0c9-1d9592ecd025',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
@ -18,13 +25,29 @@ class ComedyCentralIE(MTVServicesInfoExtractor):
|
|||||||
'timestamp': 1598670000,
|
'timestamp': 1598670000,
|
||||||
'upload_date': '20200829',
|
'upload_date': '20200829',
|
||||||
},
|
},
|
||||||
|
'params': {
|
||||||
|
'hls_prefer_native': False,
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.cc.com/episodes/pnzzci/drawn-together--american-idol--parody-clip-show-season-3-ep-314',
|
'url': 'http://www.cc.com/episodes/pnzzci/drawn-together--american-idol--parody-clip-show-season-3-ep-314',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.cc.com/video/k3sdvm/the-daily-show-with-jon-stewart-exclusive-the-fourth-estate',
|
'url': 'https://www.cc.com/video/k3sdvm/the-daily-show-with-jon-stewart-exclusive-the-fourth-estate',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}, {
|
||||||
|
'url': 'https://www.cc.com/collection-playlist/8b7hw5/the-daily-shows-summer-exclusives/o2qny3',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '2f56e756-91ec-4d68-8799-e3b710e360e4',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'The Daily Show with Trevor Noah|August 4, 2021|26|NO-EPISODE#|Hottest Take - The Olympics',
|
||||||
|
'description': 'md5:104484314a4cba36d8c62b094523efc8',
|
||||||
|
'timestamp': 1628125200,
|
||||||
|
'upload_date': '20210805',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'hls_prefer_native': False,
|
||||||
|
},
|
||||||
|
}, ]
|
||||||
|
|
||||||
|
|
||||||
class ComedyCentralTVIE(MTVServicesInfoExtractor):
|
class ComedyCentralTVIE(MTVServicesInfoExtractor):
|
||||||
@ -49,3 +72,99 @@ class ComedyCentralTVIE(MTVServicesInfoExtractor):
|
|||||||
'imageEp': 'web.cc.tv',
|
'imageEp': 'web.cc.tv',
|
||||||
'mgid': uri,
|
'mgid': uri,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ComedyCentralCollectionIE(ComedyCentralIE):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?cc\.com/collections/(?P<id>[0-9a-z]{6})(?:/[^/]*)?'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.cc.com/collections/8b7hw5/the-daily-show-s-summer-exclusives',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '8b7hw5',
|
||||||
|
'title': "The Daily Show's Summer Exclusives",
|
||||||
|
'description': 'md5:ae65028fcf8438e65f1c98099119fe6d',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 11,
|
||||||
|
}, ]
|
||||||
|
_CLIP_IE = 'ComedyCentral'
|
||||||
|
|
||||||
|
# we need to know the redirected URL, so stash it in the extractor
|
||||||
|
# strange that this hasn't been a general requirement
|
||||||
|
def _request_webpage(self, url_or_request, video_id,
|
||||||
|
note=None, errnote=None, fatal=True, data=None,
|
||||||
|
headers={}, query={}, expected_status=None):
|
||||||
|
urlh = super(ComedyCentralCollectionIE, self)._request_webpage(
|
||||||
|
url_or_request, video_id, note, errnote, fatal,
|
||||||
|
data, headers, query, expected_status)
|
||||||
|
if urlh is not False:
|
||||||
|
self._url = urlh.geturl()
|
||||||
|
elif isinstance(url_or_request, compat_str):
|
||||||
|
self._url = url_or_request
|
||||||
|
else:
|
||||||
|
self._url = url_or_request.get_full_url()
|
||||||
|
return urlh
|
||||||
|
|
||||||
|
def _get_clip_id(self, url):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
playlist_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
url = self._url
|
||||||
|
clip_id = self._get_clip_id(url)
|
||||||
|
if clip_id:
|
||||||
|
url = url.rstrip(clip_id)
|
||||||
|
else:
|
||||||
|
url = url.replace('/collections/', '/collection-playlist/')
|
||||||
|
path = compat_urlparse.urlparse(url).path
|
||||||
|
if path.endswith('/'):
|
||||||
|
path = path[:-1]
|
||||||
|
clip_urls = re.finditer(
|
||||||
|
r'<a\s?[^>]*?href\s*=\s*"(?P<link>%s/(?P<id>[0-9a-z]{6}))"[^<]*>' % path,
|
||||||
|
webpage)
|
||||||
|
playlist_title = (self._html_search_meta('twitter:title', webpage, 'title')
|
||||||
|
or self._og_search_title(webpage, display_name='title')
|
||||||
|
or self._html_search_regex(r'<title\s?[^>]*>([^<]+)</',
|
||||||
|
webpage, 'title', default=None))
|
||||||
|
playlist_desc = (self._html_search_meta(('description', 'twitter:description'), webpage)
|
||||||
|
or self._og_search_description(webpage, display_name='description'))
|
||||||
|
pl = self.playlist_from_matches(clip_urls, playlist_id, playlist_title,
|
||||||
|
lambda m: urljoin(url, m.group('link')),
|
||||||
|
self._CLIP_IE)
|
||||||
|
if pl:
|
||||||
|
pl['description'] = playlist_desc
|
||||||
|
return pl
|
||||||
|
|
||||||
|
|
||||||
|
class ComedyCentralPlaylistIE(ComedyCentralCollectionIE):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?cc\.com/playlists/(?P<id>[0-9a-z]{6})(?:/(?:[^/]+(?:/(?P<clip_id>[0-9a-z]{6})?)?)?)?'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.cc.com/playlists/mym6e5/corporate-working-nine-to-five',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'mym6e5',
|
||||||
|
'title': 'Coffee Break - Corporate | Comedy Central US',
|
||||||
|
'description': 'md5:89bc6e8e983ad34ded85af84108f6ea8',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 5,
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.cc.com/playlists/mym6e5/corporate-working-nine-to-five/dm8ekc',
|
||||||
|
'only_matching': True,
|
||||||
|
}, ]
|
||||||
|
|
||||||
|
def _get_clip_id(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
return mobj.group('clip_id')
|
||||||
|
|
||||||
|
def _real_initialize(self):
|
||||||
|
self._CLIP_IE = self.IE_NAME
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
if self._get_clip_id(url):
|
||||||
|
return ComedyCentralIE._real_extract(self, url)
|
||||||
|
playlist_id = self._match_id(url)
|
||||||
|
if self._downloader.params.get('noplaylist', False):
|
||||||
|
_ = self._download_webpage(url, playlist_id)
|
||||||
|
if self._get_clip_id(self._url):
|
||||||
|
self.to_screen(
|
||||||
|
'Downloading just the "now playing" clip because of --no-playlist')
|
||||||
|
return self.url_result(self._url, self._CLIP_IE, playlist_id)
|
||||||
|
return super(ComedyCentralPlaylistIE, self)._real_extract(url)
|
||||||
|
@ -422,6 +422,8 @@ class InfoExtractor(object):
|
|||||||
_GEO_COUNTRIES = None
|
_GEO_COUNTRIES = None
|
||||||
_GEO_IP_BLOCKS = None
|
_GEO_IP_BLOCKS = None
|
||||||
_WORKING = True
|
_WORKING = True
|
||||||
|
# supply this in public subclasses: used in supported sites list, etc
|
||||||
|
# IE_DESC = 'short description of IE'
|
||||||
|
|
||||||
def __init__(self, downloader=None):
|
def __init__(self, downloader=None):
|
||||||
"""Constructor. Receives an optional downloader."""
|
"""Constructor. Receives an optional downloader."""
|
||||||
|
@ -251,6 +251,8 @@ from .coub import CoubIE
|
|||||||
from .comedycentral import (
|
from .comedycentral import (
|
||||||
ComedyCentralIE,
|
ComedyCentralIE,
|
||||||
ComedyCentralTVIE,
|
ComedyCentralTVIE,
|
||||||
|
ComedyCentralCollectionIE,
|
||||||
|
ComedyCentralPlaylistIE,
|
||||||
)
|
)
|
||||||
from .commonmistakes import CommonMistakesIE, UnicodeBOMIE
|
from .commonmistakes import CommonMistakesIE, UnicodeBOMIE
|
||||||
from .commonprotocols import (
|
from .commonprotocols import (
|
||||||
|
@ -903,6 +903,9 @@ class GenericIE(InfoExtractor):
|
|||||||
'timestamp': 1349922600,
|
'timestamp': 1349922600,
|
||||||
'upload_date': '20121011',
|
'upload_date': '20121011',
|
||||||
},
|
},
|
||||||
|
'params': {
|
||||||
|
'hls-prefer-native': False,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
# YouTube embed via <data-embed-url="">
|
# YouTube embed via <data-embed-url="">
|
||||||
{
|
{
|
||||||
|
@ -35,15 +35,6 @@ from ..utils import (
|
|||||||
|
|
||||||
class ITVBaseIE(InfoExtractor):
|
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):
|
def __handle_request_webpage_error(self, err, video_id=None, errnote=None, fatal=True):
|
||||||
if errnote is False:
|
if errnote is False:
|
||||||
return False
|
return False
|
||||||
@ -109,7 +100,9 @@ class ITVBaseIE(InfoExtractor):
|
|||||||
|
|
||||||
class ITVIE(ITVBaseIE):
|
class ITVIE(ITVBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?:(?P<w>watch)|hub)/[^/]+/(?(w)[\w-]+/)(?P<id>\w+)'
|
_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 = [{
|
_TESTS = [{
|
||||||
'note': 'Hub URLs redirect to ITVX',
|
'note': 'Hub URLs redirect to ITVX',
|
||||||
'url': 'https://www.itv.com/hub/liar/2a4547a0012',
|
'url': 'https://www.itv.com/hub/liar/2a4547a0012',
|
||||||
@ -270,7 +263,7 @@ class ITVIE(ITVBaseIE):
|
|||||||
'ext': determine_ext(href, 'vtt'),
|
'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 {})
|
video_data.update(traverse_obj(next_data, ('props', 'pageProps', ('title', 'episode')), expected_type=dict)[0] or {})
|
||||||
title = traverse_obj(video_data, 'headerTitle', 'episodeTitle')
|
title = traverse_obj(video_data, 'headerTitle', 'episodeTitle')
|
||||||
info = self._og_extract(webpage, require_title=not title)
|
info = self._og_extract(webpage, require_title=not title)
|
||||||
@ -323,7 +316,7 @@ class ITVIE(ITVBaseIE):
|
|||||||
|
|
||||||
class ITVBTCCIE(ITVBaseIE):
|
class ITVBTCCIE(ITVBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?!(?:watch|hub)/)(?:[^/]+/)+(?P<id>[^/?#&]+)'
|
_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 = [{
|
_TESTS = [{
|
||||||
'note': 'British Touring Car Championship',
|
'note': 'British Touring Car Championship',
|
||||||
'url': 'https://www.itv.com/btcc/articles/btcc-2018-all-the-action-from-brands-hatch',
|
'url': 'https://www.itv.com/btcc/articles/btcc-2018-all-the-action-from-brands-hatch',
|
||||||
|
@ -229,6 +229,8 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
if info:
|
if info:
|
||||||
entries.append(info)
|
entries.append(info)
|
||||||
|
|
||||||
|
if len(entries) == 1:
|
||||||
|
return entries[0]
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
entries, playlist_title=title, playlist_description=description)
|
entries, playlist_title=title, playlist_description=description)
|
||||||
|
|
||||||
@ -290,7 +292,7 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
main_container = self._extract_child_with_type(data, 'MainContainer')
|
main_container = self._extract_child_with_type(data, 'MainContainer')
|
||||||
ab_testing = self._extract_child_with_type(main_container, 'ABTesting')
|
ab_testing = self._extract_child_with_type(main_container, 'ABTesting')
|
||||||
video_player = self._extract_child_with_type(ab_testing or main_container, 'VideoPlayer')
|
video_player = self._extract_child_with_type(ab_testing or main_container, 'VideoPlayer')
|
||||||
mgid = video_player['props']['media']['video']['config']['uri']
|
mgid = try_get(video_player, lambda x: x['props']['media']['video']['config']['uri'])
|
||||||
|
|
||||||
return mgid
|
return mgid
|
||||||
|
|
||||||
@ -298,7 +300,11 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
title = url_basename(url)
|
title = url_basename(url)
|
||||||
webpage = self._download_webpage(url, title)
|
webpage = self._download_webpage(url, title)
|
||||||
mgid = self._extract_mgid(webpage)
|
mgid = self._extract_mgid(webpage)
|
||||||
|
if not mgid:
|
||||||
|
raise ExtractorError('Unable to determine MTVServices ID (mgid)', expected=True)
|
||||||
videos_info = self._get_videos_info(mgid)
|
videos_info = self._get_videos_info(mgid)
|
||||||
|
if videos_info and videos_info.get('_type') != 'playlist':
|
||||||
|
videos_info['display_id'] = title
|
||||||
return videos_info
|
return videos_info
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class SenateISVPIE(InfoExtractor):
|
|||||||
['vetaff', '76462', 'http://vetaff-f.akamaihd.net'],
|
['vetaff', '76462', 'http://vetaff-f.akamaihd.net'],
|
||||||
['arch', '', 'http://ussenate-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>.+)'
|
_VALID_URL = r'https?://(?:www\.)?senate\.gov/isvp/?\?(?P<qs>.+)'
|
||||||
_TESTS = [{
|
_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',
|
'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',
|
||||||
|
@ -686,6 +686,8 @@ class JSInterpreter(object):
|
|||||||
raise self.Exception('Cannot get index {idx!r:.100}'.format(**locals()), expr=repr(obj), cause=e)
|
raise self.Exception('Cannot get index {idx!r:.100}'.format(**locals()), expr=repr(obj), cause=e)
|
||||||
|
|
||||||
def _dump(self, obj, namespace):
|
def _dump(self, obj, namespace):
|
||||||
|
if obj is JS_Undefined:
|
||||||
|
return 'undefined'
|
||||||
try:
|
try:
|
||||||
return json.dumps(obj)
|
return json.dumps(obj)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user