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.

64 lines
2.2 KiB

10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class EinthusanIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?einthusan\.com/movies/watch.php\?([^#]*?)id=(?P<id>[0-9]+)'
  7. _TESTS = [
  8. {
  9. 'url': 'http://www.einthusan.com/movies/watch.php?id=2447',
  10. 'md5': 'af244f4458cd667205e513d75da5b8b1',
  11. 'info_dict': {
  12. 'id': '2447',
  13. 'ext': 'mp4',
  14. 'title': 'Ek Villain',
  15. 'thumbnail': 're:^https?://.*\.jpg$',
  16. 'description': 'md5:9d29fc91a7abadd4591fb862fa560d93',
  17. }
  18. },
  19. {
  20. 'url': 'http://www.einthusan.com/movies/watch.php?id=1671',
  21. 'md5': 'ef63c7a803e22315880ed182c10d1c5c',
  22. 'info_dict': {
  23. 'id': '1671',
  24. 'ext': 'mp4',
  25. 'title': 'Soodhu Kavvuum',
  26. 'thumbnail': 're:^https?://.*\.jpg$',
  27. 'description': 'md5:05d8a0c0281a4240d86d76e14f2f4d51',
  28. }
  29. },
  30. ]
  31. def _real_extract(self, url):
  32. mobj = re.match(self._VALID_URL, url)
  33. video_id = mobj.group('id')
  34. webpage = self._download_webpage(url, video_id)
  35. video_title = self._html_search_regex(
  36. r'<h1><a class="movie-title".*?>(.*?)</a></h1>', webpage, 'title')
  37. movieid = self._html_search_regex(
  38. r'data-movieid="(.*?)"', webpage, 'movieid')
  39. location = 'Washington'
  40. geturl = 'http://cdn.einthusan.com/geturl/%s/hd/%s' % (movieid, location)
  41. video_url = self._download_webpage(geturl, video_id)
  42. description = self._html_search_meta('description', webpage)
  43. thumbnail = self._html_search_regex(
  44. r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''',
  45. webpage, "thumbnail url", fatal=False)
  46. if thumbnail is not None:
  47. thumbnail = thumbnail.replace('..', 'http://www.einthusan.com')
  48. return {
  49. 'id': video_id,
  50. 'title': video_title,
  51. 'url': video_url,
  52. 'thumbnail': thumbnail,
  53. 'description': description,
  54. }