from urlextract import URLExtract def extract_urls(text): ext = URLExtract() urls = ext.find_urls(text) return urls