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.

47 lines
1.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class RTVSIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?rtvs\.sk/(?:radio|televizia)/archiv/\d+/(?P<id>\d+)'
  6. _TESTS = [{
  7. # radio archive
  8. 'url': 'http://www.rtvs.sk/radio/archiv/11224/414872',
  9. 'md5': '134d5d6debdeddf8a5d761cbc9edacb8',
  10. 'info_dict': {
  11. 'id': '414872',
  12. 'ext': 'mp3',
  13. 'title': 'Ostrov pokladov 1 časť.mp3'
  14. },
  15. 'params': {
  16. 'skip_download': True,
  17. }
  18. }, {
  19. # tv archive
  20. 'url': 'http://www.rtvs.sk/televizia/archiv/8249/63118',
  21. 'md5': '85e2c55cf988403b70cac24f5c086dc6',
  22. 'info_dict': {
  23. 'id': '63118',
  24. 'ext': 'mp4',
  25. 'title': 'Amaro Džives - Náš deň',
  26. 'description': 'Galavečer pri príležitosti Medzinárodného dňa Rómov.'
  27. },
  28. 'params': {
  29. 'skip_download': True,
  30. }
  31. }]
  32. def _real_extract(self, url):
  33. video_id = self._match_id(url)
  34. webpage = self._download_webpage(url, video_id)
  35. playlist_url = self._search_regex(
  36. r'playlist["\']?\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
  37. 'playlist url', group='url')
  38. data = self._download_json(
  39. playlist_url, video_id, 'Downloading playlist')[0]
  40. return self._parse_jwplayer_data(data, video_id=video_id)