Retrieve images from Instagram that contains more tag - image

I'm retrieving images from Instagram but I can't figure out why with this call:
https://api.instagram.com/v1/tags/trytag/media/recent?access_token=ACCESS_TOKEN
I can only retrieve images with one single trytag.
So if I post an image with more tags the link above can't retrieve it.

The current Instagram v1.0 API doesn't currently allow for multiple tag search. You could query for each tag separately and combine your results, or an alternative is to use a third party search like Mixagram, which is most likely doing the same thing but doesn't require an enormous amount of storage space upfront.

Related

How to search for locations using Tags inside OpenStreetMap

Using the Nominatim APIs, am able to do a search based on a query. However, all the results returned have a Tag associated with them, like leisure=fitness_centre.
How can I, thus, use the OpenStreetMap APIs to search a given location (say London) for all the fitness_centre tags? Idea is to be able to search the map, zero in a location (say London, Oxford etc.) and then search for all places/locations with Tag [leisure=fitness_centre]
Using Google Places API, one can search using tags using something like below (specifying type=gym) -
https://maps.googleapis.com/maps/api/place/search/json?location=51.509865,-0.118092&radius=50000&sensor=true&key=&types=gym
Only issue with the Google Places API is that they are extremely pricey!!, so looking for OpenStreetMap as an alternative.
For searching specific objects in OSM, Overpass API is usually a good choice.
There is a nice frontend available called overpass turbo. Open the wizard, enter "leisure=fitness_centre in London" and it will generate an appropriate query:
[out:json][timeout:25];
{{geocodeArea:London}}->.searchArea;
(
node["leisure"="fitness_centre"](area.searchArea);
way["leisure"="fitness_centre"](area.searchArea);
relation["leisure"="fitness_centre"](area.searchArea);
);
out body;
>;
out skel qt;
Then hit run to see the results on the map: https://overpass-turbo.eu/s/1fbg
Please note that the {{geocodeArea:London}}->.searchArea; part is a feature added by the overpass turbo frontend. Overpass API won't understand this geocoding request. Instead, you have to replace it with an area query and the corresponding relation ID (in this case area(id:3600065606)->.searchArea;).
Another thing to note is that Overpass API servers shouldn't be used for heavy queries or commercial purposes. If you need this kind of service then install your own Overpass API instance or use a commercial Overpass API provider.

Retrieve multiple pictures for each place

Is there a way to retrieve multiple place photos per place request?
I am able to retrieve the picture for each place that is contained within the place response, is there a way to retrieve multiple pictures per place?
That depends on the Places SKU you are using. If you are using Find Place, Nearby Search, or Text Search requests, these can only return a single photo reference per place, when relevant. However, if you use a Place Details request, you can retrieve a no. of photo reference per place. For example:
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJN1t_tDeuEmsRUsoyG83frY4&fields=name,photos&key=YOUR_API_KEY
Do keep in mind that you will still have to make separate place photo requests for each photo reference.

Google Custom Search API returning HTML documents instead of images

I started using the Google Custom Search API for a project, the idea is to search for images, and I wanted to use the Custom Search because the Google Images API is deprecated.
I already enabled image search on the CSE console
My query is like this:
https://www.googleapis.com/customsearch/v1?key=APIKEY&cx=CSECX&q=flower&alt=json&searchType=image&num=1&start=NUMBER
Where NUMBER is a random value between 1 and 20
Sometimes, it returns results like this:
{u'kind': u'customsearch#result', u'title': u'Flower Wallpaper Tumblr #6790199', u'displayLink': u'7-themes.com', u'htmlTitle': u'<b>Flower</b> Wallpaper Tumblr #6790199', u'snippet': u'Flower Wallpaper Tumblr', u'htmlSnippet': u'<b>Flower</b> Wallpaper Tumblr', u'link': u'http://7-themes.com/data_images/out/7/6790199-flower-wallpaper-tumblr.jpg', u'mime': u'image/jpeg', u'image': {u'thumbnailWidth': 150, u'byteSize': 808360, u'height': 1200, u'width': 1920, u'contextLink': u'http://7-themes.com/6790199-flower-wallpaper-tumblr.html', u'thumbnailLink': u'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSad0z_Wla0nRHAcQrjO5jLQkFjcoqnNHhejjuGmdA1AW2BqIVEpLARAk0s', u'thumbnailHeight': 94}}
Highlighting the interesting part:
u'link': u'http://7-themes.com/data_images/out/7/6790199-flower-wallpaper-tumblr.jpg', u'mime': u'image/jpeg'
So it seems that the URL is http://7-themes.com/data_images/out/7/6790199-flower-wallpaper-tumblr.jpg and mimetype is image/jpeg, but if you go to the URL, you'll see it's not an image, but an HTML document
Of course, I could capture this as an exception, but I don't want to waste daily API requests (out of a 100 limit per day) because the API didn't give me an image when I explicitly said so.
So, the question is: Is this normal behaviour, or misconfiguration/misuse on my part? If so, how could I fix it?
Thanks for your attention
After a little bit of reading, my best guess is that some servers are doing a resource redirect to prevent external sources from hotlinking directly to a resource. The file in question is advertised as an image, but accessing it from an external server will provide an HTML document instead. This is not a URL redirect, so it isn't detected by clients (including the Google crawler) until the resource is downloaded.
This sort of resource redirect is done on Apache servers using the .htaccess file and the RewriteEngine, with a technique similar to the one described here, although that particular technique can't be used to bait-and-switch images for HTML documents.
In short, if a server is lying about what type of file it's hosting, Google can't do anything about that. You can confirm that this is not an issue with the custom search API by performing the same query on the normal web search interface -- notice that clicking the image loads an HTML document rather than the image itself.

Youtube API v3 Search own videos by tag

Is it possible to search videos by tags using Youtube API v3 ?
I would like to search among my own videos.
Use search method with ##tagname search string for q parameter and set type:video parameter. You can find other search operators here. Old one - tag:tangle doesn't work with new api for me. ## works fine.
Recently tried the solution given by user 350D, but q=##{YOUR_TAG} does not appear to work with the latest YouTube API. It appears that the tag can only be retrieved when the video ID is provided as a parameter. I found that the following works for me:
First, retrieve a list of videos (returning minimal needed information, e.g. the video ID, title, and the high quality thumbnail URL):
https://www.googleapis.com/youtube/v3/search?key={YOUR API KEY}&fields=items(id(videoId),snippet(title,thumbnails(high(url))))&part=id,snippet;
Then batch the video IDs into one request to retrieve the associated tags:
https://www.googleapis.com/youtube/v3/videos?key={YOUR API KEY}&fields=items(id,snippet(tags))&part=snippet&id={videoID01,videoID02,etc};
You can do a videos->list with with settings video ids as the ones in your playlist and iterate through them checking with tags. But searching by tags is not available in API anymore.

Bing API: specify both medium and large images

I am forming a JSON request to pull images from the Bing API for a given query. I want to get both medium and large images (exclude small). I tried using:
Image.Filters=Style:Photo+Size:Medium
But this seems to be "and"ing them, as I get no results. Having only one of them works fine.
How do I "or" them?
&Image.Filters=Style:Photo&Image.Filters=Size:Medium

Resources