https://github.com/vivyir/trackermeta
small library to parse module metadata from the website modarchive
https://github.com/vivyir/trackermeta
library rust scraper webscraping
Last synced: 5 months ago
JSON representation
small library to parse module metadata from the website modarchive
- Host: GitHub
- URL: https://github.com/vivyir/trackermeta
- Owner: vivyir
- License: mpl-2.0
- Created: 2021-06-30T14:34:12.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-11T21:07:10.000Z (about 1 year ago)
- Last Synced: 2024-12-20T05:26:17.365Z (6 months ago)
- Topics: library, rust, scraper, webscraping
- Language: Rust
- Homepage:
- Size: 98.6 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trackermeta
[](https://github.com/vivyir/trackermeta/blob/master/LICENSE)
[](https://crates.io/crates/trackermeta)
This is a simple library crate that helps with scraping metadata from the website called [Mod Archive](https://modarchive.org).
It works by parsing the returned HTML and providing the data programmatically, if you have an API key from the Mod Archive please use the XML fork of this library ([Modark](https://github.com/RepellantMold/modark)) by RepellantMold.Please be sure to donate to [the Mod Archive's hosting fund](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=28NK9DJQRRNGJ) if you use this for any significant amount of time, as scraping data is sure to put strain on their servers and every cent counts!<3
⚠️ This library uses the [`ureq`](https://crates.io/crates/ureq) crate for web requests and isn't back-end agnostic nor asynchronous. Even though `ureq` is a pretty lightweight library if you find a need for those please make an issue!
## Examples
In the following example the program will search for the file name provided by the user and display the data for the closest match.
```rust
use trackermeta::ModInfo;fn main() {
let args: Vec = std::env::args().collect();
match args.get(1).unwrap_or(&"".into()).as_ref() {
"get" => {
// Returns the first 40 search results, here we'll pick the closest match, if none exist this will panic!
let mod_id = ModInfo::resolve_filename(
args.get(2)
.expect("No filename provided as second argument."),
)
.unwrap()[0].id;let mod_info = ModInfo::get(mod_id).unwrap();
println!("{:#?}", mod_info);
println!("Download link: {}", mod_info.get_download_link());
}
_ => println!("Usage: trackermeta get "),
}
}
```Check out the [examples](examples) directory on the github repo for all examples using the library!
## Roadmap
- Improve code ergonomics and refactor idiomatically
- Better error handling
- Add the ability to traverse paginated searches
- Add more search functions## License
This project is licenced under the [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/).