Compare commits

..

No commits in common. "549cb2a8362e1d9b8106da4d3fee4807f0c07a9a" and "5b804e39066e01c8cb421957bad1ddbc8daa9831" have entirely different histories.

3 changed files with 17 additions and 63 deletions

View File

@ -90,10 +90,6 @@ _NSIG_TESTS = [
'https://www.youtube.com/s/player/e06dea74/player_ias.vflset/en_US/base.js', 'https://www.youtube.com/s/player/e06dea74/player_ias.vflset/en_US/base.js',
'AiuodmaDDYw8d3y4bf', 'ankd8eza2T6Qmw', 'AiuodmaDDYw8d3y4bf', 'ankd8eza2T6Qmw',
), ),
(
'https://www.youtube.com/s/player/5dd88d1d/player-plasma-ias-phone-en_US.vflset/base.js',
'kSxKFLeqzv_ZyHSAt', 'n8gS8oRlHOxPFA',
),
] ]

View File

@ -1,19 +1,11 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import (
parse_duration,
traverse_obj,
unified_timestamp,
)
class RTVSIE(InfoExtractor): class RTVSIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rtvs\.sk/(?:radio|televizia)/archiv(?:/\d+)?/(?P<id>\d+)/?(?:[#?]|$)' _VALID_URL = r'https?://(?:www\.)?rtvs\.sk/(?:radio|televizia)/archiv/\d+/(?P<id>\d+)'
_TESTS = [{ _TESTS = [{
# radio archive # radio archive
'url': 'http://www.rtvs.sk/radio/archiv/11224/414872', 'url': 'http://www.rtvs.sk/radio/archiv/11224/414872',
@ -21,37 +13,23 @@ class RTVSIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': '414872', 'id': '414872',
'ext': 'mp3', 'ext': 'mp3',
'title': 'Ostrov pokladov 1 časť.mp3', 'title': 'Ostrov pokladov 1 časť.mp3'
'duration': 2854, },
'thumbnail': 'https://www.rtvs.sk/media/a501/image/file/2/0000/b1R8.rtvs.jpg', 'params': {
'display_id': '135331', 'skip_download': True,
} }
}, { }, {
# tv archive # tv archive
'url': 'http://www.rtvs.sk/televizia/archiv/8249/63118', 'url': 'http://www.rtvs.sk/televizia/archiv/8249/63118',
'md5': '85e2c55cf988403b70cac24f5c086dc6',
'info_dict': { 'info_dict': {
'id': '63118', 'id': '63118',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Amaro Džives - Náš deň', 'title': 'Amaro Džives - Náš deň',
'description': 'Galavečer pri príležitosti Medzinárodného dňa Rómov.', 'description': 'Galavečer pri príležitosti Medzinárodného dňa Rómov.'
'thumbnail': 'https://www.rtvs.sk/media/a501/image/file/2/0031/L7Qm.amaro_dzives_png.jpg', },
'timestamp': 1428555900, 'params': {
'upload_date': '20150409', 'skip_download': True,
'duration': 4986,
}
}, {
# tv archive
'url': 'https://www.rtvs.sk/televizia/archiv/18083?utm_source=web&utm_medium=rozcestnik&utm_campaign=Robin',
'info_dict': {
'id': '18083',
'ext': 'mp4',
'title': 'Robin',
'description': 'md5:2f70505a7b8364491003d65ff7a0940a',
'timestamp': 1636652760,
'display_id': '307655',
'duration': 831,
'upload_date': '20211111',
'thumbnail': 'https://www.rtvs.sk/media/a501/image/file/2/0916/robin.jpg',
} }
}] }]
@ -59,31 +37,11 @@ class RTVSIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
iframe_id = self._search_regex(
r'<iframe[^>]+id\s*=\s*"player_[^_]+_([0-9]+)"', webpage, 'Iframe ID')
iframe_url = self._search_regex(
fr'<iframe[^>]+id\s*=\s*"player_[^_]+_{re.escape(iframe_id)}"[^>]+src\s*=\s*"([^"]+)"', webpage, 'Iframe URL')
webpage = self._download_webpage(iframe_url, video_id, 'Downloading iframe') playlist_url = self._search_regex(
json_url = self._search_regex(r'var\s+url\s*=\s*"([^"]+)"\s*\+\s*ruurl', webpage, 'json URL') r'playlist["\']?\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
data = self._download_json(f'https:{json_url}b=mozilla&p=win&v=97&f=0&d=1', video_id) 'playlist url', group='url')
if data.get('clip'): data = self._download_json(
data['playlist'] = [data['clip']] playlist_url, video_id, 'Downloading playlist')[0]
return self._parse_jwplayer_data(data, video_id=video_id)
if traverse_obj(data, ('playlist', 0, 'sources', 0, 'type')) == 'audio/mp3':
formats = [{'url': traverse_obj(data, ('playlist', 0, 'sources', 0, 'src'))}]
else:
formats = self._extract_m3u8_formats(traverse_obj(data, ('playlist', 0, 'sources', 0, 'src')), video_id)
self._sort_formats(formats)
return {
'id': video_id,
'display_id': iframe_id,
'title': traverse_obj(data, ('playlist', 0, 'title')),
'description': traverse_obj(data, ('playlist', 0, 'description')),
'duration': parse_duration(traverse_obj(data, ('playlist', 0, 'length'))),
'thumbnail': traverse_obj(data, ('playlist', 0, 'image')),
'timestamp': unified_timestamp(traverse_obj(data, ('playlist', 0, 'datetime_create'))),
'formats': formats
}

View File

@ -2413,7 +2413,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
def _extract_n_function_name(self, jscode): def _extract_n_function_name(self, jscode):
nfunc, idx = self._search_regex( nfunc, idx = self._search_regex(
r'\.get\("n"\)\)&&\(b=(?P<nfunc>[a-zA-Z0-9$]+)(?:\[(?P<idx>\d+)\])?\([a-zA-Z0-9]\)', r'\.get\("n"\)\)&&\(b=(?P<nfunc>[a-zA-Z0-9$]{3})(?:\[(?P<idx>\d+)\])?\([a-zA-Z0-9]\)',
jscode, 'Initial JS player n function name', group=('nfunc', 'idx')) jscode, 'Initial JS player n function name', group=('nfunc', 'idx'))
if not idx: if not idx:
return nfunc return nfunc