mikf / gallery-dl

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

Pixiv refresh token from the "callback" page doesn't work #1522

Closed arisboch closed 3 years ago

arisboch commented 3 years ago

I'm following all instructions I see when I use enter gallery-dl oauth:pixiv, but the only thing I get in return is {'has_error': True, 'errors': {'system': {'message': 'The authorization code has expired', 'code': 1508}}, 'error': 'invalid_grant'}. What can I do?

mikf commented 3 years ago

Be faster. No, seriously, that's it. The code expires after only a few seconds, so you have to be rather quick to select-copy-paste-enter

arisboch commented 3 years ago

Is there any way to download sign-in-only content from Pixiv without having to jump through this kinda absurd hoops (such as cookies)?

mikf commented 3 years ago

No, there isn't, at least not with gallery-dl. This is the only way to use the Pixiv Mobile API after logging in with username and password got disabled (#1304, https://github.com/upbit/pixivpy/issues/158)

Thankfully this only has to be done once, and I'd recommend also storing the token in your config file in case your cache gets deleted ("refresh-token": "token" where previously your username and password setting where).

marlekal commented 3 years ago

is there a way to view the token in order to store it in the config file? i already have the token linked using the "callback" steps thingy or do i have to do the process again?

mikf commented 3 years ago

Not with gallery-dl. You could try sqlitebrowser, or you put a print(token) in extractor/pixiv.py before line 546. or I could write a small Python script that does it, but doing the process again might be the fastest.

You'll also be able to select which cache entries to delete, by the way: https://github.com/mikf/gallery-dl/commit/755164b36a945677443d1b972fb8d0c83194f2ed