Created
February 17, 2018 21:44
-
-
Save alpercalisir/0b29bfafdfb3f940487a7a3311ade41b to your computer and use it in GitHub Desktop.
Retrieves the price of a product from Hepsiburada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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