artoo icon indicating copy to clipboard operation
artoo copied to clipboard

Import to ReactJs

Open nxvinh222 opened this issue 4 years ago • 4 comments

I'm trying to create a scraping extension using ReactJs but i can't find anywhere that how to import this library via code. I tried to run the script in the docs but it's not working at all. I would be grateful if anyone can help me how to import this. /-/-/-/ image

nxvinh222 avatar Nov 26 '21 04:11 nxvinh222

Hello @nxvinh222 you should propbably check out how I did to inject artoo in PhantomJS for instance: https://github.com/medialab/sandcrawler/blob/master/phantom/bindings.js#L59-L90. This should be close to what you want to achieve. Note that artoo was born at a time where packaging JS code wasn't even a thing, so it might be a bit hairy to adapt to newer schemes.

Yomguithereal avatar Nov 26 '21 09:11 Yomguithereal

@Yomguithereal wow thank you for your answer. I'm trying to make a scrape chrome extension and I'm wondering should I run the scrape step via the API to my server(using Scrappy, Puppeteer) or run it directly in the browser(artoo, jQuery). Can you give me some advice, thank you so much.

nxvinh222 avatar Nov 26 '21 09:11 nxvinh222

It depends on so much that I cannot give you a proper answer. I would say that if you need to scrape things as they appear on the user's screen you should probably do so on the client side. This is even more true if you are scraping pages where you need to authenticate or perform complex interactions or interact with complex public-facing APIs.

Yomguithereal avatar Nov 26 '21 09:11 Yomguithereal

@Yomguithereal Thank you so much, I appreciate your guidance.

nxvinh222 avatar Nov 26 '21 09:11 nxvinh222