mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-06-07 05:22:39 +09:00
Compare commits
10 Commits
af4f45d57a
...
3989bb5798
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3989bb5798 | ||
![]() |
4e714f9df1 | ||
![]() |
c1ea7f5a24 | ||
![]() |
b1699d4752 | ||
![]() |
8f7352509e | ||
![]() |
f3da91008c | ||
![]() |
39681044bc | ||
![]() |
aa8433993f | ||
![]() |
417bfcf413 | ||
![]() |
1abfe53cda |
@ -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',
|
||||||
|
@ -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."""
|
||||||
|
@ -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',
|
||||||
|
@ -8,12 +8,14 @@ from ..utils import (
|
|||||||
int_or_none,
|
int_or_none,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
parse_filesize,
|
parse_filesize,
|
||||||
|
parse_count,
|
||||||
|
parse_resolution,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class NewgroundsIE(InfoExtractor):
|
class NewgroundsIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?newgrounds\.com/(?:audio/listen|portal/view)/(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://(?:www\.)?newgrounds\.com/(?:audio/listen|portal/view)/(?P<id>[0-9]+)(?:/format/flash)?'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.newgrounds.com/audio/listen/549479',
|
'url': 'https://www.newgrounds.com/audio/listen/549479',
|
||||||
'md5': 'fe6033d297591288fa1c1f780386f07a',
|
'md5': 'fe6033d297591288fa1c1f780386f07a',
|
||||||
@ -25,17 +27,18 @@ class NewgroundsIE(InfoExtractor):
|
|||||||
'timestamp': 1378878540,
|
'timestamp': 1378878540,
|
||||||
'upload_date': '20130911',
|
'upload_date': '20130911',
|
||||||
'duration': 143,
|
'duration': 143,
|
||||||
|
'description': 'Sonic blahblahblah I\'m late again SEPTEMBER 11TH: Busmode-The story of ants on a log. ',
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.newgrounds.com/portal/view/673111',
|
'url': 'https://www.newgrounds.com/portal/view/297383',
|
||||||
'md5': '3394735822aab2478c31b1004fe5e5bc',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '673111',
|
'id': '297383',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Dancin',
|
'title': 'Metal Gear Awesome',
|
||||||
'uploader': 'Squirrelman82',
|
'uploader': 'Egoraptor',
|
||||||
'timestamp': 1460256780,
|
'timestamp': 1140663240,
|
||||||
'upload_date': '20160410',
|
'upload_date': '20060223',
|
||||||
|
'description': 'Metal Gear is awesome is so is this movie.',
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
# source format unavailable, additional mp4 formats
|
# source format unavailable, additional mp4 formats
|
||||||
@ -44,9 +47,10 @@ class NewgroundsIE(InfoExtractor):
|
|||||||
'id': '689400',
|
'id': '689400',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'ZTV News Episode 8',
|
'title': 'ZTV News Episode 8',
|
||||||
'uploader': 'BennettTheSage',
|
'uploader': 'ZONE-SAMA',
|
||||||
'timestamp': 1487965140,
|
'timestamp': 1487965140,
|
||||||
'upload_date': '20170224',
|
'upload_date': '20170224',
|
||||||
|
'description': 'ZTV News Episode 8 (February 2017)',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
@ -55,51 +59,65 @@ class NewgroundsIE(InfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
media_id = self._match_id(url)
|
media_id = self._match_id(url)
|
||||||
|
formats = []
|
||||||
|
uploader = None
|
||||||
|
|
||||||
webpage = self._download_webpage(url, media_id)
|
webpage = self._download_webpage(url, media_id)
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<title>([^>]+)</title>', webpage, 'title')
|
r'<title>(.+?)</title>', webpage, 'title')
|
||||||
|
|
||||||
media_url = self._parse_json(self._search_regex(
|
media_url_string = self._search_regex(r'"url"\s*:\s*("[^"]+"),', webpage, 'media url string', fatal=False, default=None)
|
||||||
r'"url"\s*:\s*("[^"]+"),', webpage, ''), media_id)
|
|
||||||
|
|
||||||
formats = [{
|
if media_url_string:
|
||||||
'url': media_url,
|
media_url = self._parse_json(media_url_string, media_id)
|
||||||
'format_id': 'source',
|
formats = [{
|
||||||
'quality': 1,
|
'url': media_url,
|
||||||
}]
|
'format_id': 'source',
|
||||||
|
'quality': 1,
|
||||||
|
}]
|
||||||
|
else:
|
||||||
|
json_data = self._download_json('https://www.newgrounds.com/portal/video/' + media_id, media_id, headers={
|
||||||
|
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
})
|
||||||
|
|
||||||
max_resolution = int_or_none(self._search_regex(
|
uploader = json_data.get('author')
|
||||||
r'max_resolution["\']\s*:\s*(\d+)', webpage, 'max resolution',
|
media_formats = json_data['sources']
|
||||||
default=None))
|
for media_format in media_formats:
|
||||||
if max_resolution:
|
media_sources = media_formats[media_format]
|
||||||
url_base = media_url.rpartition('.')[0]
|
for source in media_sources:
|
||||||
for resolution in (360, 720, 1080):
|
format = {
|
||||||
if resolution > max_resolution:
|
'format_id': media_format,
|
||||||
break
|
'url': source.get('src'),
|
||||||
formats.append({
|
}
|
||||||
'url': '%s.%dp.mp4' % (url_base, resolution),
|
format.update(parse_resolution(media_format))
|
||||||
'format_id': '%dp' % resolution,
|
format['quality'] = format.get('height')
|
||||||
'height': resolution,
|
formats.append(format)
|
||||||
})
|
|
||||||
|
|
||||||
self._check_formats(formats, media_id)
|
if not uploader:
|
||||||
self._sort_formats(formats)
|
uploader = self._html_search_regex(
|
||||||
|
(r'(?s)<h4[^>]*>(.+?)</h4>.*?<em>\s*Author\s*</em>',
|
||||||
uploader = self._html_search_regex(
|
r'(?:Author|Writer)\s*<a[^>]+>([^<]+)'), webpage, 'uploader',
|
||||||
(r'(?s)<h4[^>]*>(.+?)</h4>.*?<em>\s*Author\s*</em>',
|
fatal=False)
|
||||||
r'(?:Author|Writer)\s*<a[^>]+>([^<]+)'), webpage, 'uploader',
|
|
||||||
fatal=False)
|
|
||||||
|
|
||||||
timestamp = unified_timestamp(self._html_search_regex(
|
timestamp = unified_timestamp(self._html_search_regex(
|
||||||
(r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+</dd>\s*<dd>[^<]+)',
|
(r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+</dd>\s*<dd>[^<]+)',
|
||||||
r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+)'), webpage, 'timestamp',
|
r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+)'), webpage, 'timestamp',
|
||||||
default=None))
|
default=None))
|
||||||
|
|
||||||
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
|
||||||
duration = parse_duration(self._search_regex(
|
duration = parse_duration(self._search_regex(
|
||||||
r'(?s)<dd>\s*Song\s*</dd>\s*<dd>.+?</dd>\s*<dd>([^<]+)', webpage,
|
r'(?s)<dd>\s*Song\s*</dd>\s*<dd>.+?</dd>\s*<dd>([^<]+)', webpage,
|
||||||
'duration', default=None))
|
'duration', default=None))
|
||||||
|
|
||||||
|
description = self._og_search_description(webpage)
|
||||||
|
|
||||||
|
view_count = parse_count(self._html_search_regex(r'(?s)<dt>\s*Views\s*</dt>\s*<dd>([\d\.,]+)</dd>', webpage,
|
||||||
|
'view_count', fatal=False, default=None))
|
||||||
|
|
||||||
filesize_approx = parse_filesize(self._html_search_regex(
|
filesize_approx = parse_filesize(self._html_search_regex(
|
||||||
r'(?s)<dd>\s*Song\s*</dd>\s*<dd>(.+?)</dd>', webpage, 'filesize',
|
r'(?s)<dd>\s*Song\s*</dd>\s*<dd>(.+?)</dd>', webpage, 'filesize',
|
||||||
default=None))
|
default=None))
|
||||||
@ -109,6 +127,9 @@ class NewgroundsIE(InfoExtractor):
|
|||||||
if '<dd>Song' in webpage:
|
if '<dd>Song' in webpage:
|
||||||
formats[0]['vcodec'] = 'none'
|
formats[0]['vcodec'] = 'none'
|
||||||
|
|
||||||
|
self._check_formats(formats, media_id)
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': media_id,
|
'id': media_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
@ -116,6 +137,9 @@ class NewgroundsIE(InfoExtractor):
|
|||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'view_count': view_count,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,14 +151,14 @@ class NewgroundsPlaylistIE(InfoExtractor):
|
|||||||
'id': 'cats',
|
'id': 'cats',
|
||||||
'title': 'Cats',
|
'title': 'Cats',
|
||||||
},
|
},
|
||||||
'playlist_mincount': 46,
|
'playlist_mincount': 45,
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.newgrounds.com/portal/search/author/ZONE-SAMA',
|
'url': 'https://www.newgrounds.com/collection/dogs',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'ZONE-SAMA',
|
'id': 'dogs',
|
||||||
'title': 'Portal Search: ZONE-SAMA',
|
'title': 'Dogs',
|
||||||
},
|
},
|
||||||
'playlist_mincount': 47,
|
'playlist_mincount': 25,
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.newgrounds.com/audio/search/title/cats',
|
'url': 'http://www.newgrounds.com/audio/search/title/cats',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@ -155,14 +179,14 @@ class NewgroundsPlaylistIE(InfoExtractor):
|
|||||||
|
|
||||||
entries = []
|
entries = []
|
||||||
for a, path, media_id in re.findall(
|
for a, path, media_id in re.findall(
|
||||||
r'(<a[^>]+\bhref=["\']/?((?:portal/view|audio/listen)/(\d+))[^>]+>)',
|
r'(<a[^>]+href="https?://[^/]+/(audio/listen|portal/view)/([0-9]+)"[^>]+>)',
|
||||||
webpage):
|
webpage):
|
||||||
a_class = extract_attributes(a).get('class')
|
a_class = extract_attributes(a).get('class')
|
||||||
if a_class not in ('item-portalsubmission', 'item-audiosubmission'):
|
if a_class not in ('item-portalsubmission', 'item-audiosubmission'):
|
||||||
continue
|
continue
|
||||||
entries.append(
|
entries.append(
|
||||||
self.url_result(
|
self.url_result(
|
||||||
'https://www.newgrounds.com/%s' % path,
|
'https://www.newgrounds.com/%s/%s' % (path, media_id),
|
||||||
ie=NewgroundsIE.ie_key(), video_id=media_id))
|
ie=NewgroundsIE.ie_key(), video_id=media_id))
|
||||||
|
|
||||||
return self.playlist_result(entries, playlist_id, title)
|
return self.playlist_result(entries, playlist_id, title)
|
||||||
|
@ -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',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user