Web scraping The Crag

The Crag is a platform for logging and detailing rock climbing areas and routes. The contect is user generated and well structured making it perfect for web-scraping. The method used to web scrape is to fetch website data using Requests and parsed using Beautiful Soup.

pic

Data from every page needs to be feched from The Crag. This handy function does exactly that.

The data in The Crag is structured as follows:

Country > States > Regions > Areas > Crags

To start with we need a list of urls for every State in the Country and every Region in every state. These can both be achieved with the function below:

The yellow arrow has a link to the list of climbs in the state. By right clicking on the yellow arrow and selecting inspect element in Chrome we can see that first we need to find all of the "div" ekements with the class "area". Then, for each area, the url is in the "a" element which has the class "mappin located".

ghgf

For each crag we need:

The name and number of routes can be found from the correct elements and the URL can be founf from the same method as before.

The GPS co-ordinates are in a seperate guide page for the crag. This function gets that page and searches for 'Lat / Long:' in every

element. Once found the coordinates are returned.

Code to get all climbing areas in Australia: