Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function parse_x_enchants(count, data) {
- var pages = Math.ceil(count/50)
- for (var i = 0; i<pages; i++){
- parse_enchants(data)
- document.querySelector("#lv-spells > div.listview-band-top > div.listview-nav > a:nth-child(5)").click()
- }
- return data
- }
- function parse_all(data) {
- parse_enchants(data)
- while (document.querySelector("#lv-spells > div.listview-band-top > div.listview-nav > a:nth-child(5)").getAttribute('data-active') === "yes") {
- document.querySelector("#lv-spells > div.listview-band-top > div.listview-nav > a:nth-child(5)").click()
- parse_enchants(data)
- }
- return data
- }
- function parse_enchants(data) {
- var trs = document.querySelectorAll("#lv-spells > div.listview-scroller-horizontal > div > table > tbody > tr")
- for (var tr of trs) {
- var row = []
- row.push(tr.querySelector("td:nth-child(2) > div > a").text)
- for (var i=1;i<=4;i++){
- row.push(tr.querySelector("td:nth-child(5) > div:nth-child(2) > span.r"+String(i))?.textContent)
- }
- 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))
- row.push(tr.querySelector("td:nth-child(4)")?.textContent)
- data.push(row)
- }
- return data
- }
- var data = []
- parse_x_enchants(385, data)
- console.log(JSON.stringify(data))
Add Comment
Please, Sign In to add comment