clickrain / EE_Twitter

EE Add-on that uses oAuth to display Twitter Feed
Other
48 stars 18 forks source link

max number of tweets #44

Closed klibansky closed 9 years ago

klibansky commented 9 years ago

If I understand correctly from the twitter docs, the maximum number of tweets one can receive is 3200, however in the plugin its about 200. Is this correct? Can I get more?

bryanburgers commented 9 years ago

You're right and you're right. The docs say that the maximum number of tweets total one can receive is 3200. However, the maximum number of tweets one can receive in a single API call is 200 (see the count parameter). So you could get 3200 tweets, but you'd have to make at least 16 API calls to Twitter.

EE_Twitter makes its API call when a visitor requests a page. If it were to make 16 API calls when a page is requested, the visitor would have to wait a long time for the server to make all of those calls, and the page might even time out before anything is returned to the visitor.

Can you elaborate on what you're trying to accomplish? If it requires more than getting the results of a single API call from Twitter, you might need to consider an alternate approach that makes the API calls and saves the results ahead of time.

klibansky commented 9 years ago

Hi Bryan, I would like to get all of my tweets (about 500) initially to import them into EE. How would I do that? Is there a way to offset the tweets to first get 200 and then the next 200 and so on?

bryanburgers commented 9 years ago

The functionality of EE_Twitter is to fetch and render tweets when a page is requested. It doesn't, by design, put the tweets into EE or store them in the database at all. So when you talk about importing tweets into EE, I think EE_Twitter might not be quite what you're looking for.

I'm sorry that our project won't fit your exact use case. However, feel free to use or reference the code in EE_Twitter to build something that will fit your needs!

klibansky commented 9 years ago

I'm sorry, that I wasn't clear. I don't expect your add-on to import them into EE. I will do that once I get all of the desired output myself. I would like to use this plugin to generate the XML file, which I can import with another EE module. My only question is how to get all of my tweets with your add-on. Is there a way get more then 200 results?

bryanburgers commented 9 years ago

You'll have to use either max_id or since_id when you hit the Twitter API. There isn't anything set up in the add-on right now, but around line 97 of mod.twitter.php you can pass parameters to the Twitter API.

klibansky commented 9 years ago

Thank you very much! It worked. Maybe, for a future version, it would be cool to add the max_id parameter(?).