This document describes how Content Core extracts content from different source types. Processors are organized into three categories: URL, document, and media.
Content Core automatically selects the appropriate processor based on input:
- URL provided -- routes to a URL processor (or YouTube processor for YouTube links)
- File path provided -- file type is detected, then routed to the matching document or media processor
- Text provided -- handled by the text processor
File type detection is done in pure Python using binary signatures and content analysis. No system library (like libmagic) is required.
Located in src/content_core/processors/url/.
The url_engine setting controls which processor handles web URLs. When set to auto (the default), Content Core tries engines in this order:
- Firecrawl -- if
FIRECRAWL_API_KEYis set - Jina -- uses Jina Reader API (works without API key, but
JINA_API_KEYavoids rate limits) - Crawl4AI -- if installed (
pip install content-core[crawl4ai]) - BeautifulSoup -- always available as the final fallback
- File:
bs4.py - Fetches HTML via aiohttp and extracts meaningful text
- No external API keys required
- Suitable for simple pages; may struggle with JavaScript-heavy sites
- File:
jina.py - Uses Jina Reader API for clean content extraction
- Works without an API key, but setting
JINA_API_KEYavoids rate limits - Good for articles and documentation pages
- File:
firecrawl.py - Uses the Firecrawl API for high-quality web extraction
- Requires
FIRECRAWL_API_KEY - Supports self-hosted instances via
FIRECRAWL_API_URL - Configurable proxy (
CCORE_FIRECRAWL_PROXY, default:auto) — retries with stealth proxies on anti-bot blocks - Configurable wait time (
CCORE_FIRECRAWL_WAIT_FOR, default:3000ms) — waits for dynamic content before extraction
- File:
reddit.py - Automatically detects Reddit post URLs and extracts via the public
.jsonendpoint - Extracts post title, body, metadata (author, score, subreddit), and full comment tree with nested replies
- No API key or authentication needed for public posts
- Falls back to the configured URL engine if JSON extraction fails
- Supports
www.reddit.com,old.reddit.com, andnew.reddit.com
- File:
crawl4ai.py - Two modes: local browser automation or Docker API
- Local mode (default): Requires
pip install content-core[crawl4ai]andpython -m playwright install --with-deps - Docker mode: Set
CRAWL4AI_API_URL(e.g.,http://localhost:11235) to use a remote Crawl4AI container — no local Playwright needed. Crawl4AI >= 0.9.0 requires a bearer token for external connections: setCRAWL4AI_API_TOKEN(orcrawl4ai_api_tokenin the config file) and it is sent asAuthorization: Bearer <token>; leave it unset for older or unauthenticated instances - No third-party API keys needed; all processing happens locally or on your server
- Handles JavaScript-heavy sites well
Located in src/content_core/processors/document/.
The document_engine setting controls document processing. When set to auto (the default):
- Docling -- tried first if installed
- Simple -- pdfplumber for PDF, fast-ebook for EPUB, native parsers for Office formats
- File:
document/pdf.py - Uses pdfplumber for text and table extraction
- Features:
- Automatic table detection and conversion to markdown
- Text cleaning (ligatures, whitespace, hyphenation normalization)
- File:
document/epub.py - Uses fast-ebook (Rust-powered) for EPUB2/EPUB3 extraction
- Converts EPUB content to markdown
- File:
document/docx.py - Extracts text from Word documents using python-docx
- Headings, lists, and runs that are bold or italic (not both: a bold-italic run keeps only the bold) become markdown; hyperlinks in body paragraphs become
[text](url) - Tables become markdown tables (first row as header) in their place in the document
- File:
document/pptx.py - Extracts text from PowerPoint slides: one block per slide (
# Slide N, the title as## ...) - Reads the text inside group shapes, nested groups included
- Slide tables become markdown tables (first row as header)
- File:
document/xlsx.py - Extracts data from Excel spreadsheets
- File:
document/odf.py - Uses odfpy for LibreOffice/OpenOffice formats
- ODT: paragraphs, headings (by outline level), lists and tables as markdown
- ODS: one markdown table per sheet, preceded by
# Sheet: <sheet name>(as for XLSX) - ODP: one block per slide (
# Slide Nfollowed by its text frames, as for PPTX)
- File:
document/docling.py - Requires
pip install content-core[docling]; selectingdocument_engine="docling"without it raisesConfigurationError(useautoorsimpleto proceed without Docling) - Supports PDF, DOCX, PPTX, XLSX, Markdown, AsciiDoc, HTML, CSV, and images
- Configurable output format: markdown (default), HTML, or JSON
- Provides richer structural parsing than the simple engine
Located in src/content_core/processors/media/.
- File:
media/audio.py - Transcribes audio files using speech-to-text (default: OpenAI Whisper)
- Supported formats: MP3, WAV, M4A, FLAC, OGG
- Uses ffmpeg/ffprobe for duration detection and segment splitting (stream copy, no re-encoding)
- Features:
- Files longer than 10 minutes are automatically split into segments
- Segments are transcribed in parallel with configurable concurrency (1-10, default 3)
- Results are assembled in correct order regardless of completion time
- Custom STT provider and model can be specified per call
- File:
media/video.py - Extracts audio from video files, then transcribes using the audio processor
- Supported formats: MP4, AVI, MOV, MKV
- Uses ffmpeg/ffprobe for audio stream selection and extraction
- File:
processors/url/youtube.py - Extracts transcripts from YouTube videos
- Uses youtube-transcript-api (primary) with pytubefix as fallback
- Supports configurable language preferences via
CCORE_YOUTUBE_LANGUAGES - Automatic retry with backoff for rate limiting
- File:
processors/text.py - Handles direct text input
- Automatically detects HTML content and converts it to markdown using markdownify
- Plain text passes through unchanged
- Located in
src/content_core/content/identification/file_detector.py - Pure Python implementation, no system dependencies
- Detection methods:
- Binary signature matching for PDF, images, audio, video, and archives
- ZIP structure inspection for Office formats (DOCX, XLSX, PPTX) and EPUB
- OpenDocument (ODT, ODS, ODP) identified by the ZIP's
mimetypemember - Content analysis for text-based formats (HTML, XML, JSON, YAML, CSV, Markdown)
- Reads only the first 512 bytes for binary signatures and 1024 bytes for text content analysis
- Works regardless of file extension