Webpage Clean Text avatar

Webpage Clean Text

Pricing

$3.00 / 1,000 results

Go to Apify Store
Webpage Clean Text

Webpage Clean Text

Pricing

$3.00 / 1,000 results

Rating

0.0

(0)

Developer

Eichan Jolly

Eichan Jolly

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Categories

Security

Limited permissions

Share

Webpage Clean Text — LLM-Ready Plain Text & Markdown

Slug: webpage-clean-text
Category: AI / AI data preparation (not a chatbot)
Apify Store categories to select when publishing: AI, DEVELOPER_TOOLS (2 of 3 available). These are publishing choices, not automatic settings in actor.json.
Suggested pricing: per run (one URL produces one dataset item). Configure pricing separately in Apify Console; this repository does not set fees.

What it does

Fetches one public, static HTML webpage (or a plain-text URL) and returns its readable text plus simple Markdown. Useful for retrieval-augmented generation (RAG) preparation, search indexing, prompt preparation, and data-cleaning workflows. It does not generate an AI summary, rank importance, or make semantic judgments.

How the method works

  1. Validate that the URL is HTTP(S) and resolves to public internet IP addresses. Check redirects too.
  2. Download at most 1 MB of HTML/text using urllib.request with a 15-second network timeout.
  3. Parse static HTML with the standard-library html.parser and decode HTML entities.
  4. Exclude common boilerplate tags (script, style, nav, header, footer, aside, form, etc.). If a <main> or <article> region contains text, favor that region; otherwise use the remaining page text.
  5. Emit block-separated plain text and basic Markdown (# headings and - list items). word_count counts whitespace-separated tokens, not linguistic words.

No external LLM, browser, JavaScript renderer, login, or third-party Python package is used. The standard Apify platform token provided to an Actor run is used only to read the run's input and publish output through the Apify storage API; customers do not supply a key.

Input example

One URL only:

{
"url": "https://example.com/"
}

Output example

One item is appended to the default dataset. The values below are illustrative; live website content can change:

{
"url": "https://example.com/",
"title": "Example Domain",
"text": "Example Domain\n\nThis domain is for use in documentation examples.",
"markdown": "# Example Domain\n\nThis domain is for use in documentation examples.",
"word_count": 10
}
FieldTypeMeaning
urlstringFinal URL after redirects
titlestringHTML <title>, or empty string
textstringExtracted text separated by blank lines
markdownstringBasic Markdown, not full HTML-to-Markdown fidelity
word_countintegerWhitespace-separated word count in text

Who this is for

Developers feeding public information into AI search, RAG ingestion, indexes, or data transformation pipelines without running an LLM.

Limitations and safety

  • Static HTML only. JavaScript-rendered content, SPA application views, PDF, paywalls, authenticated pages, cookie consent workflows, and blocked sources are not supported.
  • Main/article selection is a simple HTML tag heuristic. It can omit important content or include ads and boilerplate. It does not understand page meaning.
  • Markdown is intentionally basic. HTML tables, links, inline emphasis, image descriptions, page layout, and code formatting are not preserved faithfully.
  • Whitespace is normalized. Complex HTML, malformed markup, and non-UTF-8 pages without a declared charset may yield imperfect text.
  • Only public HTTP(S) pages on standard ports (80/443) are accepted; private and loopback destinations are rejected, including on redirects. DNS validation is a protective check, not a security guarantee against DNS rebinding. Never use this as a privileged intranet fetcher.
  • Honor website access policies, copyright, and applicable law. A public URL does not guarantee permission to reuse content.
  • One failed fetch returns a plain-language ERROR: in the run log, exits nonzero, and does not create a misleading success row. No Python traceback is shown.

Running locally (no Apify SDK)

From the actor's root folder, create storage/key_value_stores/default/INPUT.json with the input example above. Run:

$python src/main.py

The result is written to storage/datasets/default/000000001.json (or the next available numbered JSON file). Clear storage/ between independent test runs if you do not want accumulated results.

Running on Apify

Build from the included Dockerfile and use the form generated from input_schema.json. The Actor reads input from its default key-value store using the Apify API and writes one JSON item to its default dataset using the Apify API. This is necessary because local JSON files alone do not publish dataset items to the Apify cloud. APIFY_IS_AT_HOME, APIFY_TOKEN, and the ACTOR_DEFAULT_* environment variables are provided by Apify; no manual API token configuration is needed.

There are no Python dependencies to install; requirements.txt deliberately contains no packages.