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