aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/odatv.py
diff options
context:
space:
mode:
authorUnknown <blackjack4494@web.de>2020-09-02 23:33:41 +0200
committerUnknown <blackjack4494@web.de>2020-09-02 23:33:41 +0200
commit3ca3f77f9ce9dd504dc6af4ef605c245c31ff860 (patch)
tree6bd9c9352327148a78b8c46227c8d526f1447b03 /youtube_dl/extractor/odatv.py
parent4cd6add62b54721eeb3bf76bd9c0b4d676dc4d68 (diff)
[skip travis] adding automerge support
basically copying content of youtube_dl folder to youtube_dlc and excluding the youtube_dl folder when compiling
Diffstat (limited to 'youtube_dl/extractor/odatv.py')
-rw-r--r--youtube_dl/extractor/odatv.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/youtube_dl/extractor/odatv.py b/youtube_dl/extractor/odatv.py
new file mode 100644
index 000000000..314527f98
--- /dev/null
+++ b/youtube_dl/extractor/odatv.py
@@ -0,0 +1,50 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ NO_DEFAULT,
+ remove_start
+)
+
+
+class OdaTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?odatv\.com/(?:mob|vid)_video\.php\?.*\bid=(?P<id>[^&]+)'
+ _TESTS = [{
+ 'url': 'http://odatv.com/vid_video.php?id=8E388',
+ 'md5': 'dc61d052f205c9bf2da3545691485154',
+ 'info_dict': {
+ 'id': '8E388',
+ 'ext': 'mp4',
+ 'title': 'Artık Davutoğlu ile devam edemeyiz'
+ }
+ }, {
+ # mobile URL
+ 'url': 'http://odatv.com/mob_video.php?id=8E388',
+ 'only_matching': True,
+ }, {
+ # no video
+ 'url': 'http://odatv.com/mob_video.php?id=8E900',
+ 'only_matching': True,
+ }]
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage(url, video_id)
+
+ no_video = 'NO VIDEO!' in webpage
+
+ video_url = self._search_regex(
+ r'mp4\s*:\s*(["\'])(?P<url>http.+?)\1', webpage, 'video url',
+ default=None if no_video else NO_DEFAULT, group='url')
+
+ if no_video:
+ raise ExtractorError('Video %s does not exist' % video_id, expected=True)
+
+ return {
+ 'id': video_id,
+ 'url': video_url,
+ 'title': remove_start(self._og_search_title(webpage), 'Video: '),
+ 'thumbnail': self._og_search_thumbnail(webpage),
+ }