mikf / gallery-dl

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

Redoing Oauth for Pixiv #6030

Closed thegoldenboy542 closed 2 months ago

thegoldenboy542 commented 3 months ago

Everytime I complete the oauth for pixiv it keeps telling me to do it again

PS C:\Users\> gallery-dl -d E:\x1 -R 100 -r 2.5M --download-archive E:\x1\archivepixiv.txt --write-tags --filter "extension in ('jpg', 'jpeg', 'png')" -u "" -p "" 
[pixiv][error] AuthenticationError: 'refresh-token' required.
Run `gallery-dl oauth:pixiv` to get one.
PS C:\Users\> gallery-dl oauth:pixiv
[oauth][info] Opening URL in :

https://app-api.pixiv.net/web/v1/login?code_challenge=cpnTMoiUYkADar87TZtgWdmaPorwVjd0HRS-4pDV7eg&code_challenge_method=S256&client=pixiv-android

1) Open your browser's Developer Tools (F12) and switch to the Network tab
2) Login
3) Select the last network monitor entry ('callback?state=...')
4) Copy its 'code' query parameter, paste it below, and press Enter

- This 'code' will expire 30 seconds after logging in.
- Copy-pasting more than just the 'code' value will work as well,
  like the entire URL or several query parameters.

code: https://app-api.pixiv.net/web/v1/users/auth/pixiv/callback?state=VIuGIX6AIYTljkw2PyygdbESWatnGmPsd32nRY3v4Ums6llDcssPy7oHUiw1wvuX&code=ZomYOXrhtFZnoQjTLbUOTygFEfflgYueOjIGBS5nojs
[oauth][info] Writing 'refresh-token' to cache

Your 'refresh-token' is

abcdefghijklmnopqrstuvwxyz1234567890abcdefg

This value has been cached and will automatically be used.
PS C:\Users\> gallery-dl -d E:\x1 -R 100 -r 2.5M --download-archive E:\x1\archivepixiv.txt --write-tags --filter "extension in ('jpg', 'jpeg', 'png')" -u "" -p "" 
[pixiv][error] AuthenticationError: 'refresh-token' required.
Run `gallery-dl oauth:pixiv` to get one.
PS C:\Users\>
mikf commented 3 months ago

This value has been cached and will automatically be used.

For whatever reason, for some this caching process doesn't work the way it should.

In this case, try explicitly specifying the cache.file location

-o cache.file="%APPDATA%/gallery-dl/cache.sqlite3"
"cache": {
    "file": "%APPDATA%/gallery-dl/cache.sqlite3"
}

or input the token value manually / add it to your config file

-o refresh-token=aBcDeFgHiJkLmNoPqRsTuVwXyZ01234567890-FedC9

https://github.com/mikf/gallery-dl/blob/0bbdeaaa504541c1b9fb62396e228cd99fdff25f/docs/gallery-dl-example.conf#L46