-
I search with the twitter API all the public tweets with "4sq.com":
我使用twitter API搜索所有公共推文“4sq.com”:
so I get all the check-in on Foursquare that actually shared on Twitter.
所以我在Foursquare上获得了在Twitter上实际共享的所有登记信息。
{"created_at":"Sun, 08 Jan 2012 20:05:27 +0000","from_user":"fenavergara","from_user_id":50876086,"from_user_id_str":"50876086","from_user_name":"Fernanda Vergara Ch","geo":null,"id":156104246239051776,"id_str":"156104246239051776","iso_language_code":"lt","metadata":{"result_type":"recent"},"profile_image_url":"http://a2.twimg.com/profile_images/1708744785/image_normal.jpg","profile_image_url_https":"https://si0.twimg.com/profile_images/1708744785/image_normal.jpg","source":"<a href="http://foursquare.com" rel="nofollow">foursquare</a>","text":"I'm at Roca Roja (Antofagasta) http://t.co/DIKdYGwD","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null},{"created_at":"Sun, 08 Jan 2012 20:05:27 +0000","from_user":"Fabioland76","from_user_id":357326176,"from_user_id_str":"357326176","from_user_name":"Fabio Landini","geo":null,"id":156104246104821760,"id_str":"156104246104821760","iso_language_code":"no","metadata":{"result_type":"recent"},"profile_image_url":"http://a3.twimg.com/profile_images/1506958638/profiloJPG_normal.jpg","profile_image_url_https":"https://si0.twimg.com/profile_images/1506958638/profiloJPG_normal.jpg","source":"<a href="http://foursquare.com" rel="nofollow">foursquare</a>","text":"I'm at Burger King (Gallerie Cantoni, Legnano) http://t.co/rU1jIJ4A","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null}
With these tweets, Foursquare provides a link (like this one: http://t.co/DIKdYGwD) where I can see the position of the check-in on a map (if I display the link on a webpage).
通过这些推文,Foursquare提供了一个链接(如下所示:http://t.co/DIKdYGwD),我可以在地图上看到办理登机手续的位置(如果我在网页上显示链接)。
How can I get the latitude and longitude programmaticly directly from the list of tweets?
如何直接从推文列表中以编程方式获取经度和纬度?
Idea: Do I need to fetch the link on a webpage and analyse it to get the latitude and longitude?
想法:我是否需要获取网页上的链接并进行分析以获得经度和纬度?
EDIT: I don't want to use Twitter geocode
编辑:我不想使用Twitter地理编码
2 个解决方案
#1
2
You already have what you want, look at the "geo" section in sample of search output you posted. It's null because it is not filled (twitter user forget to enable twitter location in settings and all locations from foursquare are ignored by twitter).
您已经拥有了所需的内容,请查看您发布的搜索输出样本中的“地理位置”部分。它是空的,因为它没有填充(推特用户忘记在设置中启用推特位置,并且来自foursquare的所有位置都被推特忽略)。
You can filter twits by location, look at the Twitter Dev documentation.
您可以按位置过滤twits,查看Twitter Dev文档。
UPD:
If you want to get location even in case when it is not stored to twit, you have to perform request to foursquare short link and parse venue information (you can steal location also). Look at the source of the sample 4sq.com page (small part):
如果你想获得位置,即使它没有存储到twit,你必须执行foursquare短链接和解析场地信息的请求(你也可以窃取位置)。查看示例4sq.com页面的源代码(小部分):
...
options['lat'] = 42.98758759825106;
options['lng'] = -71.50742411613464;
options['fuzzy'] = false;
options['venue'] = {"id":"v4f08df964fc62d44946f058a","venue":{"id":"4f08df964fc62d44946f058a","name":"ABC News \u2013 WMUR Debate","contact":{"twitter":"MittRomney"},"location":{"address":"100 St Anselm Drive","lat":42.98758759825106,"lng":-71.50742411613464,"city":"Manchester","state":"NH"},"categories":[{"id":"4bf58dd8d48988d1af941735","name":"College Auditorium","pluralName":"College Auditoriums","shortName":"Auditorium","icon":{"prefix":"https:\/\/foursquare.com\/img\/categories\/education\/default_","sizes":[32,44,64,88,256],"name":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":7,"usersCount":7,"tipCount":1}}};
...
Unfortunately, Foursquare team can change the format of the page or limit requests from IP Address without any notes. That's why this solution is ugly.
不幸的是,Foursquare团队可以更改页面格式或限制来自IP地址的请求而无需任何注释。这就是为什么这个解决方案很难看的原因。
UPD2
See answer from @MikeLewis, I've missed that Foursquare API supports requesting information by checking id.
请参阅@MikeLewis的回答,我错过了Foursquare API支持通过检查ID来请求信息。
#2
9
There's actually a much nicer solution here if you would like to use the foursquare API. One that doesn't depend upon a user having enabled Twitter's geo-tagging.
如果您想使用foursquare API,那么实际上有一个更好的解决方案。一个不依赖于用户启用了Twitter的地理标记的用户。
You noticed already that the link in the status update redirects to a foursquare page. Rather than screen scraping, you may notice there are two key pieces of information in the url. The checkin id, and a parameter called s (for signature) that lets you access that checkin via foursquare's API.
您已经注意到状态更新中的链接重定向到foursquare页面。您可能会注意到网址中有两个关键信息,而不是屏幕抓取。签入ID和一个名为s(用于签名)的参数,允许您通过foursquare的API访问该签入。
https://foursquare.com/dens/checkin/4f0b3676e4b0e8ed3a590e41?s=MWHM3-0BsLXIJprfbALvOM606ZE&ref=tw
For instance, in the above url, the checkin id is 4f0b3676e4b0e8ed3a590e41 while the signature is MWHM3-0BsLXIJprfbALvOM606ZE
例如,在上面的url中,签入ID是4f0b3676e4b0e8ed3a590e41,而签名是MWHM3-0BsLXIJprfbALvOM606ZE
Using the /checkins endpoint, you can get the full checkin details (including lat/long of the venue). Dox here: https://developer.foursquare.com/docs/checkins/checkins
使用/ checkins端点,您可以获得完整的签入详细信息(包括场地的纬度/经度)。 Dox:https://developer.foursquare.com/docs/checkins/checkins
#1
2
You already have what you want, look at the "geo" section in sample of search output you posted. It's null because it is not filled (twitter user forget to enable twitter location in settings and all locations from foursquare are ignored by twitter).
您已经拥有了所需的内容,请查看您发布的搜索输出样本中的“地理位置”部分。它是空的,因为它没有填充(推特用户忘记在设置中启用推特位置,并且来自foursquare的所有位置都被推特忽略)。
You can filter twits by location, look at the Twitter Dev documentation.
您可以按位置过滤twits,查看Twitter Dev文档。
UPD:
If you want to get location even in case when it is not stored to twit, you have to perform request to foursquare short link and parse venue information (you can steal location also). Look at the source of the sample 4sq.com page (small part):
如果你想获得位置,即使它没有存储到twit,你必须执行foursquare短链接和解析场地信息的请求(你也可以窃取位置)。查看示例4sq.com页面的源代码(小部分):
...
options['lat'] = 42.98758759825106;
options['lng'] = -71.50742411613464;
options['fuzzy'] = false;
options['venue'] = {"id":"v4f08df964fc62d44946f058a","venue":{"id":"4f08df964fc62d44946f058a","name":"ABC News \u2013 WMUR Debate","contact":{"twitter":"MittRomney"},"location":{"address":"100 St Anselm Drive","lat":42.98758759825106,"lng":-71.50742411613464,"city":"Manchester","state":"NH"},"categories":[{"id":"4bf58dd8d48988d1af941735","name":"College Auditorium","pluralName":"College Auditoriums","shortName":"Auditorium","icon":{"prefix":"https:\/\/foursquare.com\/img\/categories\/education\/default_","sizes":[32,44,64,88,256],"name":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":7,"usersCount":7,"tipCount":1}}};
...
Unfortunately, Foursquare team can change the format of the page or limit requests from IP Address without any notes. That's why this solution is ugly.
不幸的是,Foursquare团队可以更改页面格式或限制来自IP地址的请求而无需任何注释。这就是为什么这个解决方案很难看的原因。
UPD2
See answer from @MikeLewis, I've missed that Foursquare API supports requesting information by checking id.
请参阅@MikeLewis的回答,我错过了Foursquare API支持通过检查ID来请求信息。
#2
9
There's actually a much nicer solution here if you would like to use the foursquare API. One that doesn't depend upon a user having enabled Twitter's geo-tagging.
如果您想使用foursquare API,那么实际上有一个更好的解决方案。一个不依赖于用户启用了Twitter的地理标记的用户。
You noticed already that the link in the status update redirects to a foursquare page. Rather than screen scraping, you may notice there are two key pieces of information in the url. The checkin id, and a parameter called s (for signature) that lets you access that checkin via foursquare's API.
您已经注意到状态更新中的链接重定向到foursquare页面。您可能会注意到网址中有两个关键信息,而不是屏幕抓取。签入ID和一个名为s(用于签名)的参数,允许您通过foursquare的API访问该签入。
https://foursquare.com/dens/checkin/4f0b3676e4b0e8ed3a590e41?s=MWHM3-0BsLXIJprfbALvOM606ZE&ref=tw
For instance, in the above url, the checkin id is 4f0b3676e4b0e8ed3a590e41 while the signature is MWHM3-0BsLXIJprfbALvOM606ZE
例如,在上面的url中,签入ID是4f0b3676e4b0e8ed3a590e41,而签名是MWHM3-0BsLXIJprfbALvOM606ZE
Using the /checkins endpoint, you can get the full checkin details (including lat/long of the venue). Dox here: https://developer.foursquare.com/docs/checkins/checkins
使用/ checkins端点,您可以获得完整的签入详细信息(包括场地的纬度/经度)。 Dox:https://developer.foursquare.com/docs/checkins/checkins