diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2015-01-10 02:26:21 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2015-01-10 02:26:21 +0100 |
commit | ff21a8e0ee43d4ce0b75cd938f9bdfab664dd579 (patch) | |
tree | a5cc60c1f3ed96beee2df443acdd2bda3c545ab3 /youtube_dl/extractor/common.py | |
parent | 904fffffebcf26b8004d6298001f17236857a5d8 (diff) | |
parent | 2415951ead0c4996d7892ef859d06970c4595701 (diff) |
Merge remote-tracking branch 'Tithen-Firion/master'
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r-- | youtube_dl/extractor/common.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index b4cd59e43..cd155a090 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -376,9 +376,19 @@ class InfoExtractor(object): return content - def _download_webpage(self, url_or_request, video_id, note=None, errnote=None, fatal=True): + def _download_webpage(self, url_or_request, video_id, note=None, errnote=None, fatal=True, tries=1, timeout=5): """ Returns the data of the page as a string """ - res = self._download_webpage_handle(url_or_request, video_id, note, errnote, fatal) + success = False + try_count = 0 + while success is False: + try: + res = self._download_webpage_handle(url_or_request, video_id, note, errnote, fatal) + success = True + except compat_http_client.IncompleteRead as e: + try_count += 1 + if try_count >= tries: + raise e + self._sleep(timeout, video_id) if res is False: return res else: |