Notes/ML/FlipkartTracker-200910-134031.py

33 lines
852 B
Python

import requests
from bs4 import BeautifulSoup
URL = "https://www.flipkart.com/samsung-galaxy-m31-ocean-blue-64-gb/p/itm1268b57512fb8?pid=MOBFPNPS6GTGZHE4&lid=LSTMOBFPNPS6GTGZHE4MR8YKS&marketplace=FLIPKART&srno=s_1_1&otracker=AS_Query_HistoryAutoSuggest_1_3_na_na_na&otracker1=AS_Query_HistoryAutoSuggest_1_3_na_na_na&fm=SEARCH&iid=7ed64fb0-2813-4eba-a188-31510a3200d9.MOBFPNPS6GTGZHE4.SEARCH&ppt=sp&ppn=sp&ssid=mfr9comyls0000001599722937598&qH=72c0d4f69be69bf9"
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 OPR/70.0.3728.106"
}
page = requests.get(URL, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
print(page)
price3 = soup.find("div", {"class": "_1vC4OE _3qQ9m1"})
print (price3)
print(price3.string)