X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fteamcoco.py;h=7cb06f351e5b388142b00b51aeba69a1ecfef250;hb=674fb0fcc54c72448f80a0573f7fd116f220827e;hp=bc48620f0b992366e866181b1dad22aeb2e5d0a6;hpb=231516b6c983561cdfb7d58a07bb78a5fa132e10;p=youtube-dl diff --git a/youtube_dl/extractor/teamcoco.py b/youtube_dl/extractor/teamcoco.py index bc48620f0..7cb06f351 100644 --- a/youtube_dl/extractor/teamcoco.py +++ b/youtube_dl/extractor/teamcoco.py @@ -1,71 +1,92 @@ +from __future__ import unicode_literals + +import base64 import re -import xml.etree.ElementTree from .common import InfoExtractor -from ..utils import ( - ExtractorError, -) +from ..utils import qualities class TeamcocoIE(InfoExtractor): - _VALID_URL = r'http://teamcoco\.com/video/(?P.*)' - _TEST = { - u'url': u'http://teamcoco.com/video/louis-ck-interview-george-w-bush', - u'file': u'19705.mp4', - u'md5': u'cde9ba0fa3506f5f017ce11ead928f9a', - u'info_dict': { - u"description": u"Louis C.K. got starstruck by George W. Bush, so what? Part one.", - u"title": u"Louis C.K. Interview Pt. 1 11/3/11" + _VALID_URL = r'http://teamcoco\.com/video/(?P[0-9]+)?/?(?P.*)' + _TESTS = [ + { + 'url': 'http://teamcoco.com/video/80187/conan-becomes-a-mary-kay-beauty-consultant', + 'md5': '3f7746aa0dc86de18df7539903d399ea', + 'info_dict': { + 'id': '80187', + 'ext': 'mp4', + 'title': 'Conan Becomes A Mary Kay Beauty Consultant', + 'description': 'Mary Kay is perhaps the most trusted name in female beauty, so of course Conan is a natural choice to sell their products.', + 'age_limit': 0, + } + }, { + 'url': 'http://teamcoco.com/video/louis-ck-interview-george-w-bush', + 'md5': 'cde9ba0fa3506f5f017ce11ead928f9a', + 'info_dict': { + 'id': '19705', + 'ext': 'mp4', + 'description': 'Louis C.K. got starstruck by George W. Bush, so what? Part one.', + 'title': 'Louis C.K. Interview Pt. 1 11/3/11', + 'age_limit': 0, + } } - } + ] + _VIDEO_ID_REGEXES = ( + r'"eVar42"\s*:\s*(\d+)', + r'Ginger\.TeamCoco\.openInApp\("video",\s*"([^"]+)"', + r'"id_not"\s*:\s*(\d+)' + ) 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) - video_id = self._html_search_regex(r'