Created
March 12, 2023 09:19
-
-
Save Paulooh007/b9aafb42293794e40c21eac930c8bfc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import internetarchive as ia | |
# Create a session and search for items with CC BY-NC-SA 4.0 license | |
session = ia.search_items('licenseurl:"http://creativecommons.org/licenses/by-nc-sa/4.0/"') | |
# Print the number of items found | |
print(f'Found {session.num_found} items with CC BY-NC-SA 4.0 license.') | |
# Define fields to be retrieved for each item | |
fields = ["identifier", "title", "collection", "downloads", "description", "date"] | |
# Retrieve details for each item and print the download count | |
for item in session: | |
identifier = item['identifier'] | |
results = ia.search_items(f"identifier:{identifier}", fields=fields) | |
for result in results: | |
print(f"The item {identifier} has {result['downloads']} downloads.") | |
print(result) | |
# Found 96179 items with CC BY-NC-SA 4.0 license. | |
# #The item 001HistoriaInternetP1 has 931 downloads. | |
# # { | |
# # 'date': '2019-04-01T00:00:00Z', | |
# # 'identifier': '001HistoriaInternetP1', | |
# # 'downloads': 931, | |
# # 'description': 'Episódio numero um do versão beta explicando a história da internet', | |
# # 'collection': ['podcasts_miscellaneous', 'podcasts'], | |
# # 'title': 'História da Internet - Parte 1' | |
# # } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment