#!/usr/bin/env python
# coding: utf-8
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
from time import sleep
driver = webdriver.Chrome('chromedriver')
#Automatisation de la connexion
# driver.get('https://with.is/auth/facebook')
# id = driver.find_element_by_id("email")
# id.send_keys('')
# password = driver.find_element_by_id('pass')
# password.send_keys('')
# login_button = driver.find_element_by_id("loginbutton")
# login_button.click()
# login2 = driver.find_element_by_id('u_0_f')
# login2.click()
# code = driver.find_element_by_id('approvals_code')
# val1 = input()
# code.send_keys(val1)
# nextlogin = driver.find_element_by_id('checkpointSubmitButton')
# nextlogin.click()
driver.get("https://with.is/#_=_")
#Mise à jour en bas de page
for i in range(10):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
sleep(2)
soup = BeautifulSoup(driver.page_source, 'html.parser')
#Obtenez uniquement le lien
links = [url.get('href') for url in soup.find_all('a')]
#Extraire uniquement les utilisateurs des liens
links = [s for s in links if "users" in s]
#Accédez à autant d'utilisateurs
for link in links:
href = 'https://with.is/' + link
driver.get(href)
driver.back()
sleep(1)
driver.refresh()
Recommended Posts