Courlan (version 1.3.2) is a Python library designed to clean, filter, and sample URLs, optimizing data collection workflows. It includes features for spam detection, content type filtering, and language identification. The library maintains an active development pace with minor releases typically every few months.
pip install courlanVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic URL cleaning, link extraction from HTML, and usage of the `UrlStore` for managing visited and unvisited URLs. Link extraction often benefits from a `base_url` to resolve relative links, and the `UrlStore` provides efficient tracking for web crawling applications.
Upgrade your Python environment to version 3.8 or higher.
For `UrlStore.get_download_urls()`, remove the `timelimit` parameter. For other `UrlStore` methods, rename `timelimit` to `time_limit`.
The intended replacement for handling relative URLs is often to clean them after extraction using `clean_url` with an explicit base, or to ensure the input `url` parameter to `extract_links` provides a sufficient base for resolution. Consult the latest documentation for alternatives as the parameter's removal approaches.
Explicitly install the required packages: `pip install python-bzip2` for bzip2 compression, or ensure zlib development libraries are available for zlib-python (often built-in with Python).
Most commonly used functions are available directly from the top-level `courlan` package. If a function is in a submodule, import it from `courlan` directly, or check the documentation for the correct import path. For example, `from courlan import get_base_url` instead of trying to guess the submodule.
Consult the `courlan` documentation or source code to confirm the correct function name and its location. For example, `courlan` offers `filter_links()` for link filtering.
To reset the internal cache and resolve inconsistencies, import `clear_caches` from `courlan.meta` and call it: `from courlan.meta import clear_caches; clear_caches()`