when running the code i am scrapping the images from twitter post replies
code i am using
driver.get('https://x.com/convomf/status/1785644297448251638')
time.sleep(3)
prev_height = driver.execute_script("return document.body.scrollHeight")
while True:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(7)
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == prev_height:
break
prev_height = new_height
anchor_elements = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//div[@class="css-175oi2r r-1iusvr4 r-16y2uox r-1777fci r-kzbkwu"]//a[@class="css-175oi2r r-1pi2tsx r-1ny4l3l r-1loqt21"]')))
hrefs = []
for anchor_element in anchor_elements:
href = anchor_element.get_attribute('href')
hrefs.append(href)
print(hrefs)
i except to scrape over 100-200 images from the tweet, best i have been able to get is 15