mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-18 00:24:04 -05:00
Fix BreakIE
Also detect videos that come from Youtube
This commit is contained in:
parent
de48addae2
commit
67ae7b4760
1 changed files with 15 additions and 10 deletions
|
@ -1,6 +1,8 @@
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import determine_ext
|
||||||
|
|
||||||
|
|
||||||
class BreakIE(InfoExtractor):
|
class BreakIE(InfoExtractor):
|
||||||
|
@ -17,17 +19,20 @@ class BreakIE(InfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group(1).split("-")[-1]
|
video_id = mobj.group(1).split("-")[-1]
|
||||||
webpage = self._download_webpage(url, video_id)
|
embed_url = 'http://www.break.com/embed/%s' % video_id
|
||||||
video_url = re.search(r"videoPath: '(.+?)',",webpage).group(1)
|
webpage = self._download_webpage(embed_url, video_id)
|
||||||
key = re.search(r"icon: '(.+?)',",webpage).group(1)
|
info_json = self._search_regex(r'var embedVars = ({.*?});', webpage,
|
||||||
final_url = str(video_url)+"?"+str(key)
|
u'info json', flags=re.DOTALL)
|
||||||
thumbnail_url = re.search(r"thumbnailURL: '(.+?)'",webpage).group(1)
|
info = json.loads(info_json)
|
||||||
title = re.search(r"sVidTitle: '(.+)',",webpage).group(1)
|
video_url = info['videoUri']
|
||||||
ext = video_url.split('.')[-1]
|
m_youtube = re.search(r'(https?://www\.youtube\.com/watch\?v=.*)', video_url)
|
||||||
|
if m_youtube is not None:
|
||||||
|
return self.url_result(m_youtube.group(1), 'Youtube')
|
||||||
|
final_url = video_url + '?' + info['AuthToken']
|
||||||
return [{
|
return [{
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': final_url,
|
'url': final_url,
|
||||||
'ext': ext,
|
'ext': determine_ext(final_url),
|
||||||
'title': title,
|
'title': info['contentName'],
|
||||||
'thumbnail': thumbnail_url,
|
'thumbnail': info['thumbUri'],
|
||||||
}]
|
}]
|
||||||
|
|
Loading…
Reference in a new issue