Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying tweets from multiple users (similar to Embedded Timelines) without twitter-side user lists

Tags:

twitter

I am new to Twitter and need some tips.

I need to display tweet feed from multiple users on some webpage.

The first thing I stumbled upon is Embedded Timelines. It allows to display tweets from list of users but the gotcha is that those lists should be maintained on Twitter-side (i.e. I cannot specify @qwe and @asd only on my side and get timeline without adding those users into list on Twitter-side).

The thing is that list of users that should be included into timeline is dynamic and managing those lists through Twitter API will probably be painful. Not to mention that my website will probably generate tons of those lists and I feel that I will violate some api quotas sooner or later.

So, my question is - am I stuck with using Embedded Timelines that refer some user list on Twitter-side and managing those lists through, say Twitter REST api, or there is a simplier way to do what I want?

like image 357
Eugene Loy Avatar asked Mar 24 '23 06:03

Eugene Loy


1 Answers

It's pretty simple to display tweets for multiple users.

Links to start with

  • This post explains some of the search queries you can make
  • This post is a simple library to make requests to the twitter API that 'just works'

Your Query

Okay, so you want multiple users. The endpoint you're looking at using is the search/tweets one: https://api.twitter.com/1.1/search/tweets.json.

The query string uses :from and you can interpolate multiple froms with AND/OR.

An example query for the GET request:

?q=from:user1+OR+from:user2

Read more about the search API queries here.

Your "over-the-quote" issue

This is something you're going to need to figure out yourself - depending on the number of requests you expect to make, and the twitter imposed limits, maybe some sort of caching or saving information when you hit your limit, and only pull back from the cache whilst you're hitting your limit..

like image 166
Jimbo Avatar answered Apr 25 '23 16:04

Jimbo