Filter 按位置筛选Twitter流

Filter 按位置筛选Twitter流,filter,twitter,location,twitter-streaming-api,Filter,Twitter,Location,Twitter Streaming Api,推特流API是否可以按位置字段过滤推特?正如您在下面的示例JSON条目中看到的,有“location”:“Philippine”字段-值。现在,我想要的是通过location字段过滤来自该位置的推文。但别误会我。我不是说地理标记过滤器 这可能吗 {"geo":null,"in_reply_to_screen_name":null,"truncated":false,"text":"RT @BreakingNewsPH: Typhoon hits Taiwan after pummeling Ph

推特流API是否可以按位置字段过滤推特?正如您在下面的示例JSON条目中看到的,有“location”:“Philippine”字段-值。现在,我想要的是通过location字段过滤来自该位置的推文。但别误会我。我不是说地理标记过滤器

这可能吗

{"geo":null,"in_reply_to_screen_name":null,"truncated":false,"text":"RT @BreakingNewsPH: Typhoon hits Taiwan after pummeling Philippines: Typhoon Nanmadol slammed into\u2026 http:\/\/t.co\/rF3jbVU #breakingnews","in_reply_to_user_id_str":null,"contributors":null,"retweeted":false,"retweet_count":1,"entities":{"hashtags":[{"text":"breakingnews","indices":[120,133]}],"urls":[{"indices":[100,119],"display_url":"goo.gl\/fb\/JVdpj","expanded_url":"http:\/\/goo.gl\/fb\/JVdpj","url":"http:\/\/t.co\/rF3jbVU"}],"user_mentions":[{"indices":[3,18],"name":"Breaking News PH","screen_name":"BreakingNewsPH","id":190144401,"id_str":"190144401"}]},"coordinates":null,"retweeted_status":{"geo":null,"in_reply_to_screen_name":null,"truncated":false,"text":"Typhoon hits Taiwan after pummeling Philippines: Typhoon Nanmadol slammed into\u2026 http:\/\/t.co\/rF3jbVU #breakingnews","in_reply_to_user_id_str":null,"contributors":null,"retweeted":false,"retweet_count":1,"entities":{"hashtags":[{"text":"breakingnews","indices":[100,113]}],"urls":[{"indices":[80,99],"display_url":"goo.gl\/fb\/JVdpj","expanded_url":"http:\/\/goo.gl\/fb\/JVdpj","url":"http:\/\/t.co\/rF3jbVU"}],"user_mentions":[]},"coordinates":null,"place":null,"source":"\u003Ca href=\"http:\/\/www.google.com\/support\/youtube\/bin\/answer.py?hl=en&answer=164577\" rel=\"nofollow\"\u003EGoogle\u003C\/a\u003E","created_at":"Mon Aug 29 04:16:31 +0000 2011","in_reply_to_user_id":null,"user":{"listed_count":19,"favourites_count":0,"profile_sidebar_fill_color":"252429","location":"Philippines","profile_background_tile":false,"lang":"en","profile_link_color":"2FC2EF","description":"Follow us to receive round-the-clock Philippine Breaking News updates directly on your Twitter account!","default_profile_image":false,"default_profile":false,"verified":false,"profile_sidebar_border_color":"181A1E","notifications":null,"time_zone":"Hong Kong","created_at":"Mon Sep 13 05:14:02 +0000 2010","followers_count":804,"following":null,"profile_use_background_image":true,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme9\/bg.gif","profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1130204413\/breakingnewsph-logo-small_normal.png","show_all_inline_media":false,"follow_request_sent":null,"geo_enabled":false,"profile_background_color":"1A1B1F","protected":false,"contributors_enabled":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/images\/themes\/theme9\/bg.gif","url":"http:\/\/www.breakingnews.ph","screen_name":"BreakingNewsPH","name":"Breaking News PH","friends_count":210,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1130204413\/breakingnewsph-logo-small_normal.png","id":190144401,"id_str":"190144401","is_translator":false,"statuses_count":51981,"utc_offset":28800,"profile_text_color":"666666"},"in_reply_to_status_id":null,"favorited":false,"id":108030240370073602,"possibly_sensitive":false,"in_reply_to_status_id_str":null,"id_str":"108030240370073602"},"place":null,"source":"web","created_at":"Mon Aug 29 04:23:44 +0000 2011","in_reply_to_user_id":null,"user":{"listed_count":0,"favourites_count":1,"profile_sidebar_fill_color":"FFF7CC","location":"cabuyao,Laguna PHILIPINES","profile_background_tile":false,"lang":"en","profile_link_color":"FF0000","description":"Prudence keeps life safe, but it does not often make it happy.","default_profile_image":false,"default_profile":false,"verified":false,"profile_sidebar_border_color":"F2E195","notifications":null,"time_zone":"Alaska","created_at":"Sun Nov 14 09:15:11 +0000 2010","followers_count":32,"following":null,"profile_use_background_image":true,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/188170056\/Picture_276.jpg","profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1423110432\/271010_220561634650699_100000905924979_647505_1229915_n_normal.jpg","show_all_inline_media":true,"follow_request_sent":null,"geo_enabled":false,"profile_background_color":"BADFCD","protected":false,"contributors_enabled":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/188170056\/Picture_276.jpg","url":null,"screen_name":"emerlyn14","name":"Emerlyn Cantalejo","friends_count":215,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1423110432\/271010_220561634650699_100000905924979_647505_1229915_n_normal.jpg","id":215568114,"id_str":"215568114","is_translator":false,"statuses_count":270,"utc_offset":-32400,"profile_text_color":"0C3E53"},"in_reply_to_status_id":null,"favorited":false,"id":108032058986729472,"possibly_sensitive":false,"in_reply_to_status_id_str":null,"id_str":"108032058986729472"}

查看twitter流媒体api,网址为

地点

指定要跟踪的一组边界框。只有两者都是的推特 使用地理标记API创建,并从跟踪的 边界框将包含在流中–用户的位置 字段不用于过滤推文(例如,如果用户有他们的位置 设置为“旧金山”,但twitt不是使用 地理标记API,没有地理元素,将不包括在 流)。边界框指定为一个逗号分隔的列表 经纬度对,第一对表示西南 盒子的一角。例如位置=-122.75,36.8,-121.75,37.8 将追踪来自旧金山地区的推特。多重边界 例如,可以通过连接纬度/经度对来指定框 示例:位置=-122.75,36.8,-121.75,37.8,-74,40,-73,41将跟踪 来自旧金山和纽约的推特。< /P> 与track参数一样,查询也受track的约束 限制,如轨道限制和访问角色中所述, 在状态/筛选方法中描述。无论是数量还是大小 边界框是有限的。边界框最多可以是360度 经度乘以180度纬度,您最多可以指定25度 边界框。一个360度乘180度的盒子将覆盖 整个地球。较高的访问级别提供了额外的边界框

边界框是逻辑运算符。可以组合位置参数 使用轨迹参数,但请注意,所有术语在逻辑上都是ORd,所以 查询字符串 track=twitter&;位置=-122.75,36.8,-121.75,37.8将匹配 任何包含Twitter(甚至非地理推文)或即将发布的推文 来自旧金山地区。

值:经度/纬度对,用逗号分隔。第一对 指定长方体的西南角。方法:状态/过滤器

示例:创建一个名为“位置”的文件,该文件包含 引号、短语: “位置=-122.75,36.8,-121.75,37.8,-74,40,-73,41”然后执行:

curl -d @locations https://stream.twitter.com/1/statuses/filter.json
-uAnyTwitterUser:Password. 
<>你将收到来自旧金山和新的所有地理标记的推文。 约克市地区


嗯..你不能使用twitter api..twitter不过滤位置字段,只过滤地理标签..如果你想要过滤位置,你必须在json响应中编写一个过滤器来过滤位置..这真的很低效,你会失去很多twitt,因为你只收到不到10%的公共状态:

状态/样本

返回所有公共状态的随机样本。默认访问级别“Spritzer”提供了消防软管的一小部分,大致占所有公共状态的1%。“Gardenhose”访问级别提供了一个更适合数据挖掘和研究应用程序的比例,这些应用程序需要更大比例的数据才具有统计意义。目前,Gardenhos大约返回了所有公共状态的10%。请注意,这些比例可能会随着交通量的变化而突然调整

你也可以阅读:

状态/消防水带

返回所有公共状态。消防水带不是一般可用的资源。很少有应用程序需要这种级别的访问。创造性地使用其他资源和各种访问级别的组合可以满足几乎每个应用程序用例

因此..您只有2个选项..1)使用位置过滤器过滤整个国家/地区,或2)仅接收1%的完整公共状态并进行过滤,也许阅读它可以帮助您:

再见,快乐编码