Running my scraper I could see that it fetches nothing from yell.com. So far I know Xpaths are alright. Can't really find out whether I've made any mistakes. Hope there is any workaround. I tried with the below code:
import requests
from lxml import html
url="https://www.yell.com/ucs/UcsSearchAction.do?keywords=pizza&location=all+states&scrambleSeed=821749505"
def Startpoint(address):
response = requests.get(address)
tree = html.fromstring(response.text)
titles = tree.xpath('//div[contains(@class,"col-sm-24")]')
for title in titles:
try:
Name=title.xpath('.//h2[@itemprop="name"]/text()')[0]
print(Name)
except exception as e:
print(e.message)
continue
Startpoint(url)