]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tvp.py
Fix lintian warning introduced by Ben's patch.
[youtubedl] / youtube_dl / extractor / tvp.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class TvpIE(InfoExtractor):
7 IE_NAME = 'tvp.pl'
8 _VALID_URL = r'https?://www\.tvp\.pl/.*?wideo/(?P<date>\d+)/(?P<id>\d+)'
9
10 _TEST = {
11 'url': 'http://www.tvp.pl/warszawa/magazyny/campusnews/wideo/31102013/12878238',
12 'md5': '148408967a6a468953c0a75cbdaf0d7a',
13 'info_dict': {
14 'id': '12878238',
15 'ext': 'wmv',
16 'title': '31.10.2013 - Odcinek 2',
17 'description': '31.10.2013 - Odcinek 2',
18 },
19 'skip': 'Download has to use same server IP as extraction. Therefore, a good (load-balancing) DNS resolver will make the download fail.'
20 }
21
22 def _real_extract(self, url):
23 video_id = self._match_id(url)
24 webpage = self._download_webpage(url, video_id)
25 json_url = 'http://www.tvp.pl/pub/stat/videofileinfo?video_id=%s' % video_id
26 params = self._download_json(
27 json_url, video_id, "Downloading video metadata")
28 video_url = params['video_url']
29
30 return {
31 'id': video_id,
32 'title': self._og_search_title(webpage),
33 'ext': 'wmv',
34 'url': video_url,
35 'description': self._og_search_description(webpage),
36 'thumbnail': self._og_search_thumbnail(webpage),
37 }