Skip to content
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

Can't properly DL this particular image although it works with urllib #6338

Closed
stephanebruckert opened this issue Jan 22, 2023 · 1 comment
Closed

Comments

@stephanebruckert
Copy link

stephanebruckert commented Jan 22, 2023

This code would normally work for other images but for this specific image URL it doesn't. The image is downloaded but the file is corrupt.

url = "https://i.discogs.com/UzkDSQACNmbykQvWO0B9JGVajps7_MULzdwP9RK-o94/rs:fit/g:sm/q:90/h:591/w:589/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9MLTk3NzE1/LTE2MjA2NjkwNzQt/MjMxMS5qcGVn.jpeg"

# doesn't work with requests
import requests  # 2.28.1
img_data = requests.get(url).content
with open('image_requests.jpeg', 'wb') as handler:
    handler.write(img_data)

# it works with urllib
import urllib
urllib.request.urlretrieve(url, "image_urllib.jpeg")

Result:

Screenshot 2023-01-22 at 12 52 00

We can see the requests one doesn't have a preview and doesn't have the same size.

Screenshot 2023-01-22 at 12 52 46

Here are other examples:

@sigmavirus24
Copy link
Contributor

Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use StackOverflow for general usage questions instead and only report defects here.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants