Scraping Forbes and RateMyProfessors to Create a College Recommendation App

Will Markowitz
Posted on Oct 17, 2017

College Recommendation App

I created a web application using data collected from Forbes and RateMyProfessors as a tool for prospective college students and their families. The application conveniently synthesizes general statistics with student sentiment at elite American colleges and universities.

The user is able to input their SAT score, budget, desired student body size and/or preferred state in order to find schools that would be an appropriate match. From those schools, the user can select two and see how the RateMyProfessors ratings are trending over time in any given rating category as well as a side-by-side comparison of the schools with statistics from Forbes and average ratings from RateMyProfessors.

The application was created using R Shiny and is available here.

                           

 

Scraping Procedure

  1. Forbes is scraped, generating a list of the top 100 colleges and additional information such as location, SAT range and costs associated with attending the school.
  2. The names of the schools are then queried into the RateMyProfessors school search. The correct search result is identified and the URL is saved.
  3. Finally, each RateMyProfessors URL is visited, and every review on the page is collected. A review consists of ratings on categories (e.g., happiness, food, internet, opportunities) on a scale from one to five.

Scraping Software

The data was scraped using the Selenium and Beautiful Soup Python packages.

When a school's review page is visited on RateMyProfessors, 20 reviews at most are visible in the browser or the HTML code. To load 20 more reviews, the user must click the “Load More” button located at the bottom of the page. In order to load all the reviews, the user must repeat this process until the “Load More” button disappears.

While Selenium in general is a slower scraping method, it is necessary in this case.  The Selenium WebDriver Object interacts with the webpage by locating the “Load More” button and continuing to click that button until all school reviews are visible in the HTML code.

Once fully loaded, the entire HTML code is saved as an Object which Beautiful Soup can then parse. It is possible to do this parsing in Selenium, but Beautiful Soup is much faster.

Scraping Techniques

Two techniques were integral in the scraping of RateMyProfessors and can be useful in scraping numerous other websites. I have described them below. 

Adblock

RateMyProfessors has numerous advertisements that significantly increase the page load time and in some instances inhibit the browser’s ability to scroll on the page without exiting out of the ads. Even if you have an adblocker installed on your normal browser, the automated Selenium browser will not have it installed automatically. The following code snippet adds AdBlockPlus to an automated Chrome browser.

Scrolling and Clicking

The Selenium click command does not execute unless the load button is scrolled into the browser’s current view. The normal Selenium commands for scrolling an element into view were not responding; however, Selenium commands did yield the correct location of the button. I used the following code to execute the JavaScript command that loads the desired location into view, and subsequently uses Selenium to click the button.

 

 

 

 

About Author

Related Articles

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

2019 airbnb alumni Alumni Interview Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Big Data Book Launch Book-Signing bootcamp Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Industry Experts Job Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest recommendation recommendation system regression Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Tableau TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp