about summary refs log tree commit diff
path: root/youtube_dl/extractor/tudou.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-08-05 23:07:52 +0600
committerSergey M․ <dstftw@gmail.com>2015-08-05 23:07:52 +0600
commit238755752f4f9169a1edda91067c8627afe19cce (patch)
tree29d13381c54278b5abd9eea50af5cf54089cec63 /youtube_dl/extractor/tudou.py
parentc71a3195afa8c2a9ed5fe0ffa56ff6c969147d91 (diff)
downloadyoutube-dl-238755752f4f9169a1edda91067c8627afe19cce.tar.gz
youtube-dl-238755752f4f9169a1edda91067c8627afe19cce.tar.xz
youtube-dl-238755752f4f9169a1edda91067c8627afe19cce.zip
[tudou] Extract player URL from the webpage
Diffstat (limited to 'youtube_dl/extractor/tudou.py')
-rw-r--r--youtube_dl/extractor/tudou.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/extractor/tudou.py b/youtube_dl/extractor/tudou.py
index 9b934cb57..84fe71aef 100644
--- a/youtube_dl/extractor/tudou.py
+++ b/youtube_dl/extractor/tudou.py
@@ -30,7 +30,7 @@ class TudouIE(InfoExtractor):
     }]
 
     _PLAYER_URL = 'http://js.tudouui.com/bin/lingtong/PortalPlayer_177.swf'
-	
+
     def _url_for_id(self, id, quality=None):
         info_url = "http://v2.tudou.com/f?id=" + str(id)
         if quality:
@@ -56,6 +56,10 @@ class TudouIE(InfoExtractor):
         thumbnail_url = self._search_regex(
             r",pic:\s*[\"'](.+?)[\"']", webpage, 'thumbnail URL', fatal=False)
 
+        player_url = self._search_regex(
+            r"playerUrl\s*:\s*['\"](.+?\.swf)[\"']",
+            webpage, 'player URL', default=self._PLAYER_URL)
+
         segs_json = self._search_regex(r'segs: \'(.*)\'', webpage, 'segments')
         segments = json.loads(segs_json)
         # It looks like the keys are the arguments that have to be passed as
@@ -79,7 +83,7 @@ class TudouIE(InfoExtractor):
                 'title': title,
                 'thumbnail': thumbnail_url,
                 'http_headers': {
-                    'Referer': self._PLAYER_URL,
+                    'Referer': player_url,
                 },
             }
             result.append(part_info)