LodestonerEx v1.0.0 LodestonerEx.Client.Character
Provides functionality surrounding both locating a character’s lodestone ID and scraping character info for a particular lodestone id.
Summary
Functions
Scrape achievements for a particular lodestone ID
Retrieve the character info for a particular lodestone ID.
Parameters
lodestone_id
: The character lodestone ID as a string
Retrieve lodestone ID for given Server/Name Combo
Functions
Scrape achievements for a particular lodestone ID.
Note that this is a pretty heavy operation. Achievements are only shown
20 at a time, and Lodestone is notoriously slow. I’ve done my best by
spawning all the requests and parsing via Task.async/1
and reducing
the results. However, you’ll be opening a lot of connections, so
be careful.
Paramaters
lodestone_id
: The character’s lodestone ID as a string.
Returns
A list of maps. See examples.
Examples
iex> LodestonerEx.Client.Character.achievements!("6128486") |> List.first
%{date: %DateTime{calendar: Calendar.ISO, day: 25, hour: 3, microsecond: {0, 0},
minute: 59, month: 10, second: 51, std_offset: 0, time_zone: "Etc/UTC",
utc_offset: 0, year: 2016, zone_abbr: "UTC"},
icon: "http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/63/63eff52f13b87097fd1ac2fc2bd5e9fbef35924c.png?1473652662",
id: "1594", name: "Floor the Horde"}
iex> LodestonerEx.Client.Character.achievements!("6128486") |> List.last
%{date: %DateTime{calendar: Calendar.ISO, day: 10, hour: 20,
microsecond: {0, 0}, minute: 58, month: 1, second: 52, std_offset: 0,
time_zone: "Etc/UTC", utc_offset: 0, year: 2014, zone_abbr: "UTC"},
icon: "http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/66/66ebf6f40f5d7259d4bf9cbb5b52bfb1aa77b06f.png?1473652658",
id: "323", name: "All the More Region to Leve I"}
iex> LodestonerEx.Client.Character.achievements!("6128486") |> Enum.count
398
Retrieve the character info for a particular lodestone ID.
Parameters
lodestone_id
: The character lodestone ID as a string.
Returns
See examples.
Raises
LodestonerEx.Client.ClientError
if any of the following occur:
- Lodestone returns a non-200 HTTP response.
Examples
iex(1)> LodestonerEx.Client.Character.info!("15893891")
%{attributes: %{dex: 24, int: 21, mnd: 17, pie: 21, str: 22, vit: 23},
avatar_url: "http://img2.finalfantasyxiv.com/f/ccef11a9d5cb981df3c3c20f6d209229_284358f8eb4efc9095914e46798c6ab3fc0_96x96.jpg?1478634220",
city_state: "Gridania", clan: "Midlander",
classes: %{alchemist: %{level: "-", xp: %{current: "-", next: "-"}},
arcanist: %{level: "-", xp: %{current: "-", next: "-"}},
archer: %{level: "1", xp: %{current: "0", next: "300"}},
armorer: %{level: "-", xp: %{current: "-", next: "-"}},
astrologian: %{level: "-", xp: %{current: "-", next: "-"}},
blacksmith: %{level: "-", xp: %{current: "-", next: "-"}},
botanist: %{level: "-", xp: %{current: "-", next: "-"}},
carpenter: %{level: "-", xp: %{current: "-", next: "-"}},
conjurer: %{level: "-", xp: %{current: "-", next: "-"}},
culinarian: %{level: "-", xp: %{current: "-", next: "-"}},
dark_knight: %{level: "-", xp: %{current: "-", next: "-"}},
fisher: %{level: "-", xp: %{current: "-", next: "-"}},
gladiator: %{level: "-", xp: %{current: "-", next: "-"}},
goldsmith: %{level: "-", xp: %{current: "-", next: "-"}},
lancer: %{level: "-", xp: %{current: "-", next: "-"}},
leatherworker: %{level: "-", xp: %{current: "-", next: "-"}},
machinist: %{level: "-", xp: %{current: "-", next: "-"}},
marauder: %{level: "-", xp: %{current: "-", next: "-"}},
miner: %{level: "-", xp: %{current: "-", next: "-"}},
pugilist: %{level: "-", xp: %{current: "-", next: "-"}},
rogue: %{level: "-", xp: %{current: "-", next: "-"}},
thaumaturge: %{level: "-", xp: %{current: "-", next: "-"}},
weaver: %{level: "-", xp: %{current: "-", next: "-"}}},
current_class: "Archer",
elements: %{earth: 52, fire: 50, ice: 54, lightning: 52, water: 52, wind: 53},
free_company: nil, gender: "male", grand_company: [nil, nil],
guardian: "Halone, the Fury", minions: [], mounts: [],
name: "Derplander Defaultus", nameday: "1st Sun of the 1st Astral Moon",
portrait_url: "http://img2.finalfantasyxiv.com/f/ccef11a9d5cb981df3c3c20f6d209229_284358f8eb4efc9095914e46798c6ab3fl0_640x873.jpg?1478634220",
race: "Hyur", server: "Coeurl", title: ""}
iex> LodestonerEx.Client.Character.info!("404_me")
** (LodestonerEx.Client.ClientError) "Got an HTTP 404 status from "http://na.finalfantasyxiv.com/lodestone/character/404_me/"
Retrieve lodestone ID for given Server/Name Combo.
Parameters
server_name
: The server or world name, e.g."Gilgamesh"
full_character_name
: Space seperated first and last name, e.g."Derplander Default"
Returns
- String.t The lodestone ID.
Raises
LodestonerEx.Client.ClientError
if any of the following occur:
- Lodestone returns a non-200 HTTP response.
- No characters are found by the search.
Multiple characters are found by the search.
The last reason generally means that the exact first and last name does not exist on that world/server. However, some characters with the first or last name exist.
Examples
iex> LodestonerEx.Client.Character.lodestone_id!("Gilgamesh", "Krin Starrion")
"6128486"
iex> LodestonerEx.Client.Character.lodestone_id!("Gilgamesh", "Gobble Gobble")
** (LodestonerEx.Client.ClientError) Found multiple characters. Usually means no such character exists.
iex> LodestonerEx.Client.Character.lodestone_id!("Gilgamesh", "Goobly Gook")
** (LodestonerEx.Client.ClientError) Found no such character.
iex> LodestonerEx.Client.Character.lodestone_id!("Nonsense", "404_me")
** (LodestonerEx.Client.ClientError) "Got an HTTP 404 status from "http://na.finalfantasyxiv.com/lodestone/character?q=404_me&worldname=Nonsense"