31 lines
703 B
Python
31 lines
703 B
Python
|
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))
|