2014-09-15 00:14:00 -04:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2015-12-31 15:23:03 -05:00
|
|
|
from ..compat import compat_urlparse
|
|
|
|
from ..utils import (
|
|
|
|
remove_start,
|
|
|
|
sanitized_Request,
|
|
|
|
)
|
2014-09-15 00:14:00 -04:00
|
|
|
|
|
|
|
|
|
|
|
class EinthusanIE(InfoExtractor):
|
2014-09-15 17:33:47 -04:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?einthusan\.com/movies/watch.php\?([^#]*?)id=(?P<id>[0-9]+)'
|
2014-09-15 00:14:00 -04:00
|
|
|
_TESTS = [
|
|
|
|
{
|
2014-09-15 17:27:18 -04:00
|
|
|
'url': 'http://www.einthusan.com/movies/watch.php?id=2447',
|
2016-09-27 02:38:41 -04:00
|
|
|
'md5': 'd71379996ff5b7f217eca034c34e3461',
|
2014-09-15 00:14:00 -04:00
|
|
|
'info_dict': {
|
|
|
|
'id': '2447',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Ek Villain',
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg$',
|
2014-09-15 17:33:47 -04:00
|
|
|
'description': 'md5:9d29fc91a7abadd4591fb862fa560d93',
|
2014-09-15 00:14:00 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'url': 'http://www.einthusan.com/movies/watch.php?id=1671',
|
2016-09-27 02:38:41 -04:00
|
|
|
'md5': 'b16a6fd3c67c06eb7c79c8a8615f4213',
|
2014-09-15 00:14:00 -04:00
|
|
|
'info_dict': {
|
|
|
|
'id': '1671',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Soodhu Kavvuum',
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg$',
|
2016-09-27 02:38:41 -04:00
|
|
|
'description': 'md5:b40f2bf7320b4f9414f3780817b2af8c',
|
2014-09-15 00:14:00 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2015-12-31 15:23:03 -05:00
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
|
|
|
request = sanitized_Request(url)
|
|
|
|
request.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 5.2; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0')
|
|
|
|
webpage = self._download_webpage(request, video_id)
|
2014-09-15 00:14:00 -04:00
|
|
|
|
2015-12-31 15:23:03 -05:00
|
|
|
title = self._html_search_regex(
|
|
|
|
r'<h1><a[^>]+class=["\']movie-title["\'][^>]*>(.+?)</a></h1>',
|
|
|
|
webpage, 'title')
|
2014-09-15 00:14:00 -04:00
|
|
|
|
2015-12-31 15:23:03 -05:00
|
|
|
video_id = self._search_regex(
|
|
|
|
r'data-movieid=["\'](\d+)', webpage, 'video id', default=video_id)
|
2015-12-15 15:37:47 -05:00
|
|
|
|
2016-09-27 02:38:41 -04:00
|
|
|
m3u8_url = self._download_webpage(
|
2015-12-31 15:23:03 -05:00
|
|
|
'http://cdn.einthusan.com/geturl/%s/hd/London,Washington,Toronto,Dallas,San,Sydney/'
|
2016-09-27 02:38:41 -04:00
|
|
|
% video_id, video_id, headers={'Referer': url})
|
|
|
|
formats = self._extract_m3u8_formats(
|
|
|
|
m3u8_url, video_id, ext='mp4', entry_protocol='m3u8_native')
|
2014-09-15 00:14:00 -04:00
|
|
|
|
2014-09-15 17:33:47 -04:00
|
|
|
description = self._html_search_meta('description', webpage)
|
|
|
|
thumbnail = self._html_search_regex(
|
|
|
|
r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''',
|
|
|
|
webpage, "thumbnail url", fatal=False)
|
|
|
|
if thumbnail is not None:
|
2015-12-31 15:23:03 -05:00
|
|
|
thumbnail = compat_urlparse.urljoin(url, remove_start(thumbnail, '..'))
|
2014-09-15 00:14:00 -04:00
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
2015-12-31 15:23:03 -05:00
|
|
|
'title': title,
|
2016-09-27 02:38:41 -04:00
|
|
|
'formats': formats,
|
2014-09-15 17:33:47 -04:00
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'description': description,
|
2014-09-15 00:14:00 -04:00
|
|
|
}
|