This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
BWTAqua/modules/bwt_scrape.py

31 lines
703 B
Python
Raw Normal View History

2023-08-23 15:13:17 +03:00
from typing import Union
from bs4 import BeautifulSoup
from selenium import webdriver
def get_balance(card_id: Union[str, int]) -> Union[str, None]:
driver = webdriver.Chrome()
driver.get(f"https://bwtaqua.com.ua/card-topup/?id={card_id}")
html = driver.page_source
soup = BeautifulSoup(html, "html.parser")
return (
(
soup.find_all(
"h3",
class_="headline headline_center headline_pink js-payment-balance",
)[0].getText()
)
.replace("Твій баланс ", "")
.replace(" л", "")
)
if __name__ == "__main__":
card = input("Type your card ID: ")
print(get_balance(card))