I want to be able to download pictures from a site by web scraping. My site of choice is threads.net. And I watched several tutorials on how to download photos from the site, but no one was able to help me.
This is part of the code that i have written so far…
from bs4 import BeautifulSoup
import requests
import os
url = "https://threads.net"
r = requests.get(url)
soup = BeautifulSoup(r.text, 'html.parser')
images = soup.find_all('img')
# for image in images:
# name = image['alt']
# link = image['src']
# with open(name.replace(' ', '').replace('/', '') + '.jpg', 'wb') as f:
# im = requests.get(link)
# f.write(im.content)
print(images)