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

# the alternative is regex as engine if you suffered installing on re2
pip install google-re2 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

import xurls

# 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.3.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

pyxurls-0.1.3-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyxurls-0.1.3.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for pyxurls-0.1.3.tar.gz
Algorithm Hash digest
SHA256 282e66006e15bb39cc67dcba3d2794c04726a7803d75ee7202b9db254b6922a4
MD5 ada3ccddf43f0cdb21c38c13e8857a62
BLAKE2b-256 7def765d0828e9b5718ec59df50ca41329f462249eade494d03a6a367a091593

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyxurls-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for pyxurls-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 522ed61c0d3be22fd2cf775db99db23f20d2cc0c3393c2c69ad98cb63bd3e4c4
MD5 0eedebf313bfbd76d13a636639640e48
BLAKE2b-256 725ffeb504ed207f6357ab602733f4e6629c70cea46533a78fd1a653b16748fc

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