Skip to content

Instantly share code, notes, and snippets.

@matt40k
Created April 24, 2022 19:40
Show Gist options
  • Save matt40k/b8d856df7c2fdf7a765040c5994c87cc to your computer and use it in GitHub Desktop.
Save matt40k/b8d856df7c2fdf7a765040c5994c87cc to your computer and use it in GitHub Desktop.
Download the Wahapedia CSV exports
$baseUri = "http://wahapedia.ru/wh40k9ed/"
$r = (Invoke-WebRequest -Uri "$($baseUri)Last_update.csv" -UseBasicParsing).Content | ConvertFrom-Csv -Delimiter "|" -Header "last_update" | Select-Object -Skip 1
$lastUpdated = $r.last_update
$factions = (Invoke-WebRequest -Uri "$($baseUri)Factions.csv" -UseBasicParsing).Content | ConvertFrom-Csv -Delimiter "|" -Header "id", "name", "link" | Select-Object -Skip 1
$datasheets = (Invoke-WebRequest -Uri "$($baseUri)Datasheets.csv" -UseBasicParsing).Content | ConvertFrom-Csv -Delimiter "|" -Header "id", "name", "link", "faction_id", "source_id", "role", "unit_composition", "transport", "power_points", "priest", "psyker", "open_play_only", "crusade_only", "virtual", "cost_per_unit", "Cost" | Select-Object -Skip 1
$wargear = (Invoke-WebRequest -Uri "$($baseUri)Wargear_list.csv" -UseBasicParsing).Content | ConvertFrom-Csv -Delimiter "|" -Header "id", "name", "type", "description", "source_id", "is_relic", "faction_id", "legend" | Select-Object -Skip 1
$datasheetWargear = (Invoke-WebRequest -Uri "$($baseUri)Datasheets_wargear.csv" -UseBasicParsing).Content | ConvertFrom-Csv -Delimiter "|" -Header "datasheet_id", "line", "wargear_id", "is_index_wargear", "cost", "model", "is_upgrade" | Select-Object -Skip 1
$model = (Invoke-WebRequest -Uri "$($baseUri)Datasheets_models.csv" -UseBasicParsing).Content | ConvertFrom-Csv -Delimiter "|" -Header "datasheet_id", "line", "name", "M", "WS", "BS", "S", "T", "W", "A", "Ld", "Sv", "Cost", "cost_description", "models_per_unit", "cost_including_wargear", "base_size", "base_size_descr" | Select-Object -Skip 1
$factions
$datasheets
$wargear
$datasheetWargear
$model
$lastUpdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment