I've created a script in python to scrape only the name of a food store from a webpage. However, when I execute my script I get the following error.
name = soup.select_one("h1.listing-name").text
AttributeError: 'NoneType' object has no attribute 'text'
My attempt so far with:
from bs4 import BeautifulSoup
import requests
url = "https://www.yellowpages.com.au/sa/gawler/mega-health-gawler-14366108-listing.html"
with requests.Session() as s:
s.headers["User-Agent"] = "Mozilla/5.0"
response = s.get(url)
soup = BeautifulSoup(response.text,"lxml")
name = soup.select_one("h1.listing-name").text
print(name)
The content I'm after is not generated dynamically. Moreover, the selector I've used within my script is flawless. How can I print the name of that store from that site?