wikidata 1.1.0

A library for working with Wikidata in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use wikidata::*;

fn main() {
    for i in 1_usize.. {
        let uri = format!(
            "https://www.wikidata.org/wiki/Special:EntityData/Q{}.json",
            i
        );
        let res = reqwest::blocking::get(uri).unwrap();
        let text = res.text().unwrap();
        if text.contains("<h1>Not Found</h1><p>No entity with ID ") {
            continue;
        }
        let ent = Entity::from_json(serde_json::from_str(&text).unwrap()).unwrap();
        let _ = ent;
        println!("verified Q{}", i);
    }
}