You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3 KiB

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