0

我在 ruby​​ 平台上使用 twitter 流 API。在 twitter gem(https://github.com/sferik/twitter)的帮助下,我能够找到流文本。

在检查推文时,我能够得到推文。

:text=>“Sublime Text:一个编辑器来统治它们?| Linux Journal - http://t.co/8riSamtlc4

但我需要输入类似 :search=>"linux" 的确切搜索文本

在检查推文时,我得到的输出为

**#<Twitter::Tweet:0x007fb541799688 @attrs={:created_at=>"Tue Oct 22 01:05:09 +0000 2013", :id=>392456556538634240, :id_str=>"392456556538634240", :text=>"#linux #bluetooth  [PATCH v3 09/11] android: Add IPC helper for convenient error sending http://t.co/WTdtDxJ1AH", :source=>"<a href=\"http://dlvr.it\" rel=\"nofollow\">dlvr.it</a>", :truncated=>false, :in_reply_to_status_id=>nil, :in_reply_to_status_id_str=>nil, :in_reply_to_user_id=>nil, :in_reply_to_user_id_str=>nil, :in_reply_to_screen_name=>nil, :user=>{:id=>134530863, :id_str=>"134530863", :name=>"Linux Networking", :screen_name=>"linuxnet", :location=>"", :url=>"http://www.spinics.net/lists/linux-net/", :description=>"Linux Networking Discussion Archive", :protected=>false, :followers_count=>1706, :friends_count=>415, :listed_count=>73, :created_at=>"Sun Apr 18 17:56:03 +0000 2010", :favourites_count=>0, :utc_offset=>nil, :time_zone=>nil, :geo_enabled=>false, :verified=>false, :statuses_count=>167802, :lang=>"en", :contributors_enabled=>false, :is_translator=>false, :profile_background_color=>"131516", :profile_background_image_url=>"http://abs.twimg.com/images/themes/theme14/bg.gif", :profile_background_image_url_https=>"https://abs.twimg.com/images/themes/theme14/bg.gif", :profile_background_tile=>true, :profile_image_url=>"http://a0.twimg.com/profile_images/833409212/network-cable_normal.png", :profile_image_url_https=>"https://si0.twimg.com/profile_images/833409212/network-cable_normal.png", :profile_link_color=>"009999", :profile_sidebar_border_color=>"EEEEEE", :profile_sidebar_fill_color=>"EFEFEF", :profile_text_color=>"333333", :profile_use_background_image=>true, :default_profile=>false, :default_profile_image=>false, :following=>nil, :follow_request_sent=>nil, :notifications=>nil}, :geo=>nil, :coordinates=>nil, :place=>nil, :contributors=>nil, :retweet_count=>0, :favorite_count=>0, :entities=>{:hashtags=>[{:text=>"linux", :indices=>[0, 6]}, {:text=>"bluetooth", :indices=>[7, 17]}], :symbols=>[], :urls=>[{:url=>"http://t.co/WTdtDxJ1AH", :expanded_url=>"http://dlvr.it/49zHZy", :display_url=>"dlvr.it/49zHZy", :indices=>[89, 111]}], :user_mentions=>[]}, :favorited=>false, :retweeted=>false, :possibly_sensitive=>false, :filter_level=>"medium", :lang=>"en"}>**
4

1 回答 1

1

终于从hashtag中得到了搜索#{tweet['hashtags']}

于 2013-10-22T03:52:36.360 回答