From fe1c6984b2a75894c8d7fb115f7e21373a75b64b Mon Sep 17 00:00:00 2001 From: profitroll Date: Thu, 8 Sep 2022 13:04:37 +0200 Subject: [PATCH] Option to use compiled page saver --- README.md | 3 ++- config.json | 3 ++- modules/bwt.py | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e739a93..3aba52b 100644 --- a/README.md +++ b/README.md @@ -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). \ No newline at end of file diff --git a/config.json b/config.json index 6fc5ab5..a4835a1 100644 --- a/config.json +++ b/config.json @@ -4,5 +4,6 @@ "api_id": 0, "api_hash": "", "bot_token": "", - "bot_name": "" + "bot_name": "", + "use_compiled_page_saver": false } \ No newline at end of file diff --git a/modules/bwt.py b/modules/bwt.py index 9d89b7a..c2a563c 100644 --- a/modules/bwt.py +++ b/modules/bwt.py @@ -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()