Web scraping recipes
These examples apply for both /scrape and /scrape-js endpoints. We use /scrape in code below, for brevity.
Specify proxy geo
Section titled “Specify proxy geo”curl --request POST \ --url https://scrapeninja.p.rapidapi.com/scrape \ --header 'X-RapidAPI-Host: scrapeninja.p.rapidapi.com' \ --header 'X-RapidAPI-Key: YOUR KEY' \ --header 'content-type: application/json' \ --data '{ "url": "https://website.com/post.php", "geo": "fr"}'Building 2-step scrapers
Section titled “Building 2-step scrapers”It is possible to build a 2-step scrapers using ScrapeNinja, where first step executes expensive (slow) call to /scrape-js to perform some JS calculations of target website and dump cookies to a file, and then re-use these cookies in subsequent requests using /scrape.
Here is an example of such implementation:
https://github.com/restyler/airlines-scraper-example