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 mode

Node.js

Python

curl

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4client = ApifyClient("<YOUR_API_TOKEN>")
5
6# Prepare the Actor input
7run_input = {
8    "startUrls": [{ "url": "https://www.theguardian.com" }],
9    "isUrlArticleDefinition": {
10        "minDashes": 4,
11        "hasDate": True,
12        "linkIncludes": [
13            "article",
14            "storyid",
15            "?p=",
16            "id=",
17            "/fpss/track",
18            ".html",
19            "/content/",
20        ],
21    },
22    "proxyConfiguration": { "useApifyProxy": True },
23    "extendOutputFunction": """($) => {
24    const result = {};
25    // Uncomment to add a title to the output
26    // result.pageTitle = $('title').text().trim();
27
28    return result;
29}""",
30}
31
32# Run the Actor and wait for it to finish
33run = client.actor("lukaskrivka/article-extractor-smart").call(run_input=run_input)
34
35# Fetch and print Actor results from the run's dataset (if there are any)
36for item in client.dataset(run["defaultDatasetId"]).iterate_items():
37    print(item)
Developer
Apify logo Maintained by Apify
Actor metrics
  • 183 monthly users
  • 56.9% runs succeeded
  • 1.3 days response time
  • Created in Nov 2019
  • Modified 4 months ago
Categories

You might also like these Actors