Skip to content

Commit

Permalink
Handle case where internet archive id is invalid or no longer available
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVinyard committed Jan 24, 2019
1 parent f0b69ef commit e178bca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zounds/datasets/internetarchive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import urlparse
from zounds.soundfile.audio_metadata import AudioMetaData
from simplejson.decoder import JSONDecodeError


class InternetArchive(object):
Expand Down Expand Up @@ -51,7 +52,11 @@ def __iter__(self):
base_url, '/details/{archive_id}&output=json'.format(**locals()))
resp = requests.get(url)

all_files = resp.json()['files']
try:
all_files = resp.json()['files']
except JSONDecodeError as e:
all_files = dict()

for k, v in all_files.iteritems():
if self.format_filter(v):
sound_url = urlparse.urljoin(
Expand Down

0 comments on commit e178bca

Please sign in to comment.