Closed keranski closed 7 years ago
Hello there!
I've got Pinterest working, I think...
It seems that with the Pinterest account access token it is possible to access only the account pins | boards related to the access token.
Here is the code (I didn't clean it up...):
`pinterest: { posts: [], loaded: false, apiv1: 'https://api.pinterest.com/v1/',
getData: function(account) { var request_url; //limit = 'limit=' + options.pinterest.limit, var fields = 'fields=id,created_at,link,note,creator(url,first_name,last_name,image),image'; //query_extention = fields + '&access_token=' + options.pinterest.access_token + '&' + limit + '&callback=?'; switch (account[0]) { case '@': var username = account.substr(1); if (username === 'me') { request_url = Feed.pinterest.apiv1 + 'me/pins/' + '?access_token=' + options.pinterest.access_token + '&' + fields + '&' + 'limit=' + options.pinterest.limit + '&callback=?'; } else { request_url = Feed.pinterest.apiv1 + 'me/pins/' + '?access_token=' + options.pinterest.access_token + '&' + fields + '&' + 'limit=' + options.pinterest.limit + '&callback=?'; //request_url = Feed.pinterest.apiv1 + 'me/boards/' + '?access_token=' + options.pinterest.access_token + '&' + 'limit=' + options.pinterest.limit + '&callback=?'; } break; default: } Utility.request(request_url, Feed.pinterest.utility.getPosts); }, utility: { getPosts: function(json) { json.data.forEach(function(element) { var post = new SocialFeedPost('pinterest', Feed.pinterest.utility.unifyPostData(element)); post.render(); }); }, unifyPostData: function(element){ var post = {}; post.id = element.id; post.dt_create= moment(element.created_at); post.author_link = element.creator.url; post.author_picture = element.creator.image['60x60'].url; post.author_name = element.creator.first_name + element.creator.last_name; post.message = element.note; post.description = ''; post.social_network = 'pinterest'; post.link = 'https://www.pinterest.com/pin/' + element.id; //post.link = element.link ? element.link : 'https://www.pinterest.com/pin/' + element.id; if (options.show_media) { post.attachment = '<img class="attachment" src="' + element.image['original'].url + '" />'; } return post; } } },`
Regards
Hello there!
I've got Pinterest working, I think...
It seems that with the Pinterest account access token it is possible to access only the account pins | boards related to the access token.
Here is the code (I didn't clean it up...):
`pinterest: { posts: [], loaded: false, apiv1: 'https://api.pinterest.com/v1/',
Regards