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

Error while downloading album from VK #2535

Closed
MagnetizedFreckles opened this issue Apr 28, 2022 · 12 comments
Closed

Error while downloading album from VK #2535

MagnetizedFreckles opened this issue Apr 28, 2022 · 12 comments
Labels

Comments

@MagnetizedFreckles
Copy link

MagnetizedFreckles commented Apr 28, 2022

Platform: Garuda Linux (Arch based)
Version of gallery-dl: latest from pip (v1.21.2)

Here is the output with --verbose flag:

[urllib3.connectionpool][debug] https://vk.com:443 "POST /al_photos.php HTTP/1.1" 200 18019
/home/username/Destination-directory/328898457.jpg
[vk][error] An unexpected error occurred: ValueError - not enough values to unpack (expected 3, got 1). Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[vk][debug] 
Traceback (most recent call last):
  File "/home/username/.local/lib/python3.10/site-packages/gallery_dl/job.py", line 76, in run
    for msg in extractor:
  File "/home/username/.local/lib/python3.10/site-packages/gallery_dl/extractor/vk.py", line 43, in items
    photo["url"], photo["width"], photo["height"] = photo[size]
ValueError: not enough values to unpack (expected 3, got 1)
@AlttiRi
Copy link

AlttiRi commented Apr 29, 2022

It's difficult to say that exactly wrong without an example URL.
Is *_ array empty, or does it have a missed link, or dimension values.
UPD: It says that it has 1 value instead of 3, so probably it has only URL value. Or maybe something other one (an error message, for example)?

Here is an example of the site's response (from DevTools):
image


Well, possible fix is try to use *_src instead of *_. Then fallback sizes. (It's requires changes in the source code.)

@MagnetizedFreckles
Copy link
Author

Honestly i don't know, where to change these attributes. Here is JSON outpun of me trying to download this album, hope it will somehow help

 "x_src": "https://sun9-34.userapi.com/s/v1/if2/m2kjq3pjfOGsGCU-7sB_-X6zujKEGaLFq9adNZ5R6Lwty3h0LhaulOGqI1S0bbZEcg1EzRHDh3M8uVE0TDvG9H_e.jpg?size=551x600&quality=96&type=album"
    }
  ],
  [
    "ValueError",
    "not enough values to unpack (expected 3, got 1)"
  ]
]

This is the only image in tens of thousands of downloads, which I can't get and I don't know what is the problem.

@mikf mikf closed this as completed in a39e7b7 May 2, 2022
@mikf mikf added the bug label May 2, 2022
@mikf
Copy link
Owner

mikf commented May 2, 2022

The contents of "x_" are, most of the time

"x_": ["URL", width, height]

but in some rare instances there is no width/height:

"x_": ["URL"]

Never mind. That is one issue, but the URLs for these photos are either incomplete or throw 404 errors. Back to the drawing board ...

@mikf mikf reopened this May 2, 2022
@mikf
Copy link
Owner

mikf commented May 2, 2022

Example URL: https://vk.com/id76957806

The first two photos download, but the rest throws errors:

$ gallery-dl https://vk.com/id76957806
"x_": ['https://sun9-50.userapi.com/s/v1/if2/eO2BuPbYiOkUMgKNjR-QN_w1VxbRMIvsyNpkzqNUyZhzXu8ewYpa6q0dHmQZ4gkvhoLam6HByvKJZFv8UQyeriM3.jpg?size=453x604&quality=96&type=album', 453, 604]
/tmp/vk/76957806/290329915.jpg
"x_": ['https://sun9-44.userapi.com/s/v1/if2/i42wl995UnFeXWZePR2ebB6GkjjYzrrWQp8UDPy39uqRejb23vNSj2cDIjU8uSV1sd8QXksw-UT_0u5gXf-mzL12.jpg?size=550x150&quality=96&type=album', 550, 150]
/tmp/vk/76957806/289422101.jpg
"y_": ['https://sun9-53.userapi.com/c10322/u76957806/-6/y_53845288']
[downloader.http][warning] '404 Not Found' for 'https://sun9-53.userapi.com/c10322/u76957806/-6/y_53845288'
[download][error] Failed to download 264910048.part
"x_": ['c10322/u76957806/-7/x_8e7bfcef']
[download][error] 'c10322/u76957806/-7/x_8e7bfcef:' URLs are not supported/enabled
[download][error] Failed to download c10322/u76957806/-7/x_8e7bfcef
"x_": ['c10322/u76957806/138963481/x_89f86d58']
[download][error] 'c10322/u76957806/138963481/x_89f86d58:' URLs are not supported/enabled
[download][error] Failed to download c10322/u76957806/138963481/x_89f86d58
...

mikf added a commit that referenced this issue May 2, 2022
@AlttiRi
Copy link

AlttiRi commented May 2, 2022

image
Yeah, they are 404 since the URLs are incorrect trimmed by the server.
_y, _z have missed .jpg, _x also has missed origin with /.
Anyway *_src have the correct URL.

@God-damnit-all
Copy link
Contributor

gallery-dl https://vk.com/msinsanity used to grab a lot of images (though not all) a month ago or so, but now it returns nothing. This is the entire output:

[gallery-dl][debug] Version 1.22.0-dev - Executable
[gallery-dl][debug] Python 3.9.12 - Windows-10-10.0.19044-SP0
[gallery-dl][debug] requests 2.27.1 - urllib3 1.26.9
[gallery-dl][debug] Starting DownloadJob for 'https://vk.com/msinsanity'
[vk][debug] Using VkPhotosExtractor for 'https://vk.com/msinsanity'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): vk.com:443
[urllib3.connectionpool][debug] https://vk.com:443 "GET /msinsanity HTTP/1.1" 200 117835
[vk][debug] Sleeping for 0.997 seconds
[urllib3.connectionpool][debug] https://vk.com:443 "POST /al_photos.php HTTP/1.1" 200 10787

@AlttiRi
Copy link

AlttiRi commented May 2, 2022

With selecting albums manually it downloads all 3049 almost all (3047) images. (1059 + 1990 from the wall)

Except these two 404:
https://vk.com/photo-72806334_430536412
https://vk.com/photo-72806334_430536511

https://vk.com/album-72806334_0 https://vk.com/album-72806334_00 https://vk.com/album-72806334_241779797 https://vk.com/album-72806334_225403523 https://vk.com/album-72806334_219089737 https://vk.com/album-72806334_215256639 https://vk.com/album-72806334_214655435 https://vk.com/album-72806334_218538666

Upd: Now these URLs are online.

@mikf
Copy link
Owner

mikf commented May 4, 2022

This should now be fixed with commit 5b7423d, so I'm closing this ... again.

@ImportTaste fixed in 3e6aba0. It failed to get the numeric ID for msinsanity, which can also be used directly with https://vk.com/photos-72806334 or https://vk.com/albums-72806334

@mikf mikf closed this as completed May 4, 2022
@AlttiRi
Copy link

AlttiRi commented May 4, 2022

/photos-72806334 most likely (did not test) will not include wall photos.

Also using of /photos, or /albums leads to other results, than using the list of album URLs.
For example:

image
image
It uses "custom id" / "photo id" path.

Downloading of a selected album uses the "id" / "album id" / "photo id" path:
image

@God-damnit-all
Copy link
Contributor

@mikf I too am having issues with downloading media from walls, whether it be from targeting the user or targeting the wall URL itself. (e.g. gallery-dl https://vk.com/wall-72806334_28956)

The easiest test subject is the pinned post on vk.com/msinsanity which has videos. (The caption says GIF but I think that's like what Twitter does where it converts them.) I'm pretty sure it's not downloading non-video media from wall posts as well though.

@God-damnit-all
Copy link
Contributor

God-damnit-all commented May 4, 2022

Looks like doc and photo posts have the same problem:
https://vk.com/doc23047329_353385634
https://vk.com/photo120798604_457243422
https://vk.com/photo-72806334_395573737

Some of this media might be covered by extracting the user's albums, but some isn't. VK is very inconsistent in that regard, annoyingly.

Also note that one photo post has a dash in it and one does not. The regex might need to have -? after album/albums/doc/photo/wall if it doesn't already.

EDIT: Yet another weirdness I've noticed. In the case of 'album' posts (not 'albums'), it doesn't extract the user directly.

https://vk.com/album-72806334_219089737 will result in a vk/-72806334 folder (with default settings).

@AlttiRi
Copy link

AlttiRi commented Jun 26, 2022

In some rare cases 404 error happens for an old profile.

downloader.http: '404 Not Found' for https://sun9-80.userapi.com/c1234/u12345678/12345678/z_qwe12345

The file extension is just missed. Adding .jpg helps.

The broken URL is only in *_ property, in *_src property is correct one.


except ValueError:
# photo without width/height entries (#2535)
photo["url"] = photo[size + "src"]

UPD. Well, I already posted this bug above, lol.

In this case *_ property has width and height in the array, but the URL is cut.

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

No branches or pull requests

4 participants