]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/breakcom.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class BreakIE(InfoExtractor
):
10 _VALID_URL
= r
'http://(?:www\.)?break\.com/video/([^/]+)'
12 'url': 'http://www.break.com/video/when-girls-act-like-guys-2468056',
13 'md5': 'a3513fb1547fba4fb6cfac1bffc6c46b',
17 'title': 'When Girls Act Like D-Bags',
21 def _real_extract(self
, url
):
22 mobj
= re
.match(self
._VALID
_URL
, url
)
23 video_id
= mobj
.group(1).split("-")[-1]
24 embed_url
= 'http://www.break.com/embed/%s' % video_id
25 webpage
= self
._download
_webpage
(embed_url
, video_id
)
26 info_json
= self
._search
_regex
(r
'var embedVars = ({.*?});', webpage
,
27 'info json', flags
=re
.DOTALL
)
28 info
= json
.loads(info_json
)
29 video_url
= info
['videoUri']
30 m_youtube
= re
.search(r
'(https?://www\.youtube\.com/watch\?v=.*)', video_url
)
31 if m_youtube
is not None:
32 return self
.url_result(m_youtube
.group(1), 'Youtube')
33 final_url
= video_url
+ '?' + info
['AuthToken']
37 'title': info
['contentName'],
38 'thumbnail': info
['thumbUri'],