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

Downloaded images from vk.com are blurred #5017

Closed
photologist opened this issue Jan 4, 2024 · 3 comments
Closed

Downloaded images from vk.com are blurred #5017

photologist opened this issue Jan 4, 2024 · 3 comments

Comments

@photologist
Copy link

Tried to download images from this vk.com profile (nsfw) and they were all blurred...

I can right+click on individual images and download them w/out the blur.

Here's a sample url for an individual image from the previously linked profile...

@wankio
Copy link
Contributor

wankio commented Jan 5, 2024

when i check:
https://sun6-20.userapi.com/impf/dwZBZfHK80GDEqLBNrFkQ7_vkJqzPYozqgBzRw/Q8GeTduRtKc.jpg?size=2048x1152&quality=95&blur=50,20&sign=fddc0bd9d62c90342b298f6d16a2f1e2&type=album

fullsize https://sun6-20.userapi.com/dwZBZfHK80GDEqLBNrFkQ7_vkJqzPYozqgBzRw/Q8GeTduRtKc.jpg
which should delete any /impf/ or /impg/ and the rest start from "?" to the end

by change

             try:
                 photo["url"] = photo[size + "src"]
             except KeyError:
                 self.log.warning("no photo URL found (%s)", photo.get("id"))
                 continue

in vk.py

to

            try:
                photo_url = photo[size + "src"]
                # Remove "impf" or "impg" from the URL
                photo_url = photo_url.replace("/impf/", "/").replace("/impg/", "/")
                
                # Remove anything after "?"
                photo_url = photo_url.split('?')[0]
                
                photo["url"] = photo_url
            except KeyError:
                self.log.warning("no photo URL found (%s)", photo.get("id"))
                continue

it will work

@photologist
Copy link
Author

@wankio

Your recommended change worked like a charm!

Sincere thanks!

mikf added a commit that referenced this issue Jan 8, 2024
bradenhilton pushed a commit to bradenhilton/gallery-dl that referenced this issue Feb 5, 2024
@parasiteoflife
Copy link

one thing about this is that impf/impg not only blurred image have in their url, normal photos also have them, when you open a photo and then click on Open Original the opened urls often have impf/impg. I haven't done an exhausting test in this but if you download that image and then the image without impf the downloaded images are not 1:1, I don't know which one is the actual original file but I do know that (I think this is also often and not always happens) the impf version is bigger in size and has last-modified headers, using dsim and other tools show that the images are not the same so either both are not the original image, one of them is, or one of them is more compressed than the other, either way, removing impf from the url should not be done lightly, maybe you have more info about this in which case I would like to know because so far I've been saving the images that "Open Original" directed me to. I'm saying all of this after downloading ~3K photos manually (without using gallery-dl or any other tool than my browser)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants