From 69630ac3fd67fd83d7b0ea2d01691daebfc9eb3b Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Tue, 31 Dec 2024 15:05:30 +0100 Subject: [PATCH] undo bot modification --- scripts/generate_link_lists.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scripts/generate_link_lists.py b/scripts/generate_link_lists.py index 82cc7761..69586dd3 100644 --- a/scripts/generate_link_lists.py +++ b/scripts/generate_link_lists.py @@ -499,3 +499,35 @@ def complete_zenodo_data(zenodo_url): """ zenodo_data = read_zenodo(zenodo_url) entry = {} + urls = [zenodo_url] + + if 'doi_url' in zenodo_data.keys(): + doi_url = zenodo_data['doi_url'] + + # Add DOI URL to the URLs list if it's not already there + if doi_url not in urls: + urls.append(doi_url) + entry['url'] = urls + + if 'metadata' in zenodo_data.keys(): + metadata = zenodo_data['metadata'] + # Update entry with Zenodo metadata and statistics + entry['name'] = metadata['title'] + if 'publication_date' in metadata.keys(): + entry['publication_date'] = metadata['publication_date'] + if 'description' in metadata.keys(): + entry['description'] = remove_html_tags(metadata['description']) + if 'creators' in metadata.keys(): + creators = metadata['creators'] + entry['authors'] = [c['name'] for c in creators] + if 'license' in metadata.keys(): + entry['license'] = metadata['license']['id'] + + if 'stats' in zenodo_data.keys(): + entry['num_downloads'] = zenodo_data['stats']['downloads'] + + return entry + + +if __name__ == "__main__": + main()