Similar to this question
Is it possible to make a request to the API that will only return videos as opposed to a mix of videos and photos?
Right now every request I make I parse out the videos and display them. A lot of the time the response includes 20 objects, the majority of which are photos, and only leaves me with 1 or 2 videos if I'm lucky.
Is there anyway to get a response only composed of video objects?
In Instagram there is just one parameter called media to fetch the photos and videos.
After we have fetched all the videos and photos we can they sort only the videos from the bucket locally and save it.
This is the only option
Related
After a short timeframe, Instagram updates the image URL and the one they give you becomes expired. It isn't a scheduled thing so it isn't something you can refetch on a schedule to fix. The URL you have may break at any time. Has anyone found a solution to easily retrieve an Instagram video URL perhaps similar to the way that the linked solution fetches a current version of static images?
Here is an example of an expired URL that comes from the Instagram API:
https://video-iad3-1.cdninstagram.com/v/t50.33967-16/311796704_656982995824312_2200462786629368413_n.mp4?_nc_cat=100&vs=415717487387323_1550039796&_nc_vs=HBksFQAYJEdPQ2psUks0N2hiR2hWVUNBRjE2Z3ZJX25Za2VicV9FQUFBRhUAAsgBABUAGCRHRGw4alJKMmxkNUFBTU1CQU0wMG1qVU5adW9XYnFfRUFBQUYVAgLIAQAoABgAGwGIB3VzZV9vaWwBMRUAACb8mv6DgfHqQBUCKAJDMywXQBIFHrhR64UYEmRhc2hfYmFzZWxpbmVfMV92MREAdQAA&ccb=1-7&_nc_sid=59939d&efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLjcyMC5jbGlwcyJ9&_nc_ohc=nav3pTRz9T0AX-csieO&_nc_ht=video-iad3-1.cdninstagram.com&edm=AL-3X8kEAAAA&oh=00_AT9Wj2ue0CNOvRywTzAh2gvCxJl9Bhr1me4nIveXwZ2KNg&oe=634A481F&_nc_rid=6e1aabaa0c
This problem is specifically for Instagram Videos. The same thing happens to images and we are using the solution from this post: Instagram/feed API media URL shows 'URL signature expired' to fix static images and video poster images. But this doesn't work for video.
We've also tried the suggestions of using parameters ?__a=1 but it comes up as a broken page and does not return json as some have suggested.
Currently we are falling back to the poster image, but having the video would obviously be ideal.
I'm trying to get the most recent uploaded videos but for some channels, the latest video is missing and the other videos aren't in the same order as when you go on the actual channel uploads section on the website... Using search as opposed to playlist seems to work (has the most recent videos in order) but has an insane quota impact compared to playlists.
Is using the search query my only option or am I doing something wrong with playlists?
I'm using part=snippet, maxresults=3 and providing the upload playlist id.
I've had similar problems. It appears to me that uploaded videos in the uploads playlist are sorted by when they were uploaded. Some Youtube creators make and upload many videos at the same time but publish them one by one. But their order is not changed as they are published. More videos can be uploaded and published before an older already uploaded video is published.
There is as far as I can tell there is no additional cost to increasing maxResults when fetching the playlist items. I think the cost is per call not per item. At least that is how I interpret this note from the Quota Calculator:
Note: If your application calls a method, such as search.list, that returns multiple pages of results, each request to retrieve an additional page of results will incur the estimated quota cost.
Each page can be a maximum of 50 videos long so you can fetch 50 videos in a single call for the same price as fetching 3. I don't know if the call takes longer time, but I don't think it will change significantly. So try using maxResults=20 or maxResults=50 and see if that works. Then sort the results afterwards.
I'd imagine that it's rare that someone uploads a video then uploads and publishes more than 50 other videos before publishing the first one. So using maxResults=50 should work ok.
Instagram only returns latest 300 liked images via instagram API. Is there any way to get all liked images?
Instagram limits the number of images returned for instagram likes and feed API, its not really 300 always, it can be less than that. No other way to get all.
Current scenario
I have build an application that harvest Instagram images from a specific hashtag.
I use the pagination to fetch all images, and store the data (not the images) locally in a database. The first invocation of the app harvest all images. Subsequent invocations only harvest those newer than the newest image in the local database. Otherwise I would need to make thousands of request to page through all images on popular tags. And that would need to be done every few minutes, if images where to appear without too much delay in the app.
The problem that arises is that when users put tags on old images, these images are then not fetched by my app - because of the only-fetch-new-images performance construct.
Attempt at solution
I looked at the realtime API, but is seems to me it is constructed in a way that makes it unsuable. This is what it sends in a realtime update for a tag:
{
"subscription_id": "2",
"object": "tag",
"object_id": "nofilter",
"changed_aspect": "media",
"time": 1297286541
}
I would have thought that there would be a list of media IDs, representing the new/changed content, from which I could fetch the actual content - but there is not.
My current solution is to fetch new content every few minutes, and then doing full rescans every hour. This is suboptimal both from a user, and a performance perspective.
Question
Is it really not possible to do in a more elegant way? I appreciate that Instagram does not send the full content in the realtime update, but sending the IDs should not be a problem in terms of payload-size. It seems like the API is pretty useless in this regards - the only use-case I can think of, where it would be of any use, is for a "There is new content on you hashtag watch" nofications.
Best,
Torben
What I do with geography search is that everytime I get a update package I query the recent geography endpoint. This works quite well. Im guessing thats the idea with tag subscription aswell, have you tried querying the recent instagrams tag endpoint?
/tags/[tag-name]/media/recent
Paginate the recent media for a tag with the min_tag_id parameter to sort the result based on when it was tagged and not when the photo was taken. We use this in combination with the realtime api at silarapp.com and it works fine.
From the Instagram Api Documenation (my emphasis):
Get a list of recently tagged media. Note that this media is ordered by when the media was tagged with this tag, rather than the order it was posted. Use the max_tag_id and min_tag_id parameters in the pagination response to paginate through these objects. Can return a mix of image and video types.
The Youtube API will return videos that can be played no problem within the chromeless player. It also returns videos that cannot be played, - "Embedding disabled by request".
I don't want to retrieve videos that cannot be played, is there a way to request only videos that can be embedded?
cheers
Yes, there is a parameter exactly for this purpose. In this Url
http://gdata.youtube.com/feeds/api/videos?q=connemara&orderby=published&max-results=10&v=2&format=5
the "format=5" parameter restricts the results to embeddable videos. See the 'Developer's Guide: Data API Protocol – API Query Parameters'.