You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

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