diff options
author | Johny Mo Swag <johnymoswag@gmail.com> | 2014-02-22 00:11:57 -0800 |
---|---|---|
committer | Johny Mo Swag <johnymoswag@gmail.com> | 2014-02-22 00:11:57 -0800 |
commit | 9ddfd84e41b57343adac6d0677d91750686b8bc6 (patch) | |
tree | 0410471ccdf23ef1dde61724069a147b4b7f59f6 /youtube_dl | |
parent | 1cf563d84baf84a208f4368b9b9f5b2e2b98ddd3 (diff) |
added trutubeIE
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/trutube.py | 43 | ||||
-rw-r--r-- | youtube_dl/extractor/worldstarhiphop.py | 4 |
3 files changed, 46 insertions, 2 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index e35287f88..6377f8b4c 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -224,6 +224,7 @@ from .tinypic import TinyPicIE from .toutv import TouTvIE from .traileraddict import TrailerAddictIE from .trilulilu import TriluliluIE +from .trutube import TruTubeIE from .tube8 import Tube8IE from .tudou import TudouIE from .tumblr import TumblrIE diff --git a/youtube_dl/extractor/trutube.py b/youtube_dl/extractor/trutube.py new file mode 100644 index 000000000..37d3af0ca --- /dev/null +++ b/youtube_dl/extractor/trutube.py @@ -0,0 +1,43 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, +) + + +class TruTubeIE(InfoExtractor): + _VALID_URL = r'(?:https?://)?(?:www\.)?(?P<url>trutube\.tv/video/(?P<videoid>.*/.*))' + _TEST = { + 'url': ('http://www.trutube.tv/video/20814/Ernst-Zundel-met-les-Jui' + 'fs-en-guarde-VOSTFR'), + 'md5': '9973aa3c2870626799d2ac4e36cfc3dc', + 'info_dict': { + u"title": u"TruTube.TV - Spitting in the face of die-versity", + u"ext": u"mp4" + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + + video_id = mobj.group('videoid') + + # Get webpage content + webpage = self._download_webpage(url, video_id) + + # Get the video title + video_title = self._html_search_regex(r'<title>(?P<title>.*)</title>', + webpage, 'title').strip() + + video_url = self._search_regex(r'(http://.*\.(?:mp4|flv))', + webpage, u'video URL') + + ext = video_url[-3:] + + return { + 'id': video_id, + 'url': video_url, + 'title': video_title, + 'ext': ext + } diff --git a/youtube_dl/extractor/worldstarhiphop.py b/youtube_dl/extractor/worldstarhiphop.py index 3237596a3..fc9237a3f 100644 --- a/youtube_dl/extractor/worldstarhiphop.py +++ b/youtube_dl/extractor/worldstarhiphop.py @@ -22,8 +22,8 @@ class WorldStarHipHopIE(InfoExtractor): webpage_src = self._download_webpage(url, video_id) m_vevo_id = re.search(r'videoId=(.*?)&?', - webpage_src) - + webpage_src) + if m_vevo_id is not None: self.to_screen(u'Vevo video detected:') return self.url_result('vevo:%s' % m_vevo_id.group(1), ie='Vevo') |