Trying to parse stream.twitter.com, please help

I'm having no luck working on this, and it's my first attempt at such a
process. Here is the code as it is now. When I run the file, I'm
testing it against my own twitter account, and I see in the '% Received'
it gets about 1100 bytes each time I update, but nothing else works
beyond that.

This is a job qualifier, any help is appreciated.
[code]
require "rubygems"
require "json"

BASE = "http://stream.twitter.com/"
MODE = "follow.json"
USER = "-u----------:-------"

USERS = [26079932]

IO.popen("curl -d @following #{BASE}#{MODE} #{USER}") do |io|
  begin
    while line = io.gets
      status = line.length > 2 ? JSON.parse(line) : nil
      if status
        if status["user"]["screen_name"] == 'my_screen_name'
          File.new("update_file", 'a').puts "hello"
          #`echo \"#{status[:user][:id]}\" >> update_file`
        end
      end
    end
  rescue
    # connection lost
  end
end
[/code]

···

--
Posted via http://www.ruby-forum.com/.

My god how low has the world gotten - it's one thing for a kid to beg for
code to get a high school grade in a class they probably don't care about -
but when an adult actually sticks up their hand in a room of professionals
and begs for assistance to cheat a company out of money what the hell have
we become. If you cannot perform the job (and can't even figure out how to
google the answer at least) then please have the decency to not steal the
time and money of the company who you are trying to steal from.

John W Higgins

···

On Tue, Jul 14, 2009 at 6:15 PM, Jesse Crockett <tefflox@gmail.com> wrote:

I'm having no luck working on this, and it's my first attempt at such a
process. Here is the code as it is now. When I run the file, I'm
testing it against my own twitter account, and I see in the '% Received'
it gets about 1100 bytes each time I update, but nothing else works
beyond that.

This is a job qualifier, any help is appreciated.

That's very assuming. Good job, you're typical.

···

--
Posted via http://www.ruby-forum.com/.

A man of such integrity as John W Higgins would surely code in the
middle of Wichita for $10/hr and have an open case with SRS Vocational
Rehab. How about it, Higgs?

···

--
Posted via http://www.ruby-forum.com/.

My sincerest sympathy (I can't think of a better term here but I mean no
disrespect), on whatever condition/situation placed you in the situation
that required any form of rehab.

However, clearly if one looked at your original request it's a very
different situation then what you now state. Maybe in the future when you
make a request that clearly could be viewed as a negative request you'll put
a little more context around it so it doesn't look like you are doing
something dishonest.

Best of luck to you and your family!

John W Higgins

···

On Tue, Jul 14, 2009 at 6:55 PM, Jesse Crockett <tefflox@gmail.com> wrote:

A man of such integrity as John W Higgins would surely code in the
middle of Wichita for $10/hr and have an open case with SRS Vocational
Rehab. How about it, Higgs?

--
Posted via http://www.ruby-forum.com/.

I've been working on this for five hours and the closest thing this week
old problem has to a "solution" appears here
http://blog.signalnine.net/?p=29

I've asked in the #ruby channel for 2 hours

You can all f*ck yourselves.

···

--
Posted via http://www.ruby-forum.com/.

FWIW, why are you trying to use an external process within the ruby script?

A cursory search in twitter's and in google will tell you that you should be able to parse the stream directly. Look up open-uri docs - that should get you someplace.

···

On Jul 14, 2009, at 10:07 PM, Jesse Crockett wrote:

I've been working on this for five hours and the closest thing this week
old problem has to a "solution" appears here
http://blog.signalnine.net/?p=29

I've asked in the #ruby channel for 2 hours

You can all f*ck yourselves.
--
Posted via http://www.ruby-forum.com/.

Finally made some progress, which means one less grudge :slight_smile: I'm
guessing this thread will get some traffic in the near future, so I'm
posting what I believe is a good starting block. While it's not a
parsing solution, it should aim in the right direction.

require 'rubygems'
require 'json'

BASE_URL = "http://stream.twitter.com/spritzer.json"
USER = "-uuser_name:password"

File.open("update_file", "a") do |f|
  IO.popen("curl #{BASE_URL} #{USER}") do |p|
    p.each do |status|
      f.puts status
    end
  end
end

···

--
Posted via http://www.ruby-forum.com/.