From 45014296be276399f6d4b761e6ffec3a6c6b292b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Tue, 21 May 2013 14:37:32 +0200 Subject: [PATCH] Add TeamcocoIE (closes #212) --- test/tests.json | 10 ++++++++ youtube_dl/InfoExtractors.py | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/test/tests.json b/test/tests.json index eed062813..f57ebf1c9 100644 --- a/test/tests.json +++ b/test/tests.json @@ -472,5 +472,15 @@ "uploader_id": "forestwander-nature-pictures", "description": "Waterfalls in the Springtime at Dark Hollow Waterfalls. These are located just off of Skyline Drive in Virginia. They are only about 6/10 of a mile hike but it is a pretty steep hill and a good climb back up." } + }, + { + "name": "Teamcoco", + "url": "http://teamcoco.com/video/louis-ck-interview-george-w-bush", + "file": "19705.mp4", + "md5": "27b6f7527da5acf534b15f21b032656e", + "info_dict":{ + "title": "Louis C.K. Interview Pt. 1 11/3/11", + "description": "Louis C.K. got starstruck by George W. Bush, so what? Part one." + } } ] diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index fe47e5254..6b644e15f 100755 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -4341,6 +4341,51 @@ def _real_extract(self, url): 'uploader_id': video_uploader_id, }] +class TeamcocoIE(InfoExtractor): + _VALID_URL = r'http://teamcoco\.com/video/(?P.*)' + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + if mobj is None: + raise ExtractorError(u'Invalid URL: %s' % url) + url_title = mobj.group('url_title') + webpage = self._download_webpage(url, url_title) + + mobj = re.search(r'
(.*?)', data) + if mobj is None: + raise ExtractorError(u'Unable to extract video url') + video_url = mobj.group(1) + + return [{ + 'id': video_id, + 'url': video_url, + 'ext': 'mp4', + 'title': video_title, + 'thumbnail': thumbnail, + 'description': description, + }] def gen_extractors(): """ Return a list of an instance of every supported extractor. @@ -4402,6 +4447,7 @@ def gen_extractors(): HowcastIE(), VineIE(), FlickrIE(), + TeamcocoIE(), GenericIE() ]