mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-06-06 04:52:41 +09:00
Compare commits
9 Commits
ccbf69fdb2
...
faf6fc9ab3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
faf6fc9ab3 | ||
![]() |
4e714f9df1 | ||
![]() |
c1ea7f5a24 | ||
![]() |
43fe4b597f | ||
![]() |
3fa061e297 | ||
![]() |
dd2ee5e071 | ||
![]() |
0af2f585e7 | ||
![]() |
9409e00d95 | ||
![]() |
f24ea24a29 |
@ -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 = [{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import itertools
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_parse_qs,
|
compat_parse_qs,
|
||||||
@ -10,6 +8,7 @@ from ..compat import (
|
|||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
clean_html,
|
clean_html,
|
||||||
|
ExtractorError,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
try_get,
|
try_get,
|
||||||
@ -21,12 +20,13 @@ class CiscoLiveBaseIE(InfoExtractor):
|
|||||||
# These appear to be constant across all Cisco Live presentations
|
# These appear to be constant across all Cisco Live presentations
|
||||||
# and are not tied to any user session or event
|
# and are not tied to any user session or event
|
||||||
RAINFOCUS_API_URL = 'https://events.rainfocus.com/api/%s'
|
RAINFOCUS_API_URL = 'https://events.rainfocus.com/api/%s'
|
||||||
RAINFOCUS_API_PROFILE_ID = 'Na3vqYdAlJFSxhYTYQGuMbpafMqftalz'
|
RAINFOCUS_API_PROFILE_ID = '' # if blank will be fetched at runtime from site javascript
|
||||||
RAINFOCUS_WIDGET_ID = 'n6l4Lo05R8fiy3RpUBm447dZN8uNWoye'
|
RAINFOCUS_WIDGET_ID = '' # if blank will be fetched at runtime from site javascript
|
||||||
|
RAINFOCUS_TOKENS_URL = 'https://cdn-events.rainfocus.com/pages/cisco/clondemand/catalog.js'
|
||||||
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/5647924234001/SyK2FdqjM_default/index.html?videoId=%s'
|
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/5647924234001/SyK2FdqjM_default/index.html?videoId=%s'
|
||||||
|
|
||||||
HEADERS = {
|
HEADERS = {
|
||||||
'Origin': 'https://ciscolive.cisco.com',
|
'Origin': 'https://ciscolive.com',
|
||||||
'rfApiProfileId': RAINFOCUS_API_PROFILE_ID,
|
'rfApiProfileId': RAINFOCUS_API_PROFILE_ID,
|
||||||
'rfWidgetId': RAINFOCUS_WIDGET_ID,
|
'rfWidgetId': RAINFOCUS_WIDGET_ID,
|
||||||
}
|
}
|
||||||
@ -34,9 +34,25 @@ class CiscoLiveBaseIE(InfoExtractor):
|
|||||||
def _call_api(self, ep, rf_id, query, referrer, note=None):
|
def _call_api(self, ep, rf_id, query, referrer, note=None):
|
||||||
headers = self.HEADERS.copy()
|
headers = self.HEADERS.copy()
|
||||||
headers['Referer'] = referrer
|
headers['Referer'] = referrer
|
||||||
return self._download_json(
|
if not self.RAINFOCUS_API_PROFILE_ID or not self.RAINFOCUS_WIDGET_ID:
|
||||||
|
rf_token_js = self._download_webpage(self.RAINFOCUS_TOKENS_URL, 'catalog.js', headers=headers)
|
||||||
|
for token in ('apiToken', 'widgetId'):
|
||||||
|
if token not in rf_token_js:
|
||||||
|
raise ExtractorError(
|
||||||
|
'Unable to fetch ' + token, expected=True)
|
||||||
|
api_token = self._html_search_regex(
|
||||||
|
r'''apiToken:\s+["'](\w+)''', rf_token_js, 'apiToken')
|
||||||
|
widget_id = self._html_search_regex(
|
||||||
|
r'''widgetId:\s+["'](\w+)''', rf_token_js, 'widgetId')
|
||||||
|
headers['rfApiProfileId'] = api_token
|
||||||
|
headers['rfWidgetId'] = widget_id
|
||||||
|
rf_result = self._download_json(
|
||||||
self.RAINFOCUS_API_URL % ep, rf_id, note=note,
|
self.RAINFOCUS_API_URL % ep, rf_id, note=note,
|
||||||
data=urlencode_postdata(query), headers=headers)
|
data=urlencode_postdata(query), headers=headers)
|
||||||
|
if int(rf_result['responseCode']) != 0:
|
||||||
|
raise ExtractorError(
|
||||||
|
'Rainfocus %s api returned a non success responseCode: %s. api keys might be invalid' % (ep, rf_result['responseCode']), expected=True)
|
||||||
|
return rf_result
|
||||||
|
|
||||||
def _parse_rf_item(self, rf_item):
|
def _parse_rf_item(self, rf_item):
|
||||||
event_name = rf_item.get('eventName')
|
event_name = rf_item.get('eventName')
|
||||||
@ -67,17 +83,16 @@ class CiscoLiveBaseIE(InfoExtractor):
|
|||||||
class CiscoLiveSessionIE(CiscoLiveBaseIE):
|
class CiscoLiveSessionIE(CiscoLiveBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?ciscolive(?:\.cisco)?\.com/[^#]*#/session/(?P<id>[^/?&]+)'
|
_VALID_URL = r'https?://(?:www\.)?ciscolive(?:\.cisco)?\.com/[^#]*#/session/(?P<id>[^/?&]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://ciscolive.cisco.com/on-demand-library/?#/session/1423353499155001FoSs',
|
'url': 'https://www.ciscolive.com/on-demand/on-demand-library.html?search=#/session/16360600004400017rMx',
|
||||||
'md5': 'c98acf395ed9c9f766941c70f5352e22',
|
'md5': 'e0f5b0b2927b586ebff619294fec6926',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '5803694304001',
|
'id': '6128601216001',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': '13 Smart Automations to Monitor Your Cisco IOS Network',
|
'title': 'A Deeper Dive into the Telco Cloud Architecture Evolution to support 5G and MEC - BRKSPG-1565',
|
||||||
'description': 'md5:ec4a436019e09a918dec17714803f7cc',
|
'description': 'md5:04bc54ec8ede2bbd9d21264bfaf16cb3',
|
||||||
'timestamp': 1530305395,
|
'timestamp': 1580474594,
|
||||||
'upload_date': '20180629',
|
'upload_date': '20200131',
|
||||||
'uploader_id': '5647924234001',
|
'uploader_id': '5647924234001',
|
||||||
'location': '16B Mezz.',
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.ciscolive.com/global/on-demand-library.html?search.event=ciscoliveemea2019#/session/15361595531500013WOU',
|
'url': 'https://www.ciscolive.com/global/on-demand-library.html?search.event=ciscoliveemea2019#/session/15361595531500013WOU',
|
||||||
@ -85,6 +100,9 @@ class CiscoLiveSessionIE(CiscoLiveBaseIE):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'https://www.ciscolive.com/global/on-demand-library.html?#/session/1490051371645001kNaS',
|
'url': 'https://www.ciscolive.com/global/on-demand-library.html?#/session/1490051371645001kNaS',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.ciscolive.com/on-demand/on-demand-library.html?#/session/16360600774720017Iby',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -94,16 +112,15 @@ class CiscoLiveSessionIE(CiscoLiveBaseIE):
|
|||||||
|
|
||||||
|
|
||||||
class CiscoLiveSearchIE(CiscoLiveBaseIE):
|
class CiscoLiveSearchIE(CiscoLiveBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?ciscolive(?:\.cisco)?\.com/(?:global/)?on-demand-library(?:\.html|/)'
|
_VALID_URL = r'https?://(?:www\.)?ciscolive(?:\.cisco)?\.com/(?:global/|on-demand/)?on-demand-library(?:\.html|/)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://ciscolive.cisco.com/on-demand-library/?search.event=ciscoliveus2018&search.technicallevel=scpsSkillLevel_aintroductory&search.focus=scpsSessionFocus_designAndDeployment#/',
|
'url': 'https://www.ciscolive.com/on-demand/on-demand-library.html?search.technology=1614262524988009b6j9&search.technicallevel=scpsSkillLevel_bintermediate#/',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'title': 'Search query',
|
'title': 'Search query',
|
||||||
},
|
},
|
||||||
'playlist_count': 5,
|
'playlist_count': 6,
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://ciscolive.cisco.com/on-demand-library/?search.technology=scpsTechnology_applicationDevelopment&search.technology=scpsTechnology_ipv6&search.focus=scpsSessionFocus_troubleshootingTroubleshooting#/',
|
'url': 'https://www.ciscolive.com/on-demand/on-demand-library.html?search.technology=scpsTechnology_automation&search.technicallevel=scpsSkillLevel_cadvanced#/',
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.ciscolive.com/global/on-demand-library.html?search.technicallevel=scpsSkillLevel_aintroductory&search.event=ciscoliveemea2019&search.technology=scpsTechnology_dataCenter&search.focus=scpsSessionFocus_bestPractices#/',
|
'url': 'https://www.ciscolive.com/global/on-demand-library.html?search.technicallevel=scpsSkillLevel_aintroductory&search.event=ciscoliveemea2019&search.technology=scpsTechnology_dataCenter&search.focus=scpsSessionFocus_bestPractices#/',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@ -118,31 +135,25 @@ class CiscoLiveSearchIE(CiscoLiveBaseIE):
|
|||||||
return int_or_none(try_get(rf_item, lambda x: x['videos'][0]['url'])) is not None
|
return int_or_none(try_get(rf_item, lambda x: x['videos'][0]['url'])) is not None
|
||||||
|
|
||||||
def _entries(self, query, url):
|
def _entries(self, query, url):
|
||||||
query['size'] = 50
|
results = self._call_api(
|
||||||
query['from'] = 0
|
'search', None, query, url,
|
||||||
for page_num in itertools.count(1):
|
'Downloading search JSON')
|
||||||
results = self._call_api(
|
if int(results['totalSearchItems']) == 0:
|
||||||
'search', None, query, url,
|
raise ExtractorError(
|
||||||
'Downloading search JSON page %d' % page_num)
|
'Search api returned no items (if matches are expected rfApiProfileId may be invalid)',
|
||||||
sl = try_get(results, lambda x: x['sectionList'][0], dict)
|
expected=True)
|
||||||
if sl:
|
sl = try_get(results, lambda x: x['sectionList'], list)
|
||||||
results = sl
|
if sl is not None:
|
||||||
items = results.get('items')
|
for s in sl:
|
||||||
if not items or not isinstance(items, list):
|
items = s.get('items')
|
||||||
break
|
if not items or not isinstance(items, list):
|
||||||
for item in items:
|
break
|
||||||
if not isinstance(item, dict):
|
for item in items:
|
||||||
continue
|
if not isinstance(item, dict):
|
||||||
if not self._check_bc_id_exists(item):
|
continue
|
||||||
continue
|
if not self._check_bc_id_exists(item):
|
||||||
yield self._parse_rf_item(item)
|
continue
|
||||||
size = int_or_none(results.get('size'))
|
yield self._parse_rf_item(item)
|
||||||
if size is not None:
|
|
||||||
query['size'] = size
|
|
||||||
total = int_or_none(results.get('total'))
|
|
||||||
if total is not None and query['from'] + query['size'] > total:
|
|
||||||
break
|
|
||||||
query['from'] += query['size']
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
query = compat_parse_qs(compat_urllib_parse_urlparse(url).query)
|
query = compat_parse_qs(compat_urllib_parse_urlparse(url).query)
|
||||||
|
@ -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',
|
||||||
|
@ -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