Any way to get random places from Facebook Search Places API? - api

I have been working with the Places Search API in Facebook's API Explorer. Currently I am returning results limited to 20 per page, with countless pages. For my application I would like to retrieve 20 random places.
I have tried using the offset pagination to specify a random offset, but the offset parameter doesn't seem to be working, as it is returning the same ordered results. I could just iterate through each page using cursor pagination, but this would return every result and seems illogical. Any ideas on how to this can be done?
My current call: https://graph.facebook.com/v3.2/search?pretty=0&fields=name%2Ccheckins&type=place&center=40.7304%2C-73.9921&categories=[%22FOOD_BEVERAGE%22]&distance=10000&limit=20

Related

How do I search this? Possible to access more than 100 JSON api search results if I pay for it?

How to search this?
I want to be able to:
1. create a search engine
2. programatically search it thorugh an API (python, or other)
3. paginate through the results (all of them, if I chose)
4. store URL's or results that I want.
Is this even possible with Google Custom Search Engine?
I enabled billing, my CC is up to date with Google, I do steps 1..3 above.
On a search, I will get back 4,000 results for example, but I can only access 10 at a time with the API, none more, and when I reach 100 results I am shut off.
I want to be able to process 1000 results if I wish.
Before you reply, do you personally have working code that goes beyond the 100 limit?
If so, would be very much interested in speaking, learning how you did it.
I am using Python at the moment, but it could be any language.
--
I tried using the &start=100, 200, and so on to paginate through, but this does not work.
I tried getting 100 results in a python script, ending the program, calling it again setting start=100 (after the first set returned), and nothing happened.
I want to be able to use the Google Custom Search API, pay Google for a monthly subscription but have not found that this is possible.
For any given search, I want to decide how many results to process, could be 1K, could be 20K, I simply need/want access to the full result set, but I do not, have not seemed to find a way to do this.
The API allows only a max result depth of 100. See https://developers.google.com/custom-search/v1/cse/list

Google custom search engine result counts changing as results are paged

I have implemented a Google custom search engine in a website. When searching a word, it brings out results like totalResults - 168 and I am retrieving it by 10 results per page.
Up to 60 results it works fine, but in the 7th page, the total results from Google api response changes to a total of 67.
I am using a free version of the Google custom search API. I don't know whether it is working correctly or not. Please provide me a solution if it is wrong or correct me if I am wrong.
It is because of google search behaviour well explained in following links.
https://productforums.google.com/forum/m/#!topic/customsearch/D4--2TfYk9A
https://productforums.google.com/forum/m/#!topic/customsearch/SjlrUMa-X-k

Youtube data API version 3 pagination

I understand that youtube response contains the next and previous page tokens and we can use those to go to previous and next pages.
eg :
https://www.googleapis.com/youtube/v3/search?&key={key}&part=snippet&maxResults=20&order=viewCount&q=abc&type=video&videoDuration=long&videoType=movie&pageToken=Cd323A
My question is how can I navigate to nth page of particular search?
Please note that some people may see this is impossible. But I have seen some site implemented this.
Youtube API only provides NextPageToken and PreviousPageToken, that's it, sorry: see documentation here: https://developers.google.com/youtube/v3/docs/videos/list
You can still make a pagination item but you will have to implement it by calling multiple times the URL, passing the NextPageToken as pageToken in your requestion every time, and caching results.
By the way, this question is already answered here (see the 1st point of the answer): youtube data api v3 php search pagination?
Quoting them:
In particular your case where you need 50 pages per page and you are
showing 3 pagination like (1,2,NEXT) then you need to fetch results
two times. Both the results you will keep in cache so for page 1 and 2
results will be retrieved from cache. For next you make it sure that
you are making query google again by sending nextPageToken.
Thus to show pagination 1-n and every page 50 results then you need to
make n-1 queries to google api. But if you are showing 10 results per
page then you cane make single query of 50 results using which you can
show first 5 pages (1-5) with the help of retrieved results and at
next you should again send next page token like above.
NOTE- Google youtube api provide 50 results max.
nextPageToken and prevPageToken comes with the api request.
Now you save the token in an array and then insert it as a nextPageToken in another api call and you will get the next page. The same way you will get a prevPageToken when u get the next page results.
Hope it helps.

What is the maximum results returned for YouTube Data API v3 call

Context
I am in the process of providing some consultancy on doing a HTTP GET using YouTube Data API V3; in order to develop a Windows based application to GET a list of results from Youtube, for say a specific CATEGORY, or a specific TAG.
We are open to using any programming language(I'm from a C++ background and am hoping You tube will support direct HTTP connections without using Google client SDK and so on) to connect to YouTube and (HTTP) GET data.(Once a month or so, so YouTube API quotas should not be problem).
The Issue
We are being told by some of my client's web developers that YouTube API v3 will only return a maximum of 500 records/results, for say a query that returns JUST the Total viewers, the Video's link, and basic meta data such as that.
S, say I wish to find 5,000 results for category "House music" or "basketball" - and I have the Developer Key etc are all set up, would that be possible?
If so, what GET fields would I need to populate(such as "max_results_per_page")?
Thank you.
The API won't provide more than ~500 search results for any arbitrary query. It's by design. Technically, it means that the nextPageToken field won't be returned once you hit ~500 results. No additional parameter can change that.
If you want more than ~500 results for a query, you have to split it into more specific sub-queries. I'd suggest using the publishedAfter and publishedBefore parameters to achieve that, but feel free to experiment with the other ones here.
This only holds for the search-Query. Other queries like "PlaylisItem:list" deliver more results. I have tested with 100.000 items to get the videos of a playlist.

Specify items per page

I'm trying to query Picasa Web Albums to pull album/photo data (obviously!) however initially I only need to pull the first 4 photos. Is there any way to limit a particular field or specify the items per page?
I've already accomplished something similar with Facebook's Graph API however I'm unable to find anything similar for Picasa. The only items I can find related to limiting the response is specifying which fields, but nothing related to the number of rows.
Use max-results argument. See doc here.
https://developers.google.com/picasa-web/docs/2.0/reference#Parameters