ArtScraper: A Python library to scrape online artworks
ArtScraper is a Python library to download images and metadata for artworks available on WikiArt and Google Arts & Culture.
pip install https://github.com/sodascience/artscraper.git
Downloading images from WikiArt
To download data from WikiArt it is necessary to obtain free API keys.
Once you have the API keys, you can simply run the code below to download the images and metadata of the three artworks of Aleksandra Ekster.
# artworks to scrape some_links = [ "https://www.wikiart.org/en/aleksandra-ekster/women-s-costume-1918", "https://www.wikiart.org/en/aleksandra-ekster/still-life-1913", "https://www.wikiart.org/en/aleksandra-ekster/view-of-paris-1912" ] # download images and metadata to the folder "data" with WikiArtScraper(output_dir="data") as scraper: for url in some_links: scraper.load_link(url) scraper.save_metadata() scraper.save_image()
Downloading images from Google Art & Culture
To download data from Google Art & Culture you need to download Firefox and geckodriver. The installation instructions can be found in our GitHub repository.
Once you have Firefox and geckodriver, you can simply run the code below to download artworks. You are not allowed to share or publish the images. Use them only for research.
# artworks to scrape some_links = [ "https://artsandculture.google.com/asset/helena-hunter-fairytales/dwFMypq0ZSiq6w", "https://artsandculture.google.com/asset/erina-takahashi-and-isaac-hernandez-in-fantastic-beings-laurent-liotardo/MQEhgoWpWJUd_w", "https://artsandculture.google.com/asset/rinaldo-roberto-masotti/swG7r2rgfvPOFQ" ] # If you are on Windows, you can download geckodriver, place it in your directory, # and use the argument geckodriver_path="geckodriver.exe" with GoogleArtScraper("data") as scraper: for url in some_links: scraper.load_link(url) scraper.save_metadata() scraper.save_image()
You can find more examples here
Do you want to know more about this library? Check our GitHub repository
Are you using it for academic work? Please cite our package:
Schram, Raoul, Garcia-Bernardo, Javier, van Kesteren, Erik-Jan, de Bruin, Jonathan, & Stamkou, Eftychia. (2022). ArtScraper: A Python library to scrape online artworks (0.1.1). Zenodo. https://doi.org/10.5281/zenodo.7129975