PHP Twitter API - How to Pull in Multiple Users Tweets

PHP Twitter API - How to pull in multiple users tweets?

Use the search API and boolean OR operator. For example here is the URL for CNN Breaking News and NPR All Things Considered:

http://search.twitter.com/search.json?q=from%3acnnbrk+OR+from%3anpratc

The query is URLEncoded so use Fiddler Tools -> Text Encode/Decode or your favorite tool to see that the correct format in plain text is:

q=from:cnnbrk+OR+from:npratc

Hope that helps.

Twitter API 1.1 get tweets from multiple users

Your issue is twofold.

Firstly, the user teffy0402 has their tweets protected. You can't access the tweets of someone with a protected account, unless you are the authenticating user who owns that account.

Try another user instead:

$getfield = '?q=from:desertwinds09+OR+from:nonprotectedaccount&count=5';

Secondly, the user desertwinds09 doesn't have any tweets since the id: 386093442759417856.

You need to get the two individual parts working first before trying them together with an OR.

Twitter API - Show Latest Tweet of Multiple Specified Users

There are two ways to do this - neither is quite as simple as you want.

Firstly, you could request the user timeline for each user individually.

So call https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=McDonalds and then https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=Wendys and so on.

That might be slow. So, alternatively, you could create a list with all the users you want to follow.

Then you can use the List API to get all the recent tweets of those users.

Streaming multiple tweets - from multiple users? - Twitter API

According to the Twitter API documentation, you can only use the streaming API to follow up to 400 users. For more than that, you'll have to request an increased access level for the account you use to access the API.

List tweets from multiple users (PHP)

Yeah, you can't just change the string and that's it ;)

You need to make authenticated requests (OAuth).

This post will walk you through exactly how to make authenticated requests to the 1.1 API using Oauth.

This post, although a little more complex because it involves multiple users and also multiple hashtags, shows how you can join multiple users in a query (although it looks like you've already got that covered).

You've got the gist of the actual query you need to make, so well done for doing some research and reading the docs. However, performing 1.1 requests is a little more involved now.

Get all tweets and re tweets from Twitter API

count - optional
Specifies the number of Tweets to try and retrieve, up
to a maximum of 200 per distinct request. The value of count is best
thought of as a limit to the number of Tweets to return because
suspended or deleted content is removed after the count has been
applied. We include retweets in the count, even if include_rts is not
supplied. It is recommended you always send include_rts=1 when using
this API method.

From twitter api you can get 200 tweets in a single request. you have to make another request to get the next set of tweets. you are getting 198 because retweets are also counted as a tweet.

The max_id parameter

The solution to the issue described above is to use a technique for working with streams of data called cursoring.
Instead of reading a timeline relative to the top of the list (which
changes frequently), an application should read the timeline relative
to the IDs of Tweets it has already processed. This is achieved
through the use of the max_id request parameter.

To use max_id correctly, an application’s first request to a timeline
endpoint should only specify a count. When processing this and
subsequent responses, keep track of the lowest ID received. This ID
should be passed as the value of the max_id parameter for the next
request, which will only return Tweets with IDs lower than or equal to
the value of the max_id parameter.

Search tweets from multiple users with a certain hashtag?

You can combine users and hashtags in your search query. i.e. you could do something like this:

https://search.twitter.com/search.json?&q=from:stevdobb+OR+from:dummytwitteruser+%23file

This returns tweets from "stevdobb" or "dummytwitteruser" that contain a #file hashtag

Twitter API Get Only User Tweet

Have a look at this doc. Simply add parameters

exclude_replies=true & include_rts=false

along with your query. This will filter the retweets and replies!

Twitter API - I want to grab all the tweets by a certain user (actually, a whole bunch of users) (php)

You can make a twitter list https://support.twitter.com/entries/76460-how-to-use-twitter-lists and output via a widget https://twitter.com/about/resources/widgets/widget_list.

this answer was from here but some of the links are broken Combine multiple twitter feeds into one list with PHP?.

Or you could do the way you suggested using this php class http://code.google.com/p/twitter-php/ and using the Twitter::ME_AND_FRIENDS option



Related Topics



Leave a reply



Submit