bigflix.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from base64 import b64decode
  4. from .common import InfoExtractor
  5. from ..compat import compat_urllib_parse_unquote
  6. class BigflixIE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.)?bigflix\.com/.*/(?P<id>[0-9]+)'
  8. _TEST = {
  9. 'url': 'http://www.bigflix.com/Hindi-movies/Action-movies/Singham-Returns/16537',
  10. 'md5': 'ec76aa9b1129e2e5b301a474e54fab74',
  11. 'info_dict': {
  12. 'id': '16537',
  13. 'ext': 'mp4',
  14. 'title': 'Singham Returns',
  15. 'description': 'md5:3d2ba5815f14911d5cc6a501ae0cf65d',
  16. }
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. title = self._html_search_regex(
  22. r'<div[^>]+class=["\']pagetitle["\'][^>]*>(.+?)</div>',
  23. webpage, 'title')
  24. video_url = b64decode(compat_urllib_parse_unquote(self._search_regex(
  25. r'file=([^&]+)', webpage, 'video url')).encode('ascii')).decode('utf-8')
  26. description = self._html_search_meta('description', webpage)
  27. return {
  28. 'id': video_id,
  29. 'title': title,
  30. 'url': video_url,
  31. 'description': description,
  32. }