Instagram API - get like count on media - instagram

Good morning,
I'm writing my own library to improve skills for getting media from Instagram profile and showing it on my website.
I read a lot of articles, documentation, etc. but there are many old versions and endpoints. At the official API documentation, I'm unable to find, how to get like count or comment count on every single media.
So:
I can OAuth - OK
Get short-live token - OK
Get long-live token - OK
Refresh long-live token - OK
Get media list - OK
Get one media based on its ID - OK
But none of endpoints gives me like count or comment count. How can I achieve this?
https://graph.instagram.com/me/media?fields=id,caption,comments_count,like_count,media_type,media_url,thumbnail_url&access_token=
returns me:
{ data: [{ "id":"123456798", "caption":"My title", "media_type":"IMAGE", "media_url":"https://..." }, { ... }] }
I found in the documentation https://developers.facebook.com/docs/instagram-api/reference/ig-media/ that I can get the like_count field only for requests at media with their ID. So I tried EP:
https://graph.instagram.com/v15.0/123456789?fields=id,caption,media_type,media_url,thumbnail_url,like_count&access_token=
and return is: Tried accessing nonexisting field (like_count) on node type (Media).
On the instagram I've able to get likes and comments and the media has likes and comments. What I'm doing bad? Thank you for your time.

Related

What does YouTube API V3 I.1 policy restriction mean?

YouTube API v3 has reduced our key from 640,000 queries per day to 0 (!!! and actually blocked us). This happened after submitting a request to enlarge our quota. They did this without any warning. We received an email 2 days later saying we are are out of compliance with
Policy I.1 (Additional Prohibitions): https://developers.google.com/youtube/terms/developer-policies#i-additional-prohibitions
Our system allow users to organize and view YouTube videos in order to plan their event timeline, rather than copying the URL on a google doc the old way. Thus driving quality traffic to YouTube and providing value to YouTube users who can be monetized.
We are a harmless small startup that has been using YouTube API for the past 4 years. After using the API in our product for that long, and finally growing our user base, we requested a higher quota and were revoked completely without any notice.
We need help shedding light on what exactly YouTube Developer team think we are doing wrong that doesn't comply.
The reason was complying with policy I.1. Can anyone give examples of things that they did that have been revoked due to policy I.1 so we can understand why YouTube thinks we are not in compliance? How do we get more specific details so we can fix this? how can we fix something so vague?
Example of our API call (NODE.js):
const response = await axios.get('https://www.googleapis.com/youtube/v3/search', {
params: {
key: OUR_BLOCKED_KEY,
maxResults: 5,
q: searchStr,
part: 'snippet',
type: 'video',
fields: 'items(id/videoId,snippet(channelTitle,thumbnails/default/url,thumbnails/medium/url,title))'
}
});

Instagram Hashtag Search API returns error message "user_id is required" although I have provided it

I am trying to get data about media from my IG Business account with a specific hashtag.
I used Graph API Explorer and tried with
/{hashtag_id}?user_id={instagram_business_id}&fields=recent_media
but I got an error "(#100) The parameter user_id is required."
Does anybody know what may be the problem and how to solve it?
The API URL is incorrect, your URL should look like this:
/{hashtag_id}/recent_media?user_id={instagram_business_id}&fields=id,caption,media_url...

Instagram changed policy to retrieve posts with hashtag

Instagram has changed policy since June 1st. Now my code which used to fetch posts with certain hashtag in a website stopped working.
According to this new policy, the app needs to submit for approval. But when i went through approval process, the privacy policy is a must and which should describes how this app would use data. and when i went through sample instagram policy this is huge and mostly deals with mobile app.
Now my qeustion is, do i need to write something like this when my app just needs to use client id's secret keys and general stuff just to fetch posts with certain(defined) hastag ?
I have used instafeed.js to retrieve posts by hashtag.
var feed = new Instafeed({
get: 'tagged',
tagName: "<?php echo $tagname;?>",
clientId: "<?php echo $client_id;?>",
limit: 14,
template: '<img data-attr="{{id}}" src="{{image}}" alt="{{caption}}" data-username="{{link}}" />',
});
UPDATE :
It looks like we won't be able to fetch particular hashtagged public content in our website.
Also, in the alert section As alternative solution, ..... find a company that offers this type of service (content discover, moderation, and display).
What are these company instagram talked about ?
We're in the same boat. The only one I've found so far that claims to be able to do this is called Dialog Feed. Here is their blog post about it: https://www.dialogfeed.com/instagram-api-not-working-solutions-for-hashtag-and-profile-search/
They are not cheap, however. Like 890 eur/year not cheap for just the basic.

Spoitfy and Echo Nest API Mismatches, How to Fix?

I am using the Spotify and Echo Nest APIs to get audio information about songs. The basic flow is:
Search for a song with Spotify's API using track title and artist name
Get the Spotify URL for the track from the response
Query the Echo Nest API to get the audio summary, using the Spotify ID
This has been working well for a long time. But in the past few months I have noticed more and more tracks that cannot be found in the Echo Nest API with the given Spotify ID.
Here's an example from today. Sufjan Stevens's track "Chicago"
Search for it on Spotify.http://ws.spotify.com/search/1/track.json?q=artist:sufjan%20track:chicago
The first result gives us the spotify ID: spotify:track:7Bo0xLcXWx3pdhqwthqGaz
Query Echo Nest for this Spotify ID: http://developer.echonest.com/api/v4/song/profile?api_key=V91CRTEB0IFMAJBMB&track_id=spotify:track:7Bo0xLcXWx3pdhqwthqGaz&bucket=audio_summary
(For this URL I used their example API key, so you can see the result. Of course in my app I am using my own API key.)
The response is "The Identifier specified does not exist: spotifyv2-ZZ:track:spotify:track:7Bo0xLcXWx3pdhqwthqGaz"
But Echo Nest clearly does have this track in their database, because I can search for it, and even get Spotify Ids: http://developer.echonest.com/api/v4/song/search?api_key=V91CRTEB0IFMAJBMB&format=json&results=1&artist=sufjan&title=chicago&bucket=id:spotify&bucket=tracks (But the Spotify Id returned by Echo Nest is not the same as the one returned by Spotify.)
Is there any way for me to fix this?
Im noticing the same issue- what I did is to use Echo Nest's search instead, which actually allows you to do both at once. One less API call!
for track in search_tracks:
results = nest.get('song/search', artist=track['artist'],
title=track['title'], bucket='audio_summary')
if results['songs']:
tracks.append(results['songs'][0])

Twitter API get Parameters after Oauth

I'm using Allauth for Twitter, works like a charm.
I have never worked with Scopes, so my question is, is there any support to get for example the twitter user stream?
Or anyone got any ideas how to get the request working?
I'm struggeling with the twitter api, it seems way more complicated then facebook or foursquare or any other api i have come across.
with facebook it's like this
return requests.get("https://graph.facebook.com/v2.3/%s&access_token=%s" % (path, access_token)).json()
Now if i send
requests.get('https://api.twitter.com/1.1/statuses/home_timeline.json&oauth_consumer_key=' +oauth_con+ 'oauth_signature_method="HMAC-SHA1"&oauth_nonce="'+now+'"&oauth_token="'+twitter+'"&oauth_timestamp="'+now+'"&oauth_version=1.1"')
I get a either a 400 error or a 404 error depending on .json? or json&.
According to the doc you have to have "" around every parameter. Didn't help.

Resources