diff options
author | Tithen-Firion <Tithen-Firion@users.noreply.github.com> | 2014-12-04 14:12:09 +0100 |
---|---|---|
committer | Tithen-Firion <Tithen-Firion@users.noreply.github.com> | 2014-12-04 14:16:09 +0100 |
commit | 2415951ead0c4996d7892ef859d06970c4595701 (patch) | |
tree | 41dd4adbb9f7fcf6c6f62f94912520c799d2224e | |
parent | 995ad69c54899a0cfc84fd89083f07919acdbb83 (diff) |
[tvp] Modernize
-rw-r--r-- | youtube_dl/extractor/tvp.py | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/youtube_dl/extractor/tvp.py b/youtube_dl/extractor/tvp.py index bd7ee25a0..cf21d1202 100644 --- a/youtube_dl/extractor/tvp.py +++ b/youtube_dl/extractor/tvp.py @@ -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 = [ |