Smart Article Extractor avatar
Smart Article Extractor
Try for free

No credit card required

View all Actors
Smart Article Extractor

Smart Article Extractor

lukaskrivka/article-extractor-smart
Try for free

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.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more

Node.js

Python

curl

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "startUrls": [
11        {
12            "url": "https://www.theguardian.com"
13        }
14    ],
15    "isUrlArticleDefinition": {
16        "minDashes": 4,
17        "hasDate": true,
18        "linkIncludes": [
19            "article",
20            "storyid",
21            "?p=",
22            "id=",
23            "/fpss/track",
24            ".html",
25            "/content/"
26        ]
27    },
28    "proxyConfiguration": {
29        "useApifyProxy": true
30    },
31    "extendOutputFunction": ($) => {
32        const result = {};
33        // Uncomment to add a title to the output
34        // result.pageTitle = $('title').text().trim();
35    
36        return result;
37    }
38};
39
40(async () => {
41    // Run the Actor and wait for it to finish
42    const run = await client.actor("lukaskrivka/article-extractor-smart").call(input);
43
44    // Fetch and print Actor results from the run's dataset (if any)
45    console.log('Results from dataset');
46    console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47    const { items } = await client.dataset(run.defaultDatasetId).listItems();
48    items.forEach((item) => {
49        console.dir(item);
50    });
51})();
52
53// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Developer
Maintained by Apify
Actor metrics
  • 172 monthly users
  • 73.7% runs succeeded
  • 2.8 days response time
  • Created in Nov 2019
  • Modified about 1 month ago
Categories