Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium.webdriver.chrome.options import Options
- from telethon import TelegramClient, events
- import re
- from selenium import webdriver
- api_id = *******
- api_hash = "***************************"
- client = TelegramClient('my_account', api_id, api_hash)
- @client.on(events.NewMessage)
- async def my_event_handler(event):
- chrome_options = Options()
- chrome_options.add_argument('headless')
- driver = webdriver.Chrome(options=chrome_options)
- if "You earned" in event.message.message:
- driver.quit()
- print("Visit ended")
- else:
- print("Visit started")
- data = str(event.message.reply_markup)
- urls = re.findall(r'https://doge.+?(?=\')', data)
- if len(urls) > 0:
- print("Target found", urls[0])
- driver.get(urls[0])
- else:
- urls = re.findall(r'http://doge.+?(?=\')', data)
- if len(urls) > 0:
- print("Target found", urls[0])
- driver.get(urls[0])
- client.start()
- client.run_until_disconnected()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement