mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.27k stars 919 forks source link

[Tumblr] hard limit of 50 for Posts and Likes #5810

Open joaobarros opened 2 months ago

joaobarros commented 2 months ago

gallery-dl -> Version 1.27.1 Python 3.12.4 - Windows-11-10.0.22631-SP0 requests 2.31.0 - urllib3 2.2.2

I'm trying to backup likes for a Tumblr blog and only 312 items are downloaded when I know there are thousands of liked posts. I'm suspecting it's the hardcoded limit of 50 returned posts per API call:

urllib3.connectionpool -> https://api.tumblr.com:443 "GET /v2/blog/whatever.tumblr.com/likes?limit=50&before=1712667305 HTTP/11" 200 None

I can see it on the code in tumblr.py:

def likes(self, blog):
    """Retrieve liked posts"""
    params = {"limit": "50", "before": self.before}
    return self._pagination(blog, "/likes", params, key="liked_posts")

Any special reason for the 50 limit? Could this be a config option so the user can set their own limits?

mikf commented 2 months ago

Any special reason for the 50 limit?

The maximum number of returned posts per API request is 50 for likes. Setting limit to a higher value would still only return 50. Not setting limit at all would return the default amount - 20.

The code is supposed to paginate over all results via repeated API requests with changing query parameters, but apparently this doesn't work in your case. It does for the other blogs I tested, including https://www.tumblr.com/konmaao3/likes

The files generated by --write-pages would be helpful to debug this, but they would most likely reveal potentially private information.

joaobarros commented 2 months ago

Thank you for your response.

I started another job with --write-pages and I only got a 1 new jpg when I know there are several dozens new likes.

I noticed that the requested unix time was 2 hours in the past relative to my timezone. There were files liked before that that should have been picked up but just wanted to point out the difference from my local time.

mikf commented 1 month ago

There have been some updates that might have fixed your issue (https://github.com/mikf/gallery-dl/commit/540eaa5addf0e8489deccc9f14c2d84c49802aa7). Could you try again with the latest release?