diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-02-22 14:38:42 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-02-22 14:38:42 +0100 |
commit | af284c6d1b2833e1d3d3619306efca764e3e59af (patch) | |
tree | b342f1a707e5c5772ffa1afe8f0d6b1e95bc0380 /youtube_dl/extractor/trutube.py | |
parent | 41d3ec5fba1b64be78f3ea823a604c28833a94cd (diff) | |
parent | 9ddfd84e41b57343adac6d0677d91750686b8bc6 (diff) |
Merge remote-tracking branch 'JohnyMoSwag/master'
Diffstat (limited to 'youtube_dl/extractor/trutube.py')
-rw-r--r-- | youtube_dl/extractor/trutube.py | 43 |
1 files changed, 43 insertions, 0 deletions
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 + } |