cli-batch-processing
Use Trafilatura's command line for stdin, URL/list, and local directory batch extraction with safe outputs, configs, backups, parallelism, and validation.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- cli-batch-processing
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Trafilatura's command line for stdin, URL/list, and local directory batch extraction with safe outputs, configs, backups, parallelism, and validation.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/batch-workflows.md9.2 KB
- 参考文档references/cli-reference.md9.0 KB
- 参考文档references/troubleshooting.md9.1 KB
03 SKILL.md 正文
CLI Batch Processing
Use this sub-skill when the user wants Trafilatura from a shell or automation script rather than Python APIs: stdin extraction, -u/--URL, URL-list batches, local --input-dir batches, output directories, backups, --keep-dirs, output format flags, --parallel, --config-file, metadata filters, deduplication, precision/recall presets, and XML-TEI validation.
Do not use this sub-skill for direct Python function calls; route those requests to python-extraction. For feed/sitemap/crawl algorithms beyond the CLI flag invocation, route to discovery-downloads. For conceptual deduplication, corpus formats, and TEI quality details, route to corpus-quality.
Start here
- Confirm the CLI is reachable:
trafilatura --version trafilatura --help # PATH fallback when the console script is unavailable: python -m trafilatura.cli --help - Choose exactly one primary input mode:
- no input flag: read HTML bytes from stdin;
-u/--URL: download and extract one URL;-i/--input-file: process a text file containing one URL per line;--input-dir: walk local downloaded HTML files.
- Choose output behavior:
- no
-o/--output-dir: print to stdout; -o DIR: write result files, creating directories as needed;--backup-dir DIR: keep gzipped raw HTML for URL downloads;--keep-dirs: preserve local input paths, but only with-o/--output-dir.
- no
- Add extraction and format options deliberately:
--with-metadata,--only-with-metadata,--deduplicate,--precision,--recall,--xmltei --validate-tei,--json,--markdown, etc. - For a no-network sanity check, run the bundled helper:
python scripts/cli_fixture_runner.py python scripts/cli_fixture_runner.py --json
References
references/cli-reference.md— flag groups, input/output rules, format interactions, safe command construction, exit statuses.references/batch-workflows.md— ready-to-adapt stdin, URL-list, directory, backup, config, listing, and TEI recipes.references/troubleshooting.md— CLI-specific failure symptoms and recoveries.scripts/cli_fixture_runner.py— no-network smoke helper for installed CLI behavior.
Safety checklist for generated commands
- Quote URLs and paths in shell examples; in Python, prefer
subprocess.run([...])argument lists over shell strings. - Keep network batches polite: start with
--parallel 1, increase only when allowed, and useSLEEP_TIMEin a config file for domain-level pacing. - Separate discovery/listing from extraction:
--listprints URLs only and ignores extraction/output-format expectations. - Use a small fixture or sample directory before a large batch; verify output content and file names before scaling.
- Prefer relative
--input-dirvalues when using--keep-dirs, so mirrored output paths stay inside the chosen output directory.
Provenance
This sub-skill distills Trafilatura 2.2.0 CLI behavior from public package docs, CLI source, settings source, and selected CLI/download tests. Evidence labels include docs/usage-cli.rst, docs/quickstart.rst, docs/installation.rst, docs/settings.rst, docs/troubleshooting.rst, trafilatura/cli.py, trafilatura/cli_utils.py, trafilatura/settings.py, trafilatura/settings.cfg, tests/cli_tests.py, and selected tests/downloads_tests.py queue cases.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.