Coder Social home page Coder Social logo

ucsd-historical-enrollment-data / webreg_scraper Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 585 KB

A scraper and API for WebReg, UCSD's course enrollment system.

Home Page: https://github.com/ewang2002/webreg_scraper

License: MIT License

Rust 75.65% TypeScript 22.72% Shell 1.62%
ucsd-webreg ucsd hacktoberfest

webreg_scraper's People

Contributors

ewang2002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mr4tt

webreg_scraper's Issues

Get days, time, building, etc. of courses

Hi Wang, I was using your webreg_scraper and I found that it was not collecting the days, start time, end time and some other attributes in the output file. I would like to get them in the result, how can I do so? I tried to go through the code but I know nothing about Rust. It seems like the webweg wrapper is imported somehow into this repo and its functions(SearchRequestBuilder) are used to get those data. Could you guide me through this?

Thank you

Allow ability to not scrape data for a specific term.

This can be made a configuration option. For each term, define a property "collectData" that can either be true if we want to collect enrollment data and false otherwise.

This is useful if we're only interested in exposing a term to the web server.

npm i -g typescript not working

While this is not a problem with the program itself, I just wanted to see if you encountered the same problem when setting this up

npm i -g typescript
npm ERR! code ECONNREFUSED
npm ERR! syscall connect
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to http://registry.npmjs.org/typescript failed, reason: connect ECONNREFUSED xxxx:xxxx::xxxx:xxxx:xx

I suspect its something to do with npm not able to connect via ipv6 but I'm not completely sure.

Schedule API Access, "personal" feature gate

First, we should introduce a new feature called personal. This feature only works if the api feature is enabled. The idea is that this feature, if enabled, allows the user to access data specific to their account (hence the "personal" name). For example, the user will be able to get their schedule through an endpoint in the API if the personal feature is enabled. We can also use this opportunity to add endpoints like enrolling in classes automatically.

As mentioned above, we should give the user the ability to access their own schedule using the API. This endpoint's code is very similar to the code used by the other endpoints, the only difference being that there's a feature gate on the corresponding code.

Might be worth wrapping the Response object from a get request in a function like the one below

That way, we can be more consistent with what the wrapper is returning.

/// Processes a GET response from the resulting JSON, if any.
///
/// # Parameters
/// - `res`: The initial response.
///
/// # Returns
/// The result of processing the response.
async fn _process_get_result<T: DeserializeOwned>(
    &self,
    res: Result<Response, Error>,
) -> Result<T, Cow<'a, str>> {
    match res {
        Err(e) => Err(e.to_string().into()),
        Ok(r) => {
            if !r.status().is_success() {
                return Err(r.status().to_string().into());
            }
            let text = match r.text().await {
                Err(e) => return Err(e.to_string().into()),
                Ok(s) => s,
            };
            match serde_json::from_str(&text) {
                Err(e) => return Err(e.to_string().into()),
                Ok(o) => o,
            }
        }
    }
}

Scrapers should record last scrape time

Currently, there's no way for us to tell when a scraper last requested data. It would be nice if we could store when we last requested data so we can see, for example, if the scraper is "frozen."

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.