Category python

Google images scraping

from selenium import webdriver import time def fetch_image_urls(query:str, max_links_to_fetch:int, wd:webdriver, sleep_between_interactions:int=1): def scroll_to_end(wd): wd.execute_script("window.scrollTo(0, document.body.scrollHeight);") time.sleep(sleep_between_interactions) # build the google query search_url = ";site=&tbm=isch&source=hp&q={q}&oq={q}&gs_l=img" # load the page wd.get(search_url.format(q=query)) image_urls = set() image_count = 0 results_start = 0 while image_count…

whatsapp chat scraping

sadadd from selenium.webdriver import Chrome from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException import time URL = "" browser = Chrome() browser.get( URL ) time.sleep(50) invalid_contacts = ['a'] while True: browser.find_element_by_xpath( ".//button[contains(@class, '_1x_c3 _35Ob4 kQJNA _2-5II _338za')]").click() time.sleep(20) messages =…