]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/einthusan.py
Fixed tests
[yt-dlp.git] / youtube_dl / extractor / einthusan.py
CommitLineData
98703c7f
HP
1# coding: utf-8
2from __future__ import unicode_literals
3
4import re
5
6from .common import InfoExtractor
7
8
9class EinthusanIE(InfoExtractor):
10 _VALID_URL = r'http://(?:www\.)?einthusan\.com/movies/watch.php\?(.*)?id=(?P<id>[0-9]+).*?'
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$',
20 }
21 },
22 {
23 'url': 'http://www.einthusan.com/movies/watch.php?id=1671',
24 'md5': 'ef63c7a803e22315880ed182c10d1c5c',
25 'info_dict': {
26 'id': '1671',
27 'ext': 'mp4',
28 'title': 'Soodhu Kavvuum',
29 'thumbnail': 're:^https?://.*\.jpg$',
30 }
31 },
32 ]
33
34 def _real_extract(self, url):
35 mobj = re.match(self._VALID_URL, url)
36 video_id = mobj.group('id')
37 webpage = self._download_webpage(url, video_id)
38
39 video_title = self._html_search_regex(r'''<h1><a class="movie-title".*?>(.*?)</a></h1>''', webpage, 'title')
40
41 video_url = self._html_search_regex(
42 r'''(?s)jwplayer\("mediaplayer"\)\.setup\({.*?'file': '([^']+)'.*?}\);''', webpage, 'video url')
43
44 thumb_rel_url = self._html_search_regex(
45 r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''', webpage, "thumbnail url")
46 thumb_abs_url = re.sub('\.\.', 'http://www.einthusan.com', thumb_rel_url)
47
48 return {
49 'id': video_id,
50 'ext': 'mp4',
51 'title': video_title,
52 'url': video_url,
53 'thumbnail': thumb_abs_url,
54 }