Y
Y
yk_vova2021-01-05 18:05:46
Python
yk_vova, 2021-01-05 18:05:46

How to get span value?

There is this Html code:

5ff47ed1973f4831228377.png

I want to write a bot that will give a link to an iplogger person, at this time the bot will monitor the time of the last log every second in div id=statcontent -> div title -> span, and if it is greater than the time that the bot recorded when it gave the link to the user then it parses the ip value and then works with it. I can't get the time value at all. Help me please.
The code

URL_STAT = '*скрыта ссылка*'
def check_ip(message):
    chrome_options = webdriver.ChromeOptions()
    chrome_options.binary_location = os.environ.get('GOOGLE_CHROME_BIN')
    driver = webdriver.Chrome(chrome_options=chrome_options)
    driver.get(URL_STAT)
    driver.find_element_by_xpath('//*[@id="GDPR1"]/div/div/p[2]/label').click()
    driver.find_element_by_xpath('//*[@id="GDPR1"]/div/div/p[3]/button').click()
    time.sleep(1)
    r = requests.get(URL_STAT)
    start = time.time()
    while True:
        soup = BeautifulSoup(r.text, 'html.parser')
        titles = [div['title'] for div in soup.find_all('div', title=True)]
        for el in titles:
            print(el)

        time.sleep(0.8)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question