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.
Related
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
I am using Amazon Api to search for item. I am doing a simple
amazon.ItemSearch(Keywords="Sachin Tendulkar", SearchIndex="All", ResponseGroup="ItemAttributes")
But the result is not a popular Sachin Tendulkar book or the best search I would want.
How can I get multiple results in Item Search ?
How can I get the most popular search result?
amazon.ItemSearch(Keywords="UC Berkeley", SearchIndex="All", ResponseGroup="ItemAttributes")
gives even worse results.
Is there an option in the API that I am missing? Thanks
If you're not getting the results you expect, adjusting the SearchIndex option to something other than "All" can often help improve the results by making a less broad search.
If you change it to "Books", do you get the expected results for "Sachin Tendulkar"?
In case that doesn't fix the problem, do you get expected results for really common searches like "Apple TV"? And when you search for "Sachin Tendulkar" or others on Amazon.com do you the items returned by your API request show up at all (perhaps even pages down)?
I'm trying to get paginated results from Youtube Data API v3,
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UUCj956IF62FbT7Gouszaj9w&key={YOUR_API_KEY}
now, in the response there's the handy parameter nextPageToken that links to the next page of the results set
"nextPageToken": "CAUQAA"
Is there any way to jump to a specific page of the results, say the 6th?
Apologies, but no, there is not. This is intentional. You can only move forward one page of results at a time.
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.
Does anyone know how to target the Amazon AWS ItemSeach so that it searches in the product title only? I'm using keywords but the results returned are only vaguely related.
This example searches for 'wireless headset xbox' in the 'Accessories' node(676172011) of 'VideoGames':
&Operation=ItemSearch
&SearchIndex=VideoGames
&ItemPage=1
&BrowseNode=676172011
&Sort=salesrank
&Keywords=Wireless%20headset%20xbox
&ResponseGroup=Large
I would expect this to return only products with 'wireless headset xbox' in the tile. However only aprroximately 50% are 'correct'.
Looking at the results returned from similar 'aStore' searches, all results have the keyword in the title.
Any help much appreciated.
According to the ItemSearch documentation you need to replace the Keywords parameter with the Title parameter:
Title - The title associated with the item. You can enter all or part
of the title. Title searches are a subset of Keyword searches. If a
Title search yields insufficient results, consider using a Keywords
search. [emphasis mine]