mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-06-01 10:32:40 +09:00
Compare commits
13 Commits
0920c0a6d3
...
91e0915afa
Author | SHA1 | Date | |
---|---|---|---|
![]() |
91e0915afa | ||
![]() |
3eb8d22ddb | ||
![]() |
4e714f9df1 | ||
![]() |
c1ea7f5a24 | ||
![]() |
47217e7b54 | ||
![]() |
1734e55a96 | ||
![]() |
ee9ee5a0b7 | ||
![]() |
0ab278e488 | ||
![]() |
0edd71f0b1 | ||
![]() |
c63cbdb443 | ||
![]() |
17a9592f29 | ||
![]() |
f630222253 | ||
![]() |
f19d8c9885 |
@ -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 = [{
|
||||
|
@ -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',
|
||||
|
@ -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."""
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -4,11 +4,12 @@ import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import int_or_none
|
||||
from ..compat import compat_urllib_parse_urlencode
|
||||
|
||||
|
||||
class TwentyThreeVideoIE(InfoExtractor):
|
||||
IE_NAME = '23video'
|
||||
_VALID_URL = r'https?://(?P<domain>[^.]+\.(?:twentythree\.net|23video\.com|filmweb\.no))/v\.ihtml/player\.html\?(?P<query>.*?\bphoto(?:_|%5f)id=(?P<id>\d+).*)'
|
||||
_VALID_URL = r'https?://(?P<domain>[^.]+\.(?:twentythree\.net|kglteater\.dk|23video\.com|filmweb\.no))/v\.ihtml/player\.html\?(?P<query>.*?\bphoto(?:_|%5f)id=(?P<id>\d+).*)'
|
||||
_TESTS = [{
|
||||
'url': 'https://video.twentythree.net/v.ihtml/player.html?showDescriptions=0&source=site&photo%5fid=20448876&autoPlay=1',
|
||||
'md5': '75fcf216303eb1dae9920d651f85ced4',
|
||||
@ -23,18 +24,93 @@ class TwentyThreeVideoIE(InfoExtractor):
|
||||
}
|
||||
}, {
|
||||
'url': 'https://bonnier-publications-danmark.23video.com/v.ihtml/player.html?token=f0dc46476e06e13afd5a1f84a29e31e8&source=embed&photo%5fid=36137620',
|
||||
'only_matching': True,
|
||||
'md5': '772a91f83d129ee5f015b12bea61a78b',
|
||||
'info_dict': {
|
||||
'id': '36137620',
|
||||
'ext': 'mp4',
|
||||
'title': 'Photoshop Elements 2019 - Photo Text',
|
||||
'timestamp': 1538664032,
|
||||
'upload_date': '20181004',
|
||||
'uploader_id': '10801356',
|
||||
'uploader': 'Kristoffer Engbo',
|
||||
}
|
||||
}, {
|
||||
'url': 'https://video.kglteater.dk/v.ihtml/player.html?source=share&photo%5fid=65098499',
|
||||
'md5': '4e20a33ce86b13ca114ee44a0a8d8efb',
|
||||
'info_dict': {
|
||||
'id': '65098499',
|
||||
'ext': 'mp4',
|
||||
'title': 'Askepot',
|
||||
'timestamp': 1605173942,
|
||||
'upload_date': '20201112',
|
||||
'uploader_id': '62151179',
|
||||
'uploader': 'jbny',
|
||||
}
|
||||
}, {
|
||||
'url': 'https://video.kglteater.dk/v.ihtml/player.html?showDescriptions=0&source=site&photo%5fid=52486482&autoPlay=1',
|
||||
'md5': 'c39ffb965079fb4395788e6814ec3cdc',
|
||||
'info_dict': {
|
||||
'id': '52486482',
|
||||
'ext': 'mp4',
|
||||
'title': 'N\xf8ddekn\xe6kkeren 2019',
|
||||
'timestamp': 1558953133,
|
||||
'upload_date': '20190527',
|
||||
'uploader_id': '7450690',
|
||||
'uploader': 'Tejs Holm',
|
||||
}
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
domain, query, photo_id = re.match(self._VALID_URL, url).groups()
|
||||
base_url = 'https://%s' % domain
|
||||
photo_data = self._download_json(
|
||||
base_url + '/api/photo/list?' + query, photo_id, query={
|
||||
'format': 'json',
|
||||
}, transform_source=lambda s: self._search_regex(r'(?s)({.+})', s, 'photo data'))['photo']
|
||||
title = photo_data['title']
|
||||
|
||||
def is_geo_blocked():
|
||||
# /api/player/settings
|
||||
playersettings_0 = {'player_id': 0, 'parameters': 'showDescriptions=0&source=site&photo%5fid=' + photo_id + '&autoPlay=1', '_li': 0, '_bot': 0}
|
||||
playersettings_0_param = '/api/player/settings?' + compat_urllib_parse_urlencode(playersettings_0)
|
||||
|
||||
# /api/live/list
|
||||
livelist_1 = {'include_actions_p': 1, 'showDescriptions': 0, 'source': 'site', 'photo_id': photo_id, 'autoPlay': 1, 'upcoming_p': 1, 'ordering': 'streaming', 'player_id': 0}
|
||||
livelist_1_param = '/api/live/list?' + compat_urllib_parse_urlencode(livelist_1)
|
||||
|
||||
# /api/photo/list
|
||||
photolist_2 = {'size': 10, 'include_actions_p': 1, 'showDescriptions': 0, 'source': 'site', 'photo_id': photo_id, 'autoPlay': 1, 'player_id': 0}
|
||||
photolist_2_param = '/api/photo/list?' + compat_urllib_parse_urlencode(photolist_2)
|
||||
|
||||
new_query = {'format': 'json', 'callback': 'test', 'playersettings_0': playersettings_0_param, 'livelist_1': livelist_1_param, 'photolist_2': photolist_2_param}
|
||||
photolist_result = self._download_json(
|
||||
base_url + '/api/concatenate',
|
||||
photo_id,
|
||||
query=new_query,
|
||||
transform_source=lambda s: self._search_regex(r'(?s)({.+})', s, 'photolist_2')
|
||||
)["photolist_2"]
|
||||
|
||||
if "photos" in photolist_result:
|
||||
for photo in photolist_result['photos']:
|
||||
if photo['photo_id'] == photo_id:
|
||||
return photo['protection_method'] == 'geoblocking'
|
||||
|
||||
return False
|
||||
|
||||
def get_video_query():
|
||||
if is_geo_blocked():
|
||||
token = self._download_json(
|
||||
base_url + '/api/protection/verify',
|
||||
photo_id,
|
||||
query={'protection_method': 'geoblocking', 'object_id': photo_id, 'object_type': 'photo', 'format': 'json', 'callback': 'visualplatform_1'},
|
||||
transform_source=lambda s: self._search_regex(r'(?s)({.+})', s, 'protectedtoken'))['protectedtoken']['protected_token']
|
||||
|
||||
return {'format': 'json', 'token': token}
|
||||
else:
|
||||
return {'format': 'json'}
|
||||
|
||||
video_query = get_video_query()
|
||||
photo_data = self._download_json(
|
||||
base_url + '/api/photo/list?' + query, photo_id,
|
||||
query=video_query,
|
||||
transform_source=lambda s: self._search_regex(r'(?s)({.+})', s, 'photo data'))['photo']
|
||||
|
||||
title = photo_data['title']
|
||||
formats = []
|
||||
|
||||
audio_path = photo_data.get('audio_download')
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user