]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/breakcom.py
New test release.
[youtubedl] / youtube_dl / extractor / breakcom.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class BreakIE(InfoExtractor):
7 _VALID_URL = r'(?:http://)?(?:www\.)?break\.com/video/([^/]+)'
8 _TEST = {
9 u'url': u'http://www.break.com/video/when-girls-act-like-guys-2468056',
10 u'file': u'2468056.mp4',
11 u'md5': u'a3513fb1547fba4fb6cfac1bffc6c46b',
12 u'info_dict': {
13 u"title": u"When Girls Act Like D-Bags"
14 }
15 }
16
17 def _real_extract(self, url):
18 mobj = re.match(self._VALID_URL, url)
19 video_id = mobj.group(1).split("-")[-1]
20 webpage = self._download_webpage(url, video_id)
21 video_url = re.search(r"videoPath: '(.+?)',",webpage).group(1)
22 key = re.search(r"icon: '(.+?)',",webpage).group(1)
23 final_url = str(video_url)+"?"+str(key)
24 thumbnail_url = re.search(r"thumbnailURL: '(.+?)'",webpage).group(1)
25 title = re.search(r"sVidTitle: '(.+)',",webpage).group(1)
26 ext = video_url.split('.')[-1]
27 return [{
28 'id': video_id,
29 'url': final_url,
30 'ext': ext,
31 'title': title,
32 'thumbnail': thumbnail_url,
33 }]