|
@@ -1,3 +1,37 @@
|
|
|
+extern crate reqwest;
|
|
|
+extern crate select;
|
|
|
+
|
|
|
+use select::document::Document;
|
|
|
+use select::predicate::Name;
|
|
|
+
|
|
|
+
|
|
|
fn main() {
|
|
|
- println!("Hello, world!");
|
|
|
+ scrape_feats("http://www.archivesofnethys.com/Feats.aspx?Category=Combat");
|
|
|
}
|
|
|
+
|
|
|
+fn scrape_feats(url: &str) {
|
|
|
+
|
|
|
+ let resp = reqwest::get(url).unwrap();
|
|
|
+ assert!(resp.status().is_success());
|
|
|
+
|
|
|
+ let doc = Document::from_read(resp).unwrap();
|
|
|
+
|
|
|
+ let mut header = true;
|
|
|
+ for node in doc.find(Name("tr")) {
|
|
|
+ // skip the first one
|
|
|
+ if header {
|
|
|
+ header = false;
|
|
|
+ } else {
|
|
|
+ let name = node.find(Name("td")).next().unwrap().text();
|
|
|
+ let prereqs = node.find(Name("td")).next().unwrap().text();
|
|
|
+ let benefit = node.find(Name("td")).next().unwrap().text();
|
|
|
+
|
|
|
+ println!("|{}|{}|{}|\n", name, prereqs, benefit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|