First of all, great little module! I was just looking for this. Actually, I was looking for this earlier and ended up using javascript to load the tweets directly from twitter, but it considerably slows down the site. So thanks!

Now my problem. The tweets don't load anymore for @username. I had it working a couple of times, but I can't get it to work anymore.

The code I'm using:

<?php echo twitter_pull_render('@username', '', 6); ?>

I also copied twitter-pull-listing.tpl.php to my theme dir and deleted some things like the user's picture.

Some things I tested:
- echo twitter_pull_render('#something', '', 6); does work (always)...
- thought it was the cache, but flushing the cache multiple times, waiting 20 minutes didn't help
- uninstalling/reinstalling the module doesn't help
- changing @username to @some-other-user-name doesn't help

Comments

Cheek’s picture

Priority: Normal » Minor
Status: Active » Needs review

I hate to come back and say it's working (which means I shouldn't have posted this in the first place), but it's working now. Caching was somehow set to 'Disabled', so I re-enabled it and that seems to have done it. Still weird the # was working. Was the non-cached page causing twitter to block the @ requests?

irakli’s picture

What do you mean by: "caching set to 'disabled'"?

irakli’s picture

Category: bug » support
Cheek’s picture

In 'admin/settings/performance' I had caching set to 'disabled'. Anyway, I'm still having the 'No Tweets' problem. Sometimes it works and sometimes it doesn't.

The only problem I can think of is, because I'm currently developing the site, I'm constantly clearing the cache. So if twitter bans sites constantly requesting a certain @user that might be it..

Cheek’s picture

Still getting 'No Tweets' a lot when getting my tweets. Any solution?

Alan D.’s picture

I was getting worried about reading this: You could be nuking the server too much and hitting your limit? It is about 150 per IP / user per hour. If you are on a shared IP, you may be sharing this limit with other users (?). I'm a newbie myself.

2) You cannot make unlimited calls, follow requests, updates or direct message

API usage is rate limited. Additionally, we impose limits on the number of follow requests, updates and direct messages you can make in a single day. We have a primer that you should read to learn more.

http://apiwiki.twitter.com/Rate-limiting

arithmetric’s picture

Could your problem be related to: #716958: Old tweets disappear? Does the Twitter account that you're using have very recent tweets? You said that loading from hashtag feeds always works -- have you tried loading from several different usernames?

almalino’s picture

I have similar problem on http://MalinaMusic.ru

I pull twits from one single account @MalinaMusic

1. Initially all was fine
2. After 2 hours all twits dissapeared.
3. After another 10 minutes twits are back again.
4. After 4 hours all twits dissapeared again.

My site is hosted on bluehost shared hosting with up to 500 (according bluehost) sites served from the same server.

At this moment i see no twits. I guess it might be very much te problem of sharing hosting and Twitter limitation of how many time one IP can pull twits. And, i guess , there is no good reliable solution for such a problem?

If not then how do we solve it?
I have recent tweets in my account.

almalino’s picture

I found out that twits are dissapearing when it is night in Russia (my site is russian) and day in USA (I host it in USA)
During the day in Russia and night in USA twits are available.

Can it be that when it is day in USA sites that are hosted on bluehost(USA hosting company) are starting to update they twits activelly. And then bluehos server reaches the limit of 150 updates per IP on Twitter.

almalino’s picture

It is confirmed. This is what I get in log files on Drupal:

"Could not retrieve data from Twitter. The error message received was: Rate limit exceeded. Clients may not make more than 150 requests per hour..This site may be subject to rate limiting. For more information, see:http://apiwiki.twitter.com/Rate-limiting"

So, Twitter Pull is not very good for shared hosting. Is it possible to prevent Twitter Pull to erase already pulled messages if it receives this kind of error? Otherwise we end up with empty Twitter list on our sites?

irakli’s picture

Are you using the latest build?

almalino’s picture

I'm using 6.x-1.1

travisc’s picture

seems to be an issue with the number of tweets, if i use 10 it works, anything less then 10 nothing shows up.

j0rd’s picture

Changing it to 10 made tweets show up. Problem is I only want one. Still looking for a solution to this. Using latest 1.1 version.

Could be an "off-by-one" error. If I set it to 1, i get 0. If I set to 2, I get 1. If I set to 3, I get 2.

Looking into it myself.

j0rd’s picture

Ok, I found the problem.

Short Answer: Twitter is stupid.

Long Answer: Twitter is stupid. They don't include re-tweets by default (which is fine) but say your limit is 1 and your first tweet is a retweet, twitter returns zero tweets, instead of grabbing your first non-retweet tweet. Problem with the Twitter API if you ask me, and minor over sight in the module.

So what should happen? I dunno, personally I'd just add re-tweets by default. If I put it on my twitter timeline I want other people to see it...this includes on my website...so I say just include them by default and for people who don't want it like this, let them hack up the module and change it.

Here's the API Link;
http://dev.twitter.com/doc/get/statuses/user_timeline

The field in question is include_rts.

Here's what I changed the code in twitter_pull.class.inc to

    // if the first character is @, then consider the key a username
    elseif ($prefix == "@") {
      $key = drupal_substr($this->twitkey, 1);
      $url = 'http://api.twitter.com/1/statuses/user_timeline.json?include_rts=true&screen_name='. urlencode($key) .'&count='. $num;
    } 

You'll notice I also changed the URL to reflect what the API says it should be. The other might have had a reason why they didn't do it like this though, so you make your own decision if you want to change that.

PS to Author. Code is pretty awesome. Good work. Save me some time even if I need to resolve some bugs :)

j0rd’s picture

Version: 6.x-1.0 » 6.x-1.1
Status: Needs review » Reviewed & tested by the community

Updated to "to be reviewed"

irakli’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Solution in #15 by j0rd is already in the code (benefits of some other issue resolved before, as far as i remember), so if there's nothing to it, I am closing this issue.

Please re-open if there's something else.

Thanks.