I'm trying to extract some java script from TripAdvisor to find some geoInfo codes that they use in order to find some restaurants in different towns.
To do this I want to visit a few pages and scrape the geoName and parentName from the following bit of the page:
geoInfo: {
geoId: 31743, geoName: `'London', parentName: 'United `States', shortParentName: 'United States',
I am using BeautifulSoup because I have used it with great success for other projects, but I'm struggling to get these variables out.
The code above sits inside a tag on a geo search page, e.g.:
https://www.tripadvisor.co.uk/Search?geo=31743
I've tried stuff like, for example:
parentname = soup.findAll('script', {'geoInfo': 'parentName'}).string
...but with no luck on any variation, just can't seem to get it out of the page.
Any help very much appreciated!
Thanks for reading :)
