Last active
November 14, 2021 14:15
-
-
Save Oppodelldog/7fef5c23d859facec3f18debdd463e06 to your computer and use it in GitHub Desktop.
work on rune word data from diablo2.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://diablo2.io/runewords/ | |
let data = []; | |
document.querySelectorAll(".inner .element-item").forEach((recipe)=>{ | |
let title = recipe.querySelector(".z-uniques-title").innerHTML; | |
let url = recipe.querySelector(".z-uniques-title").href; | |
let level = parseInt(recipe.querySelector(".zso_rwlvlrq").innerHTML); | |
let sockets = parseInt(recipe.querySelector(".z-vf-hide .zso_rwsock").innerText) | |
let item = recipe.querySelector("a.z-white").innerText; | |
let runes = []; | |
recipe.querySelectorAll(".z-recipes").forEach((rune)=>{ | |
runes.push(rune.innerHTML); | |
}) | |
data.push({ | |
title, | |
url, | |
level, | |
runes, | |
sockets, | |
item | |
}) | |
}) | |
let jsonData = JSON.stringify(data) | |
console.log(jsonData) | |
goSyntax=jsonData.substring(1) | |
goSyntax=goSyntax.substring(0, goSyntax.length - 1) | |
.replaceAll(`[`,"{").replaceAll(`]`,"}") | |
.replaceAll(`"title":`,"Title:") | |
.replaceAll(`"url":`,"Url:") | |
.replaceAll(`"level":`,"Level:") | |
.replaceAll(`"runes":`,"Runes:[]string") | |
.replaceAll(`"sockets":`,"Sockets:") | |
.replaceAll(`"item":`,"Item:") | |
console.log(goSyntax) |
fix sockets add conversion to go syntax
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add number of sockets and item type