# Text Scraper (Free) (`karamelo/text-scraper-free`) Actor

Website Text Extractor. Extract Text from Webpages and Feed Your LLMs

- **URL**: https://apify.com/karamelo/text-scraper-free.md
- **Developed by:** [karamelo](https://apify.com/karamelo) (community)
- **Categories:** Automation, Developer tools
- **Features:** Full permissions
- **Stats:** 1,232 total users, 15 monthly users, 100.0% runs succeeded, 34 bookmarks
- **User rating**: 4.13 out of 5 stars

## 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 Text from Webpages and Power Your LLMs:**

\*\* Introducing the Web Text Scraper \*\*

🤖 Tired of dealing with messy HTML code and extracting relevant text from webpages manually? Introducing the **Web Text Scraper**, a powerful tool designed to efficiently extract plain text content from any webpage and feed it directly to your Large Language Models (LLMs).  This process allows you to streamline data extraction and unlock the full potential of your LLMs for deeper analysis and richer outputs.

💡 **What does it do?**

The Web Text Scraper is built using Apify's Actor framework, allowing you to easily run it on Apify's platform. It takes a URL as input and returns a clean, formatted text version of the webpage. It utilizes advanced techniques to identify and extract the most relevant text content, discarding extraneous elements like scripts, stylesheets, and irrelevant HTML tags.

✨ **Benefits:**

- 💻 **Simplicity:** No need to write complex code. Just provide the URL or URLs and get the text.
- 🎯 **Accuracy:** Designed to identify and extract the most relevant text content.
- ⚡ **Efficiency:** Processes webpages quickly, saving you time and effort.
- 📈 **Scalability:** Can handle large volumes of data with ease thanks to the power of Apify's platform.
- 🧠 **LLM Integration:** Seamlessly feeds extracted text to your chosen LLM, allowing you to utilize its capabilities for further analysis and creative tasks.

🌎 **Use Cases:**

- 📊 **Web Content Analysis:** Analyze the content of webpages to understand trends, sentiment, and key topics using LLMs for summarization and insights.
- 🗃️ **Data Extraction:** Extract text data for further processing and analysis in other tools and use LLMs for data cleaning, categorization, and transformation.
- 🧲 **SEO Analysis:** Gather keywords and content from competitor websites for SEO optimization and use LLMs to identify emerging trends and create high-quality content.
- 📚 **Research:** Extract relevant information from academic articles, news articles, and other resources and use LLMs to generate research summaries, extract key findings, and create new insights.
- 💬 **ChatGPT Integration:**  Feed extracted text into ChatGPT for enhanced conversation experiences, improved responses, and richer content generation.

🚀 **Getting Started:**

To use the Web Text Scraper, simply:

1. 🚀 Create an Apify account (if you don't have one already).
2. 🚀 Find the Web Text Scraper Actor in the Apify Marketplace.
3. 🚀 Run the Actor, providing the URL or URLs of the webpage you want to extract text from.
4. 🚀 Choose your preferred LLM (e.g., OpenAI's GPT-4 or others).
5. 🚀 Feed the extracted text to your LLM for further processing and analysis.

# Actor input Schema

## `urls` (type: `array`):

URL for text to scrape.

## `removeEmpty` (type: `boolean`):

remove the empty lines from all the text to make it more readable, defaut is checked.

## Actor input object example

```json
{
  "urls": [
    "https://news.google.com",
    "https://apify.com",
    "https://en.wikipedia.org"
  ],
  "removeEmpty": true
}
```

# 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 = {
    "urls": [
        "https://news.google.com",
        "https://apify.com",
        "https://en.wikipedia.org"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("karamelo/text-scraper-free").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 = { "urls": [
        "https://news.google.com",
        "https://apify.com",
        "https://en.wikipedia.org",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("karamelo/text-scraper-free").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 '{
  "urls": [
    "https://news.google.com",
    "https://apify.com",
    "https://en.wikipedia.org"
  ]
}' |
apify call karamelo/text-scraper-free --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,karamelo/text-scraper-free"
        }
    }
}
```

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/2gbQiRSpJIIag2FdR/builds/5ER0vQHqshDFgkeXV/openapi.json
