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.2.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

pyxurls-0.1.2-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyxurls-0.1.2.tar.gz
  • Upload date:
  • Size: 15.1 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.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for pyxurls-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2d94e59a9fd4ea715b49581e6bc424271d34e7b647b918645e3881961cc5ba56
MD5 40b872398ba09db03e4b8e3597c3e3e3
BLAKE2b-256 32858d234a529741055eb4f57156c1c4124d598d906333a67ddc70f13a07d7c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyxurls-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.1 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.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for pyxurls-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 49bc1c0995a73d96e1df3b62cec46b977a04367e2e307472b1eb792042397734
MD5 240a4485f85a735552f3df70462d462f
BLAKE2b-256 cabca876402ff9b82f935f13449fd67c9cf1fe4d498d4b645e10dbc50d7bd168

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