Collects and extracts URLs from given text.
Project description
URLExtract is python class for collecting (extracting) URLs from given text.
How does it work
It tries to find any occurrence of TLD in given text. If TLD is found it starts from that position to expand boundaries to both sides searching for “stop character” (usually whitespace, comma, single or double quote).
NOTE: List of TLDs is downloaded from iana.org to keep you up to date with new TLDs.
Installation
Package is available on PyPI - you can install it via pip.
pip install urlextract
Documentation
Online documentation is published at http://urlextract.readthedocs.io/
Requirements
IDNA for converting links to IDNA format
uritools for
pip install idna pip install uritools
Example
You can look at command line program bin/urlextract. But everything you need to know is this:
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']
License
This piece of code is licensed under The MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file urlextract-0.3.tar.gz
.
File metadata
- Download URL: urlextract-0.3.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc31bb95656e5ffb63643a32e3e340528a6d4c6ebdeeb0d064df5673d03f18ad |
|
MD5 | 165605169d43f381ef0d78ed311f43c8 |
|
BLAKE2b-256 | 86d699517438fcb94face56df0a6f2f8d3173bf2d1ee4e90e741a615d637a124 |