Scraping Forbes and RateMyProfessors to Create a College Recommendation App

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

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI