added correct hash retrieval

This commit is contained in:
arichi 2016-12-06 21:16:06 +08:00
parent 875ddd7409
commit ac6e69cde4

View File

@ -5,12 +5,14 @@ from .common import InfoExtractor
from ..compat import ( from ..compat import (
compat_str, compat_str,
compat_urlparse, compat_urlparse,
compat_urllib_request,
) )
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
float_or_none, float_or_none,
parse_duration, parse_duration,
str_to_int, str_to_int,
urlencode_postdata,
) )
@ -56,6 +58,13 @@ class PandoraTVIE(InfoExtractor):
r'^v(\d+)[Uu]rl$', format_id, 'height', default=None) r'^v(\d+)[Uu]rl$', format_id, 'height', default=None)
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()
ret = compat_urllib_request.urlopen("http://m.pandora.tv/?c=api&m=play_url", data=post_data).read()
encoding = self._guess_encoding_from_content('json', ret)
ret = self._parse_json(ret.decode(encoding, errors='ignore'), video_id)
format_url = ret['url']
formats.append({ formats.append({
'format_id': '%sp' % height, 'format_id': '%sp' % height,
'url': format_url, 'url': format_url,