Option to use compiled page saver

This commit is contained in:
Profitroll 2022-09-08 13:04:37 +02:00
parent e7ef1d4613
commit fe1c6984b2
3 changed files with 9 additions and 3 deletions

View File

@ -17,6 +17,7 @@ Simple yet helpful bot to check BWT Aqua's card balance
3. Install PageSaver:
1. `cd PageSaver`
2. `npm install`
3. `chmod +x pageSaver` (If you want to use compiled page saver)
4. Configure the bot:
1. `cd ..`
2. `nano config.json` (You can use any other text editor actually, for example `vim`)
@ -24,5 +25,5 @@ Simple yet helpful bot to check BWT Aqua's card balance
* `python3 bwtbot.py`
## Configuration
You can edit with vim, nano, on Windows it's Notepad or Notepad++. Whatever.
You can edit with vim, nano, whatever.
If you don't know where to find bot_token and your id - here you can find some hints: [get bot token](https://www.siteguarding.com/en/how-to-get-telegram-bot-api-token), [get your id](https://www.alphr.com/telegram-find-user-id/), [get api_hash and api_id](https://core.telegram.org/api/obtaining_api_id).

View File

@ -4,5 +4,6 @@
"api_id": 0,
"api_hash": "",
"bot_token": "",
"bot_name": ""
"bot_name": "",
"use_compiled_page_saver": false
}

View File

@ -17,7 +17,11 @@ async def getWaterLeft(cardid, filename, app=None):
try:
os.system(f'touch data/pages/{str(filename)}.html')
os.system(f'PageSaver/pageSaver "https://bwtaqua.com.ua/card-topup/?id={cardid}" > data/pages/{str(filename)}.html')
if config["use_compiled_page_saver"]:
os.system(f'PageSaver/pageSaver "https://bwtaqua.com.ua/card-topup/?id={cardid}" > data/pages/{str(filename)}.html')
else:
os.system(f'node ./PageSaver/pageSaver.js "https://bwtaqua.com.ua/card-topup/?id={cardid}" > data/pages/{str(filename)}.html')
with open(f'data/pages/{str(filename)}.html') as f:
html_file = f.read()