]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/breakcom.py
Imported Upstream version 2013.06.26
[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
9 def _real_extract(self, url):
10 mobj = re.match(self._VALID_URL, url)
11 video_id = mobj.group(1).split("-")[-1]
12 webpage = self._download_webpage(url, video_id)
13 video_url = re.search(r"videoPath: '(.+?)',",webpage).group(1)
14 key = re.search(r"icon: '(.+?)',",webpage).group(1)
15 final_url = str(video_url)+"?"+str(key)
16 thumbnail_url = re.search(r"thumbnailURL: '(.+?)'",webpage).group(1)
17 title = re.search(r"sVidTitle: '(.+)',",webpage).group(1)
18 ext = video_url.split('.')[-1]
19 return [{
20 'id': video_id,
21 'url': final_url,
22 'ext': ext,
23 'title': title,
24 'thumbnail': thumbnail_url,
25 }]