1
votes

I am trying to scrape information off websites like this:

https://www.glassdoor.com/Overview/Working-at-7-Eleven-EI_IE3581.11,19.htm

using python + beautifulsoup + mechanize.

Accessing anything on the main-site is no problem. However, I also need the information that appears in a overlay-window that appears when one clicks on the "Rating Trends" button next to the bar with stars.

This overlay-window can also be accessed directly by using the url:

https://www.glassdoor.com/Reviews/7-Eleven-Reviews-E3581.htm#trends-overallRating

The html associated with this page is a modification of the original site's html.

However, regardless of what element I try to find (via findAll ) on that overlay-window website, beautifulsoup returns zero hits.

How can I fix this? I tried adding a sleep time between accessing the website and reading anything in, to no avail.

Thanks!

1

1 Answers

0
votes

If you're using the Chrome browser select the background of that page (without the additional information displayed) and select 'Inspect' from the context menu (for Windows anyway), then the 'Network' tab, so that you can see network traffic. Now click on 'Rating trends'. The entry marked 'xhr' will be https://www.glassdoor.ca/api/employer/3581-rating.htm?locationStr=&jobTitleStr=&filterCurrentEmployee=false&filterEmploymentStatus=REGULAR&filterEmploymentStatus=PART_TIME (I much hope!) and its contents will be the following.

{"employerId":3581,"ratings":[{"hasRating":true,"type":"overallRating","value":2.9},{"hasRating":true,"type":"ceoRating","value":0.54},{"hasRating":true,"type":"bizOutlook","value":0.35},{"hasRating":true,"type":"recommend","value":0.4},{"hasRating":true,"type":"compAndBenefits","value":2.4},{"hasRating":true,"type":"cultureAndValues","value":2.5},{"hasRating":true,"type":"careerOpportunities","value":2.5},{"hasRating":true,"type":"workLife","value":2.4},{"hasRating":true,"type":"seniorManagement","value":2.3}],"week":0,"year":0}

Whether this URL can be altered for use in obtaining information for other employers, I regret, I cannot tell you.