开发者

How to categorize twitter streaming api results

Hey, im looking to build a product that 'listens' to twitter streaming api and tracks certain keywords. everything can be done. what im missing is one thing. This product is intended to be operational and serving multiple clients. twitter encourages developers to open as little as possible connections to the api so i need to track multiple keywords at once for 开发者_C百科multiple clients.

My question is, how can i differentiate between those tweet results so i can organize the output for each clients? meaning if client A tracks 'hiscompany' how can i categorize the tweet results from the streaming api under client A project.

I want to categorize upon insert to the database, should i just preg_match on each result to determine the keyword associated in it? whats the best practices for it?


Here's how I would approach this:

  • Use the Streaming API's track to get results for all the keywords (for all clients).
  • Determine what keywords are in each status using strpos() (or similar, don't see the need for a regular expression).
  • Add the status to the database, associated with all matching keywords.
  • Associate the client account with the specific keywords they want to track.

This allows multiple clients to track the same keywords. It also allows a status to have multiple keywords. Both seem to be likely situations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜