mikf / gallery-dl

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

gallery-dl and flickr authentication error - "Invalid API Key (Key has invalid format)" #5161

Closed estatistics closed 7 months ago

estatistics commented 7 months ago

gallery-dl and flickr authentication error - "Invalid API Key (Key has invalid format)"

./gall.sh 
https://www.flickr.com/photos/43285696@N06/favorites
orites
https://www.flickr.com/photos/43285696@N06/favorites
gallery line debug
[gallery-dl][debug] Version 1.26.7-dev
[gallery-dl][debug] Python 3.11.2 - Linux-6.1.0-15-amd64-x86_64-with-glibc2.36
[gallery-dl][debug] requests 2.28.1 - urllib3 1.26.12
[gallery-dl][debug] Configuration Files ['/mnt/LISTS/gallerydl_flickr.conf']
[gallery-dl][debug] Starting DataJob for 'https://www.flickr.com/photos/43285696@N06/favorites'
[flickr][debug] Using FlickrFavoriteExtractor for 'https://www.flickr.com/photos/43285696@N06/favorites'
[flickr][debug] Using default OAuth1.0 authentication
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.flickr.com:443
[urllib3.connectionpool][debug] https://api.flickr.com:443 "GET /services/rest/?url=https%3A%2F%2Fwww.flickr.com%2Fphotos%2F43285696%40N06&method=flickr.urls.lookupUser&format=json&nojsoncallback=1 HTTP/1.1" 200 75
[flickr][debug] Sleeping 1.67 seconds (request)
[urllib3.connectionpool][debug] https://api.flickr.com:443 "GET /services/rest/?user_id=43285696%40N06&extras=description%2Cdate_upload%2Ctags%2Cviews%2Cmedia%2Cpath_alias%2Cowner_name%2Curl_o%2Curl_6k%2Curl_5k%2Curl_4k%2Curl_3k%2Curl_k%2Curl_h%2Curl_l&page=1&method=flickr.favorites.getList&format=json&nojsoncallback=1 HTTP/1.1" 200 None

(example tokens)

    "flickr": {
                   "_comment": "OAuth keys for account 'user_that'",
                   "access-token": "1111111111111111-111111111111111111",
                   "access-token-secret": "aaaaaaaaaaaaaa",
                   "extractor.flickr.access-token": "1111111111111111-111111111111111111",
                   "extractor.flickr.access-token-secret": "aaaaaaaaaaaaaa"
               }
estatistics commented 7 months ago

gallery-dl -v --retries -1 --http-timeout 120 --config /mnt/LISTS/gallerydl_flickr.conf https://www.flickr.com/photos/183931951@N03/ without --dump-json

./gallery-dl/flickr/lovely legs and more/flickr_53504790155.jpg
[urllib3.connectionpool][debug] https://live.staticflickr.com:443 "GET /65535/53503479852_cc33748fa6_h.jpg HTTP/1.1" 200 None
./gallery-dl/flickr/lovely legs and more/flickr_53503479852.jpg
[urllib3.connectionpool][debug] https://live.staticflickr.com:443 "GET /65535/53504515268_f1bc86dee4_b.jpg HTTP/1.1" 200 None
./gallery-dl/flickr/lovely legs and more/flickr_53504515268.jpg
[urllib3.connectionpool][debug] https://live.staticflickr.com:443 "GET /65535/53504790160_0f7ee4e427_k.jpg HTTP/1.1" 200 None
./gallery-dl/flickr/lovely legs and more/flickr_53504790160.jpg
[flickr][debug] Sleeping 0.36 seconds (request)
[urllib3.connectionpool][debug] https://api.flickr.com:443 "GET /services/rest/?photo_id=53503479887&method=flickr.photos.getSizes&format=json&nojsoncallback=1 HTTP/1.1" 200 None
[urllib3.connectionpool][debug] https://live.staticflickr.com:443 "GET /65535/53503479887_e79f8c1f1f.jpg HTTP/1.1" 200 None
./gallery-dl/flickr/lovely legs and more/flickr_53503479887.jpg
[flickr][debug] Sleeping 1.38 seconds (request)
[urllib3.connectionpool][debug] https://api.flickr.com:443 "GET /services/rest/?photo_id=53503479907&method=flickr.photos.getSizes&format=json&nojsoncallback=1 HTTP/1.1" 200 None
[urllib3.connectionpool][debug] https://live.staticflickr.com:443 "GET /65535/53503479907_533bcd9836.jpg HTTP/1.1" 200 None
./gallery-dl/flickr/lovely legs and more/flickr_53503479907.jpg
[flickr][debug] Sleeping 1.00 seconds (request)
Hrxn commented 7 months ago

What's up with that example token blurb from your config?

It shouldn't look like that.

It should look like this:

            "api-key": "<token here>",
            "api-secret": "<token here>",
            "access-token": "<token here>",
            "access-token-secret": "<token here>",
estatistics commented 7 months ago

taken from here (not values of tokens). https://manpages.ubuntu.com/manpages/jammy/man5/gallery-dl.conf.5.html

estatistics commented 7 months ago

i have created a dummy application with random name, flickr given Key and Secret strings that i put them in api-key and api-secret. i have run gallery-dl oauth:flickr and i received 'access-token' and 'access-token-secret'. i made my config as you posted. now, the error code is:

 gallery-dl -v --retries -1 --http-timeout 120 --config /mnt/LISTS/gallerydl_flickr.conf  --dump-json https://www.flickr.com/photos/183931951@N03/
[gallery-dl][debug] Version 1.26.7-dev
[gallery-dl][debug] Python 3.11.2 - Linux-6.1.0-15-amd64-x86_64-with-glibc2.36
[gallery-dl][debug] requests 2.28.1 - urllib3 1.26.12
[gallery-dl][debug] Configuration Files ['/mnt/Games00/_____mine/LISTS/gallerydl_flickr.conf']
[gallery-dl][debug] Starting DataJob for 'https://www.flickr.com/photos/183931951@N03/'
[flickr][debug] Using FlickrUserExtractor for 'https://www.flickr.com/photos/183931951@N03/'
[flickr][debug] Using custom OAuth1.0 authentication
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.flickr.com:443
[urllib3.connectionpool][debug] https://api.flickr.com:443 "GET /services/rest/?url=https%3A%2F%2Fwww.flickr.com%2Fphotos%2F183931951%40N03&method=flickr.urls.lookupUser&format=json&nojsoncallback=1 HTTP/1.1" 200 None
[flickr][debug] Server response: {'stat': 'fail', 'code': 98, 'message': 'Invalid auth token'}
[
  [
    "AuthenticationError",
    "Invalid auth token"
  ]
]

i have chosen in api flickr either Web Application or Desktop nothing worked

 "flickr":{
    "_comment": "sOAuth keys for account 'user_that'",
    "api-key": "59___________a7",
    "api-secret": "565__________b0",
    "access-token": "72______________________-6b___________________e8",
    "access-token-secret": "855______________d"
           }
estatistics commented 7 months ago

in

https://www.flickr.com/services/api/explore/flickr.auth.oauth.checkToken

i put my api_key but i dont know what to put on oauth_token.

nothing worked

estatistics commented 7 months ago

solved somehow