If I look page source, I see "unusual" attribute value:
class = "bma-fly flying {{= flyingStatus(it.m_status) }}
Usually for me this is:
class = "value"
After loaded page, if I use button "Inspect", I see:
class = "bma-fly flying flying-won-team2 flying-past"
Now question, how get information with use Node.js from this "unusual" attribute value, if I use cheerio (jquery), but see nothing???
For example:
request(link, function(err, resp, html) {
if (!err){
const $ = cheerio.load(html);
let info = $("div.bma-fly.flying.flying-won-team2.flying-past");
fs.writeFileSync("4.txt" , info); // nothing
}
})
Moreover, on page use cloudflare's anti-ddos protection, may be this is important.
So, on page you have:
<div class = "bma-fly flying flying-won-team2 flying-past"> la la la </div>
<div class = "bma-fly flying flying-won-team2 flying-past"> kyrlik kyrkik </div>
<div class = "bma-fly flying flying-won-team2 flying-past"> bo bo bo </div>
<div class = "bma-fly flying flying-won-team2 flying-past"> info </div>
<div class = "bma-fly flying flying-won-team2 flying-past"> privet chelovek </div>
And you want see all information.
Code for that with use node.js and puppeteer:
const puppeteer = require('puppeteer');
var fs = require('fs');
var link = "www. IIpuBeT Dpyr . com";
(async () => {
console.log("Get info");
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(link);
});
const text = await page.evaluate(() => {
return [...document.body.querySelectorAll('.bma-fly.flying.flying-won-team2.flying-past')]
.map(element => element.innerText)
.join('\n');
});
console.log(text);
fs.writeFileSync("nameFile.txt" , text);
browser.close();
})();
more informationt there: https://github.com/GoogleChrome/puppeteer/issues/1897