Created
March 2, 2017 14:55
-
-
Save ultrakain/0c6e226ad6fe3cf18603ec6c4eeb0a85 to your computer and use it in GitHub Desktop.
Get price at amazon pdp
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
import requests | |
from bs4 import BeautifulSoup | |
def get_price(): | |
url = r'''https://www.amazon.com/Xiaomi-10000mAh-External-Portable-Smartphone/dp/B01CU0Z3UE/ref=s9u_simh_gw_i2?_encoding=UTF8&fpl=fresh&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=&pf_rd_r=3SPPSMHRQEVAYS1KWZBD&pf_rd_t=36701&pf_rd_p=1cded295-23b4-40b1-8da6-7c1c9eb81d33&pf_rd_i=desktop''' | |
res = requests.get(url) | |
soup = BeautifulSoup(res.text) | |
price_span = soup.find("span", id="priceblock_ourprice") | |
print price_span.text | |
if __name__ == '__main__': | |
get_price() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment