Cheerio Scraper
No credit card required
Cheerio Scraper
No credit card required
Crawls websites using raw HTTP requests, parses the HTML with the Cheerio library, and extracts data from the pages using a Node.js code. Supports both recursive crawling and lists of URLs. This actor is a high-performance alternative to apify/web-scraper for websites that do not require JavaScript.
Do you want to learn more about this Actor?
Get a demoYou can access the Cheerio Scraper programmatically from your own applications by using the Apify API. You can choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.
1echo '{
2 "startUrls": [
3 {
4 "url": "https://crawlee.dev"
5 }
6 ],
7 "globs": [
8 {
9 "glob": "https://crawlee.dev/*/*"
10 }
11 ],
12 "pseudoUrls": [],
13 "excludes": [
14 {
15 "glob": "/**/*.{png,jpg,jpeg,pdf}"
16 }
17 ],
18 "linkSelector": "a[href]",
19 "pageFunction": "async function pageFunction(context) {\\n const { $, request, log } = context;\\n\\n // The \\"$\\" property contains the Cheerio object which is useful\\n // for querying DOM elements and extracting data from them.\\n const pageTitle = $('\''title'\'').first().text();\\n\\n // The \\"request\\" property contains various information about the web page loaded. \\n const url = request.url;\\n \\n // Use \\"log\\" object to print information to actor log.\\n log.info('\''Page scraped'\'', { url, pageTitle });\\n\\n // Return an object with the data extracted from the page.\\n // It will be stored to the resulting dataset.\\n return {\\n url,\\n pageTitle\\n };\\n}",
20 "proxyConfiguration": {
21 "useApifyProxy": true
22 },
23 "initialCookies": [],
24 "additionalMimeTypes": [],
25 "preNavigationHooks": "// We need to return array of (possibly async) functions here.\\n// The functions accept two arguments: the \\"crawlingContext\\" object\\n// and \\"requestAsBrowserOptions\\" which are passed to the `requestAsBrowser()`\\n// function the crawler calls to navigate..\\n[\\n async (crawlingContext, requestAsBrowserOptions) => {\\n // ...\\n }\\n]",
26 "postNavigationHooks": "// We need to return array of (possibly async) functions here.\\n// The functions accept a single argument: the \\"crawlingContext\\" object.\\n[\\n async (crawlingContext) => {\\n // ...\\n },\\n]",
27 "customData": {}
28}' |
29apify call apify/cheerio-scraper --silent --output-dataset
Cheerio Scraper - HTML scraping tool API through CLI
The Apify CLI is the official tool that allows you to use Cheerio Scraper locally, providing convenience functions and automatic retries on errors.
Install the Apify CLI
1npm i -g apify-cli
2apify login
Other API clients include:
Actor Metrics
440 monthly users
-
84 stars
>99% runs succeeded
Created in Apr 2019
Modified a month ago