lodestone 0.5.0

A website wrapper for FFXIV's lodestone.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use failure::Error;
use select::document::Document;

use crate::CLIENT;

/// The URL base for profiles.
static BASE_PROFILE_URL: &str = "https://na.finalfantasyxiv.com/lodestone/character/";

pub(crate) fn load_url(user_id: u32, subpage: Option<&str>) -> Result<Document, Error> {
    let subpage = match subpage {
        None => "".to_string(),
        Some(v) => format!("{}/", v)
    };
    let mut response = CLIENT.get(&format!("{}{}/{}", BASE_PROFILE_URL, user_id, subpage)).send()?;
    let text = response.text()?;
    Ok(Document::from(text.as_str()))
}