How to get result from youtube api search morethan 5? - youtube

I tried to get youtube search from this link
https://www.googleapis.com/youtube/v3/search?part=snippet&key={my_api_key}&q=plane
it's work good. But i want to know how can i get result morethan 5 ?
ref : https://developers.google.com/youtube/v3/docs/search/list

Just in case anyone needs a solution for this.
You just need to add &maxResults=50 (to get a maximum of 50 results of course) at the end of the link / API call.
The person who asked the question was using &max-results... and not &maxResults... which is why it did not work.

The only thing you need to set here is maxResults. Now, if you're still getting 5, the problem maybe that there's really no other videos to list or your search filter is wrong.
The nextPageToken solution do not apply if you have maxResult set to 50 but are only getting 5. The problem could be your filter or the number of videos available.

Related

How can I exclude shorts from YouTube API Data v3

I currently use something like https://www.googleapis.com/youtube/v3/search?part=id&order=date&channelId=CHANNELID&maxResults=1&type=video&key=KEY and I want to be able to retrieve only the latest video and to totally exclude shorts.
How can I achieve this? 🤔
The Youtube search method
Will allow you to search for things like keyword, location, events, your own videos and related videos.
There is no way to filter or limit videos returned. Your only hope would be to sort them out locally when you get the results.
You may want to add a feature request here there is this one but it's really old Search API: More flexible/logical videoDuration requests
(sorry its my 1st time answering at stackoverflow, so might not be descriptive)
if you you use youtube serch method
then you'll realise that shorts description are assigned as empty string "" where as the videos have some description . so with an if condition like below can slove your problem (js)
if(!(video.snippet.description == ""))

ITunes Search API page number for the query

Is there any way to get results of next page of a search query? When I give page parameter, I get the same results from ITunes as:
https://itunes.apple.com/search?country=us&limit=200&entity=software&term=a
and
https://itunes.apple.com/search?country=us&limit=200&entity=software&term=a&page=2
gives the same output. Giving page parameter works for customer reviews.
Is there any way to get the results of next page?
According to API documentation there is no way but I found a lot of useful answers which are not indicated in API documentation.
I found a way to query more records. There is a parameter called offset, which is not mentioned in API documentation.
https://itunes.apple.com/search?term=a&offset=25&limit=25
Enjoy!
Actually there is no pagination in apple search API. It will only return maximum first 200 records.
Below is reference URL for same:
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#searching
Thank you.

YouTube API "published" filter doesn't seem to work

I'm trying to use the YouTube API to return videos that were recently published, but the filter I'm using doesn't seem to work as expected.
This API call only returns two videos whereas there should be tons more that were published after March 1st:
https://gdata.youtube.com/feeds/api/videos?q=&fields=entry[xs:dateTime(published)%20%3E%20xs:dateTime('2013-03-01T12:00:00.000Z')]
However, if I add a query string, then many more results are returned. For example:
https://gdata.youtube.com/feeds/api/videos?q=surfing&fields=entry[xs:dateTime(published)%20%3E%20xs:dateTime('2013-03-01T12:00:00.000Z')]
Anyone know why? Is there another approach I should be using to just get me the latest videos published regardless of query string?
I understand your confusion, but that's not what the fields= parameter is used for. The documentation should hopefully clear things up, but to summarize, using fields= in that manner is equivalent to making a request without the fields= parameter and then filtering the results of that request so that it only includes the entries that match your filter.
So if your request without fields= would normally return 25 specific videos, adding fields= to it will give you a response that includes somewhere between 0 and 25 videos—all the non-matching videos are filtered out.
You can request a feed of recently published videos without any other filters using http://gdata.youtube.com/feeds/api/videos?v=2&orderby=published

Twitter: Number of tweets OR get more tweets

I would like to know how can I get all tweets from a certain hash tag?
I am currently using the following code:
xhr.open("GET","http://search.twitter.com/search.json?q=%23PrayForJapan");
This only returns me 15 tweets. Does anyone know how to make it return more?
Also, I have got a code to get me the tweets of a certain screen name, this only returns 20 tweets, how can i ask the following 20 tweets?
The code i used for that is:
xhr.open("GET","http://api.twitter.com/1/statuses/user_timeline.json?screen_name=Eminem");
I'm using titanium to create this, but I don't think that is an issue?
Thanks!
You can usually add count=x as parameter to the query string to get up to x tweets (for the search api it seems to be rpp). Query string parameters are added to the base url via ? and each individual parameter is then separated by & as in http://api?user=1&count=4
Most of the time, it is better though to remember the last tweets and then add ?since_id=x as this way you only get tweets you did not see before.
Have a look at the api documentation.

twitter hashtag search

I am trying to search all tweets with a given hashtag (Using titanium appcelerator).
I have a working code to search all tweets from a given user (for example #prayforjapan).
Now I'm trying to get all the tweets from #prayforjapan. This isn't working..
I tried the following method (since i found it on here
Now to search for the names i use this url:
var xhr = Ti.Network.createHTTPClient();
xhr.timeout = 1000000;
xhr.open("GET","http://api.twitter.com/1/statuses/user_timeline.json?screen_name="+screen_name);
For the Hashsearch i tried the following code (doesn't work tho)
var xhr = Ti.Network.createHTTPClient();
xhr.timeout = 1000000;
xhr.open("GET","http://search.twitter.com/search.json?q=prayforjapan");
Does anyone know what's wrong with this search? or which link it should be?
Thanks!
Well, I played with it for a little bit and came up with this link format.
http://search.twitter.com/search?q=%23prayforjapan
How does that work?
%23prayforjapan is same as #prayforjapan
Sorry, Twitter does not supply this, neither with Rest or Streaming APIs. They only provide partial results unless you pay for the "garden hose" or "firehose," both of which are very costly. Garden hose starts at about $6,000/month, currently.

Resources