How to web scrape images from HTML using BeautifulSoup (bs4)? or What's the best way to web scrape im

14 Replies, 1145 Views

If you're on Windows, watch out for illegal filename chars when saving images.

I use this to clean filenames:

```python
import re

def clean_filename(filename):
return re.sub(r'[\\/*?:"<>|]', '', filename)
```

And +1 for `urljoin`β€”it’s a lifesaver for how to web scrape images from html bs4.

Messages In This Thread



Users browsing this thread: 1 Guest(s)