c_frames = driver.find_elements_by_xpath('//iframe[contains(@src,"captcha") and contains(@title,"Main content")]')
Найдено 0 iframes с каптчей
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\profile")
iframe = driver.switch_to_frame("c-737168mpnn5c")
iframe = driver.find_element_by_xpath("/html/body/div[1]/div/div[3]/div[2]/div[1]/div[1]/div[4]")
iframe.click()
time.sleep(2)
c:\Users\maksg\Desktop\parser\parser.py:31: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
button = driver.find_element_by_xpath("/html/body/form/section[2]/div/button")
'WebDriver' object has no attribute 'switch_to_frame'
iframe = driver.find_elements_by_tag_name('iframe')[0]
driver.switch_to.frame(iframe)
recapcha = driver.find_element_by_xpath("/html/body/div[1]/div/div[3]/div[2]/div[1]/div[1]/div[4]")
recapcha.click()
time.sleep(1000)
play = driver.find_element_by_xpath('//*[@id="vpaid-but"]').click()
play = driver.implicitly_wait(15)
time.sleep(10)
import telebot
import requests
import time
from bs4 import BeautifulSoup
token = ""
channel_id = ""
bot = telebot.TeleBot(token)
@bot.message_handler(content_types=['text'])
def commands(message):
#bot.send_message(channel_id, message.text)
if message.text == "Курс":
#bot.send_message(channel_id, "Hello")
global back_post_id
back_post_id = None
while True:
post_text = parser(back_post_id)
back_post_id = post_text[1]
if post_text[0] != None:
bot.send_message(channel_id, post_text[0])
time.sleep(120)
else:
bot.send_message(message.from_user.id, "Я тебя не понимаю. Напиши Курс")
def parser(back_post_id):
URL = "https://currency.com/ru/btc-to-usd?utm_course=rbc&utm_campaign=quote"
page = requests.get(URL)
soup = BeautifulSoup(page.content, "lxml")
post = soup.find("b", class_='i-price-buy')
post_id = post.text
if post_id != back_post_id:
post = soup.find("b", class_='i-price-buy').text
return f"{post}", post_id
else:
return None, post_id
bot.polling(none_stop=True, interval=0)