Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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']