I have a list of URLs I want to loop over and get the prices. I was doing it with Python but the website is blocking the script. I tried it with Chrome Dev. Tools and it was working fine. I do not have any experience with JavaScript to do it. I have a simple code where I want to loop over the URLs, extract the prices and store into a JSON file on my local PC like this. Prices
{
'link': link,
'prices' span[class="price"],
'sku': td[data-th="SKU"]
}
Code:
const urls = [
'https://www.fahorro.com/3-a-ofteno-1-mg-oft-5-ml-gotas.html',
'https://www.fahorro.com/zamoprax-0-25-mg-c2-con-30-tabletas.html'
];
urls.forEach(function(url) {
fetch(url).then(response => response.text())
.then(data => console.log(data));;
});
When it comes to parsing queries, I rely on the qs library (https://www.npmjs.com/package/qs). Can you please take a look at the package and see if can help you.