jmelesky 7 лет назад
Родитель
Сommit
7220da06da
1 измененных файлов с 11 добавлено и 20 удалено
  1. 11 20
      src/main.rs

+ 11 - 20
src/main.rs

@@ -10,18 +10,6 @@ fn main() {
 
 
 fn scrape_feats(url: &str) {
-    // let bookstrs = [
-    //     "ACG",
-    //     "APG",
-    //     "ARG",
-    //     "ISWG",
-    //     "OA",
-    //     "UC",
-    //     "UI",
-    //     "(see the Pathfinder RPG Advanced Player's Guide)"
-    // ];
-
-    // commenting out -- going local for a bit
     let resp = reqwest::get(url).unwrap();
     assert!(resp.status().is_success());
 
@@ -29,9 +17,6 @@ fn scrape_feats(url: &str) {
 
     //let doc = Document::from(include_str!("/home/jmelesky/code/featscraper/assets/feats.html"));
 
-    // compile this regex once, not once per node
-    let re_uppers = Regex::new(r"[A-Z]{2}").unwrap();
-
     let mut header = true;
     for node in doc.find(Name("tr")) {
         // skip the first one
@@ -56,11 +41,7 @@ fn scrape_feats(url: &str) {
             let prereqs = prereqs.trim();
 
 
-            // print only the ones with two consecutive uppercase letters
-            // in the prereqs -- figure out what to trim
-            if re_uppers.is_match(prereqs) {
-                println!("|{}|{}|{}|", featname, prereqs, featurl);
-            }
+            println!("|{}|{}|{}|", featname, prereqs, featurl);
         }
     }
 
@@ -69,3 +50,13 @@ fn scrape_feats(url: &str) {
 
 
 
+// list of "book strings" to strip eventually:
+// ACG
+// APG
+// ARG
+// ISWG
+// OA
+// UC
+// UI
+// (see the Pathfinder RPG Advanced Player's Guide)
+