Skip to content

Instantly share code, notes, and snippets.

@alpercalisir
Created February 17, 2018 21:44
Show Gist options
  • Save alpercalisir/0b29bfafdfb3f940487a7a3311ade41b to your computer and use it in GitHub Desktop.
Save alpercalisir/0b29bfafdfb3f940487a7a3311ade41b to your computer and use it in GitHub Desktop.
Retrieves the price of a product from Hepsiburada
#Hepsiburada Price Retriever
#Used lxml,beatifulsoup4
import bs4 as bs
import urllib.request #In order to request
url = input("Enter Hepsiburada URL: ")
sauce = urllib.request.urlopen(url).read() #Returns the source code of the given URL
soup = bs.BeautifulSoup(sauce,'lxml') #To make beautifulsoup object,the parser used is lxml
priceBeforePointArray = soup.find_all("span",{"data-bind":"markupText:'currentPriceBeforePoint'"})
priceBeforePoint = priceBeforePointArray[0].text
priceAfterArray = soup.find_all("span",{"data-bind":"markupText:'currentPriceAfterPoint'"})
priceAfterPoint= priceAfterArray[0].text
print(priceBeforePoint+","+priceAfterPoint+"TL")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment