-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTracker.py
More file actions
110 lines (68 loc) · 2.52 KB
/
Tracker.py
File metadata and controls
110 lines (68 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import requests
from bs4 import BeautifulSoup
import smtplib
import schedule
import time
URL = 'https://www.flipkart.com/zotac-nvidia-gaming-geforce-gtx-1660ti-twin-fan-6-gb-gddr6-graphics-card/p/itmfdykqwhjh33jf'
headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36'}
def check_price():
page = requests.get(URL, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
# print(soup.prettify())
price = soup.find("div", {"class": "_1vC4OE _3qQ9m1"})
title = soup.find("span", {"class": "_35KyD6"})
div = price.string
## Title extraction
print(title.text)
print(div)
converted_price = div[0:7]
k = converted_price.replace(",", "")
w = k.replace("₹", "")
converted_price = int(w)
print('this is converted price', converted_price)
# if(converted_price > 1000):
# send_mail()
return converted_price
###################################
def checkGCprice1660TI():
URL = "https://www.amazon.in/Zotac-GeForce-1660-GDDR6-Graphic/dp/B07NMWQXLR/ref=sr_1_1?dchild=1&keywords=1660ti&qid=1592377812&s=computers&sr=1-1"
page = requests.get(URL, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
price = soup.find("span", {"id": "priceblock_ourprice"})
div = price.string
converted_price = div[1:8]
k = converted_price.replace(",", "")
converted_price = int(k)
return converted_price
def checkGCprice1660SUPER():
URL = "https://www.amazon.in/GeForce-GTX-1660-OC-Gv-N166SOC-6GD/dp/B07ZPM2BVR"
page = requests.get(URL, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
price = soup.find("span", {"id": "priceblock_ourprice"})
div = price.string
converted_price = div[1:8]
k = converted_price.replace(",", "")
converted_price = int(k)
return converted_price
#######################################################
def send_mail():
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login('senders email', 'g3suitepass')
subject = 'Price fell down'
body = (f"Check the graphics card price: {URL}")
msg = f"Subject: {subject}\n\n{body}"
server.sendmail(
'senders email',
'reciever email',
msg
)
print('Hey email sent')
server.quit
# check_price()
# schedule.every(5).seconds.do(check_price)
# while True:
# schedule.run_pending()
# time.sleep(1)