Use self._parse_json
This commit is contained in:
parent
d553c324dd
commit
c7af4ad90b
@ -23,15 +23,16 @@ class TunepkIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
html = webpage.replace('\n\r', '').replace('\r', '').replace('\n', '').replace('\\', '')
|
html = webpage.replace('\n\r', '').replace('\r', '').replace('\n', '').replace('\\', '')
|
||||||
sources = re.compile('"sources"\s*:\s*\[(.+?)\]').findall(html)[0]
|
player = re.compile('"player"\s*:\s*(\{.+?\]\}\})').findall(html)[0]
|
||||||
sources = re.compile("{(.+?)}").findall(sources)
|
config = self._parse_json(player, video_id)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
for source in sources:
|
for source in config.get('sources'):
|
||||||
video_link = str(re.compile('"file":"(.*?)"').findall(source)[0])
|
video_link = source.get('file')
|
||||||
video_type = str(re.compile('"type":"(.*?)"').findall(source)[0])
|
video_type = source.get('type')
|
||||||
video_bitrate = str(re.compile('"bitrate":(\d+)').findall(source)[0])
|
video_bitrate = str(source.get('bitrate'))
|
||||||
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': video_link,
|
'url': video_link,
|
||||||
'ext': video_type,
|
'ext': video_type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user