Skip to content

Instantly share code, notes, and snippets.

@Oshibuki
Created May 18, 2023 22:34
Show Gist options
  • Select an option

  • Save Oshibuki/2f5cbd8cc05b74615246150c15dd464f to your computer and use it in GitHub Desktop.

Select an option

Save Oshibuki/2f5cbd8cc05b74615246150c15dd464f to your computer and use it in GitHub Desktop.

Revisions

  1. Oshibuki created this gist May 18, 2023.
    23 changes: 23 additions & 0 deletions mbwarlord.js
    Original 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".