IonicaBizau / scrape-it

🔮 A Node.js scraper for humans.

Home Page:http://ionicabizau.net/blog/30-how-to-write-a-web-scraper-in-node-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blocked by CORS policy

mgsotelo opened this issue · comments

Hi @IonicaBizau

I am having an issue while getting results from a list of pages... this is my code so far

 for (const index in links) {
        //console.log(links[index])
        scrapeIt(links[index],{
            data:{
                jobTitle: "section.detalle_oferta header h1",
                jobDescription: "section.detalle_oferta div.box_i ul li",
                jobSummary: "article.dOffer section.box_r ul li p"
            }
        }).then( data => {
            console.log(data)
        })
    }

and this is the error that I'm getting on the console...

Access to fetch at https url from origin 'http://localhost:8080' http localhost has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

It seems to be related to this issue here but I can't find any way to make it work with scrape-it ... Any idea on how can I solve it?

Solved using a chrome extension 👍

@mgsotelo What was the extension?

Solved it with the cors-anywhere heroku app