【发布时间】:2018-07-04 03:19:10
【问题描述】:
我正在使用 twitter gem。请告诉我为什么我在解析时只得到一部分推文?看看 (live demo)。
例如:
Yeah, we don't want to hear from you. You've been yapping away for a million years. And by the w…
Then, ‘for balance’ you need to also clearly and repe…
You stated as fact that there would be a #Brexit dividend,…
这是我的代码:
控制器
@arr = []
client.search("@#{params[:twitter_acc]}", result_type: "recent")
.take(params[:number_of_tweets].to_i)
.collect do |tweet|
@arr << tweet
.text
.gsub("@#{params[:twitter_acc]}", "")
.gsub("RT :", "")
.gsub("RT", "")
end
查看
<% @arr.uniq.each do |line| %>
<%= line %><br>
<% end %>
我该如何解决这个问题? 有什么想法吗?
更新
【问题讨论】:
-
params[:number_of_tweets]长什么样子? -
@dinjas:我假设
"30",来自在线演示。 -
是的。 30. 但我担心推文有时会以点结尾(...)。
-
你确定这些点不在官方推文中吗?有时人们这样做是为了他们可以在多条推文中写一些东西....
-
像这样.....
标签: ruby-on-rails ruby twitter