Issue
import requests
from bs4 import BeautifulSoup
response = requests.get(url="https://www.empireonline.com/movies/features/best-movies-2/")
webpage_text = response.text
soup = BeautifulSoup(webpage_text, "html.parser")
title_list = soup.find_all(name="h3", class_="jsx-4245974604")
print(title_list)
[1]: https://i.stack.imgur.com/WLuxV.png , Here is the link to the img which show the name and class of the element
Solution
You can find data in img
tag using specific class and it will return the lists and use alt
attribute get data
data=soup.find_all("img",class_="jsx-952983560 loading")[1:]
for d in data:
print(d['alt'])
Output:
Reservoir Dogs
Groundhog Day
Paddington 2
Amelie
....
Answered By - Bhavya Parikh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.