First commit

This commit is contained in:
Joan Cano
2023-08-05 14:30:28 +02:00
parent 2ace736506
commit 6c461a5df3
5 changed files with 83 additions and 0 deletions

30
bot/bot.py Normal file
View File

@@ -0,0 +1,30 @@
from bs4 import BeautifulSoup
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from telegram import Update, ForceReply
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext
def get_chrome_options():
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_prefs = {}
chrome_options.experimental_options["prefs"] = chrome_prefs
chrome_prefs["profile.default_content_settings"] = {"images": 2}
return chrome_options
def send_message(message):
driver = webdriver.Chrome(options=get_chrome_options())
driver.set_window_size(1280, 720)
driver.get("https://web.whatsapp.com/")
driver.save_screenshot('/data/screenshot.png')
#soup = BeautifulSoup(driver.page_source, "lxml"))
driver.close()
def main() -> None:
send_message("asdf")
if __name__ == '__main__':
main()