summary refs log tree commit diff
diff options
context:
space:
mode:
authorHaricharan Padmanaban <hari.jan20@gmail.com>2014-09-14 23:14:00 -0500
committerHaricharan Padmanaban <hari.jan20@gmail.com>2014-09-14 23:14:00 -0500
commit98703c7fbfcf06348220aa63f9422cdd792cfe1a (patch)
tree7da50de9653ffba31071a6c71878ae1082d7343c
parent9a66c1079cdf6d6688aafe0dcc7c1285f04a302c (diff)
downloadyoutube-dl-98703c7fbfcf06348220aa63f9422cdd792cfe1a.tar.gz
youtube-dl-98703c7fbfcf06348220aa63f9422cdd792cfe1a.tar.xz
youtube-dl-98703c7fbfcf06348220aa63f9422cdd792cfe1a.zip
Einthusan Add new extractor
-rw-r--r--youtube_dl/extractor/__init__.py1
-rw-r--r--youtube_dl/extractor/einthusan.py54
2 files changed, 55 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index de6e8ee30..7f0736ee8 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -77,6 +77,7 @@ from .dropbox import DropboxIE
 from .ebaumsworld import EbaumsWorldIE
 from .ehow import EHowIE
 from .eighttracks import EightTracksIE
+from .einthusan import EinthusanIE
 from .eitb import EitbIE
 from .ellentv import (
     EllenTVIE,
diff --git a/youtube_dl/extractor/einthusan.py b/youtube_dl/extractor/einthusan.py
new file mode 100644
index 000000000..712368faf
--- /dev/null
+++ b/youtube_dl/extractor/einthusan.py
@@ -0,0 +1,54 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+
+
+class EinthusanIE(InfoExtractor):
+    _VALID_URL = r'http://(?:www\.)?einthusan\.com/movies/watch.php\?(.*)?id=(?P<id>[0-9]+).*?'
+    _TESTS = [
+        {
+            'url': 'http://www.einthusan.com/movies/watch.php?hindimoviesonline=Ek+Villain&lang=hindi&id=2447',
+            'md5': 'af244f4458cd667205e513d75da5b8b1',
+            'info_dict': {
+                'id': '2447',
+                'ext': 'mp4',
+                'title': 'Ek Villain',
+                'thumbnail': 're:^https?://.*\.jpg$',
+            }
+        },
+        {
+            'url': 'http://www.einthusan.com/movies/watch.php?id=1671',
+            'md5': 'ef63c7a803e22315880ed182c10d1c5c',
+            'info_dict': {
+                'id': '1671',
+                'ext': 'mp4',
+                'title': 'Soodhu Kavvuum',
+                'thumbnail': 're:^https?://.*\.jpg$',
+            }
+        },
+    ]
+
+    def _real_extract(self, url):
+        mobj = re.match(self._VALID_URL, url)
+        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_url = self._html_search_regex(
+            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)
+
+        return {
+            'id': video_id,
+            'ext': 'mp4',
+            'title': video_title,
+            'url': video_url,
+            'thumbnail': thumb_abs_url,
+        }