World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
Designed by IITians, only for AI Learners.
New to InsideAIML? Create an account
Employer? Create an account
Download our e-book of Introduction To Python
4.5 (1,292 Ratings)
559 Learners
Neha Kumawat
a year 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