Created
May 18, 2023 22:34
-
-
Save Oshibuki/2f5cbd8cc05b74615246150c15dd464f to your computer and use it in GitHub Desktop.
mbwarlord equipment price get
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
let items = Array.from(document.getElementsByClassName("item_block")) | |
let result = [] | |
items.forEach(i=>{ | |
try { | |
let name = i.querySelector('.item_title').innerText | |
pricetag = i.querySelector('.gold') || i.querySelector('.item_cost_expensive') | |
let price =parseInt(pricetag.innerText) | |
worthtag = i.querySelector('.attr_value') | |
let worth =parseInt(worthtag.innerText) | |
result.push([name,price,worth]) | |
} catch (error) { | |
console.log(name) | |
} | |
}) | |
let csvContent = "data:text/csv;charset=utf-8," | |
+ result.map(e => e.join(",")).join("\n"); | |
var encodedUri = encodeURI(csvContent); | |
var link = document.createElement("a"); | |
link.setAttribute("href", encodedUri); | |
link.setAttribute("download", "my_data.csv"); | |
document.body.appendChild(link); // Required for FF | |
link.click(); // This will download the data file named "my_data.csv". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment