mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-13 07:43:23 +08:00
[rtvs] Fixed extractor
This commit is contained in:
parent
c560680247
commit
ce7daceed6
@ -2,6 +2,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import determine_ext
|
||||
|
||||
|
||||
class RTVSIE(InfoExtractor):
|
||||
@ -11,7 +12,7 @@ class RTVSIE(InfoExtractor):
|
||||
'url': 'http://www.rtvs.sk/radio/archiv/11224/414872',
|
||||
'md5': '134d5d6debdeddf8a5d761cbc9edacb8',
|
||||
'info_dict': {
|
||||
'id': '414872',
|
||||
'id': '135320',
|
||||
'ext': 'mp3',
|
||||
'title': 'Ostrov pokladov 1 časť.mp3'
|
||||
},
|
||||
@ -23,7 +24,7 @@ class RTVSIE(InfoExtractor):
|
||||
'url': 'http://www.rtvs.sk/televizia/archiv/8249/63118',
|
||||
'md5': '85e2c55cf988403b70cac24f5c086dc6',
|
||||
'info_dict': {
|
||||
'id': '63118',
|
||||
'id': '17189',
|
||||
'ext': 'mp4',
|
||||
'title': 'Amaro Džives - Náš deň',
|
||||
'description': 'Galavečer pri príležitosti Medzinárodného dňa Rómov.'
|
||||
@ -39,9 +40,39 @@ class RTVSIE(InfoExtractor):
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
playlist_url = self._search_regex(
|
||||
r'playlist["\']?\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
|
||||
r'url = (["\'])(?:https?:)?(?://)(?P<url>(?:(?!\1).)+)\1', webpage,
|
||||
'playlist url', group='url')
|
||||
|
||||
if not playlist_url.startswith("http"):
|
||||
playlist_url = "http://" + playlist_url
|
||||
|
||||
data = self._download_json(
|
||||
playlist_url, video_id, 'Downloading playlist')[0]
|
||||
return self._parse_jwplayer_data(data, video_id=video_id)
|
||||
playlist_url, video_id, 'Downloading playlist')
|
||||
|
||||
try:
|
||||
data_media = data['clip']
|
||||
except KeyError:
|
||||
data_media = data['playlist'][0]
|
||||
|
||||
media_id = data_media['mediaid']
|
||||
title = data_media['title']
|
||||
description = data_media.get('description')
|
||||
thumbnail = data_media.get('image')
|
||||
|
||||
info = {
|
||||
'id': media_id,
|
||||
'title': title,
|
||||
'description': description,
|
||||
'thumbnail': thumbnail,
|
||||
}
|
||||
|
||||
url = data_media['sources'][0]['src']
|
||||
|
||||
if determine_ext(url) == 'm3u8':
|
||||
info['formats'] = self._extract_m3u8_formats(
|
||||
url, video_id, 'mp4',
|
||||
entry_protocol='m3u8_native', m3u8_id='hls')
|
||||
else:
|
||||
info['url'] = url
|
||||
|
||||
return info
|
||||
|
Loading…
Reference in New Issue
Block a user