Search code examples
flickr

Flickr API - Custom URL to NSID


I'm trying to fetch the user information and images when I have a URL that is from flickr, however I cannot figure out how to get the username or user_id from the custom URLs.

The custom URL are with the following format.

https://www.flickr.com/photos/tataouane/

However the "tataouane" is not a NSID or a username that I can use the methods to fetch the information.

If I read the documentation I get the following:

URLs to photo and profile pages use either the user's NSID (the number with the '@' sign in it) or their custom URL (if they've chosen one). You can find their custom URL with a call to flickr.people.getInfo.

But to call the flickr.people.getInfo I need an NSID, and I want precisely the opposite.

I've tried to double check and the flickr.people.findByUsername return an "User not found" error message (as it should).

How can I get the NSID? Any ideas?

Thanks a lot!


Solution

  • OK, I found the solution and I hope this will help someone.

    There's another API method that can be used that parses the URL into a NSID and username.

    www.flickr.com/services/api/explore/flickr.urls.lookupUser

    Flickr discussion here: https://www.flickr.com/groups/api/discuss/72157649116650355/#comment72157649063153796