From 0329337f8cc879131391df3427d9f5d51c4e3aaf Mon Sep 17 00:00:00 2001 From: skacurt Date: Sat, 23 Apr 2016 04:20:04 +0300 Subject: [PATCH 1/3] [OdaTV] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/odatv.py | 60 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 youtube_dl/extractor/odatv.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 6de3438fc..42c5bab23 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -542,6 +542,7 @@ from .nytimes import ( NYTimesArticleIE, ) from .nuvid import NuvidIE +from .odatv import OdaTVIE from .odnoklassniki import OdnoklassnikiIE from .oktoberfesttv import OktoberfestTVIE from .onionstudios import OnionStudiosIE diff --git a/youtube_dl/extractor/odatv.py b/youtube_dl/extractor/odatv.py new file mode 100644 index 000000000..9dd863ef7 --- /dev/null +++ b/youtube_dl/extractor/odatv.py @@ -0,0 +1,60 @@ +# 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[^&]*)' + _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' + } + }, { + 'url': 'http://odatv.com/mob_video.php?id=8E395', + 'md5': '13179a1025f07b60933d311e06574a70', + 'info_dict': { + 'id': '8E395', + 'ext': 'mp4', + 'title': 'md5:16d2e8d0eb42e793d8224af3fae20c86' + } + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + print(url) + 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) + } From f2aa34aec9f337581ca9f4454596cb15f6ec0baa Mon Sep 17 00:00:00 2001 From: skacurt Date: Sat, 23 Apr 2016 04:28:15 +0300 Subject: [PATCH 2/3] [OdaTV] Add new extractor --- youtube_dl/extractor/odatv.py | 1 - 1 file changed, 1 deletion(-) diff --git a/youtube_dl/extractor/odatv.py b/youtube_dl/extractor/odatv.py index 9dd863ef7..bed7415e3 100644 --- a/youtube_dl/extractor/odatv.py +++ b/youtube_dl/extractor/odatv.py @@ -48,7 +48,6 @@ class OdaTVIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - print(url) if 'NO VIDEO!' in webpage: raise ExtractorError('Video %s does not exist' % video_id, expected=True) From 8aeba8d8d7d274511483c9bbec0562ae71c07e69 Mon Sep 17 00:00:00 2001 From: skacurt Date: Sun, 15 May 2016 15:25:24 +0300 Subject: [PATCH 3/3] Update odatv.py unnecessary test removed --- youtube_dl/extractor/odatv.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/youtube_dl/extractor/odatv.py b/youtube_dl/extractor/odatv.py index bed7415e3..dbf96aefe 100644 --- a/youtube_dl/extractor/odatv.py +++ b/youtube_dl/extractor/odatv.py @@ -35,14 +35,6 @@ class OdaTVIE(InfoExtractor): 'ext': 'mp4', 'title': 'not found check' } - }, { - 'url': 'http://odatv.com/mob_video.php?id=8E395', - 'md5': '13179a1025f07b60933d311e06574a70', - 'info_dict': { - 'id': '8E395', - 'ext': 'mp4', - 'title': 'md5:16d2e8d0eb42e793d8224af3fae20c86' - } }] def _real_extract(self, url):