#!/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')
#Login automation
# 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/#_=_")
#Update at the bottom of the page
for i in range(10):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
sleep(2)
soup = BeautifulSoup(driver.page_source, 'html.parser')
#Get only the link
links = [url.get('href') for url in soup.find_all('a')]
#Extract only users from links
links = [s for s in links if "users" in s]
#Access as many as users
for link in links:
href = 'https://with.is/' + link
driver.get(href)
driver.back()
sleep(1)
driver.refresh()
--Login automation is not smart --Infinite scrolling is not smart
Recommended Posts