<jupyter_start><jupyter_text>Training bot<jupyter_code>import pandas as pd
websites = pd.read_excel('websites_groups.xlsx')
websites['Category'].unique()
#websites.head(20)
group = 'Female, LGBTQ+'
proxies_list = websites[websites['Category'] == group]['Website'].to_list()
proxies_list
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--window-size=1620x1620")
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path='./chromedriver')

##------
url = 'https://www.google.nl/'
driver.get(url)
driver.implicitly_wait(4)
print(driver.current_url)
##------
for idx, proxy in enumerate(proxies_list):
    url = "'https://www."+str(proxy)+"'"
    print("Learning...", url)
    driver.execute_script("window.open("+url+")")
    driver.implicitly_wait(3)
    driver.switch_to_window(driver.window_handles[idx+1])

windows_open  = len(driver.window_handles)
print("Windows open:", windows_open)
# buttons
#driver.back() 
#driver.forward()
#driver.refresh()
#driver.switch_to.new_window('tab')
#driver.switch_to.new_window('window')
#driver.close()
#driver.switch_to.window(original_window)
from datetime import datetime
sttime = datetime.now().strftime('%Y%m%d_%Hh%M_')
url = "https://www.buienradar.nl/"
print("Saving...", url)
driver.execute_script('window.open("'+url+'","window 100")')
driver.implicitly_wait(3)
driver.switch_to_window(driver.window_handles[windows_open])

driver.save_screenshot("screenshots/"+str(sttime)+str(group)+"_buien.png")
print(driver.title, driver.current_window_handle)
url = "https://www.msn.com/nl-nl"
print("Saving...", url)
driver.execute_script('window.open("'+url+'","window 101")')
driver.implicitly_wait(3)
driver.switch_to_window(driver.window_handles[windows_open+1])

driver.save_screenshot("screenshots/"+str(sttime)+str(group)+"_msn.png")
print(driver.title, driver.current_window_handle)
#we have to reload after cookies acceptance
url = "https://www.bbc.com/news"
print("Saving...", url)
driver.execute_script('window.open("'+url+'","window 102")')
driver.implicitly_wait(3)
driver.switch_to_window(driver.window_handles[windows_open+2])
driver.save_screenshot("screenshots/"+str(sttime)+str(group)+"_bbc.png")
print(driver.title, driver.current_window_handle)
url = "https://www.weerplaza.nl/"
print("Saving...", url)
driver.execute_script('window.open("'+url+'","window 103")')
driver.implicitly_wait(3)
driver.switch_to_window(driver.window_handles[windows_open+3])
driver.save_screenshot("screenshots/"+str(sttime)+str(group)+"_weerplaza.png")
print(driver.title, driver.current_window_handle)
url = "https://www.nu.nl/"
print("Saving...", url)
driver.execute_script('window.open("'+url+'","window 104")')
driver.implicitly_wait(3)
driver.switch_to_window(driver.window_handles[windows_open+4])
driver.save_screenshot("screenshots/"+str(sttime)+str(group)+"_nunl.png")
print(driver.title, driver.current_window_handle)
url = "https://google.nl/search?q=fiets"
print("Saving...", url)
driver.execute_script('window.open("'+url+'","window 105")')
driver.implicitly_wait(3)
driver.switch_to_window(driver.window_handles[windows_open+5])
driver.save_screenshot("screenshots/"+str(sttime)+str(group)+"_google_fiets.png")
print(driver.title, driver.current_window_handle)
url = "https://google.nl/search?q=nieuws"
print("Saving...", url)
driver.execute_script('window.open("'+url+'","window 106")')
driver.implicitly_wait(3)
driver.switch_to_window(driver.window_handles[windows_open+6])
driver.save_screenshot("screenshots/"+str(sttime)+str(group)+"_google_nieuws.png")
print(driver.title, driver.current_window_handle)
url = "https://google.nl/search?q=kleding+online+kopen"
print("Saving...", url)
driver.execute_script('window.open("'+url+'","window 107")')
driver.implicitly_wait(3)
driver.switch_to_window(driver.window_handles[windows_open+7])
driver.save_screenshot("screenshots/"+str(sttime)+str(group)+"_google_kleding.png")
print(driver.title, driver.current_window_handle)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.183206106870229, 'fraction_numerical': 0.012804727899532135, 'mean_word_length': 8.93154034229829, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 10, 'lorem ipsum': 0, 'www.': 7, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '479759', 'license': 'MIT', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1448, 'n_words': 161, 'path': 'PersonaBot.ipynb', 'repo_name': 'CyrilShch/persona-training-scripts', 'size': '4061'}