logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

restudy.py (1351B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class RestudyIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:(?:www|portal)\.)?restudy\.dk/video/[^/]+/id/(?P<id>[0-9]+)'
  6. _TESTS = [{
  7. 'url': 'https://www.restudy.dk/video/play/id/1637',
  8. 'info_dict': {
  9. 'id': '1637',
  10. 'ext': 'flv',
  11. 'title': 'Leiden-frosteffekt',
  12. 'description': 'Denne video er et eksperiment med flydende kvælstof.',
  13. },
  14. 'params': {
  15. # rtmp download
  16. 'skip_download': True,
  17. }
  18. }, {
  19. 'url': 'https://portal.restudy.dk/video/leiden-frosteffekt/id/1637',
  20. 'only_matching': True,
  21. }]
  22. def _real_extract(self, url):
  23. video_id = self._match_id(url)
  24. webpage = self._download_webpage(url, video_id)
  25. title = self._og_search_title(webpage).strip()
  26. description = self._og_search_description(webpage).strip()
  27. formats = self._extract_smil_formats(
  28. 'https://cdn.portal.restudy.dk/dynamic/themes/front/awsmedia/SmilDirectory/video_%s.xml' % video_id,
  29. video_id)
  30. self._sort_formats(formats)
  31. return {
  32. 'id': video_id,
  33. 'title': title,
  34. 'description': description,
  35. 'formats': formats,
  36. }