[b]"How to use Colab to scrape images from a website with Python?"[/b] or [b]"Best way to scrape images from a web

16 Replies, 1154 Views

If you're dealing with lazy loading, try `selenium-wire` instead of plain Selenium. It captures all network requests, so you can grab image URLs even if they're loaded dynamically.

For colab scrape images from website python, it's a bit slower but way more reliable.

```python
from seleniumwire import webdriver

driver = webdriver.Chrome()
driver.get("your_url")
for request in driver.requests:
if request.path.endswith(('.jpg', '.png')):
print(request.url)
```

Bonus: it also handles AJAX-loaded content!

Messages In This Thread



Users browsing this thread: 1 Guest(s)