# Extract-any-webpage-content-for-llm (`ai-developer/extract-any-webpage-content-for-llm`) Actor

Fast and easy way to extract data from any webpage and are LLM friendly. The tool lets you easily extract content from any website. Ideal for researchers, marketers, and developers.

- **URL**: https://apify.com/ai-developer/extract-any-webpage-content-for-llm.md
- **Developed by:** [aideveloper](https://apify.com/ai-developer) (community)
- **Categories:** Automation, AI
- **Security:** Full permissions
- **Stats:** 638 total users, 1 monthly users, 82.0% runs succeeded, 16 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Extract Any Webpage Content for LLMs

**Extract Any Webpage** is a versatile tool designed to fetch content from any given URL, making it easy to capture and process web data. Its extremely LLM friendly (LLM-parsable data). It's perfect for researchers, marketers, and developers who need to extract clean, structured information from websites.

### How does Extract Any Webpage work?

The tool employs a robust mechanism to navigate and pull content from web pages. It starts by accepting a user-provided URL, then uses a headless browser such as Playwright or Puppeteer to access and render the page. Once the page is fully loaded, the tool extracts the HTML content, converting it into a readable and processable format. Users have the option to specify the data extraction format (such as raw HTML, text-only, or JSON) according to their needs.

### Handling Large Content:

In cases where the webpage content exceeds the typical processing limit, Extract Any Webpage efficiently segments the content or offers pagination handling. Users are notified in the logs about any necessary content truncation or special handling, ensuring transparency in data extraction processes.

### Cost:

Extract Any Webpage operates for Free.

### How to use Extract Any Webpage:

To start using Extract Any Webpage, configure the URLs you wish to extract from by setting them up in the tool’s interface. Here’s an example setup:

1. Input the URL of the website you want to extract from, for instance: `https://example.com`.
2. Specify the desired output format and any special handling instructions.
3. Run the tool, and it will deliver the extracted content directly to your dashboard or specified endpoint.

This tool simplifies the process of web scraping, allowing you to focus more on analyzing and utilizing your data rather than dealing with the complexities of data extraction.

# Actor input Schema

## `url` (type: `string`):

The URL of website you want to get the data from.

## Actor input object example

```json
{
  "url": "https://news.ycombinator.com/newest"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "url": "https://news.ycombinator.com/newest"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ai-developer/extract-any-webpage-content-for-llm").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "url": "https://news.ycombinator.com/newest" }

# Run the Actor and wait for it to finish
run = client.actor("ai-developer/extract-any-webpage-content-for-llm").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "url": "https://news.ycombinator.com/newest"
}' |
apify call ai-developer/extract-any-webpage-content-for-llm --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ai-developer/extract-any-webpage-content-for-llm"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Csc09YZ6QtoZNAu2D/builds/eS4q1KfURxHhcCTdo/openapi.json
