mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 19:52:11 +00:00
[ceskatelevize] Fix video availability check and add geo unrestricted test
This commit is contained in:
parent
f00fc78674
commit
7d78f0cc48
1 changed files with 40 additions and 25 deletions
|
@ -16,31 +16,46 @@ from ..utils import (
|
||||||
class CeskaTelevizeIE(InfoExtractor):
|
class CeskaTelevizeIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www\.ceskatelevize\.cz/(porady|ivysilani)/(.+/)?(?P<id>[^?#]+)'
|
_VALID_URL = r'https?://www\.ceskatelevize\.cz/(porady|ivysilani)/(.+/)?(?P<id>[^?#]+)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [
|
||||||
'url': 'http://www.ceskatelevize.cz/ivysilani/10532695142-prvni-republika/213512120230004-spanelska-chripka',
|
{
|
||||||
'info_dict': {
|
'url': 'http://www.ceskatelevize.cz/ivysilani/10532695142-prvni-republika/213512120230004-spanelska-chripka',
|
||||||
'id': '213512120230004',
|
'info_dict': {
|
||||||
'ext': 'flv',
|
'id': '213512120230004',
|
||||||
'title': 'První republika: Španělská chřipka',
|
'ext': 'flv',
|
||||||
'duration': 3107.4,
|
'title': 'První republika: Španělská chřipka',
|
||||||
|
'duration': 3107.4,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True, # requires rtmpdump
|
||||||
|
},
|
||||||
|
'skip': 'Works only from Czech Republic.',
|
||||||
},
|
},
|
||||||
'params': {
|
{
|
||||||
'skip_download': True, # requires rtmpdump
|
'url': 'http://www.ceskatelevize.cz/ivysilani/1030584952-tsatsiki-maminka-a-policajt',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '20138143440',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Tsatsiki, maminka a policajt',
|
||||||
|
'duration': 6754.1,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True, # requires rtmpdump
|
||||||
|
},
|
||||||
|
'skip': 'Works only from Czech Republic.',
|
||||||
},
|
},
|
||||||
'skip': 'Works only from Czech Republic.',
|
{
|
||||||
}, {
|
'url': 'http://www.ceskatelevize.cz/ivysilani/10532695142-prvni-republika/bonus/14716-zpevacka-z-duparny-bobina',
|
||||||
'url': 'http://www.ceskatelevize.cz/ivysilani/1030584952-tsatsiki-maminka-a-policajt',
|
'info_dict': {
|
||||||
'info_dict': {
|
'id': '14716',
|
||||||
'id': '20138143440',
|
'ext': 'flv',
|
||||||
'ext': 'flv',
|
'title': 'První republika: Zpěvačka z Dupárny Bobina',
|
||||||
'title': 'Tsatsiki, maminka a policajt',
|
'duration': 90,
|
||||||
'duration': 6754.1,
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True, # requires rtmpdump
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'params': {
|
]
|
||||||
'skip_download': True, # requires rtmpdump
|
|
||||||
},
|
|
||||||
'skip': 'Works only from Czech Republic.',
|
|
||||||
}]
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
url = url.replace('/porady/', '/ivysilani/').replace('/video/', '')
|
url = url.replace('/porady/', '/ivysilani/').replace('/video/', '')
|
||||||
|
@ -50,9 +65,9 @@ class CeskaTelevizeIE(InfoExtractor):
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
if '<p class="title">Chyba konfigurace prohlížeče.</p>' not in webpage:
|
NOT_AVAILABLE_STRING = 'This content is not available at your territory due to limited copyright.'
|
||||||
msg = self._html_search_regex(r'<p class="title">(.+?)</p>', webpage, 'error-message')
|
if '%s</p>' % NOT_AVAILABLE_STRING in webpage:
|
||||||
raise ExtractorError(msg.replace('<br />', ' '))
|
raise ExtractorError(NOT_AVAILABLE_STRING, expected=True)
|
||||||
|
|
||||||
typ = self._html_search_regex(r'getPlaylistUrl\(\[\{"type":"(.+?)","id":".+?"\}\],', webpage, 'type')
|
typ = self._html_search_regex(r'getPlaylistUrl\(\[\{"type":"(.+?)","id":".+?"\}\],', webpage, 'type')
|
||||||
episode_id = self._html_search_regex(r'getPlaylistUrl\(\[\{"type":".+?","id":"(.+?)"\}\],', webpage, 'episode_id')
|
episode_id = self._html_search_regex(r'getPlaylistUrl\(\[\{"type":".+?","id":"(.+?)"\}\],', webpage, 'episode_id')
|
||||||
|
|
Loading…
Reference in a new issue