use _download_json to get play_url

This commit is contained in:
arichi 2016-12-07 00:09:05 +08:00
parent 6033d40011
commit 50b6909db6

View File

@ -12,6 +12,7 @@ from ..utils import (
float_or_none, float_or_none,
parse_duration, parse_duration,
str_to_int, str_to_int,
urlencode_postdata,
) )
@ -58,10 +59,13 @@ class PandoraTVIE(InfoExtractor):
if not height: if not height:
continue continue
post_data = ('prgid=%s&runtime=%s&vod_url=%s' % (video_id, info.get('runtime'), format_url)).encode() post_data = {'prgid': video_id, 'runtime': info.get('runtime'), 'vod_url': format_url}
data = compat_urllib_request.urlopen("http://m.pandora.tv/?c=api&m=play_url", data=post_data).read() play_url = self._download_json('http://m.pandora.tv/?c=api&m=play_url', video_id,
encoding = self._guess_encoding_from_content('json', data) data=urlencode_postdata(post_data),
play_url = self._parse_json(data.decode(encoding, errors='ignore'), video_id) headers={
'Origin': url,
'Content-Type': 'application/x-www-form-urlencoded'
})
format_url = play_url.get('url') format_url = play_url.get('url')
if not format_url: if not format_url:
continue continue