How to use the urlextract.cachefile.CacheFile function in urlextract

To help you get started, we’ve selected a few urlextract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lipoja / URLExtract / urlextract / urlextract_core.py View on Github external
import re
import string
import sys
import warnings
from collections import OrderedDict
from datetime import datetime, timedelta

import uritools

from urlextract.cachefile import CacheFileError, CacheFile

# version of URLExtract (do not forget to change it in setup.py as well)
__version__ = '0.14.0'


class URLExtract(CacheFile):
    """
    Class for finding and extracting URLs from given string.

    **Examples:**

    .. code-block:: python

        from urlextract import URLExtract

        extractor = URLExtract()
        urls = extractor.find_urls("Let's have URL example.com example.")
        print(urls) # prints: ['example.com']

        # Another way is to get a generator over found URLs in text:
        for url in extractor.gen_urls(example_text):
            print(url) # prints: ['example.com']

urlextract

Collects and extracts URLs from given text.

MIT
Latest version published 9 months ago

Package Health Score

68 / 100
Full package analysis

Similar packages