|
@ -1,5 +1,4 @@ |
|
|
# coding: utf-8 |
|
|
# coding: utf-8 |
|
|
|
|
|
|
|
|
from __future__ import unicode_literals |
|
|
from __future__ import unicode_literals |
|
|
|
|
|
|
|
|
import re |
|
|
import re |
|
@ -8,7 +7,7 @@ from .common import InfoExtractor |
|
|
from ..utils import ( |
|
|
from ..utils import ( |
|
|
js_to_json, |
|
|
js_to_json, |
|
|
unescapeHTML, |
|
|
unescapeHTML, |
|
|
ExtractorError |
|
|
|
|
|
|
|
|
ExtractorError, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -16,7 +15,7 @@ class DVTVIE(InfoExtractor): |
|
|
IE_NAME = 'dvtv' |
|
|
IE_NAME = 'dvtv' |
|
|
IE_DESC = 'http://video.aktualne.cz/' |
|
|
IE_DESC = 'http://video.aktualne.cz/' |
|
|
|
|
|
|
|
|
_VALID_URL = r'http://video\.aktualne\.cz/.*/r~(?P<id>[0-9a-f]{32})/' |
|
|
|
|
|
|
|
|
_VALID_URL = r'http://video\.aktualne\.cz/(?:[^/]+/)+r~(?P<id>[0-9a-f]{32})' |
|
|
|
|
|
|
|
|
_TESTS = [{ |
|
|
_TESTS = [{ |
|
|
'url': 'http://video.aktualne.cz/dvtv/vondra-o-ceskem-stoleti-pri-pohledu-na-havla-mi-bylo-trapne/r~e5efe9ca855511e4833a0025900fea04/', |
|
|
'url': 'http://video.aktualne.cz/dvtv/vondra-o-ceskem-stoleti-pri-pohledu-na-havla-mi-bylo-trapne/r~e5efe9ca855511e4833a0025900fea04/', |
|
@ -24,7 +23,7 @@ class DVTVIE(InfoExtractor): |
|
|
'info_dict': { |
|
|
'info_dict': { |
|
|
'id': 'dc0768de855511e49e4b0025900fea04', |
|
|
'id': 'dc0768de855511e49e4b0025900fea04', |
|
|
'ext': 'mp4', |
|
|
'ext': 'mp4', |
|
|
'title': 'Vondra o Českém století: Při pohledu na Havla mi bylo trapně' |
|
|
|
|
|
|
|
|
'title': 'Vondra o Českém století: Při pohledu na Havla mi bylo trapně', |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
'url': 'http://video.aktualne.cz/dvtv/stropnicky-policie-vrbetice-preventivne-nekontrolovala/r~82ed4322849211e4a10c0025900fea04/', |
|
|
'url': 'http://video.aktualne.cz/dvtv/stropnicky-policie-vrbetice-preventivne-nekontrolovala/r~82ed4322849211e4a10c0025900fea04/', |
|
@ -32,13 +31,13 @@ class DVTVIE(InfoExtractor): |
|
|
'info_dict': { |
|
|
'info_dict': { |
|
|
'id': '72c02230849211e49f60002590604f2e', |
|
|
'id': '72c02230849211e49f60002590604f2e', |
|
|
'ext': 'mp4', |
|
|
'ext': 'mp4', |
|
|
'title': 'Stropnický: Policie Vrbětice preventivně nekontrolovala' |
|
|
|
|
|
|
|
|
'title': 'Stropnický: Policie Vrbětice preventivně nekontrolovala', |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
'url': 'http://video.aktualne.cz/dvtv/dvtv-16-12-2014-utok-talibanu-boj-o-kliniku-uprchlici/r~973eb3bc854e11e498be002590604f2e/', |
|
|
'url': 'http://video.aktualne.cz/dvtv/dvtv-16-12-2014-utok-talibanu-boj-o-kliniku-uprchlici/r~973eb3bc854e11e498be002590604f2e/', |
|
|
'info_dict': { |
|
|
'info_dict': { |
|
|
'title': 'DVTV 16. 12. 2014: útok Talibanu, boj o kliniku, uprchlíci', |
|
|
'title': 'DVTV 16. 12. 2014: útok Talibanu, boj o kliniku, uprchlíci', |
|
|
'id': '973eb3bc854e11e498be002590604f2e' |
|
|
|
|
|
|
|
|
'id': '973eb3bc854e11e498be002590604f2e', |
|
|
}, |
|
|
}, |
|
|
'playlist': [{ |
|
|
'playlist': [{ |
|
|
'md5': 'da7ca6be4935532241fa9520b3ad91e4', |
|
|
'md5': 'da7ca6be4935532241fa9520b3ad91e4', |
|
@ -68,7 +67,10 @@ class DVTVIE(InfoExtractor): |
|
|
'ext': 'mp4', |
|
|
'ext': 'mp4', |
|
|
'title': 'Pánek: Odmítání syrských uprchlíků je ostudou české vlády' |
|
|
'title': 'Pánek: Odmítání syrských uprchlíků je ostudou české vlády' |
|
|
} |
|
|
} |
|
|
}] |
|
|
|
|
|
|
|
|
}], |
|
|
|
|
|
}, { |
|
|
|
|
|
'url': 'http://video.aktualne.cz/v-cechach-poprve-zazni-zelenkova-zrestaurovana-mse/r~45b4b00483ec11e4883b002590604f2e/', |
|
|
|
|
|
'only_matching': True, |
|
|
}] |
|
|
}] |
|
|
|
|
|
|
|
|
def _parse_video_metadata(self, js, video_id): |
|
|
def _parse_video_metadata(self, js, video_id): |
|
@ -80,7 +82,6 @@ class DVTVIE(InfoExtractor): |
|
|
formats.append({ |
|
|
formats.append({ |
|
|
'url': video['file'], |
|
|
'url': video['file'], |
|
|
'ext': ext, |
|
|
'ext': ext, |
|
|
'format': '%s %s' % (ext, video['label']), |
|
|
|
|
|
'format_id': '%s-%s' % (ext, video['label']), |
|
|
'format_id': '%s-%s' % (ext, video['label']), |
|
|
'height': int(video['label'].rstrip('p')), |
|
|
'height': int(video['label'].rstrip('p')), |
|
|
'fps': 25, |
|
|
'fps': 25, |
|
@ -91,25 +92,26 @@ class DVTVIE(InfoExtractor): |
|
|
return { |
|
|
return { |
|
|
'id': metadata['mediaid'], |
|
|
'id': metadata['mediaid'], |
|
|
'title': unescapeHTML(metadata['title']), |
|
|
'title': unescapeHTML(metadata['title']), |
|
|
'thumbnail': 'http:%s' % metadata['image'], |
|
|
|
|
|
|
|
|
'thumbnail': self._proto_relative_url(metadata['image']), |
|
|
'formats': formats |
|
|
'formats': formats |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
def _real_extract(self, url): |
|
|
def _real_extract(self, url): |
|
|
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) |
|
|
|
|
|
|
|
|
# singe video |
|
|
|
|
|
items = re.findall( |
|
|
|
|
|
r'(?s)embedData[0-9a-f]{32}\[\'asset\'\] = (\{.+?\});', |
|
|
|
|
|
webpage) |
|
|
|
|
|
|
|
|
# single video |
|
|
|
|
|
item = self._search_regex( |
|
|
|
|
|
r"(?s)embedData[0-9a-f]{32}\['asset'\]\s*=\s*(\{.+?\});", |
|
|
|
|
|
webpage, 'video', default=None, fatal=False) |
|
|
|
|
|
|
|
|
if items: |
|
|
|
|
|
return self._parse_video_metadata(items[0], video_id) |
|
|
|
|
|
|
|
|
if item: |
|
|
|
|
|
return self._parse_video_metadata(item, video_id) |
|
|
|
|
|
|
|
|
# playlist |
|
|
# playlist |
|
|
items = re.findall( |
|
|
items = re.findall( |
|
|
r'(?s)BBX\.context\.assets\[\'[0-9a-f]{32}\'\]\.push\((\{.+?\})\);', |
|
|
|
|
|
|
|
|
r"(?s)BBX\.context\.assets\['[0-9a-f]{32}'\]\.push\(({.+?})\);", |
|
|
webpage) |
|
|
webpage) |
|
|
|
|
|
|
|
|
if items: |
|
|
if items: |
|
@ -120,4 +122,4 @@ class DVTVIE(InfoExtractor): |
|
|
'entries': [self._parse_video_metadata(i, video_id) for i in items] |
|
|
'entries': [self._parse_video_metadata(i, video_id) for i in items] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
raise ExtractorError('Could not find neither video nor playlist for requested ID') |
|
|
|
|
|
|
|
|
raise ExtractorError('Could not find neither video nor playlist') |