Skip to content

Commit

Permalink
fixed IndexError
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawween committed Oct 15, 2024
1 parent 2414d32 commit a1e9530
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stages/python/02_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ def extract_metadata(doi):
if response.status_code == 200:
data = response.json()['message']
title = data.get('title', [None])[0]
journal = data.get('container-title', [None])[0]
journal = data.get('container-title', [])
journal = journal[0] if journal else None
authors = data.get('author', [])
all_authors = ', '.join([f"{author['given']} {author['family']}" for author in authors]) if authors else None
return {'title': title, 'journal': journal, 'author': all_authorsauthor}
return {'title': title, 'journal': journal, 'author': all_authors}
return {'title': None, 'journal': None, 'author': None}

input_dir = Path('brick')
Expand Down

0 comments on commit a1e9530

Please sign in to comment.