forked from a000b/ZombieBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenshots.py
More file actions
37 lines (34 loc) · 1.18 KB
/
screenshots.py
File metadata and controls
37 lines (34 loc) · 1.18 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
import wypok_bot_lib as w
import scr_lib
import sys
import logging
# target_path = ""
target_path = ""
# target_path = "/home/m4/MyApp/py/Bot/"
logging.basicConfig(filename=target_path + 'logs.log', level=logging.INFO,
format='%(asctime)s|%(levelname)s|%(filename)s|%(funcName)s|%(message)s')
def main():
text = ''
try:
if sys.argv[1] == 'dominance_graph':
url = 'https://coinmarketcap.com/charts/'
selector = "#dominance-percentage"
text += "BTC dominance graph.\n\n"
elif sys.argv[1] == 'volatility_btc':
url = 'https://www.buybitcoinworldwide.com/volatility-index/'
selector = "#highchart_simple_div"
text += "BTC volatility / price index.\n\n"
else:
logging.error(f"Zly parametr: {sys.argv[1]}")
except Exception as e:
logging.error(e)
else:
try:
pic = scr_lib.take_scr(url, target_path + 'scr.png', selector)
except Exception as e:
logging.error(e)
else:
if pic == True:
text += 'Źródło : ' + url +'\n\n'
w.add_entry(text, target_path + 'scr.png', 1)
main()