Skip to content

Instantly share code, notes, and snippets.

@RizqiEka

RizqiEka/ZoRestPrice.py

Last active Oct 18, 2020
Embed
What would you like to do?
ZoRestPrice
#Restaurant Price for 2
try:
price_for_2_anchor = driver.find_element_by_xpath("""/html/body/div[1]/div[2]/main/div/section[4]/section/section/article[1]/section[2]/p[1]""")
price_for_2_text = price_for_2_anchor.text
except NoSuchElementException:
price_for_2_text = "No Price Data Found"
pass
if (price_for_2_text[0:2] == 'Rp') or (price_for_2_text[0:2] == 'No'):
price_for_2.append(price_for_2_text)
else:
price_for_2_anchor = driver.find_element_by_xpath("""/html/body/div[1]/div[2]/main/div/section[4]/section/section/article[1]/section[2]/p[2]""")
price_for_2_text = price_for_2_anchor.text
if (price_for_2_text[0:2] == 'Rp') or (price_for_2_text[0:2] == 'No'):
price_for_2.append(price_for_2_text)
else:
price_for_2_anchor = driver.find_element_by_xpath("""/html/body/div[1]/div[2]/main/div/section[4]/section/section/article[1]/section[2]/p[3]""")
price_for_2_text = price_for_2_anchor.text
price_for_2.append(price_for_2_text)
print(f'Scraping Restaurant Price for Two - {name} - {price_for_2_text} - OK')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.