Download our e-book of Introduction To Python
Neha Kumawat
2 years ago
Nowadays you can learn almost anything by just visiting http://www.google.com. But if you are completely new to computers or the internet then first you need to learn those fundamentals. Next
you can visit a good e-learning site like - https://insideaiml.com to learn further on a variety of subjects.
import re
with open("path\url_example.txt") as file:
for line in file:
urls = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', line)
print(urls)
['http://www.google.com.']
['https://insideaiml.com']
pip install idna
pip install uritools
pip install appdirs
pip install dnspython
from urlextract import URLExtract
extractor = URLExtract()
urls = extractor.find_urls("Text with URLs. Let's have URL janlipovsky.cz as an example.")
print(urls) # prints: ['janlipovsky.cz']
from urlextract import URLExtract
extractor = URLExtract()
example_text = "Text with URLs. Let's have URL janlipovsky.cz as an example."
for url in extractor.gen_urls(example_text):
print(url) # prints: ['janlipovsky.cz']
from urlextract import URLExtract
extractor = URLExtract()
example_text = "Text with URLs. Let's have URL janlipovsky.cz as an example."
if extractor.has_urls(example_text):
print("Given text contains some URL")
from urlextract import URLExtract
extractor = URLExtract()
extractor.update()
from urlextract import URLExtract
extractor = URLExtract()
extractor.update_when_older(7) # updates when list is older that 7 days