guitarplayer616

parseEnchants

Jul 22nd, 2021
1,015
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function parse_enchants(data) {
  2.     trs = document.querySelectorAll("#lv-spells > div.listview-scroller-horizontal > div > table > tbody > tr")
  3.     for (var tr of trs) {
  4.         var row = []
  5.         row.push(tr.querySelector("td:nth-child(2) > div > a").text)
  6.         for (var i=1;i<=4;i++){
  7.             row.push(tr.querySelector("td:nth-child(5) > div:nth-child(2) > span.r"+String(i))?.textContent)
  8.         }
  9.         tr.querySelectorAll("td:nth-child(3) > div > a, span > div:nth-child(1)").forEach(element => element?.href? row.push(element.href) : row.push(element.innerHTML))
  10.        
  11.         data.push(row)
  12.     }
  13.     return data
  14. }
RAW Paste Data