Python returns an empty list during web scraping using BeautifulSoup

Question:

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

Asked By: Ittzsheldon

||

Answers:

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
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.