Created
May 18, 2023 22:34
-
-
Save Oshibuki/2f5cbd8cc05b74615246150c15dd464f to your computer and use it in GitHub Desktop.
Revisions
-
Oshibuki created this gist
May 18, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ 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".