Website Content Crawler avatar
Website Content Crawler
Try for free

No credit card required

View all Actors
Website Content Crawler

Website Content Crawler

apify/website-content-crawler
Try for free

No credit card required

Crawl websites and extract text content to feed AI models, LLM applications, vector databases, or RAG pipelines. The Actor supports rich formatting using Markdown, cleans the HTML, downloads files, and integrates well with 🦜🔗LangChain, LlamaIndex, and the wider LLM ecosystem.

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

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://docs.apify.com/academy/web-scraping-for-beginners" }],
9    "crawlerType": "playwright:adaptive",
10    "includeUrlGlobs": [],
11    "excludeUrlGlobs": [],
12    "initialCookies": [],
13    "proxyConfiguration": { "useApifyProxy": True },
14    "removeElementsCssSelector": """nav, footer, script, style, noscript, svg,
15[role=\"alert\"],
16[role=\"banner\"],
17[role=\"dialog\"],
18[role=\"alertdialog\"],
19[role=\"region\"][aria-label*=\"skip\" i],
20[aria-modal=\"true\"]""",
21    "clickElementsCssSelector": "[aria-expanded=\"false\"]",
22}
23
24# Run the Actor and wait for it to finish
25run = client.actor("apify/website-content-crawler").call(run_input=run_input)
26
27# Fetch and print Actor results from the run's dataset (if there are any)
28print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
29for item in client.dataset(run["defaultDatasetId"]).iterate_items():
30    print(item)
31
32# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Developer
Maintained by Apify
Actor metrics
  • 2.8k monthly users
  • 317 stars
  • 100.0% runs succeeded
  • 4 days response time
  • Created in Mar 2023
  • Modified 1 day ago