Sandbox: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
<html> | |||
<div> | |||
const axios = require('axios') | |||
const https = require('https'); | |||
== | const req = axios.create({ | ||
[ | httpsAgent: new https.Agent({ | ||
rejectUnauthorized: false | |||
}) | |||
}); | |||
req.get('https://www.nodeka.com') | |||
.then((response) => { | |||
const strings = response.data.split("\n") | |||
const playerRegex = /<font color="white"><strong>(\d+)<\/strong><\/font>/ | |||
strings.forEach((string) => { | |||
const found = string.match(playerRegex); | |||
if (found) { | |||
console.log("found", found[1]); // eslint-disable-line | |||
} | |||
}) | |||
}) | |||
.catch((error) => { | |||
console.error(error) | |||
}); | |||
</div> | </div> | ||
</html> | |||
</ | |||
Latest revision as of 14:03, 1 October 2020
const axios = require('axios')
const https = require('https');
const req = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
});
req.get('https://www.nodeka.com')
.then((response) => {
const strings = response.data.split("\n")
const playerRegex = /(\d+)<\/strong><\/font>/
strings.forEach((string) => {
const found = string.match(playerRegex);
if (found) {
console.log("found", found[1]); // eslint-disable-line
}
})
})
.catch((error) => {
console.error(error)
});