I wrote this code for extract images urls from a web page as I given. And it shows all images urls. But I need to filter "https://images.unsplash.com/profile" urls and print them.
from bs4 import BeautifulSoup
import urllib.request
import re
url= "https://unsplash.com/t/nature"
html_page= urllib.request.urlopen(url)
soup= BeautifulSoup(html_page)
images= []
for img in soup.findAll('img'):
images.append(img.get('src'))
print(images)
I tried;
from bs4 import BeautifulSoup
import urllib.request
import re
url= "https://unsplash.com/t/nature"
html_page= urllib.request.urlopen(url)
soup= BeautifulSoup(html_page)
images= []
for img in soup.findAll('img'):
images.append(img.get('src'))
if "https://images.unsplash.com/profile" in images:
print(images)
And didn't worked!