about summary refs log tree commit diff
path: root/youtube_dl/extractor/einthusan.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-09-15 23:33:47 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-09-15 23:33:47 +0200
commite2037b3f7d610beefa1bb3590a4552477035f696 (patch)
tree69c39f3f58c419e14c8a21d90c6d57882d0e5050 /youtube_dl/extractor/einthusan.py
parent5419033935e75245756e984a2ef6ee3b6cb6831e (diff)
downloadyoutube-dl-e2037b3f7d610beefa1bb3590a4552477035f696.tar.gz
youtube-dl-e2037b3f7d610beefa1bb3590a4552477035f696.tar.xz
youtube-dl-e2037b3f7d610beefa1bb3590a4552477035f696.zip
[einthusan] Add description and beautify
Diffstat (limited to 'youtube_dl/extractor/einthusan.py')
-rw-r--r--youtube_dl/extractor/einthusan.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/youtube_dl/extractor/einthusan.py b/youtube_dl/extractor/einthusan.py
index 97c5d7b72..5dfea0d39 100644
--- a/youtube_dl/extractor/einthusan.py
+++ b/youtube_dl/extractor/einthusan.py
@@ -7,7 +7,7 @@ from .common import InfoExtractor
 
 
 class EinthusanIE(InfoExtractor):
-    _VALID_URL = r'http://(?:www\.)?einthusan\.com/movies/watch.php\?(.*)?id=(?P<id>[0-9]+).*?'
+    _VALID_URL = r'https?://(?:www\.)?einthusan\.com/movies/watch.php\?([^#]*?)id=(?P<id>[0-9]+)'
     _TESTS = [
         {
             'url': 'http://www.einthusan.com/movies/watch.php?id=2447',
@@ -17,6 +17,7 @@ class EinthusanIE(InfoExtractor):
                 'ext': 'mp4',
                 'title': 'Ek Villain',
                 'thumbnail': 're:^https?://.*\.jpg$',
+                'description': 'md5:9d29fc91a7abadd4591fb862fa560d93',
             }
         },
         {
@@ -27,6 +28,7 @@ class EinthusanIE(InfoExtractor):
                 'ext': 'mp4',
                 'title': 'Soodhu Kavvuum',
                 'thumbnail': 're:^https?://.*\.jpg$',
+                'description': 'md5:05d8a0c0281a4240d86d76e14f2f4d51',
             }
         },
     ]
@@ -36,19 +38,24 @@ class EinthusanIE(InfoExtractor):
         video_id = mobj.group('id')
         webpage = self._download_webpage(url, video_id)
 
-        video_title = self._html_search_regex(r'''<h1><a class="movie-title".*?>(.*?)</a></h1>''', webpage, 'title')
+        video_title = self._html_search_regex(
+            r'<h1><a class="movie-title".*?>(.*?)</a></h1>', webpage, 'title')
 
         video_url = self._html_search_regex(
-            r'''(?s)jwplayer\("mediaplayer"\)\.setup\({.*?'file': '([^']+)'.*?}\);''', webpage, 'video url')
+            r'''(?s)jwplayer\("mediaplayer"\)\.setup\({.*?'file': '([^']+)'.*?}\);''',
+            webpage, 'video url')
 
-        thumb_rel_url = self._html_search_regex(
-            r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''', webpage, "thumbnail url")
-        thumb_abs_url = re.sub('\.\.', 'http://www.einthusan.com', thumb_rel_url)
+        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:
+            thumbnail = thumbnail.replace('..', 'http://www.einthusan.com')
 
         return {
             'id': video_id,
-            'ext': 'mp4',
             'title': video_title,
             'url': video_url,
-            'thumbnail': thumb_abs_url,
+            'thumbnail': thumbnail,
+            'description': description,
         }