Skip to content

Instantly share code, notes, and snippets.

@RizqiEka
Last active October 18, 2020 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RizqiEka/8da1ba5506effe16c26ae9ca87431e6a to your computer and use it in GitHub Desktop.
Save RizqiEka/8da1ba5506effe16c26ae9ca87431e6a to your computer and use it in GitHub Desktop.
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