urlextract
Collects and extracts URLs from given text.
What it is and what it does
URLExtract is a Python library that finds URLs embedded in plain text by scanning for valid top-level domains (TLDs) and expanding outward to locate word boundaries. It works by locating any TLD occurrence in the input text, then searching left and right from that position until it hits a stop character like whitespace or punctuation. The library maintains an up-to-date TLD list downloaded from iana.org and can optionally validate extracted domains via DNS checks using uritools and idna for proper domain name handling.
The package provides three main extraction modes: `find_urls()` returns a list of all URLs found, `gen_urls()` yields URLs as a generator for memory efficiency, and `has_urls()` performs a quick boolean check. You can also manually update the TLD cache or set it to auto-update after a specified number of days. The library is aware of a known limitation: since some TLDs are also valid English words, it may produce false positives in contexts like CSS class selectors (e.g., detecting 'p.bold.name' as a domain).
Use it for:
- Extract clickable links from user-generated text, chat messages, or social media posts for processing or display
- Scan HTML or text documents to identify and collect all URLs for link validation or archival purposes
- Pre-process raw text data before feeding it to NLP or machine learning pipelines that need URL detection
- Build web scrapers or crawlers that need to identify target URLs within fetched page content
- Validate or sanitize user input by detecting whether a text block contains any URLs
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extracts URLs from text by locating TLDs and expanding boundaries to find complete domain names, with optional DNS validation.
Yes, if you need straightforward URL extraction from unstructured text. The package is stable (Production/Stable status), has no known security vulnerabilities, and carries a permissive MIT license. Install friction is low. However, the last release was 897 days ago and maintenance is dormant—if you need active support or expect frequent TLD updates, verify that the cached list meets your requirements or plan to fork/maintain it yourself.
Install
urlextract on PyPI
pip
pip install urlextractuv
uv add urlextractpoetry
poetry add urlextractInstalling urlextract
Before you install
Low friction install with four lightweight runtime dependencies. Last release was 897 days ago; repository is not archived but marked dormant, indicating the package is stable but receives infrequent updates.
License in practice
MIT license is permissive—you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install urlextract
from urlextract import URLExtract
extractor = URLExtract()
urls = extractor.find_urls("Text with URLs. Let's have URL janlipovsky.cz as an example.")
print(urls) # prints: ['janlipovsky.cz']
Verify before relying
- Whether DNS validation via dnspython is included in the base install or requires separate setup
- Current accuracy of TLD list and how often it is refreshed from iana.org
- Performance characteristics on very large texts or high-volume extraction scenarios
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — idna, uritools, platformdirs, filelock |
| Maintenance | dormant — 897 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,153,061/month — #4,293 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: urlextract-1.9.0-py3-none-any.whl
Keywords: url, extract, find, finder, collect, link, tld, list
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
mozilla-repo-urlsParses and processes Mozilla repository URLs,…
copyleft · top 5,000 on PyPI
tldextractAccurately extracts subdomain, domain, and…
permissive · top 1,000 on PyPI
tldExtracts the top-level domain (TLD) and…
copyleft · top 5,000 on PyPI
tldparseParses domain names into their constituent…
permissive · top 15,000 on PyPI
tldsProvides a set of valid top-level domains…
permissive · top 15,000 on PyPI
linkify-it-pyDetects and extracts URLs, email addresses, and…
permissive · top 1,000 on PyPI
publicsuffix2Extracts the public suffix and registrable…
copyleft · top 5,000 on PyPI
query-stringParses URL query strings and fragments into…
permissive · top 15,000 on PyPI
textractExtracts text from documents in multiple…
permissive · top 15,000 on PyPI
ldapdomaindumpCollects and exports Active Directory…
permissive · top 15,000 on PyPI