mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-16 10:32:40 +09:00
[pluralsight] Clarify and randomize ViewClip sleep interval
This commit is contained in:
parent
bea56c9569
commit
38eb2968ab
@ -1,6 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import random
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
@ -156,9 +157,17 @@ class PluralsightIE(PluralsightBaseIE):
|
|||||||
format_id = '%s-%s' % (ext, quality)
|
format_id = '%s-%s' % (ext, quality)
|
||||||
clip_url = self._download_webpage(
|
clip_url = self._download_webpage(
|
||||||
request, display_id, 'Downloading %s URL' % format_id, fatal=False)
|
request, display_id, 'Downloading %s URL' % format_id, fatal=False)
|
||||||
# #6989: sleep 3 seconds to avoid 429 errors.
|
|
||||||
# should help with #6842.
|
# Pluralsight tracks multiple sequential calls to ViewClip API and start
|
||||||
self._sleep(3, display_id)
|
# to return 429 HTTP errors after some time (see
|
||||||
|
# https://github.com/rg3/youtube-dl/pull/6989). Moreover it may even lead
|
||||||
|
# to account ban (see https://github.com/rg3/youtube-dl/issues/6842).
|
||||||
|
# To somewhat reduce the probability of these consequences
|
||||||
|
# we will sleep random amount of time before each call to ViewClip.
|
||||||
|
self._sleep(
|
||||||
|
random.randint(2, 5), display_id,
|
||||||
|
'%(video_id)s: Waiting for %(timeout)s seconds to avoid throttling')
|
||||||
|
|
||||||
if not clip_url:
|
if not clip_url:
|
||||||
continue
|
continue
|
||||||
f.update({
|
f.update({
|
||||||
|
Loading…
Reference in New Issue
Block a user