Skip to content

[flickr][error] API request failed: Invalid API Key (Key has expired) #8553

@pabs3

Description

@pabs3

The Flickr API key used by gallery-dl has expired. It is possible to get a new key from the web page by searching for root.YUI_config.flickr.api.site_key in a <script> block. Maybe the gallery-dl code could check for that first and fall back to the hard-coded Flickr API key?

$ PYTHONPATH=`pwd` ./bin/gallery-dl -v https://www.flickr.com/photos/197255316@N08/
[gallery-dl][debug] Version 1.31.0-dev - Git HEAD: 65c4f009
[gallery-dl][debug] Python 3.13.9 - Linux-6.17.7+deb14+1-amd64-x86_64-with-glibc2.41
[gallery-dl][debug] requests 2.32.5 - urllib3 2.5.0
[gallery-dl][debug] Configuration Files ['${HOME}/.gallery-dl.conf']
[gallery-dl][debug] Starting DownloadJob for 'https://www.flickr.com/photos/197255316@N08/'
[flickr][debug] Using FlickrUserExtractor for 'https://www.flickr.com/photos/197255316@N08/'
[flickr][debug] Using default api_key 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%2F197255316%40N08&method=flickr.urls.lookupUser&format=json&nojsoncallback=1&api_key=90c368449018a0cb880ea4889cbb8681 HTTP/1.1" 200 None
[flickr][debug] Server response: {'stat': 'fail', 'code': 100, 'message': 'Invalid API Key (Key has expired)'}
[flickr][debug] 
Traceback (most recent call last):
  File "~/gallery-dl/gallery_dl/job.py", line 156, in run
    for msg in extractor:
               ^^^^^^^^^
  File "~/gallery-dl/gallery_dl/extractor/flickr.py", line 32, in items
    data = self.metadata()
  File "~/gallery-dl/gallery_dl/extractor/flickr.py", line 50, in metadata
    self.user = self.api.urls_lookupUser(self.item_id)
                ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "~/gallery-dl/gallery_dl/extractor/flickr.py", line 416, in urls_lookupUser
    user = self._call("urls.lookupUser", params)["user"]
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/gallery-dl/gallery_dl/extractor/flickr.py", line 454, in _call
    raise exception.AbortExtraction(f"API request failed: {msg}")
gallery_dl.exception.AbortExtraction: API request failed: Invalid API Key (Key has expired)
[flickr][error] API request failed: Invalid API Key (Key has expired)

$ curl -s https://www.flickr.com/photos/197255316@N08/ | grep -F root.YUI_config.flickr.api.site_key 
root.YUI_config.flickr.api.site_key = "03aa3223b19babb5f0215115ced80079";
root.YUI_config.flickr.api.site_key_fetched = 1763092969;
root.YUI_config.flickr.api.site_key_expiresAt = 1763096569;

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions