1
0
Fork
You've already forked scraper
0
A brief script to report on defined elements over SAP pages.
This repository has been archived on 2022年08月16日. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Python 100%
Find a file
2021年03月17日 10:48:01 +00:00
.gitignore Scraping quotes; first working version 2020年07月14日 14:52:32 +01:00
artists.py Change from urllib to requests 2020年07月24日 09:02:58 +01:00
LICENSE Initial commit: functioning script with basic documentation 2020年07月03日 17:00:02 +01:00
README.md Update README.md 2021年03月17日 10:48:01 +00:00
requirements.txt Updated requirements.txt 2020年07月24日 09:04:54 +01:00

Samling Artists web scraper

Update!

This was created as a time-saving solution when I worked at Samling Institute for Young Artists, which I left in December 2020. They have since launched a new website, so this script is now redundant. The last archived version of the site this script was designed to work with is here.

Main README contents

This brief webscraper loops through the unique URLs of every Samling Artist and reports defined elements into a csv file.

Run as a Python script, either by typing:

$ ./artists.py or $ python artists.py

Allow up to ~15 minutes for a complete scrape, though it will typically run much quicker than this. This script does not raise exceptions. For dependencies, see requirements.txt.

Current behaviour

The scraper reads http://www.samling.org.uk/samling-artist-programme/artists/ for a list of all Samling Artists. From this, it extracts the artist's name and the URL of their local profile page. It then loops through each URL and reads the h2/sub-heading text which should conform to a set pattern: <VoiceType, Samling Artist Programme: Year>. It then checks for the presence of an image. Finally, it checks for the presence of a quote and, if present, saves this.

This data is then appended to a csv file in the current working directory, reporting six headers: Name, URL, Voice-type/Instrument, SAP-Year, IMG, Quote.

Useful side effects

If the sub-header text does not match the pattern above, the scraper continues but the inconsistency is easily identified by the incorrect presence of the string 'Samling Artist Programme:' (or similar) and the 'IMG' response will be in the wrong column.

Recent changes

The inclusion of the quote scraping is new. It currently converts all commas from ',' to '[comma]' within the quote, so the csv output is not troubled. This can be overcome better (to allow commas within the quote strings), and will likely be revised.