I've read up on their buddyicon system for profile pictures that Flickr uses, and it's API. However they're not very clear about what API method returns it. See: https://www.flickr.com/services/api/misc.buddyicons.html
It's extremely vague of documentation.
I've been using methods like the below as a base for utilizing Flickr data in my app.
$.getJSON('https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=youdontneedthis&user_id=youdontneedthiseither&format=json&nojsoncallback=1', function(data) {
$.each(data.photos.photo, function(i,item){
var src = "http://farm"+ item.farm +".static.flickr.com/"+ item.server +"/"+ item.id +"_"+ item.secret +"_m.jpg";
This is working well for me, but I'm not aware of a method to return the buddyicon??
http://farm{icon-farm}.staticflickr.com/{icon-server}/buddyicons/{nsid}.jpg
How does one determine this without a valid API method?
Any kind of help would be greatly appreciated!
You can get information about a user by user_id
and then extract necessary data for work:
// I use BabelJS / ES2015
const url = 'https://api.flickr.com/services/rest';
const api_key = /* enter api key */;
const user_id = /* enter user id */;
$.getJSON(url, {
method: 'flickr.people.getInfo',
api_key: api_key,
user_id: user_id,
format: 'json',
nojsoncallback: '1',
}, function(data) {
const {
iconfarm,
iconserver,
nsid
} = data.person;
const src = `https://farm${iconfarm}.staticflickr.com/${iconserver}/buddyicons/${nsid}.jpg`;
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.