]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[tvp] Modernize
authorTithen-Firion <Tithen-Firion@users.noreply.github.com>
Thu, 4 Dec 2014 13:12:09 +0000 (14:12 +0100)
committerTithen-Firion <Tithen-Firion@users.noreply.github.com>
Thu, 4 Dec 2014 13:16:09 +0000 (14:16 +0100)
youtube_dl/extractor/tvp.py

index bd7ee25a0bb13287695708d1819511d3b5fef61f..cf21d120242696db316071e1b6508ec771de1e08 100644 (file)
@@ -127,26 +127,15 @@ class TvpSeriesIE(InfoExtractor):
         }
     ]
 
-    def _force_download_webpage(self, url, v_id, tries=0):
-        if tries >= 5:
-            raise ExtractorError(
-                '%s: Cannot download webpage, try again later' % v_id)
-        # Sometimes happen, but in my tests second try always succeeded
-        try:
-            return self._download_webpage(url, v_id)
-        except IncompleteRead as e:
-            return self._force_download_webpage(url, v_id, tries+1)
-    
     def _real_extract(self, url):
         display_id = self._match_id(url)
-        webpage = self._force_download_webpage(url, display_id)
+        webpage = self._download_webpage(url, display_id, tries=5)
         title = self._html_search_regex(
-            r'(?s) id=[\'"]path[\'"]>(.*?)</span>', webpage, 'series')
-        title = title.split(' / ', 2)[-1]
+            r'(?s) id=[\'"]path[\'"]>(?:.*? / ){2}(.*?)</span>', webpage, 'series')
         playlist_id = self._search_regex(r'nodeId:\s*(\d+)', webpage, 'playlist id')
-        playlist = self._force_download_webpage(
+        playlist = self._download_webpage(
             'http://vod.tvp.pl/vod/seriesAjax?type=series&nodeId=%s&recommend'
-            'edId=0&sort=&page=0&pageSize=1000000' % playlist_id, display_id)
+            'edId=0&sort=&page=0&pageSize=10000' % playlist_id, display_id, tries=5)
         videos_paths = re.findall(
             '(?s)class="shortTitle">.*?href="(/[^"]+)', playlist)
         entries = [