Sandbox: Difference between revisions

From Nodeka Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
<div class="header-intro">
<html>
    <h1>Welcome to the RuneScape Wiki.</h1>
<div>
    <p>We are the official ''[[RuneScape]]'' encyclopaedia, written and maintained by the players. Since [[RuneScape:About|our start]] in 2005, we've become the largest and most comprehensive reference for the game, with {{NUMBEROFARTICLES}} articles and counting.</p>
const axios = require('axios')
</div>
const https = require('https');
<div class="header-stats">
 
     <ul>
const req = axios.create({
        <li>Number of articles: '''{{NUMBEROFARTICLES}}'''</li>
  httpsAgent: new https.Agent({
        <li>Number of files: '''{{NUMBEROFFILES}}'''</li>
    rejectUnauthorized: false
        <li>Number of active editors: '''{{NUMBEROFACTIVEUSERS}}'''</li>
  })
        <li>Number of edits: '''{{NUMBEROFEDITS}}'''</li>
});
    </ul>
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) });