title: How to get the number of Facebook likes for a URL consistently?
body: <p>I have a URL that can be expressed as HTTP and HTTPS (technically they're different URLs but there seems to be consensus that they're 'the same').</p>
  
  <p>In this example the HTTP URL redirects to the HTTP one. This happens in many cases, but I'm using <code>facebook.com</code> as an example.</p>
  
  <p>My aim is to get a "total comment and share count for <code>http://facebook.com</code> or <code>https://facebook.com</code>".</p>
  
  <p>Querying using the HTTP URL <code>https://graph.facebook.com/v2.7/http://facebook.com?access_token=XXXX</code> gives us:</p>
  
  <pre><code>  {
      og_object: {
        id: "10151063484068358",
        title: "Welcome to Facebook - Log In, Sign Up or Learn More",
        type: "website",
        updated_time: "2016-08-31T14:49:01+0000"
      },
      share: {
        comment_count: 5252,
        share_count: 115724962
      },
      id: "http://facebook.com"
    }
  </code></pre>
  
  <p>And using HTTPS, <code>https://graph.facebook.com/v2.7/https://facebook.com?access_token=XXXX</code>:</p>
  
  <pre><code>  {
      og_object: {
        id: "10151063484068358",
        title: "Welcome to Facebook - Log In, Sign Up or Learn More",
        type: "website",
        updated_time: "2016-08-31T14:49:41+0000"
      },
      share: {
        comment_count: 1348,
        share_count: 115725362
      },
      id: "https://facebook.com"
    }
  </code></pre>
  
  <p>Using the <code>og_object.id</code>, if I query <code>https://graph.facebook.com/v2.7/10151063484068358/likes?summary=true&amp;access_token=XXXX</code> I get:</p>
  
  <pre><code>{
    summary: {
      total_count: 5890439,
      can_like: false,
      has_liked: false
    }
  }
  </code></pre>
  
  <p>Which is entirely different again.</p>
  
  <p>And using the <code>engagement</code> field <code>
  https://graph.facebook.com/v2.7/10151063484068358?fields=engagement&amp;access_token=XXXX</code></p>
  
  <pre><code>{
    engagement: {
      count: 115740062,
      social_sentence: "115M people like this."
    },
    id: "10151063484068358"
  }
  </code></pre>
  
  <p>I get 115740062, which a different number <em>again</em>, but at least close to the above (caches may be updated on different schedules).</p>
  
  <p>As a side note, the <code>engagement</code> and <code>likes</code> both claim to represent likes, but in another example, they disagree:</p>
  
  <p><code>https://graph.facebook.com/v2.7/https://www.co-operativebank.co.uk/?access_token=XXXX</code> gives 910 likes:</p>
  
  <pre><code>{
    og_object: {
      id: "10150337668163877",
      description: "The Co-operative Bank provides personal banking services including current accounts, credit cards, online and mobile banking, personal loans, savings and more",
      title: "Personal banking | Online banking | Co-op Bank",
      type: "website",
      updated_time: "2016-08-31T14:07:30+0000"
    },
    share: {
      comment_count: 0,
      share_count: 910
    },
    id: "https://www.co-operativebank.co.uk/"
  }
  </code></pre>
  
  <p><code>https://graph.facebook.com/v2.7/10150337668163877?fields=engagement&amp;access_token=XXXX</code> gives the same 910 likes</p>
  
  <pre><code>{
    engagement: {
      count: 910,
      social_sentence: "910 people like this."
    },
    id: "10150337668163877"
  }
  </code></pre>
  
  <p><code>https://graph.facebook.com/v2.7/10150337668163877/likes?summary=true&amp;access_token=XXXX</code> gives zero likes.</p>
  
  <pre><code>{
    data: [ ],
    summary: {
      total_count: 0,
      can_like: false,
      has_liked: false
    }
  }
  </code></pre>
  
  <p>I'm caught between four different numbers and I only want one!</p>
  
  <p>Observations:</p>
  
  <ul>
  <li>We get the same OpenGraph ID of <code>10151063484068358</code>, which I believe is caused by one URL redirecting to the other.</li>
  <li>We get different counts for the two URLs, so they are treated differently for share counts.</li>
  <li>HTTPS comments are lower than HTTP comments </li>
  <li>HTTPS shares are higher than HTTP shares</li>
  <li>The numbers 115724962 and 115725362 are too close to be independent but coincidentally similar counts.</li>
  </ul>
  
  <p>I'm struggling to find anything consistent here.</p>
  
  <p>Is it possible to get a headline figure for "total comment and share count for <code>http://facebook.com</code> or <code>https://facebook.com</code>?</p>
  
  <p>Or is it possible to somehow use the <code>og_object.id</code> of <code>10151063484068358</code> to get a total count?</p>