summary refs log tree commit diff
diff options
context:
space:
mode:
authorskacurt <skacurt@outlook.com>2016-04-23 04:20:04 +0300
committerSergey M․ <dstftw@gmail.com>2016-07-20 21:42:05 +0700
commit740d7c49c251464b25bea5146e054390ada6b997 (patch)
treed36af02048aa83e777ec4ff53ae878b574d58831
parent4e51ec5f579465d5b64ecfef3614ac5c726fca1f (diff)
downloadyoutube-dl-740d7c49c251464b25bea5146e054390ada6b997.tar.gz
youtube-dl-740d7c49c251464b25bea5146e054390ada6b997.tar.xz
youtube-dl-740d7c49c251464b25bea5146e054390ada6b997.zip
[odatv] Add extractor
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/odatv.py51
2 files changed, 52 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index 7314be747..6de50296c 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -587,6 +587,7 @@ from .nytimes import (
     NYTimesArticleIE,
 )
 from .nuvid import NuvidIE
+from .odatv import OdaTVIE
 from .odnoklassniki import OdnoklassnikiIE
 from .oktoberfesttv import OktoberfestTVIE
 from .onet import (
diff --git a/youtube_dl/extractor/odatv.py b/youtube_dl/extractor/odatv.py
new file mode 100644
index 000000000..dbf96aefe
--- /dev/null
+++ b/youtube_dl/extractor/odatv.py
@@ -0,0 +1,51 @@
+# coding: utf-8
+
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import (
+    ExtractorError,
+    remove_start
+)
+import re
+
+
+class OdaTVIE(InfoExtractor):
+    _VALID_URL = r'^https?://(?:www\.)?odatv\.com/(?:mob|vid)_video\.php\?id=(?P<id>[^&]*)'
+    _TESTS = [{
+        'url': 'http://odatv.com/vid_video.php?id=8E388',
+        'md5': 'dc61d052f205c9bf2da3545691485154',
+        'info_dict': {
+            'id': '8E388',
+            'ext': 'mp4',
+            'title': 'md5:69654805a16a16cf9ec9d055e079831c'
+        }
+    }, {
+        'url': 'http://odatv.com/mob_video.php?id=8E388',
+        'md5': 'dc61d052f205c9bf2da3545691485154',
+        'info_dict': {
+            'id': '8E388',
+            'ext': 'mp4',
+            'title': 'md5:69654805a16a16cf9ec9d055e079831c'
+        }
+    }, {
+        'url': 'http://odatv.com/mob_video.php?id=8E900',
+        'md5': '',
+        'info_dict': {
+            'id': '8E900',
+            'ext': 'mp4',
+            'title': 'not found check'
+        }
+    }]
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+        if 'NO VIDEO!' in webpage:
+            raise ExtractorError('Video %s does not exist' % video_id, expected=True)
+
+        return {
+            'id': video_id,
+            'title': remove_start(self._og_search_title(webpage), 'Video: '),
+            'thumbnail': self._og_search_thumbnail(webpage),
+            'url': self._html_search_regex(r"(http.+?video_%s\.mp4)" % re.escape(video_id), webpage, 'url', flags=re.IGNORECASE)
+        }