Skip to main content

A regular expression based URL extractor which extracts URLs from text.

Project description

PyXURLs

PyPI version Build Status PyPI - Python Version

A regular expression based URL extractor which extracts URLs from text.

Thanks to Daniel Martí invests the project mvdan/xurls. This python project developed by the same concept as the golang version.

Installing

pip install pyxurls

Usage

Extract URLs by strict strategy

import xurls

extractor = xurls.Strict()

url = extractor.findfirst('we have the link with scheme https://www.python.org and https://www.github.com')
#  https://www.python.org

urls = extractor.findall('we have the link with scheme https://www.python.org and https://github.com')
#  ['https://www.python.org', 'https://github.com']

Extract URLs by relaxed strategy

import xurls

extractor = xurls.Relaxed()

url = extractor.findfirst('we have the link with scheme www.python.org and https://www.github.com')
#  www.python.org

urls = extractor.findall('we have the link with scheme www.python.org and https://github.com')
#  ['www.python.org', 'https://github.com']

Extract URLs by limit scheme

# limit to https
extractor = xurls.StrictScheme('https://')

url = extractor.findfirst('we have the link with scheme custom://domain.com and https://www.python.org noscheme.com')
#  https://www.python.org

# unlimit to standard scheme
extractor = xurls.StrictScheme(xurls.express.ANY_SCHEME)
urls = extractor.findall('we have the link with scheme custom://domain.com and https://www.python.org noscheme.com')
#  ['custom://domain.com', 'https://www.python.org']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyxurls-0.1.1.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

pyxurls-0.1.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file pyxurls-0.1.1.tar.gz.

File metadata

  • Download URL: pyxurls-0.1.1.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for pyxurls-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fc2d3cd359142e63fd0babd087dcf52a4ad42c7f939c6b47212471279b2c3da0
MD5 acb8daee0db87186c9139c78ecdcdc88
BLAKE2b-256 3cc8f3aa998a720a7aab4671436733492ed96df3423e552cf7b73d4f10e21373

See more details on using hashes here.

File details

Details for the file pyxurls-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyxurls-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for pyxurls-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2258082608fb0ea1a769249f1040d45fb163a687128c2aedb06cf8627eed16d
MD5 94f6ece89de4b8a5d495367552c9e47b
BLAKE2b-256 26c38ab01fc51848d0790144d9f8cda957336586093b8f61d991870af2862130

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page