2014-11-26 03:58:53 -08:00
|
|
|
from __future__ import unicode_literals
|
2013-11-05 14:30:25 -08:00
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2013-11-13 02:06:53 -08:00
|
|
|
|
2013-11-05 14:30:25 -08:00
|
|
|
|
|
|
|
class TvpIE(InfoExtractor):
|
2014-11-26 03:58:53 -08:00
|
|
|
IE_NAME = 'tvp.pl'
|
2013-11-05 14:30:25 -08:00
|
|
|
_VALID_URL = r'https?://www\.tvp\.pl/.*?wideo/(?P<date>\d+)/(?P<id>\d+)'
|
|
|
|
|
|
|
|
_TEST = {
|
2014-11-26 03:58:53 -08:00
|
|
|
'url': 'http://www.tvp.pl/warszawa/magazyny/campusnews/wideo/31102013/12878238',
|
|
|
|
'md5': '148408967a6a468953c0a75cbdaf0d7a',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '12878238',
|
|
|
|
'ext': 'wmv',
|
|
|
|
'title': '31.10.2013 - Odcinek 2',
|
|
|
|
'description': '31.10.2013 - Odcinek 2',
|
2013-11-05 14:30:25 -08:00
|
|
|
},
|
2014-11-26 03:58:53 -08:00
|
|
|
'skip': 'Download has to use same server IP as extraction. Therefore, a good (load-balancing) DNS resolver will make the download fail.'
|
2013-11-05 14:30:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2014-11-26 03:58:53 -08:00
|
|
|
video_id = self._match_id(url)
|
2013-11-13 02:06:53 -08:00
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
json_url = 'http://www.tvp.pl/pub/stat/videofileinfo?video_id=%s' % video_id
|
2014-11-26 03:58:53 -08:00
|
|
|
params = self._download_json(
|
|
|
|
json_url, video_id, "Downloading video metadata")
|
2013-11-13 02:06:53 -08:00
|
|
|
video_url = params['video_url']
|
2013-11-05 14:30:25 -08:00
|
|
|
|
2013-11-13 02:06:53 -08:00
|
|
|
return {
|
2013-11-05 14:30:25 -08:00
|
|
|
'id': video_id,
|
2014-11-26 03:58:53 -08:00
|
|
|
'title': self._og_search_title(webpage),
|
2013-11-05 14:30:25 -08:00
|
|
|
'ext': 'wmv',
|
|
|
|
'url': video_url,
|
2013-11-13 02:06:53 -08:00
|
|
|
'description': self._og_search_description(webpage),
|
|
|
|
'thumbnail': self._og_search_thumbnail(webpage),
|
2013-11-05 14:30:25 -08:00
|
|
|
}
|