-
Notifications
You must be signed in to change notification settings - Fork 556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the image doesn't download to a folder #29
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
well the code doesn't do anything and it just shows 200,so i tried to modify the code so that the images get stored in a directory ,but still it doesn't work
``
import os
from bs4 import BeautifulSoup
import urllib.request
import requests
os.makedirs('images', exist_ok=True)
url = "https://www.reddit.com/r/BabyYoda"
response = requests.get(url)
if response.status_code != 200:
print(f"Status: {response.status_code} — Try rerunning the code\n")
else:
print(f"Status: {response.status_code}\n")
soup = BeautifulSoup(response.content, "html.parser")
for data in soup.find_all("img", attrs={"alt":"Post image"}):
ll=data.get('src')
``
any idea what to do?
The text was updated successfully, but these errors were encountered: