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.

61 lines
2.1 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. video_url = self._html_search_regex(
  38. r'''(?s)jwplayer\("mediaplayer"\)\.setup\({.*?'file': '([^']+)'.*?}\);''',
  39. webpage, 'video url')
  40. description = self._html_search_meta('description', webpage)
  41. thumbnail = self._html_search_regex(
  42. r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''',
  43. webpage, "thumbnail url", fatal=False)
  44. if thumbnail is not None:
  45. thumbnail = thumbnail.replace('..', 'http://www.einthusan.com')
  46. return {
  47. 'id': video_id,
  48. 'title': video_title,
  49. 'url': video_url,
  50. 'thumbnail': thumbnail,
  51. 'description': description,
  52. }