Question

I am trying to understand the Pinterest API to figure out if I can use it to get the followers count for a person. The only documentation I found for Pinterest API is https://developers.pinterest.com/api_docs/ and that does not talk about the followers count.

Also I found this question on stackoverflow that talks about the followers count using the api - Pinterest Followers display How can I get a detailed description of the fields that are being returned in the json here? Eg. meta['count']

  1. Can someone point me to the right link?
  2. I noticed that the pinterest username can be changed by a user anytime. So, if I am trying to get the follower counts for a bunch of people, what can I query based on?

Thank you for all the help!

Was it helpful?

Solution

After some online help, I found a way to get the follower count for a pinterest profile using Nokogiri gem and scanning the meta tags.

If you run the following in ruby console to output the document for this url:

require 'open-uri'
doc = Nokogiri::HTML("http://www.pinterest.com/pinterest/")  

Now you can extract the meta tag for the followers count as follows:

doc.xpath("//meta[@name='pinterestapp:followers']").first.attributes['content'].value

The above is possible because the pinterest profile page source has the following tag (View Source for the page):

<meta property="pinterestapp:followers" name="pinterestapp:followers" content="432444" data-app>

Till the time we do not have an api for pinterest, this seems to be the way to get the followers count for a pinterest profile. Hope this helps someone!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top