summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2015-01-10 05:51:07 +0100
committerPhilipp Hagemeister <[email protected]>2015-01-10 05:51:07 +0100
commitf71fdb0acc0e168d2a5e4f60be96217647cc872e (patch)
tree5be2b5f4886548eed3015207dbf464ef71ab52e8
parentc24dfef63c55ef1a5424d11b485c3b76245448a4 (diff)
downloadyoutube-dl-f71fdb0acc0e168d2a5e4f60be96217647cc872e.tar.gz
youtube-dl-f71fdb0acc0e168d2a5e4f60be96217647cc872e.zip
[eighttracks] Improve waiting (#3954)
-rw-r--r--youtube_dl/extractor/eighttracks.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/youtube_dl/extractor/eighttracks.py b/youtube_dl/extractor/eighttracks.py
index 9df2141c3..a9b18195b 100644
--- a/youtube_dl/extractor/eighttracks.py
+++ b/youtube_dl/extractor/eighttracks.py
@@ -4,11 +4,12 @@ from __future__ import unicode_literals
import json
import random
import re
-import time
from .common import InfoExtractor
from ..compat import (
compat_str,
+)
+from ..utils import (
ExtractorError,
)
@@ -115,7 +116,7 @@ class EightTracksIE(InfoExtractor):
mix_id = data['id']
track_count = data['tracks_count']
duration = data['duration']
- avg_song_duration = duration / track_count
+ avg_song_duration = float(duration) / track_count
first_url = 'http://8tracks.com/sets/%s/play?player=sm&mix_id=%s&format=jsonh' % (session, mix_id)
next_url = first_url
entries = []
@@ -136,7 +137,7 @@ class EightTracksIE(InfoExtractor):
raise
else:
download_tries += 1
- time.sleep(avg_song_duration)
+ self._sleep(avg_song_duration, playlist_id)
api_data = json.loads(api_json)
track_data = api_data['set']['track']