Hi,
I have some problems using Twtter4R to search. Here is a method I have
in one of the models:
def self.test
client = Twitter::Client.from_config("#{RAILS_ROOT}/config/
twitter.yml")
messages = client.search(:q => "#test", :rpp => 50)
end
When I run this in the console on my server it will randomly work or
fail the first 3-4 times, after that it works fine. When it fails I
get the following:
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/runner.rb:
48: /opt/local/lib/ruby/gems/1.8/gems/json-1.1.9/lib/json/common.rb:
122:in `parse': 618: unexpected token at '<!DOCTYPE html PUBLIC "-//
W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/1999/REC-
html401-19991224/strict.dtd">
(JSON::ParserError)
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"
http://www.w3.org/TR/html4/strict.dtd"> -->
<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="0.1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<TITLE></TITLE>
</HEAD>
<BODY><P></BODY>
</HTML>
' from /opt/local/lib/ruby/gems/1.8/gems/json-1.1.9/lib/json/common.rb:
122:in `parse'
from /opt/local/lib/ruby/gems/1.8/gems/mbbx6spp-twitter4r-0.4.0/lib/
twitter/client/search.rb:24:in `search'
from /home/gmn6mfaa/apps/ffnor/releases/20090908150950/app/models/
message.rb:14:in `search'
from (eval):1
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `eval'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/
runner.rb:48
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `gem_original_require'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
from /home/gmn6mfaa/apps/ffnor/current/script/runner:3
I realize that the problem is probably in mys server rather than the
gem itself, but hopefully someone can point me in the right direction
on where to start trouble shooting. Like for instance, it seems from
the error message that the request returns an empty HTML document,
what might that mean?
Regards
Roger