]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[pandoratv] Fix extraction (closes #11023)
authorSerkora <Serkora@users.noreply.github.com>
Wed, 7 Dec 2016 16:46:42 +0000 (00:46 +0800)
committerSergey M <dstftw@gmail.com>
Wed, 7 Dec 2016 16:46:42 +0000 (23:46 +0700)
youtube_dl/extractor/pandoratv.py

index 2b07958bb1f5815a162dadadff4f450f7ea0e97d..3e37ae01d2e28ddf9600f46bc79aa27dd0c62c3c 100644 (file)
@@ -5,12 +5,14 @@ from .common import InfoExtractor
 from ..compat import (
     compat_str,
     compat_urlparse,
+    compat_urllib_request,
 )
 from ..utils import (
     ExtractorError,
     float_or_none,
     parse_duration,
     str_to_int,
+    urlencode_postdata,
 )
 
 
@@ -56,6 +58,18 @@ class PandoraTVIE(InfoExtractor):
                 r'^v(\d+)[Uu]rl$', format_id, 'height', default=None)
             if not height:
                 continue
+
+            post_data = {'prgid': video_id, 'runtime': info.get('runtime'), 'vod_url': format_url}
+            play_url = self._download_json('http://m.pandora.tv/?c=api&m=play_url', video_id, 
+                data=urlencode_postdata(post_data), 
+                headers={
+                    'Origin': url,
+                    'Content-Type': 'application/x-www-form-urlencoded'
+            })
+            format_url = play_url.get('url')
+            if not format_url:
+                continue
+
             formats.append({
                 'format_id': '%sp' % height,
                 'url': format_url,