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.

45 lines
1.4 KiB

10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class MoviezineIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?moviezine\.se/video/(?P<id>[^?#]+)'
  7. _TEST = {
  8. 'url': 'http://www.moviezine.se/video/205866',
  9. 'info_dict': {
  10. 'id': '205866',
  11. 'ext': 'mp4',
  12. 'title': 'Oculus - Trailer 1',
  13. 'description': 'md5:40cc6790fc81d931850ca9249b40e8a4',
  14. 'thumbnail': r're:http://.*\.jpg',
  15. },
  16. }
  17. def _real_extract(self, url):
  18. mobj = re.match(self._VALID_URL, url)
  19. video_id = mobj.group('id')
  20. webpage = self._download_webpage(url, video_id)
  21. jsplayer = self._download_webpage('http://www.moviezine.se/api/player.js?video=%s' % video_id, video_id, 'Downloading js api player')
  22. formats = [{
  23. 'format_id': 'sd',
  24. 'url': self._html_search_regex(r'file: "(.+?)",', jsplayer, 'file'),
  25. 'quality': 0,
  26. 'ext': 'mp4',
  27. }]
  28. self._sort_formats(formats)
  29. return {
  30. 'id': video_id,
  31. 'title': self._search_regex(r'title: "(.+?)",', jsplayer, 'title'),
  32. 'thumbnail': self._search_regex(r'image: "(.+?)",', jsplayer, 'image'),
  33. 'formats': formats,
  34. 'description': self._og_search_description(webpage),
  35. }