Giter VIP home page Giter VIP logo

scrapers's Introduction

Scrapers for Professor Ratings and Reviews

Scrapers should all extend the WebScraper class which supports Object based output as well as JSON based output. These methods have a couple of thrown exceptions. NoResultsException will be thrown if the query didn't find any professors, and IOException will be thrown from network troubles.

Usage

You can download the code and builder the jar using the maven jar, but a simpler method is to use jitpack.io to include this repo as a dependency for your project.

ratemyprofessors.com

Use the RateMyProfessorWebScaper to scrape for results from rmp. Note the school formatting is very specific for rmp so you must use a constant from the School enum.

import edu.cpp.hci.scrapers.rmp.RateMyProfessorWebScaper;
import edu.cpp.hci.scrapers.rmp.dto.professor.impl.RateMyProfessorProfessor;
import edu.cpp.hci.scrapers.constants.School;
import edu.cpp.hci.scrapers.exceptions.NoResultsException;

import java.util.List;

public class Example {
    public static void main(String[] args) {
        RateMyProfessorWebScaper scrapper = new RateMyProfessorWebScaper("Yu Sun", School.CAL_POLY_POMONA);
        
        try {
            List<RateMyProfessorProfessorDTO> objectResult = scrapper.getData();
            String jsonResult = scrapper.getJson();
            System.out.println(jsonResult);
        } catch (IOException | NoResultsException e) {
            e.printStackTrace();
        }
    }
}

Output:

[{"id":1943004,"overallQuality":5.0,"levelOfDifficulty":2.0,"wouldTakeAgain":1.0,"ratings":[{"id":28009667,"date":"04/06/2017","description":"awesome","overallQuality":5,"levelOfDifficulty":2,"className":"CS480","forCredit":"Yes","attendance":"Not Mandatory","textBookUsed":"No","wouldTakeAgain":"Yes","gradeReceived":"A","tags":["Caring","GROUP PROJECTS","LOTS OF HOMEWORK"],"ratingText":"Dr Sun is knowledgeable about the subject and communicates clearly, both verbally and through presentation materials. Live coding demos in class and energetic lecture keep the class interesting. Workload, however, is as much as you want to put in. If you are motivated to learn a lot about Software Engineering quickly, he is a good choice.","foundHelpful":0,"foundUnhelpful":0},{"id":27809149,"date":"02/06/2017","description":"awesome","overallQuality":5,"levelOfDifficulty":2,"className":"CS480","forCredit":"N/A","attendance":"Not Mandatory","textBookUsed":"No","wouldTakeAgain":"Yes","gradeReceived":"A","tags":["Inspirational","GROUP PROJECTS","Caring"],"ratingText":"Best Software Engineering professor at CPP.  Only class you'll take that means anything outside of college.","foundHelpful":1,"foundUnhelpful":0}]}]

scrapers's People

Contributors

zkysar avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

scrapers's Issues

Implement DAO

We have to implement a DAO to store and access our data in a database. We can implement this once we decide the rest of our tech stack.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.