So this is my first time programming, I’m trying to create a scraper that pulls text, I’m trying to follow along with a YouTube video but I’m getting different results, when running my code it only gives this:
PS C:Usersbasje> & 'g:codingvs codefilesDiscord Gta Botscrapers.js'
which is just the file location of the file.
i ran the code by clicking the 3 dots on the terminal and pressing “Run Active File”
i did import puppeteer and made an empty packaged json
here are the code and YouTube video for reference
const puppeteer = require('puppeteer');
async function scrapeProduct(url) {
const browser = await puppeteer.launch();
const page = await browser.newPage()
await page.goto(url)
const[el] = await page.$x('//*[@id="productTitle"]')
const txt = await el.getProperty('textContent');
const rawTxt = await txt.JsonValue();
console.log({srcTxt, rawTxt});
}
scrapeProduct('https://www.amazon.nl/SKYLEO-Bureaulamp-Aanraakbediening-helderheidsniveaus-
geheugenfunctie/dp/B0CG17QTVS?ref_=ast_slp_dp&th=1&psc=1');