Instagram oEmbed - URL signature mismatch for thumbnail_url - instagram

Is there any way how to correctly fetch the thumbnail image for video from Instagram oEmbed?
The typical thumbnail_url in oEmbed response now is https://scontent-cdg2-1.cdninstagram.com/vp/5c0c62bb1aec72c31a9e72680b9d839b/5C37201B/t51.2885-15/sh0.08/e35/p640x640/47693743_354556005338968_7959923928510913600_n.jpg that produces "URL signature mismatch" instead of the image.

What you need to do, is to use the shortlink provided by instagram, you can find this or either via the embed function in the UI or via the API, In the API shows as 'link', then add '/media' at the end, this will redirect to the resource without need to sign the calls.
Hope helps

Related

Adding image from google drive into google slideshow with API

I'm trying to add an image that I've uploaded to Drive via the Drive API into a slide show I've created using the same API.
when Running the fairly standard:
response = (self
._slides_service
.presentations()
.batchUpdate(presentationId=slide_deck_id, body=body)
.execute()
)
I get:
googleapiclient.errors.HttpError: <HttpError 400 when requesting {url} returned "Invalid requests[0].createImage: The provided image is in an unsupported format.">
I'm generating the service in the same way as suggested in the documentation here: https://developers.google.com/slides/quickstart/python
My scope is:
https://www.googleapis.com/auth/presentations
If I run the command with a random png from the internet then it inserts the image fine. I've tried the url provided by webContentLink or WebViewLink values from the response from uploading the images. Neither are valid.
What URL will work to do this?
I'm aware there are other similar questions on stack overflow but all of them are not related to doing this in python or if they are, there solutions don't work.
EDIT:
body is:
{'requests': [{'createImage': {'url': url, 'elementProperties': {'pageObjectId': page_id}}}]}
had to generalise the url and page id because GDPR is a pain.

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...

Spotify API Token Scope Issue

I have been at this for sometime now and wanted to see if anyone had and idea of what I could be doing wrong. What I am trying to do is add a song to a playlist using the provided Spotify Web APIs. According to the documentation on this https://developer.spotify.com/documentation/web-api/reference/playlists/add-tracks-to-playlist/ I need to establish the scope of the user.
"adding tracks to the current user’s private playlist (including collaborative playlists) requires the playlist-modify-private scope" I have created the playlist as collaborative and I am using the login credentials of my personal account to reach this playlist I created. all this is under the same login.
What I am finding is that my scope is not getting added to my token on my call for my token causes a 403 error when I try to add the song.
Here is what that call looks like
https://accounts.spotify.com/authorize/?client_id=mynumber&response_type=code&scope=playlist-modify-private&redirect_uri=http:%2F%2Flocalhost:55141/Home/GetToken/
here are the docs on using authorization to get the correct token.
https://accounts.spotify.com/authorize/?client_id=894400c20b884591a05a8f2432cca4f0&response_type=code&scope=playlist-modify-private&redirect_uri=http:%2F%2Flocalhost:55141/Home/GetToken/
further more if I go into the dev support here
https://developer.spotify.com/documentation/web-api/reference/playlists/add-tracks-to-playlist/
and click the green try button and then request a new token it works.
Bottom line some how my request is not taking my scope request. Any Ideas?
Thanks
To get the token with a specific scope you need to go to the authorize endpoint and get the code. The code is what you want to get to be able http post to the endpoint https://accounts.spotify.com/api/token and get a token with your desired scopes. You can simply get the code by pasting a url like this in your browser...
https://accounts.spotify.com/authorize?client_id=<client_id>&response_type=code&scope=streaming%20user-read-email%20user-read-private&redirect_uri=<redirect_uri>
Only add %20 in between scopes if you have multiple ones
You will then be sent to spotify's website and they'll verify you want to do this. Once you verify it your browser will redirect you to what you set the redirect_uri to be in the url above. At the end of the url that you are sent to, you should be able to see the parameter name code with the code value assigned to it. You then get that code and put it in your http post body params to the https://accounts.spotify.com/api/token endpoint. Make sure you accurately follow the query params requirements in your post method.
An example of the post in python using the requests library:
authorization = requests.post(
"https://accounts.spotify.com/api/token",
auth=(client_id, client_secret),
data={
"grant_type": "authorization_code",
"code": <code>,
"redirect_uri": <redirect_uri>
},
)
authorization_JSON = authorization.json()
return authorization_JSON["access_token"]
In the end you should get a json that shows the scopes you set a long with a refresh the token later on to make more requests.
I know this answer is quite late but I was experiencing the same issue as well which is how I came across this question. I hope this helps anyone that sees this at a later date.
Source: https://developer.spotify.com/documentation/general/guides/authorization-guide/#client-credentials-flow

Instagram users/self/feed 404 errorcode

I am trying to get myself mediafeeds information with the following API (using JInstagram library):
https://api.instagram.com/v1/users/self/feed?access_token={valid access_token}
The response code is 404. I am not sure what I'm missing since the access_token is valid, the API is listed in the Ruby library, but it can't be found on the develop website.
I see there is a 404 error in this site for feeds to, but it are not same API.
Instagram changed their policy and also deprecated some APIs. Check the below link.
https://instagram.com/developer/changelog/
Old API
https://api.instagram.com/v1/users/self/feed?access_token={valid access_token}
Use the below API instead of the above one
https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN

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