ljosberinn/keystone-heroes

[Feature]: extend trinket tracking

Closed this issue · 1 comments

script to parse wowhead:

function getData() {
    const itemName = document.querySelector('h1.heading-size-1').textContent
   
    const icon = document.querySelector('ins[style]').style.backgroundImage.replace('url("https://wow.zamimg.com/images/wow/icons/small/', '').replace('.jpg")', '')
    const key = itemName.split(' ').join('_').toUpperCase().replace("\'S", 'S').replace('\'', '').replace(':', '')

    
    const spellLink = document.querySelector('table a[href].q2')
    const useDescription = spellLink.parentElement
    const spellID = Number.parseInt(spellLink.href.replace('https://www.wowhead.com/spell=', '').split('/')[0])

    
    return JSON.stringify({
        [key]: {
            ids: [spellID],
            icon,
            name: itemName,
            type: ["cast"],
            cd: useDescription.textContent
        }
    }).slice(1, -1)
}

getData()