Sandbox: Difference between revisions

From Nodeka Wiki
Jump to navigation Jump to search
(Created page with "<includeonly><div class="mainpage-header nomobile"> <div class="header-intro"> <h1>Welcome to the RuneScape Wiki.</h1> <p>We are the official ''RuneScape'' encyclo...")
 
No edit summary
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
<includeonly><div class="mainpage-header nomobile">
<html>
<div class="header-intro">
<div>
    <h1>Welcome to the RuneScape Wiki.</h1>
const axios = require('axios')
     <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 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>
<div class="header-stats">
</html>
    <ul>
        <li>Number of articles: '''{{NUMBEROFARTICLES}}'''</li>
        <li>Number of files: '''{{NUMBEROFFILES}}'''</li>
        <li>Number of active editors: '''{{NUMBEROFACTIVEUSERS}}'''</li>
        <li>Number of edits: '''{{NUMBEROFEDITS}}'''</li>
    </ul>
</div>
</div></includeonly><noinclude>{{/doc}}</noinclude>

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) });