Friday, February 22, 2008

Combine multiple Twitter feeds on Blogger

NOTICE August 12, 2009: If you are having issues with the hosted version of my twitter widget (i.e. you are not linking to a local copy of the javascript file on your own server), it looks like my bandwidth has been exceeded on my googlepages account. Frankly, I can't imagine how that tiny .js file could exceed my bandwidth, but perhaps someone with a very popular site is linking to it. In any case, I'm working to find a permanent, alternate host. For the latest updates on this issue, check back here or follow my Twitter feed.

Oh, and I probably will have to find a paid host, so if you are a user of this widget and would like to help out, a donation would be appreciated (the Donate button is in the right hand column on this page).



UPDATE 1/25/2009: I have received a few feature and bug fix requests. That list is available here. I have a fairly packed schedule through the spring and mid-summer of 2009, so it may be quite some time before I am able to complete these. But you are welcome to download a copy of the code, add these or other features you'd like to see, and fire it back to me. This code is non-commercial, not-for-profit open source, so I will gladly give full credit to whomever contributes code if I decide to include it in the version that is distributed here. And while this is not-for-profit, if you should wish to thank me for the time I've invested in this project, I am happy to accept even the smallest PayPal donation (see the Donate button to the right on this page). ;-) And now back to the original post.

This Blogger widget I created is based on the original widget provided by Twitter. This one, however, will let you combine multiple users' feeds into one and sort them by time. This is as opposed to showing your entire timeline, including everyone you follow. Perhaps someone has already written something like this, but damned if I could find it. Constructive criticism is welcome, particularly since this is my first crack at creating a blogger widget.

Configure and add the widget here.

I promise to post more documentation for this feature later, as there are other nifty things you can do to control the style of the output, including creating a "mask" to define the format of your output, and inclusion of data like the user profile, user homepage link, user profile image, etc.

Caveats: The number you are defining in the form does NOT mean that only the last n posts from your pool of users will appear. It means that the last n posts from each user will be shown. For example, you've set the twitter number to 3. User1 posted a single twitter 4 days ago, but User2 posted 4 twitters today alone. You will see the last 3 posts from User1 and the last 3 posts from User2.

19 comments:

Editor said...

Been looking 4 this. Thank you!

Jeremy Q. Afterglide said...

You're welcome! Glad someone other than me is getting some use out of it. :-)

Carolina said...

I swear I've looked at the entire world of Twitter badges, and this is the only one that can combine two selected users in one badge. Thanks.

Andre Charland said...

thanks for this! I can't seem to add it to my blogger account. it just keeps looping me back to a login in screen after I click add. even though I logged in the first time and blogger found my blog...anyone else having trouble with authentication?

M. LeBlanc said...

this just solved a really, really annoying problem for me. thanks, jeremy.

piratasdaprotasio said...

Thank you very much!!!!

Leon said...

awesome script :D.

one thing... is it possible to change the number of tweets per person to a maximum number in total?

say instead of 3 each.. a total of 10?

Thanks, Leon

Jeremy "King Skidz" Gibbens said...

Thanks, Leon. At this time, that is not an available option (to the best of my recollection), but that sounds like a reasonable feature for a future version. However, you are free to download a copy of the .js file and tinker with it in the meantime. Normally I would probably just hop in there immediately, change it, test it, and republish it, but I'm working under some tight deadlines with some work and personal projects until April.

renovia said...

Thank you for making this, are you thinking about making it sortable by username? Like 3 in a row for one user and 3 in a row for the other user?

Leon said...

Thanks Jeremy, i have done it!

its simple... in the JS, find the line 86...

for (var i=0; i"lessthan"MultiTweet.length; i++){

and replace 'MultiTweet.length' with the number of posts you want to display.

Hope this is helpful to anyone that sees it.

Leon

Jeremy "King Skidz" Gibbens said...

That's another good idea. Actually that would be very easy to do because that is pretty much the default behavior to a certain degree. I actually had to specifically code to sort the tweets by timestamp. I will add that one to the list. Incidentally I have published the current list of bug fix and feature requests here. I will also link this from the post itself.

Ben said...

Hi Jeremy. This is a sweet idea what you have done here. I got it running on www.roadcycling.co.nz in about 10 minutes. But then I got a few emails from viewers saying problems with IE.
Have you had any issues or do you think it might be my site? have some sort of conflict. I have google analytics and google adsense running and some other scripts have problems with these.
cheers

Jeremy Gibbens said...

Ben, that is the first I've heard of any issues in IE. What versions have been at issue? Have you confirmed any of the problems independently?

Anonymous said...

Hi Jeremy, thanks, I got someone to have a look and its not your script, but rather a conflict with other js I have running. Seems I have mootools, jquery, and with these and analytics, and adsense seems to be not happy. Who knew. Great script so I will get sorted and keep using. thanks ben

Sarah said...

any way to remove the VIA WEB, Via Tweetdeck, etc... part of the widget?

thanks.

The Adams Group said...

If using a "custom" mask, is there a way to format the %text% so it puts in the links for URL's?

Coastal Community Foundation said...

Thank you - exactly what I was looking for! Any idea how to do something similar for a Facebook page?

Jeremy Gibbens said...

Sorry for the long delay in my replies everyone. Until recently, between my regular gig and a personal project, I was working the equivalent of 2 full time jobs. I'm now back to a more normal schedule and hope to return to making improvements to this widget over the next few months.

Sarah, at this time, I don't believe you can remove the "from..." line.

Adams group, I believe it should already automatically detect URLs and make them links (i.e. anything matching the format http://..., https://... www.blah.com, etc). If the current version isn't doing that, I added that feature at the request of Livestrong, and I may have simply forgotten to merge it in to the stable release. Let me know if it isn't working for you.

Coastal, I have never developed any Facebook apps and have no plans to do so in the foreseeable future (in other words, perhaps someday). For now, I plan to keep my attention on this widget, as well as development of non-Twitter apps for the iPhone and Palm Pre.

Senojeel said...

Hi Jeremy,

This is a great script. I have it working well on every browser except for IE 7 and 8. Someone else had mentioned having problems too and attributed it to conflicts with mootools, jquery, etc.. I too have mootools running on a Joomla site and et the following error:

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Timestamp: Tue, 4 Aug 2009 15:01:20 UTC

Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
Line: 0
Char: 0
Code: 0
URI: http://taborministries.org/

Any ideas on what I could to fix it? Or anyone else who has had an issue?

Thanks!

FYI, I disabled the script for now...