Creating JS Extractors
Why use JS extractors?
JS extractors are optional. If you are running the ScrapeNinja API on your cloud server (e.g. in a Python or Node.js environment), you don't necessarily need to create a JS extractor. Instead, you can process the raw ScrapeNinja output on your end: using the BeautifulSoup library in Python, or the local Cheerio installed via npm. This can be more convenient. However, if you are running the ScrapeNinja API call in a no-code environment such as Make.com, writing extractors becomes invaluable as they return clean JSON that no-code environments can process.
Developing and Testing JS Extractors in the Cheerio Playground
ScrapeNinja provides a dedicated Cheerio Playground to enhance the experience of writing extractors. The Cheerio Playground expects the website output to be placed in a special text area. To obtain the website's HTML, it may be helpful to use the ScrapeNinja Scraper Playground and then copy & paste the HTML from the Scraper Playground into the Cheerio Playground.