Hello to all,
I'm a beginner in node js and I could use some help. I want to scrap some data to display them on a local website. For the moment I have created a small script that allows me to retrieve my ip via a site. I would like to be able to display on a web page this result as well as customize the display of this page
here is my script to scrape my ip :
Thank you in advance for your answer
I'm a beginner in node js and I could use some help. I want to scrap some data to display them on a local website. For the moment I have created a small script that allows me to retrieve my ip via a site. I would like to be able to display on a web page this result as well as customize the display of this page
here is my script to scrape my ip :
Code:
const puppeteer = require("puppeteer");
(async function f() {
const browser = await puppeteer.launch({ headless : true , args: [ '--proxy-server=' ]});
const page = await browser.newPage();
await page.goto('https://nordvpn.com/fr/what-is-my-ip/', {waiUntil: "networkidle2"});
const data = await page.evaluate(() => {
let elements = document.querySelector('body > div.Page.d-flex.flex-column.overflow-hidden > div:nth-child(2) > div > div > div > div > div > div > div.col-xs-12.col-sm-6.mb-7.mb-sm-0 > h3.Title.h3.mb-6.js-ipdata-ip-address').innerText;
return elements;
});
f();
console.log("Mon ip est : " + data);
await browser.close();
})();
Thank you in advance for your answer