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

14 Replies, 1160 Views

For relative URLs, you can also use `urljoin` from `urllib.parse`:

```python
from urllib.parse import urljoin

img_url = urljoin(url, img['src'])
```

This handles all the messy path stuff for you.

And yeah, bs4 is fine, but if you're doing heavy scraping, check out Scrapy. It’s built for this stuff.

Messages In This Thread



Users browsing this thread: 1 Guest(s)