-
-
Save Yiin/1cbc08e680674a708287979a3a62bdef to your computer and use it in GitHub Desktop.
This file contains 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 characters
// ==UserScript== | |
// @name Unnamed Script 760860 | |
// @version 1 | |
// @grant GM.xmlHttpRequest | |
// ==/UserScript== | |
(async () => { | |
const rows = [...document.querySelectorAll('#overview > tbody > tr')]; | |
const promises = rows | |
.filter(el => el.querySelector('.iReport.iReport8')) | |
.map((el, index) => new Promise(resolve => { | |
setTimeout(() => { | |
console.log('parsing', `${index + 1}/${rows.length}`); | |
GM.xmlHttpRequest({ | |
url: el.querySelector('.iReport + div > a').href, | |
method: 'GET', | |
onload(response) { | |
const parser = new DOMParser(); | |
const page = parser.parseFromString(response.responseText, 'text/html'); | |
const info = `${page.querySelector('.player').innerHTML.trim()} : ${el.querySelector('.dat').innerHTML.trim()}`; | |
resolve(info); | |
}, | |
onerror() { | |
console.log('error'); | |
resolve(); | |
}, | |
}); | |
}, index * parseInt(Math.floor(Math.random() * 500) + 500)); | |
})); | |
Promise.all(promises).then(data => data && console.log(data.join('\n'))); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment