Website Text Extractor - Webpage Content to Ordered Text Blocks
Pricing
from $10.00 / 1,000 page_extracteds
Website Text Extractor - Webpage Content to Ordered Text Blocks
Extract the visible text of any web page as numbered blocks in DOM order, each carrying its HTML tag. One JSON item per URL: page title, every text block, per-page counts. Batch several URLs in one run, optionally drop headers, footers and cookie banners. For translation, migration and copy audits.
Pricing
from $10.00 / 1,000 page_extracteds
Rating
5.0
(1)
Developer
My Smart Digital
Maintained by CommunityActor stats
2
Bookmarked
92
Total users
3
Monthly active users
12 days ago
Last modified
Categories
Share
Website Text Extractor
Apify Actor for extracting visible text content from websites as structured JSON blocks.
Description
Extract clean, visible text from websites as structured blocks. Perfect for content migration, translation workflows, and data analysis. This actor extracts text content that is actually visible to users, with options to exclude headers, footers, cookies, and extract form content.
Features
✅ Multi-URL Batch Processing: Process multiple URLs in a single run
✅ Viewport Presets: Choose between Desktop (1920x1080), Mobile (375x667), Tablet (768x1024), or custom dimensions
✅ Header/Footer/Cookie Exclusion: Compatible with WordPress, Shopify, Webflow, Drupal, Joomla and most CMS platforms
✅ Form Content Extraction: Optional extraction of form content (labels, placeholders, values, dropdown options)
✅ DOM Order Preservation: Text blocks extracted in the order they appear on the page
✅ Code Filtering: Automatically filters out JavaScript, CSS, and code snippets
✅ Deduplication: Removes duplicate text blocks
✅ Configurable Selectors: Customize which elements to include/exclude
✅ Clean JSON Output: Structured output perfect for content analysis, translation, and data migration
Input
{"startUrls": ["https://example.com","https://example.com/about","https://example.com/contact"],"viewportType": "desktop","viewportWidth": 1920,"viewportHeight": 1080,"excludeHeader": false,"excludeFooter": false,"excludeCookies": false,"excludeSelectors": [],"includeSelectors": [],"minTextLength": 3,"deduplicate": true,"waitForSelector": "","waitTimeout": 30000,"removeEmptyBlocks": true,"extractForms": false}
Parameters
- startUrl (optional): Single URL to extract text from (useful for quick tests). Leave empty if you only use startUrls
- startUrls (optional): List of additional URLs to process in bulk in a single run. Duplicates and empty lines are ignored. Use this field to process multiple pages in one execution
- viewportType (optional, default: "desktop"): Choose a predefined viewport size (desktop, mobile, tablet) or use custom dimensions
- viewportWidth (optional, default: 1920): Custom viewport width in pixels (only used when viewportType is "custom")
- viewportHeight (optional, default: 1080): Custom viewport height in pixels (only used when viewportType is "custom")
- excludeHeader (optional, default: false): Exclude header and navigation elements. Compatible with WordPress, Shopify, Webflow, Drupal, Joomla and most CMS platforms. If this doesn't work for your site, use Exclude Selectors manually
- excludeFooter (optional, default: false): Exclude footer elements. Compatible with WordPress, Shopify, Webflow, Drupal, Joomla and most CMS platforms. If this doesn't work for your site, use Exclude Selectors manually
- excludeCookies (optional, default: false): Exclude cookie consent banners and GDPR notices. Compatible with Cookiebot, OneTrust, Iubenda and most cookie consent platforms
- extractForms (optional, default: false): Extract form content (labels, placeholders, values). When disabled, form elements (form, input, textarea, select, label) are excluded from extraction. When enabled, form content is extracted including labels, placeholders, and input values. Each form field and dropdown option is extracted as a separate block
- excludeSelectors (optional, default: []): Additional CSS selectors for custom elements to exclude. Use this if Exclude Header/Footer/Cookies options don't work for your site structure
- includeSelectors (optional): CSS selectors to specifically include. If empty, all visible text is extracted
- minTextLength (optional, default: 3): Minimum character length for text blocks
- deduplicate (optional, default: true): Remove duplicate text blocks
- waitForSelector (optional): CSS selector to wait for before extraction
- waitTimeout (optional, default: 30000): Timeout in milliseconds for waiting for selector
- removeEmptyBlocks (optional, default: true): Remove empty or whitespace-only text blocks
Output
The actor returns a JSON object with the following structure:
{"url": "https://example.com","title": "Page Title","viewport": {"width": 1920,"height": 1080},"textBlocks": [{"id": "block-1","text": "First visible text block","order": 1,"tagName": "h1","selector": null},{"id": "block-2","text": "Second text block","order": 2,"tagName": "p","selector": null}],"statistics": {"totalBlocks": 25,"totalCharacters": 5432,"uniqueBlocks": 23,"excludedElements": 8}}
Output Fields
- url: The URL that was processed
- title: Page title
- viewport: Viewport dimensions used
- textBlocks: Array of extracted text blocks, each with:
- id: Unique identifier (block-1, block-2, etc.)
- text: The extracted text content
- order: Order of appearance (1, 2, 3, etc.)
- tagName: HTML tag name (h1, p, li, etc.)
- selector: CSS selector if extracted from specific selector
- statistics: Summary statistics
Pricing
This Actor is pay per event. Two events are charged, at the prices shown on this page:
- Actor Start — charged once per run, one event per gigabyte of memory allocated (minimum one).
- PAGE_EXTRACTED — charged once per page whose text was actually extracted and returned. A URL that could not be loaded, or that its site answered with the page of its anti-bot protection instead of its own (a Cloudflare challenge, for example), returns no item and is not charged.
Use Cases
- Content Translation: Extract clean text blocks for translation workflows
- Content Analysis: Analyze visible content without navigation/header/footer noise
- SEO Content Extraction: Get only the main content for SEO analysis
- Content Migration: Extract content for migration to new platforms
- Form Data Extraction: Extract form labels, placeholders, and dropdown options for documentation or analysis
Header and Footer Exclusion
By default, nothing is excluded - all visible text is extracted. You can optionally exclude headers and/or footers using the excludeHeader and excludeFooter options.
When enabled, these options use universal selectors compatible with:
- WordPress:
.site-header,.elementor-location-header,.wp-block-navigation, etc. - Shopify:
.shopify-section-header,.shopify-section-footer, etc. - Webflow:
[class*='header'],[id*='header'], etc. - Drupal:
.region-header,.region-footer, etc. - Joomla:
.header,.footer,.moduletable-menu, etc. - Generic:
header,footer,nav,[role='banner'],[role='contentinfo'], etc.
If these options don't work for your specific site structure, you can use the excludeSelectors parameter to manually specify CSS selectors.
Technical Details
- Uses Playwright for rendering with configurable viewport sizes
- Waits for
networkidleto ensure all content is loaded - Automatically scrolls pages to load lazy-loaded content
- Works within the run timeout: with a short timeout (30 to 60 seconds is common for AI agents), each page is opened in a fast mode where images, videos, fonts and embedded frames, which never carry the page's text, are not downloaded; the waits are shortened, and the page is frozen as it stands before its text is read. A run shorter than two minutes opens all its pages this way, one at a time, and with several URLs each page waits only its share of the time left, so one slow page cannot take the whole run. The run ends on its own just before its timeout, with the pages already extracted: it succeeds when it delivered at least one page, and fails with a message saying so when the timeout left no time to extract any, instead of being cut off without a result
- A URL that cannot be loaded (an address that does not answer) or that its site turns away is named in the run's status message with the reason, and nothing is charged for it. A site turns a request away when it refuses automated requests (HTTP 401, 403 or 429), or when its anti-bot protection answers with its own page instead of the site's, whatever the status code: a Cloudflare challenge, the error page of Akamai's edge, an AWS WAF challenge, a DataDome or Imperva block. The text of such a page describes the protection, not the site, so it is neither returned nor charged. The extractor does not try to get past a protection
- Checks element visibility using computed styles and layout boxes (
getClientRects()) - Filters out elements with
display: none,visibility: hidden,opacity: 0 - Filters out JavaScript, CSS, and code snippets automatically
- Reads the whole rendered page, not only the part shown in the viewport
- Deduplicates text blocks by normalized (lowercase) content
- Maintains DOM order for accurate content structure