Finding Instagram tag_id of a post to search by date range - instagram

I'm building a JavaScript app that returns Instagram posts with a given tag, using the tags/tag-name/media/recent endpoint. I'm trying to add in functionality to search by date range. Min/max_timestamp works for the Users API, but the Tag API only accepts min/max_tag_id. Following the suggestion here, I am trying to search the Users API with my dates of interest. The idea is to get post id's that correspond with my dates, then plug those id's into the min/max_tag_id in the Tag API.
However, the post id returned from the Users API (ie 9999999999999999999_9999999) appears to be a different format than what min/max_tag_id is looking for, confirmed by a Tag API paging response (131 character string of characters, numbers, underscores and hyphens).
Is there any way I can find a tag_id using a date-based search?

The max_tag_id and min_tag_id value is not media_id anymore after the June 1, 2016 API changes.
When API was first launched, the max_tag_id and min_tag_id was taking epoch timestamp value, then it was changed to actual media_id and now it looks like it is some cryptic value that is not easy to decode.
I was supporting date/time search for all feeds before, but now it is not possible for tag media feed. I have implemented date/time search in https://picodash.com for all feeds except tag media

Related

Youtube search using the google API

I am using the google API and I wanted to do a youtube search.
I request a search with https://www.googleapis.com/youtube/v3/search?part=snippet&q=[word that I searched for]&key=my_keyto get the items array. I noticed though that the items array does not return the results in the same order as when you search youtube yourself.
Ex: if I search for the word 'bad' the first result in the items array is the "Young Lex ft AwKarin - BAD ( Official Music Video Clip )" while if I searched like a youtube user its the "Michael Jackson - Bad (Shortened Version)".
Perhaps they are not ordered and I have to order them using a property or something I have missed.
So my question is how can I make the items array return as the first item the first result that would have appeared in the youtube search.
edit: I have tried adding chart=MostPopular leaving to default videoCategoryId, but it still showed the same first result.
Well, it seems that the YouTube acts like that and it is a natural behavior of it. The only possible way that you can do to match the API and the YouTube site itself is by passing the same filter for it. Example is upload date and viewCount.
Here is the example request for viewCount.
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&maxResults=10&order=viewCount&q=spider&_h=1&
and this is for the YouTube site
https://www.youtube.com/results?q=spider&sp=CAM%253D
Hope this slight information helps you.

Instagram - pull LESS than 20 media + pagination

I've found out, that you can get latest public posts of an instagram page by using simple media url:
https://www.instagram.com/PAGE_ID_NAME/media/
I've noticed that it returnes JSON with maximum of 20 posts and information if there are "more_available".
Now I don't want to pull 20 posts - I just need like 5 and provide a pagination for possible more - but I did not find how to limit these results - I've tried adding ?limit=NUMBER and ?count=NUMBER without success.
So 2 questions arise:
How do I limit results while using url structure above?
How do I make pagination links while using url structure above?
Is 1. & 2. even possible?
Try building this url.
https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token={YOUR-ACCESS-TOKEN}&COUNT={NUMBER-RESULTS}
Get a list of recently tagged media. Use the max_tag_id and min_tag_id parameters in the pagination response to paginate through these objects.
PARAMETERS
COUNT Count of tagged media to return.
MIN_TAG_ID Return media before this min_tag_id.
MAX_TAG_ID Return media after this max_tag_id.

Twitter search for hashtags that date back almost 2 years

I am trying to retrieve all tweets with a certain #hashtag in them over a certain time period (dates 2 years back). Is there a way to automatically collect/save all the tweets concerned or the search results?
I tried scrolling down to that point, which kind of worked, but it took hours of holding the "page down-button".
Using the twitter-api, it looks like you're trying to use the search call.
The two date methods (year-month-day) are:
hashtag since:2011-05-09 - Searches for "hashtag" and sent since date "2011-05-09".
hashtag until:2011-05-09 - Searches for "hashtag" and sent before date "2011-05-09".
Using these in the GET request, you can pull as many as the api allows at once, then loop through them and save them how you wish. You haven't provided a language that you're using, so this generic information is as far as I can help with.

Instagram: Get photos from a tag after a specified photo

I'm working on an instagram scraper for something and I'm trying to figure out if it's possible to get all photos for a tag that have an id or timestamp later than the last one I have.
The instagram API docs are useless in that they don't have any real info on pagination (which I presume I'll have to abuse).
Does anyone have any ideas?
I've been slogging through the Instagram API for the last couple of days so here's my 2 cents worth:
As far as I can see it if you call the api with /tags/tag-name/media/recent it only return a list if items. If the amount exceeds about 25 you have to make another request with the pagination value returned in the previous request.
In order to gain some control I am initially iterating through all images and storing the results (just the URL not the actual image) to a database. Now I can manipulate however I want. When I feel like updating (I'm doing it manually now but could be a cron job or use the real-time api) I re-read all the images, compare to what I have in my DB and add possible new images. My app then reads out the url and info from my DB (which btw is a heck of a lot faster than going through the instagram api, which will only return about 25 images per request - regardless of any 'count' parameter value you put in the request url) and displays it.
I am developing this for a client who is afraid of people posting nsfw or whatever pics using their dedicated hashtag (for a contest) - with the above set up I can offer them an interface where they can check and mark images that are then displayed in the app.
One thing to watch out for is when a user deletes his picture; you will have to find a way to check for this. Currently (since I'm lazy) I load all images and use jquery to check for an error loading the image. If there is one I delete the image from the DB (via ajax).
I'm not sure the pagination is going to help you: as far as I can see the pagination response has no relation to the id's of the actual image objects on each page - so theoretically a pagination id that jumps to a certain page (i.e. date) might not work tomorrow if enough images have been deleted in the mean time.
to get all images instead of latest 20, just append &count=-1 to your api call - it's that simple.
In either case, there is a timestamp on each json object - or if you prefer, you can use max_tag_id
check out my post here: there any way to show more than 20 photos of the instagram API?
* Update April 2014: count=-1 is no longer available.

Foursquare API - Has there been a change to the core venue field specials?

Has there been a change to the core venue field specials?
I'm using Venue Detail request (https://developer.foursquare.com/docs/venues/venues) to retrieve Venue Detail. As usual this request returns a "venue" for a response field.
What seems to have changed is the core venue field "specials". This now appears to be returning the same response fields as Specials/list ( https://developer.foursquare.com/docs/specials/list).
This requires iteration on specials.items as opposed to specials.
Looking at https://developer.foursquare.com/docs/responses/venue the Core venue field "specials" still should be returned as an array.
I'm trying to find in the change log where this may have changed?
The venues specials object is now using the standard count and items format that other lists in the api use.
The new format is only for clientversion 20120120 and later. Older versions get the old format.
We'll be updating the docs/changelog shortly.

Resources