skillfed

urlextract

Collects and extracts URLs from given text.

urlextract v1.9.0 1.2M downloads/30d#4,293 on PyPI278
Permissive license MIT DORMANT released

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 urlextract

uv

uv add urlextract

poetry

poetry add urlextract

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Text ProcessingTopic :: Text Processing :: Markup :: HTML

Tags

extract urls from textfind links in texturl detectiontld-based url extractionparse urls from stringscollect urls from contenturl finder
url-extractiontext-processingtld-parsing

More Python Modules packages