mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-07-18 17:34:13 +09:00
Compare commits
5 Commits
10da593d5a
...
9de4621037
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9de4621037 | ||
![]() |
3eb8d22ddb | ||
![]() |
4e714f9df1 | ||
![]() |
c1ea7f5a24 | ||
![]() |
68ad5cb00d |
@ -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."""
|
||||||
|
@ -954,6 +954,7 @@ from .playfm import PlayFMIE
|
|||||||
from .playplustv import PlayPlusTVIE
|
from .playplustv import PlayPlusTVIE
|
||||||
from .plays import PlaysTVIE
|
from .plays import PlaysTVIE
|
||||||
from .playstuff import PlayStuffIE
|
from .playstuff import PlayStuffIE
|
||||||
|
from .playsuisse import PlaySuisseIE
|
||||||
from .playtvak import PlaytvakIE
|
from .playtvak import PlaytvakIE
|
||||||
from .playvid import PlayvidIE
|
from .playvid import PlayvidIE
|
||||||
from .playwire import PlaywireIE
|
from .playwire import PlaywireIE
|
||||||
|
@ -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',
|
||||||
|
299
youtube_dl/extractor/playsuisse.py
Normal file
299
youtube_dl/extractor/playsuisse.py
Normal file
@ -0,0 +1,299 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import std_headers
|
||||||
|
|
||||||
|
|
||||||
|
class PlaySuisseIE(InfoExtractor):
|
||||||
|
_MEDIA_URL = 'https://4bbepzm4ef.execute-api.eu-central-1.amazonaws.com/prod/graphql'
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?playsuisse\.ch/watch/(?P<id1>[0-9]+)'
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'https://www.playsuisse.ch/watch/763211/0',
|
||||||
|
'md5': '0d716b7a16c3e6ab784ef817ee9a20c1',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '763211',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Wilder S01E01 - Knochen',
|
||||||
|
'description': 'md5:8ea7a8076ba000cd9e8bc132fd0afdd8'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://www.playsuisse.ch/watch/808675/0',
|
||||||
|
'md5': '7aa043e69fea5044db2da8bb58bca239',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '808675',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Der Läufer',
|
||||||
|
'description': 'md5:'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://www.playsuisse.ch/watch/817913/0',
|
||||||
|
'md5': '50721c46ca0b3a9836eb61ecb0ed7097',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '42',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Nr. 47 S01E01 - Die Einweihungsparty',
|
||||||
|
'description': 'md5:'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
def _get_media_data(self, media_id):
|
||||||
|
locale = std_headers.get('locale', 'de').strip()
|
||||||
|
# TODO find out why the locale has no effect in request
|
||||||
|
response = self._download_json(
|
||||||
|
self._MEDIA_URL,
|
||||||
|
media_id,
|
||||||
|
data=json.dumps({
|
||||||
|
'operationName': 'AssetWatch',
|
||||||
|
'query': self._GRAPHQL_QUERY,
|
||||||
|
'variables': {
|
||||||
|
"assetId": media_id
|
||||||
|
}
|
||||||
|
}).encode('utf-8'),
|
||||||
|
headers={'Content-Type': 'application/json', 'locale': locale})
|
||||||
|
|
||||||
|
return response['data']['asset']
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
media_id, = self._VALID_URL_RE.match(url).groups()
|
||||||
|
media_data = self._get_media_data(media_id)
|
||||||
|
|
||||||
|
def _get_title(data):
|
||||||
|
if data.get('seriesName'):
|
||||||
|
return '{} S{:02}E{:02} - {}'.format(
|
||||||
|
data['seriesName'],
|
||||||
|
int(data['seasonNumber']),
|
||||||
|
int(data['episodeNumber']),
|
||||||
|
data['name'])
|
||||||
|
else:
|
||||||
|
return data['name']
|
||||||
|
|
||||||
|
title = _get_title(media_data)
|
||||||
|
description = media_data['description']
|
||||||
|
thumbnails = [
|
||||||
|
{
|
||||||
|
'id': thumb['id'],
|
||||||
|
'url': thumb['url']
|
||||||
|
}
|
||||||
|
for key, thumb in media_data.items()
|
||||||
|
if key.startswith('thumbnail') and thumb is not None
|
||||||
|
]
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
|
||||||
|
for media in media_data['medias']:
|
||||||
|
# NOTE subtitle info is included in the m3u8 file, but it's not supported by ytdl
|
||||||
|
# https://github.com/ytdl-org/youtube-dl/issues/6106
|
||||||
|
if media['type'] == 'HLS':
|
||||||
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
media['url'],
|
||||||
|
media_id,
|
||||||
|
'mp4',
|
||||||
|
'm3u8_native',
|
||||||
|
m3u8_id="HLS",
|
||||||
|
fatal=False))
|
||||||
|
|
||||||
|
# NOTE seems to be 404 for all tested media
|
||||||
|
elif media['type'] == 'DASH' and False:
|
||||||
|
formats.extend(self._extract_mpd_formats(
|
||||||
|
media['url'],
|
||||||
|
media_id,
|
||||||
|
mpd_id='dash',
|
||||||
|
fatal=False
|
||||||
|
))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': media_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnails': thumbnails,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
|
|
||||||
|
_GRAPHQL_QUERY = '''\
|
||||||
|
query AssetWatch($assetId: ID!) {
|
||||||
|
asset(assetId: $assetId) {
|
||||||
|
...Asset
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fragment Asset on Asset {
|
||||||
|
...AssetDetails
|
||||||
|
episodes {
|
||||||
|
...AssetDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
fragment AssetDetails on Asset {
|
||||||
|
audioLanguages
|
||||||
|
awards
|
||||||
|
bu
|
||||||
|
contentCategories
|
||||||
|
contentCodes
|
||||||
|
contentTypes
|
||||||
|
contractType
|
||||||
|
countries
|
||||||
|
creators
|
||||||
|
creditsTimeInSecs
|
||||||
|
description
|
||||||
|
descriptionLong
|
||||||
|
directors
|
||||||
|
downloadable
|
||||||
|
duration
|
||||||
|
editorialContentCategoriesDatalab {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
editorialContentMetaCategoriesDatalab {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
endDate
|
||||||
|
episodeNumber
|
||||||
|
episodesInSequence
|
||||||
|
externalId
|
||||||
|
firstEpisodeDuration
|
||||||
|
id
|
||||||
|
image16x9 {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
image2x3 {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
image16x9WithTitle {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
image2x3WithTitle {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
mainCast
|
||||||
|
name
|
||||||
|
nextEpisode {
|
||||||
|
id
|
||||||
|
episodeNumber
|
||||||
|
seasonNumber
|
||||||
|
numberOfEpisodesInSeason
|
||||||
|
image16x9 {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
numberOfSeasons
|
||||||
|
otherKeyPeople
|
||||||
|
parentalRating
|
||||||
|
popularity
|
||||||
|
premium
|
||||||
|
presenters
|
||||||
|
primaryLanguage
|
||||||
|
productionCompanies
|
||||||
|
productionCountries
|
||||||
|
provider
|
||||||
|
ratings
|
||||||
|
regions
|
||||||
|
restrictions
|
||||||
|
seasons {
|
||||||
|
seasonNumber
|
||||||
|
assetIds
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
seasonNumber
|
||||||
|
seriesId
|
||||||
|
seriesName
|
||||||
|
nextEpisode {
|
||||||
|
...NextEpisodeDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
parentId
|
||||||
|
startDate
|
||||||
|
subtitleLanguages
|
||||||
|
tagline
|
||||||
|
targetAudience
|
||||||
|
themes
|
||||||
|
thumbnail16x9 {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
thumbnail2x3 {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
thumbnail16x9WithTitle {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
thumbnail2x3WithTitle {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
type
|
||||||
|
writers
|
||||||
|
year
|
||||||
|
medias {
|
||||||
|
...MediaDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
trailerMedias {
|
||||||
|
...MediaDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
sponsors {
|
||||||
|
...SponsorDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
sponsorEndDate
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
fragment ImageDetails on Image {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
alt
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
fragment MediaDetails on Media {
|
||||||
|
id
|
||||||
|
type
|
||||||
|
url
|
||||||
|
duration
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
fragment SponsorDetails on Sponsor {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
type
|
||||||
|
externalId
|
||||||
|
image16x9 {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
thumbnail16x9 {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
fragment NextEpisodeDetails on NextEpisode {
|
||||||
|
id
|
||||||
|
episodeNumber
|
||||||
|
seasonNumber
|
||||||
|
numberOfEpisodesInSeason
|
||||||
|
image16x9 {
|
||||||
|
...ImageDetails
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
'''
|
@ -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