Include length in player cache ID
authorPhilipp Hagemeister <phihag@phihag.de>
Fri, 4 Oct 2013 09:36:04 +0000 (11:36 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Fri, 4 Oct 2013 09:36:06 +0000 (11:36 +0200)
Some videos use the same player with IDs of multiple lengths.
See https://travis-ci.org/rg3/youtube-dl/jobs/12126506#L319 for an example.

youtube_dl/extractor/youtube.py

index 39ff33290cc617f853026712cece2155c335f5fb..1101011ea38aedc4d2a46aecb3c357861e441929 100644 (file)
@@ -1037,12 +1037,13 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
 
         if player_url is not None:
             try:
-                if player_url not in self._player_cache:
+                player_id = (player_url, len(s))
+                if player_id not in self._player_cache:
                     func = self._extract_signature_function(
                         video_id, player_url, len(s)
                     )
-                    self._player_cache[player_url] = func
-                func = self._player_cache[player_url]
+                    self._player_cache[player_id] = func
+                func = self._player_cache[player_id]
                 if self._downloader.params.get('youtube_print_sig_code'):
                     self._print_sig_code(func, len(s))
                 return func(s)