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.

54 lines
1.8 KiB

  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'http://(?:www\.)?einthusan\.com/movies/watch.php\?(.*)?id=(?P<id>[0-9]+).*?'
  7. _TESTS = [
  8. {
  9. 'url': 'http://www.einthusan.com/movies/watch.php?hindimoviesonline=Ek+Villain&lang=hindi&id=2447',
  10. 'md5': 'af244f4458cd667205e513d75da5b8b1',
  11. 'info_dict': {
  12. 'id': '2447',
  13. 'ext': 'mp4',
  14. 'title': 'Ek Villain',
  15. 'thumbnail': 're:^https?://.*\.jpg$',
  16. }
  17. },
  18. {
  19. 'url': 'http://www.einthusan.com/movies/watch.php?id=1671',
  20. 'md5': 'ef63c7a803e22315880ed182c10d1c5c',
  21. 'info_dict': {
  22. 'id': '1671',
  23. 'ext': 'mp4',
  24. 'title': 'Soodhu Kavvuum',
  25. 'thumbnail': 're:^https?://.*\.jpg$',
  26. }
  27. },
  28. ]
  29. def _real_extract(self, url):
  30. mobj = re.match(self._VALID_URL, url)
  31. video_id = mobj.group('id')
  32. webpage = self._download_webpage(url, video_id)
  33. video_title = self._html_search_regex(r'''<h1><a class="movie-title".*?>(.*?)</a></h1>''', webpage, 'title')
  34. video_url = self._html_search_regex(
  35. r'''(?s)jwplayer\("mediaplayer"\)\.setup\({.*?'file': '([^']+)'.*?}\);''', webpage, 'video url')
  36. thumb_rel_url = self._html_search_regex(
  37. r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''', webpage, "thumbnail url")
  38. thumb_abs_url = re.sub('\.\.', 'http://www.einthusan.com', thumb_rel_url)
  39. return {
  40. 'id': video_id,
  41. 'ext': 'mp4',
  42. 'title': video_title,
  43. 'url': video_url,
  44. 'thumbnail': thumb_abs_url,
  45. }