1

There is a way in React to do web scraping without using a server that takes care of this.

I would like to use only React.

I was trying to use casperjs but it seems to give me problems on react when I set it, it can't find the module.

10
  • Not sure what you mean without using server. But have you taken a look at the requests? Maybe you can grab your data a different way? Commented May 29, 2019 at 18:20
  • 1
    @antfuentes87: if i try to do a fetch in react, i can't make it cors problems. Commented May 29, 2019 at 18:23
  • Can you link the website? And what data are you trying to scrape? Probably easier if I just take a look. Commented May 29, 2019 at 19:59
  • @antfuentes87: I speak in general there is no specific site, I would simply like to be able to do scraping in react as I do in react-native. But in react-native there are no cors problems, instead in react yes because it runs on a browser. Commented May 30, 2019 at 9:05
  • Oh ok, I understand now. You are using react to do the actual scraping. I am honestly not sure about all that (never done it). But you may just want to use something different? Python perhaps? Probably be a lot easier. Commented May 30, 2019 at 16:11

2 Answers 2

1

As i understand, web scraping is process of gathering information (not data), from web pages.

Short answer: It is not always possible because of cross site scripting.

Long answer: The problem of gathering usefull information from pages with other domain name is that, server that serves specific domain have to explicitly define that allow you to get information from that server(technically not exactly, but for simplicity it is true). Mostly web servers, try to reduce list of allowed domain names, because this is security issue.

Sign up to request clarification or add additional context in comments.

3 Comments

But with react-native with a fetch there are no problems. Instead react that runs on a browser exists this problem.
@Paul, as i know, react native is tool for creating mobile app(i am not familiar with it). So it work in mobile environment. While just react, work in browser, that beware about users security, and do not allow every cross site request.
I don't understand why cross site requests must necessarily be blocked, if one needs them because they don't allow using an attribute in the request to execute it. Why do I have to create a server in nodejs to do this.
0

you have to use a server in order to do scraping in react. if you are using python or any other language you can do it via console.

1 Comment

This is the problem I would like to do without a server, as specified by the title of the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.