Getting location of Tweets Using Search API - api

I'm trying to get a list of Tweets with a certain keyword in them, but I need to know the co-ordinates where they were posted. I am using the following URL but GEO always seems to be empty, I don't think I've seen it populated yet, even in the example in the docs.
http://search.twitter.com/search.json?q=lorem&rpp=100&include_entities=true&with_twitter_user_id=true&result_type=recent&geocode=53.429147,-2.93335,100mi&page=1
It does return a location, a city name or similar which I was using to generate the co-ordinates using Google's maps api, but I got blocked for using it too many times..
Does anybody have any ideas?
Thanks!

Related

How to search and filter tweetts using Twitter API?

I am exploring how to search and filter tweets using the Twitter API version 2 which as of this writing has been newly released. The documentation for this particular endpoint is available here.
I tried successfully searching for the following query:
https://api.twitter.com/2/tweets/search/recent?query=puppy
As I needed to be more specific, I checked out v1.1 docs for rules and filtering and tried to look for tweets containing puppy images (filter:image) and no retweets (-filter:retweets) but I could not get the query in v2 (preferably) or v1.1 working with postman even though I tried percent-encoding for the special characters.
It is also not clear to me from the documentation (though mentioned in the docs) how to specify a certain language like English (lang=english) and a certain distance in the query "37.781157,-122.398720,1mi"
Does somebody know how to pass it into the query?
For language filter you can refer the post
https://community.postman.com/t/define-the-language-of-tweets/20643
But I am not sure about the image filter. But in recent times a developer sean.keegan from Postman is talking more about twitter API's in Postman. Please do check out https://community.postman.com/search?q=twitter and https://www.youtube.com/watch?v=ySbLo13Fk-c
I hope these will be helpful for you!!

How can I get a random article in a specific category from the Wikipedia API?

This is my link for getting one random article using Wiki API:
https://en.wikipedia.org/w/api.php?%20format=json&action=query&prop=extracts&exsentences=2&exintro=&explaintext=&generator=random&grnnamespace=0
I need to get from it the first two sentences of the first section, and it works pretty well.
I want to use this kind of link and search this random article in a specific category. This is what I have tried after searching online:
https://en.wikipedia.org/w/api.php?%20format=json&action=query&prop=extracts&exsentences=2&exintro=&explaintext=&generator=random&grnnamespace=0&cmtitle=Category:Music
(I have added this part to the original link: cmtitle=Category:Music )
It doesn't work for me.
It gets the random article like the first link (not under a wanted category, which is Music in this link).
There is no API to get a random category member (and using a parameter from some unrelated API module is certainly not going to help). You could screen scrape Special:RandomInCategory (or turn it into an API module - patches welcome :)
try to use cmlimit to get all of the catgeorymembers, then use a programming language, like Python to request the page, then store every catgeory in an array, and use the random module to get a random catgeorymember from the array you stored them in. then you can use it in a link to get the specific page for the categorymember or anything else that you need.

GPS coordinates to display google street view panorama

I looked at the documentation and many other questions but I couldn't find something similar to what I am looking for. I want a query url where I give in a gps coordinate and it displays the google street view panorama, or some kind of call that when I give it a GPS coordinate it gives me the "Panoid".
I dont have the panoid, or am I trying to extract it from a URL, I want to create a call that return the panoid.
I found a way that I actually wasnt looking for since Im writing my program in C++. But it seems I will do it in Javascript, and pass it to my C++ program.
In the Street View Api Documentation there is this example:
https://developers.google.com/maps/documentation/javascript/examples/streetview-service
In this example there are a few lines that are important to answering this question:
var markerPanoID = data.location.pano;
// Set the Pano to use the passed panoID.
panorama.setPano(markerPanoID);
I could just grab the data.location.pano value from there, then use it as however I may like. I hope this is not a final answer, I really wish if there is another way where I dont have to create a webservice.
What about this (via Google Maps Street View API)
https://maps.googleapis.com/maps/api/streetview?
size=10000x10000
&location=46.414382,10.013988
&heading=151.78
&pitch=0

Accessing full url of all page images Wikipedia API

I'm experimenting with the Wikipedia API and was trying to get the full urls for all images on a particular page, in this example Google's main page (http://en.wikipedia.org/wiki/Google).
I found the page id through the use of another API and then attempted to use this information in the following API to get the full urls of all images on that page:
http://en.wikipedia.org/w/api.php?action=query&pageids=1092923&generator=images&prop=imageinfo&iiprop=url|dimensions|mime&format=xml
I get some of the page images from this but cannot understand why I am not getting all - specifically the logo which is what I was most interested in. Apologies I am aware that there are similar questions which have been asked but I was not able to find one which would assist me here.
The API does not give you all results at once, it defaults to 10 results. You see in the beginning answer that you have a value for the parameter gimcontinue. If you use it like this you get more images: http://en.wikipedia.org/w/api.php?action=query&pageids=1092923&generator=images&prop=imageinfo&iiprop=url|dimensions|mime&format=xml&gimcontinue=1092923|Google_bike.jpg
Alternatively, you can ask for more images at once using gimlimit like this: http://en.wikipedia.org/w/api.php?action=query&pageids=1092923&generator=images&prop=imageinfo&iiprop=url|dimensions|mime&format=xml&gimlimit=500

How to detect if a query string is relevant for a Google Map Static API lookup

I am currently developing a web app that uses Google's Static Map API, in order to display maps of places upon user's request.
My problem is the following: How can I detect if a given string is relevant or not to searching Google Maps ?
Examples:
Searching for "North Beach San Francisco" with the following URL returns a relevant map of what is asked.
http://maps.google.com/maps/api/staticmap?size=270x185&maptype=roadmap&sensor=false&markers=north%20beach%20san%20francisco
However, searching for something that is not an address like Orwell's "1984" with the following URL does also return a map but it is absolutely not relevant to the query.
http://maps.google.com/maps/api/staticmap?size=270x185&maptype=roadmap&sensor=false&markers=1984
My point is, I don't need to parse the query since Google Maps Static API can find an address pretty easily, but I need to know if the string the user submitted should be searched in Maps or just regular search.
There is a lot of address-parsing related questions on SO, but I repeat that I don't want to have a full address parsing process, I just want to know if Google would have displayed a map link if I had searched the same thing on their website.
I do know the Google Geocoding API but it's roughly the same, as it will return coordinates even for unadapted queries like "1984". (And I'm not even talking about the limitations that make it pretty impossible to use in a large-scale web application)
Thank you for your time !
Gael
What I eventually did:
Google Geocoding API has a response parameter that indicates the accuracy of the geocoding lookup. Using this parameter, I was able to determine if my query is a real address or just a standard query looking like an address.
Keep in mind that both Geocoding Service and Javascript Geocoding API have limitations (as of now, 2,500 requests per IP per day)
Do post a comment if you want further information about that !