Smart Article Extractor
No credit card required
Smart Article Extractor
No credit card required
📰 Smart Article Extractor extracts articles from any scientific, academic, or news website with just one click. The extractor crawls the whole website and automatically distinguishes articles from other web pages. Download your data as HTML table, JSON, Excel, RSS feed, and more.
Do you want to learn more about this Actor?
Get a demoYou can access the Smart Article Extractor programmatically from your own JavaScript applications by using the Apify API. You can also 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.
1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4// Replace the '<YOUR_API_TOKEN>' with your token
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9// Prepare Actor input
10const input = {
11 "startUrls": [
12 {
13 "url": "https://www.theguardian.com"
14 }
15 ],
16 "isUrlArticleDefinition": {
17 "minDashes": 4,
18 "hasDate": true,
19 "linkIncludes": [
20 "article",
21 "storyid",
22 "?p=",
23 "id=",
24 "/fpss/track",
25 ".html",
26 "/content/"
27 ]
28 },
29 "proxyConfiguration": {
30 "useApifyProxy": true
31 },
32 "extendOutputFunction": ($) => {
33 const result = {};
34 // Uncomment to add a title to the output
35 // result.pageTitle = $('title').text().trim();
36
37 return result;
38 }
39};
40
41// Run the Actor and wait for it to finish
42const run = await client.actor("lukaskrivka/article-extractor-smart").call(input);
43
44// Fetch and print Actor results from the run's dataset (if any)
45console.log('Results from dataset');
46console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47const { items } = await client.dataset(run.defaultDatasetId).listItems();
48items.forEach((item) => {
49 console.dir(item);
50});
51
52// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Scrape and download articles and news API in JavaScript
The Apify API client for JavaScript is the official library that allows you to use Smart Article Extractor API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.
Install the apify-client
npm install apify-client
Other API clients include:
Actor Metrics
201 monthly users
-
69 stars
>99% runs succeeded
2.4 days response time
Created in Nov 2019
Modified 11 days ago