mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-05-11 08:14:50 +09:00
Compare commits
5 Commits
26ae1f8664
...
4aff7f7088
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4aff7f7088 | ||
![]() |
3eb8d22ddb | ||
![]() |
4e714f9df1 | ||
![]() |
c1ea7f5a24 | ||
![]() |
fe02a15b1c |
@ -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."""
|
||||
|
@ -736,6 +736,7 @@ from .mtv import (
|
||||
MTVJapanIE,
|
||||
)
|
||||
from .muenchentv import MuenchenTVIE
|
||||
from .mujrozhlas import MujRozhlasIE
|
||||
from .mwave import MwaveIE, MwaveMeetGreetIE
|
||||
from .mychannels import MyChannelsIE
|
||||
from .myspace import MySpaceIE, MySpaceAlbumIE
|
||||
|
@ -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',
|
||||
|
95
youtube_dl/extractor/mujrozhlas.py
Normal file
95
youtube_dl/extractor/mujrozhlas.py
Normal file
@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
clean_html,
|
||||
ExtractorError,
|
||||
js_to_json,
|
||||
)
|
||||
|
||||
|
||||
class MujRozhlasIE(InfoExtractor):
|
||||
IE_NAME = 'mujRozhlas'
|
||||
IE_DESC = 'https://www.mujrozhlas.cz/'
|
||||
_VALID_URL = r'https?://www\.mujrozhlas\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
||||
_TESTS = [
|
||||
{
|
||||
'url': 'https://www.mujrozhlas.cz/vinohradska-12/zadne-dalsi-pusy-konec-prchala-spol-muze-znamenat-babisuv-odchod-z-politiky-tipuje',
|
||||
'md5': '34ecaa47f64079a63d6b80498c280e9d',
|
||||
'info_dict': {
|
||||
'id': '0c54ba72-93dd-3a29-b567-910d3d8c71a8',
|
||||
'ext': 'mp3',
|
||||
'title': 'Žádné další pusy. Konec Prchala a spol. může znamenat Babišův odchod z politiky, tipuje politolog',
|
||||
'description': 'md5:ec0610bdb1f591061dbd224d2dd9c19e',
|
||||
},
|
||||
},
|
||||
{
|
||||
'url': 'https://www.mujrozhlas.cz/kazki/princi-ta-zliy-drakon',
|
||||
'md5': 'cbad6f68db6dc4d6d798d69b5d258aa5',
|
||||
'info_dict': {
|
||||
'id': 'ec5f53b2-3910-448e-8e7f-d6d1a19f4926',
|
||||
'ext': 'm4a',
|
||||
'title': 'Принці та злий дракон',
|
||||
'description': 'md5:b21701e09c2b509c4451194af7ac271b',
|
||||
},
|
||||
'params': {
|
||||
'format': 'hls-128',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
def _real_extract(self, url):
|
||||
display_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, display_id)
|
||||
player_data = self._search_regex(
|
||||
r'\bvar dl = ({[^\n]+});',
|
||||
webpage, 'player data', default=None)
|
||||
if not player_data:
|
||||
raise ExtractorError('Could not find player data')
|
||||
|
||||
player_data = self._parse_json(player_data, display_id, js_to_json)
|
||||
audio_id = player_data['contentId']
|
||||
bundle = player_data['siteEntityBundle']
|
||||
if bundle not in ('episode', 'serialPart'):
|
||||
raise ExtractorError('Unsupported entity: {0}'.format(bundle))
|
||||
|
||||
url = 'https://api.mujrozhlas.cz/episodes/{0}'.format(player_data['contentId'])
|
||||
webpage = self._download_webpage(url, audio_id)
|
||||
attr = self._parse_json(webpage, audio_id)['data']['attributes']
|
||||
|
||||
formats = []
|
||||
for link in attr['audioLinks']:
|
||||
variant = link['variant']
|
||||
if variant == 'hls':
|
||||
formats.extend(self._extract_m3u8_formats(
|
||||
link['url'], audio_id, 'm4a', entry_protocol='m3u8_native',
|
||||
m3u8_id='hls', fatal=False))
|
||||
elif variant == 'dash':
|
||||
formats.extend(self._extract_mpd_formats(
|
||||
link['url'], audio_id, mpd_id='dash', fatal=False))
|
||||
elif variant == 'mp3':
|
||||
url = link['url']
|
||||
m = re.search(
|
||||
r'(?P<proto>[^:]+):(?:.*/)*(?P<id>[^.]+)\.(?P<ext>[^/.]+)$',
|
||||
url)
|
||||
bitrate = link['bitrate']
|
||||
formats.append({
|
||||
'url': link['url'],
|
||||
'protocol': m.group('proto'),
|
||||
'ext': m.group('ext'),
|
||||
'format_id': '-'.join(('mp3', str(bitrate))),
|
||||
'vcodec': 'none',
|
||||
'abr': bitrate,
|
||||
'tbr': bitrate,
|
||||
})
|
||||
self._sort_formats(formats)
|
||||
|
||||
return {
|
||||
'id': audio_id,
|
||||
'title': attr['title'],
|
||||
'description': clean_html(attr['description']),
|
||||
'formats': formats,
|
||||
}
|
@ -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',
|
||||
|
@ -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