Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

UsualT

New Coder
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 :

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
 
Back
Top Bottom