-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorona_stats.py
30 lines (29 loc) · 1.04 KB
/
corona_stats.py
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
import time
import notify2 as not2
import requests
import os
ico=os.getcwd()+"/corona_ico.png"
url="https://www.worldometers.info/coronavirus/country/turkey"
while True:
try:
raw=requests.get(url).text.splitlines()
ind=raw.index('<div class="maincounter-number">')
raw_=(raw[ind+1],raw[ind+7],raw[ind+13])
del raw
data=[raw_[0].replace('<span style="color:#aaa">',"").replace(' </span>',"").replace(",","."),
raw_[1].replace("<span>","").replace('</span>',"").replace(",","."),
raw_[2].replace("<span>","").replace('</span>',"").replace(",",".")
]
out="Vaka Sayısı:"+data[0]+"\nVefat:"+data[1]+"\nİyileşen:"+data[2]
print(out)
not2.init("Covid-19")
n=not2.Notification("Covid-19",out,ico)
n.show()
time.sleep(3600)
except:
out="Erişim yok. Ağa bağlanın veya ağda oturum açın."
print(out)
not2.init("Covid-19")
n=not2.Notification("Covid-19",out,ico)
n.show()
time.sleep(1200)