]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/teamcoco.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 class TeamcocoIE(InfoExtractor
):
9 _VALID_URL
= r
'http://teamcoco\.com/video/(?P<video_id>[0-9]+)?/?(?P<display_id>.*)'
12 'url': 'http://teamcoco.com/video/80187/conan-becomes-a-mary-kay-beauty-consultant',
13 'md5': '3f7746aa0dc86de18df7539903d399ea',
17 'title': 'Conan Becomes A Mary Kay Beauty Consultant',
18 'description': 'Mary Kay is perhaps the most trusted name in female beauty, so of course Conan is a natural choice to sell their products.',
22 'url': 'http://teamcoco.com/video/louis-ck-interview-george-w-bush',
23 'md5': 'cde9ba0fa3506f5f017ce11ead928f9a',
27 "description": "Louis C.K. got starstruck by George W. Bush, so what? Part one.",
28 "title": "Louis C.K. Interview Pt. 1 11/3/11",
34 r
'"eVar42"\s*:\s*(\d+)',
35 r
'Ginger\.TeamCoco\.openInApp\("video",\s*"([^"]+)"',
36 r
'"id_not"\s*:\s*(\d+)'
39 def _real_extract(self
, url
):
40 mobj
= re
.match(self
._VALID
_URL
, url
)
42 display_id
= mobj
.group('display_id')
43 webpage
= self
._download
_webpage
(url
, display_id
)
45 video_id
= mobj
.group("video_id")
47 video_id
= self
._html
_search
_regex
(
48 self
._VIDEO
_ID
_REGEXES
, webpage
, 'video id')
50 data_url
= 'http://teamcoco.com/cvp/2.0/%s.xml' % video_id
51 data
= self
._download
_xml
(
52 data_url
, display_id
, 'Downloading data webpage')
54 qualities
= ['500k', '480p', '1000k', '720p', '1080p']
56 for filed
in data
.findall('files/file'):
57 if filed
.attrib
.get('playmode') == 'all':
58 # it just duplicates one of the entries
61 m_format
= re
.search(r
'(\d+(k|p))\.mp4', file_url
)
62 if m_format
is not None:
63 format_id
= m_format
.group(1)
65 format_id
= filed
.attrib
['bitrate']
67 int(filed
.attrib
['bitrate'])
68 if filed
.attrib
['bitrate'].isdigit()
72 quality
= qualities
.index(format_id
)
79 'format_id': format_id
,
83 self
._sort
_formats
(formats
)
87 'display_id': display_id
,
89 'title': self
._og
_search
_title
(webpage
),
90 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
91 'description': self
._og
_search
_description
(webpage
),
92 'age_limit': self
._family
_friendly
_search
(webpage
),