From 85741b998660bfb1564ca2c02e233db42059be05 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sergey=20M=E2=80=A4?= Date: Sat, 14 Mar 2015 15:52:06 +0600 Subject: [PATCH] [8tracks] Use predefined avg duration when duration is negative (Closes #5200) --- youtube_dl/extractor/eighttracks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/youtube_dl/extractor/eighttracks.py b/youtube_dl/extractor/eighttracks.py index fb5dbbe2b..869ff72d6 100644 --- a/youtube_dl/extractor/eighttracks.py +++ b/youtube_dl/extractor/eighttracks.py @@ -117,6 +117,9 @@ class EightTracksIE(InfoExtractor): track_count = data['tracks_count'] duration = data['duration'] avg_song_duration = float(duration) / track_count + # duration is sometimes negative, use predefined avg duration + if avg_song_duration <= 0: + avg_song_duration = 300 first_url = 'http://8tracks.com/sets/%s/play?player=sm&mix_id=%s&format=jsonh' % (session, mix_id) next_url = first_url entries = [] -- 2.39.5