{"id":19662422,"url":"https://github.com/qsctech/jw-scraper-rs","last_synced_at":"2025-04-28T21:32:01.426Z","repository":{"id":57672872,"uuid":"170518321","full_name":"QSCTech/jw-scraper-rs","owner":"QSCTech","description":"浙江大学教务网爬虫库","archived":true,"fork":false,"pushed_at":"2019-09-28T06:36:46.000Z","size":140,"stargazers_count":6,"open_issues_count":0,"forks_count":6,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-06T11:47:42.996Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QSCTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-13T14:07:48.000Z","updated_at":"2024-11-20T11:27:19.000Z","dependencies_parsed_at":"2022-08-31T12:50:37.920Z","dependency_job_id":null,"html_url":"https://github.com/QSCTech/jw-scraper-rs","commit_stats":null,"previous_names":["qsctech/jw-parser"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QSCTech%2Fjw-scraper-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QSCTech%2Fjw-scraper-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QSCTech%2Fjw-scraper-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QSCTech%2Fjw-scraper-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QSCTech","download_url":"https://codeload.github.com/QSCTech/jw-scraper-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251391254,"owners_count":21582135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T16:11:10.785Z","updated_at":"2025-04-28T21:32:00.706Z","avatar_url":"https://github.com/QSCTech.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"### ZJU-JWB scraper \n\n[![Build status](https://img.shields.io/travis/QSCTech/jw-scraper-rs/master.svg)](https://travis-ci.org/QSCTech/jw-scraper-rs)\n[![Coverage Status](https://coveralls.io/repos/github/QSCTech/jw-scraper-rs/badge.svg?branch=master)](https://coveralls.io/github/QSCTech/jw-scraper-rs?branch=master)\n[![Crate version](https://img.shields.io/crates/v/zju-jw-scraper.svg)](https://crates.io/crates/zju-jw-scraper)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/QSCTech/jw-scraper-rs/blob/master/LICENSE)\n[![Rust Docs](https://docs.rs/zju-jw-scraper/badge.svg)](https://docs.rs/zju-jw-scraper)\n\n#### service\n\n```rust,ignore\n#[async_trait]\npub trait JWService {\n    type Err;\n    async fn login(\u0026self, stu_id: \u0026str, password: \u0026str) -\u003e Result\u003cString, Self::Err\u003e;\n    async fn get_course_info(\u0026self, code: \u0026str) -\u003e Result\u003cCourseInfo, Self::Err\u003e;\n    async fn get_courses(\n        \u0026self,\n        stu_id: \u0026str,\n        school_year: SchoolYear,\n        semester: CourseSemester,\n        cookie: \u0026str,\n    ) -\u003e Result\u003cVec\u003cCourse\u003e, Self::Err\u003e;\n    async fn get_exams(\n        \u0026self,\n        stu_id: \u0026str,\n        school_year: SchoolYear,\n        semester: ExamSemester,\n        cookie: \u0026str,\n    ) -\u003e Result\u003cVec\u003cExam\u003e, Self::Err\u003e;\n    async fn get_scores(\u0026self, stu_id: \u0026str, cookie: \u0026str) -\u003e Result\u003cVec\u003cScore\u003e, Self::Err\u003e;\n    async fn get_major_scores(\n        \u0026self,\n        stu_id: \u0026str,\n        cookie: \u0026str,\n    ) -\u003e Result\u003cVec\u003cMajorScore\u003e, Self::Err\u003e;\n    async fn get_total_credit(\u0026self, stu_id: \u0026str, cookie: \u0026str) -\u003e Result\u003cf32, Self::Err\u003e;\n}\n```\n\nThe `JWService` is implemented for all types which implements [`interfacer_http::HttpClient`](https://docs.rs/interfacer-http/0.2/interfacer_http/trait.HttpClient.html).\n\nYou can refer to `src/test.rs` for all use cases.\n\n#### client\n\nYou can use this crate with `client` feature, like this:\n\n```toml\nzju-jw-scraper = { version = \"0.2\", features = [\"client\"] }\n```\n\nThen, you can use default client provided by `interfacer-http-hyper`:\n\n```rust,no_run\nuse zju_jw_scraper::{client::client, JWService};\n\n#[tokio::test]\nasync fn test_login() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let service = client(\"http://jwbinfosys.zju.edu.cn\".parse()?);\n    let cookie = service.login(\"319000000\", \"test\").await?;\n    assert!(!cookie.is_empty());\n    Ok(())\n}\n```\n\nHowever, the default client can only handle requests on HTTP, if you want to use other protocol like HTTPS, you need other [`Connect`](https://docs.rs/hyper/0.13.0-alpha.1/hyper/client/connect/trait.Connect.html).\n\nAs the example `connector`:\n\n```rust,no_run\nuse hyper_tls::HttpsConnector;\nuse zju_jw_scraper::{client::client_on, JWService};\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let service = client_on(\"https://jw.zjuqsc.com\".parse()?, HttpsConnector::new()?);\n    let cookie = service.login(\"319000000\", \"test\").await?;\n    assert!(!cookie.is_empty());\n    Ok(())\n}\n\n```\n\n#### test\n\nRun basic tests:\n\n```bash\ncargo test\n```\n\nTo test this crate fully, create a config file `test-settings.toml`, and fill it referring to `test-settings.toml.sample`. Then run tests:\n\n```bash\ncargo test --all --all-features\n```\n\nAs an alternative, you can configure tests using environment variables with prefix `TEST_`.\n\n```bash\nTEST_stu_id=3190000000 cargo test --all --all-features\n```\n\n\u003e Environment variables always have higher priority.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqsctech%2Fjw-scraper-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqsctech%2Fjw-scraper-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqsctech%2Fjw-scraper-rs/lists"}