How to build a twitter stream parser in ruby?
i want to build a parser, which runs in the background and reads reads tweets with a specific @ reply in it every minute. should i use cronjobs or daemons? any advice here?
is the开发者_StackOverflow中文版re a gems for this?
thank you
Definitely go with a cron_job here. And I like to use the json gem and simply parse the search results of a public timeline. Twitter has a nice, simple, but slightly unreliable, json API.
I would opt to use a daemon for this task. If you do choose to go the cronjob route, make sure your app can handle multiple processes running at once (or use a lock-file or other mechanism to make sure your job won't run concurrently). Since the HTTP request timeout is longer than a minute, you are almost guaranteed to encounter this issue on a semi-frequent basis.
精彩评论