我怎样才能在Twitter上发布四方签入的位置(纬度,经度)? [英] How can I get the position (lat, lon) of a foursquare checkin posted on twitter?

查看:177
本文介绍了我怎样才能在Twitter上发布四方签入的位置(纬度,经度)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 我与Twitter的API搜索所有公共鸣叫以4sq.com

  1. I search with the twitter API all the public tweets with "4sq.com":

<一个href=\"http://search.twitter.com/search.json?q=4sq.com\">http://search.twitter.com/search.json?q=4sq.com

让我得到所有的入住手续上,实际上在Twitter上分享四方。

so I get all the check-in on Foursquare that actually shared on 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":"&lt;a href=&quot;http://foursquare.com&quot; rel=&quot;nofollow&quot;&gt;foursquare&lt;/a&gt;","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":"&lt;a href=&quot;http://foursquare.com&quot; rel=&quot;nofollow&quot;&gt;foursquare&lt;/a&gt;","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}

通过这些微博,Foursquare的提供了一个链接(像这样的: http://t.co/DIKdYGwD )在那里我可以看到入住在地图上的位置(如果我显示网页上的链接)。

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).

如何从微博列表中获得的经度和纬度programmaticly直接?

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?

编辑:我不想使用Twitter地理code

I don't want to use Twitter geocode

推荐答案

您已经拥有你想要的东西,看在搜索输出样本的地理部分中,您张贴在。它的,因为它不填充特(Twitter用户忘记在设置中启用Twitter的位置,并从Foursquare的所有位置都被Twitter忽略)。

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).

您可以通过位置过滤蠢特夫妇,看 Twitter的开发文档

You can filter twits by location, look at the Twitter Dev documentation.

UPD:

UPD:

如果你想,即使在情况下得到的位置时,它不存储到强烈抵制,您必须执行请求,Foursquare的短链接和分析场地信息(可以偷的位置也可以)。看样品4sq.com页面的源代码(小部分):

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):

...
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}}};
...

不幸的是,Foursquare的团队可以更改IP地址的页面或限制的请求没有任何注释的格式。这就是为什么这个解决方案是丑陋的。

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.

UPD2

请参阅从@MikeLewis回答,我已经错过了Foursquare的API支持通过检查ID请求信息。

See answer from @MikeLewis, I've missed that Foursquare API supports requesting information by checking id.

这篇关于我怎样才能在Twitter上发布四方签入的位置(纬度,经度)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆