On: 2010/09/21 Viewed: 11214 times
Shorter URL for this page: http://ozh.in/tq

Current version : 2.0 – compatible with Twitter's OAuth API

If you want to browse your own tweet history, Twitter sucks. If you have published more than 3200 tweets, Twitter lost the older ones. If you want to search a particular tweet about that awesome link you shared, you're toast. You can use #hashtags in your tweets but they won't be of any use to help you organize them. Oh, and those horrible t.co links.

On the other hand, WordPress does all this fine, so I made a plugin to archive all your tweets in WordPress, easily search them, and everything you wish Twitter would do.

Live Example

My tweet archive: Ozh' Tweets (notice the cool stats in the sidebar)

Download

Download the plugin :
ozh-tweet-archiver.zip
Extract and upload to your blog, preserving directory structure.

Plugin Usage

  • Install a fresh new empty blog (a subdirectory of your current blog will be fine, or a tweet.domain.com subdomain, it doesn't matter)
  • Install, activate the plugin, follow configuration instructions.

Features, Plugin Configuration

You'll need to create a Twitter application to obtain the consumer and secret keys. That'll be the hardest part.

screenshot-1

FAQ

Q: The [whatever] does not work!
A: WorksForMe.

Q: But [Other guy's plugin] does the same and more!
A: Exactly. "And more". I didn't need this.

Q: How are tweets imported?
A: As regular posts, with a few post custom fields (containing tweet source, "in reply to" data, etc). Hashtags can be converted as post tags if you wish (you'll want to do this), t.co links can be expanded to their original URLs, and some proper markup will be applied (see below, developer info)

Q: I tried to import all my tweets for the first time but the page died with an error / timeout / alien abduction !!1
A: Just hit F5 to reload the page. There will be no duplicates.

Q: I have more than 3200 tweets. How do I import & archive the old ones?
A: I wrote an importer script that uses this plugin. If it doesn't work for you, see first question of this FAQ (or write something yourself). The script: https://gist.github.com/ozh/11166845.

Q: What theme did you use for your Tweet archive?
A: I made a theme for my own needs but it's freely available, feel free to use and hack it to make something for yourself: Ozh' Tweet Archive Theme.

Q: Can you add this or that feature?
A: This plugin was made to fit my needs. But hey, who knows, maybe I'll feel the need for your idea? Head to the Github repository and file a pull request.

Q: That one tweet got weirdly formatted/truncated when imported!
A: There's an "Edit post" link somewhere. That's the beauty of WordPress when compared to Twitter.

Q: Something doesn't work
A: Create a file named debug.log in this plugin's directory. This will activate the debug mode and a lot of things will be logged in that file. See if that helps. If not, see item #1 of this FAQ.

Theme developer stuff

Each tweet will be added some markup and classes, depending on your settings (if you want to link to @mentions, link to #hashtags as tags, etc…) to allow fine styling.

@mentions

When linked to Twitter profiles:

  1. <span class="username username_linked">@<a href="https://twitter.com/ozh" title="Ozh Richard">ozh</a></span>

Not linked:

  1. <span title="@ozh" class="username username_unlinked">@ozh</span>

#hashtags

You can elect to link hashtags to Twitter (as Twitter does), as local WordPress tags (much cooler), or to not link them. In each case, the markup for #bleh will be:

When linked to Twitter:

  1. <span class="hashtag hashtag_twitter">#<a href="https://twitter.com/search?q=#bleh">bleh</a></span>

When locally linked to WordPress tags:

  1. <span class="hashtag hashtag_local">#<a href="http://yoursite.com/tag/bleh">bleh</a>

Not linked:

  1. <span class="hashtag hashtag_no">#bleh</span>

Links

Links can be "un-t.co'd" (expanded)

  1. <a href="http://example.com" title="http://example.com" class="link link_untco">example.com</a>

Or kept as original t.co links:

  1. <a href="http://t.co/L4m3l1nk" class="link link_tco">http://t.co/L4m3l1nk</a>

Embedded media

If you enable embedding images from pic.twitter.com, you'll get the following:

  1. <span class="embed_image embed_image_yes"><a href="[image link]"><img src="[image src]" /></a></span>

Template tags

The plugin comes with a bunch of template tags to be used into your theme. Refer to file template_tags.php that comes with the plugin.

Shorter URL

Want to share or tweet this page? Please use this short URL: http://ozh.in/tq

Metastuff

This page "Ozh’ Tweet Archiver (Backup Twitter With WordPress)" was posted on 21/09/2010 at 11:12 pm
Watch this discussion : Comments RSS 2.0.

123 Blablas

    Pages: [1] 2 3 » Show All

  1. 1
    Sarah Gooding United States »
    replied, on 23/Sep/10 at 7:17 am # :

    I LOVE this one in the FAQ:

    Q: The [whatever] does not work!
    A: Worksforme.

    Best plugin developer FAQ item ever. :) I'm writing up your plugin tonight. Thanks for your hard work on this one!

  2. 2
    deuts Philippines »
    wrote, on 23/Sep/10 at 4:01 pm # :

    I'm loving this plugin. However, I just noted, my Twitter profile says I currently have 998 tweets so far, while my Tweet Archives' edit posts page in the admin area indicates I only have 968 posts so far. It means either the import is short by 30 tweets, or Twitter's count is over by 30.

  3. 3
    Ozh France »
    replied, on 23/Sep/10 at 4:03 pm # :

    deuts » yeah I notice the same slight difference with my account. I guess DM's are counted (but not displayed, obviously), or maybe the Twitter API is just wrong :)

  4. 4
    deuts Philippines »
    commented, on 23/Sep/10 at 5:39 pm # :

    Oh, is that it? Anyway, I can leave without those 30 tweets. :D

  5. 5
    oriste Greece »
    said, on 23/Sep/10 at 10:16 pm # :

    Great plugin, fantastic idea. I have one problem: for over an hour now the manual archiving page says:

    1. Your browser will refresh this page in 38.5 seconds. If the page does not refresh, click here: Next please
    2.  
    3. Twitter is over capacity. This page will refresh in 90 seconds. Please wait this delay to avoid a ban.

    with the seconds counting down from 90 to 0, cycling ad infinitum over those 90 seconds.
    Would appreciate any suggestion.

  6. 6
    Max United States »
    said, on 24/Sep/10 at 2:29 am # :

    Thanks! Got this running on two accounts now.

  7. 7
    oriste Greece »
    wrote, on 24/Sep/10 at 10:42 am # :

    Doh! Turns out the FAQ was right, especially the part that Sarah Gooding quotes.
    I've been debugging this thing well into the night without result, after which I decided to start from scratch this morning, deactivated and deleted the plugin, reinstalled it again and, voilà, it worked.
    I still don't know what happened, but now "Worksformetoo!" :D

  8. 8
    oriste Greece »
    said, on 25/Sep/10 at 12:17 pm # :

    I tweaked the theme a bit and my twitter archive looks great. I found one problem in the searchform.php module. My archive sits at the root of the domain oriste.gr (linked under my name). Searchform.php however contains this line:

    and returns a 404 in my case. Changing "/tweets/" to "/" solved the problem.

    I'd also like to take you up on the invite in the last item of the FAQ. I have way over 3200 tweets (so manually archiving only retrieves those), but I have been saving them all in json format files through backupmytweets.com. It would be neat if there would be a way to load such files as well. Just a suggestion, I'll understand if you don't feel the need for this idea.

    I tried it myself by tweaking the code to point $api to a location where my jason file resides (and omitting the optional parameters) but that didn't work. I'm not proficient enough in PHP or the WP framework to do this myself I'm afraid.

    Anyway I had a great time so far with your plugin, so thank you for that!

  9. 9
    oriste Greece »
    replied, on 25/Sep/10 at 12:20 pm # :

    Oops, the code line in the previous post was eaten. Here it is (hopefully):

  10. 10
    oriste Greece »
    wrote, on 25/Sep/10 at 12:22 pm # :

    Giving up, it's the first line in searchform.php

  11. 11
    Ozh France »
    said, on 25/Sep/10 at 12:37 pm # :

    oriste » no surprise here, the theme is full of hardcoded stuff :) About the JSON archive from backupmytweets, can you send me this file? (ozh at ozh dot org) If the JSON structure is the same than the one produced by the API, it could be quite easy to import all tweets from this file.

  12. 12
    Scott Crevier United States »
    wrote, on 26/Sep/10 at 7:58 am # :

    Import worked okay, but the time stamps are all off. I suspect it has to do with how you're handling GMT (or not). Here's an example from your own site:

    3:43pm Sep 24
    http://planetozh.com/tweets/3698

    10:43 AM Sep 24
    http://twitter.com/ozh/status/25415368585

    The above two seem to be the same tweet, but the date/time don't match. I believe the twitter API gives you GMT stamps. You could either check the time zone setting in WordPress, or check the time zone setting in the user's twitter profile. Then do the conversion before inserting into the 'posts' table.

    Thanks.

  13. 13
    Ozh France »
    said, on 26/Sep/10 at 11:44 am # :

    Scott Crevier » I'll see what I can do (but I don't really mind to be honest)

  14. 14
    Joe Buhler United States »
    replied, on 01/Dec/10 at 9:40 pm # :

    OK, I should have first read about setting up a sub-directory before archiving all my tweets after installing the plug-in on my main blog. All tweets now show up there ahead of my blog posts! This is not what I wanted at all…. How can I either delete them or move them to a new sub-directory?
    Thanks for your assistance.

    Joe

  15. 15
    TwisterMc United States »
    wrote, on 22/Feb/11 at 2:09 pm # :

    I tried your plugin with WordPress 3.1 and it failed.

    Main errors:
    Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available.
    Notice: has_cap was called with an argument that is deprecated since version 2.0!
    Warning: Cannot modify header information

  16. 16
    TwisterMc United States »
    replied, on 22/Feb/11 at 2:15 pm # :

    Nevermind. It may have been another plugin and I just assumed. My bad.

    Seems to be working now. ;)

  17. 17
    Wouterjanss Netherlands »
    replied, on 06/Mar/11 at 6:51 pm # :

    Is it possible to get more variables? like tweet link and inreply link?

  18. 18
    sjefen6 Norway »
    thought, on 07/Mar/11 at 2:27 am # :

    It causes a bug like this bug: http://wordpress.org/support/topic/plugin-audio-player-problems-after-update#post-1343872 when used with Audio Player. Sorry if you have adressed this…

  19. 19
    Jason Paul United States »
    thought, on 16/Mar/11 at 1:02 am # :

    I like this plugin. Straight to the point. Is there anyway it can capture my Retweets as well?

  20. 20
    Brian United States »
    wrote, on 21/May/11 at 7:35 am # :

    Great plugin Ozh! Thank you sir. I'm using this on my website to pick up RT's from a twitter bot I made that will search for a certain #Tag tweeted by it's followers — to do that with your plugin I needed to change the json twitter API call to include_rts=true — problem being that when I have longer tweets posted to wordpress they're truncated after the RT @wsoppokerblog: part has been added… I'm looking to remove that 140 char limit for the wordpress posts but I'm not sure where to turn. Once again great job on this plugin and I thank you in advance for any help you can provide Cheers!

  21. 21
    Nader Jordan »
    said, on 05/Jun/11 at 5:36 am # :

    Why dose the Title/Subject and the Tweet have same contents, can I reduce the Post Title/Subject ?

    It looks dull, showing the same tweet twice

  22. 22
    Ozh France »
    said, on 05/Jun/11 at 10:40 am # :

    Nader » It's a theme matter. Just edit your theme and make it look the way you want.

  23. 23
    Nader United States »
    thought, on 08/Jun/11 at 9:19 am # :

    Dear Ozh,

    It was not a theme thing, I did the following modification on your php script (import.php)

    // Insert tweet as new post
    $post = array(
    'post_title' => ",
    'post_content' => $text,
    cheers.

  24. 24
    Ozh France »
    thought, on 08/Jun/11 at 5:13 pm # :

    Nader » as I said: theme issue to me. I'd rather have a tweet archive theme that doesn't display both post title & content (eg http://planetozh.com/tweets/) than get an empty value.

  25. 25
    Brian United States »
    commented, on 08/Jun/11 at 6:35 pm # :

    Hi Ozh Thanks for a great plugin… Any thoughts on my issue. Posted at the top of page 2. Thanks!

  26. 26
    gadelkareem Egypt »
    wrote, on 10/Jun/11 at 12:34 am # :

    Thanks for the plugin..
    I have 2 features request
    – option to remove links and hashtags from title and shorten titles string.
    – option to process links and display them the way facebook does ex. youtube videos, images, website title and desc. ….etc

  27. 27
    Ozh France »
    said, on 10/Jun/11 at 7:58 am # :

    gadelkareem » these are theme level tasks. Have your theme to do this.

  28. 28
    Carlos Spain »
    thought, on 13/Sep/11 at 10:43 am # :

    Hi Ozh:

    Thanks for your great plugin, but there is a problem: how can I say to the plugin where list the tweets? I tryed in a localhost and all tweets are in the main page, each tweet like each post. Where is the option to fil and say "list your tweets in this folder"?

    Regards

    Carlos

  29. 29
    Ozh France »
    wrote, on 13/Sep/11 at 2:30 pm # :

    Carlos » I'm not sure what you call a "folder". Anyway, this plugin imports tweets as posts so what you got is the normal behavior. In a future version I *might* add custom post type support.

  30. 30
    Carlos Spain »
    replied, on 13/Sep/11 at 5:29 pm # :

    Hi Ozh:

    folder means "subdomain". doesn't matter, because I understand now this plugin better. i must use a new WP installation, DB included.

    Thanks a lot

    Carlos Xabier

  31. 31
    Ozh France »
    replied, on 13/Sep/11 at 8:45 pm # :

    Carlos » note that you can simply activate multisite on your existing WP setup

  32. 32
    oriste Greece »
    thought, on 15/Sep/11 at 8:21 am # :

    Carlos » You might want to take a look at How To Set A Custom Post Type And Taxonomy Terms With Ozh' Tweet Archiver

  33. 33
    Carlos Spain »
    wrote, on 15/Sep/11 at 11:35 am # :

    Thanks Oriste for your help.

    Regards

    Carlos

  34. 34
    rolf United States »
    commented, on 03/Oct/11 at 12:40 pm # :

    hello Ozh,

    thanks for your WP plug.

    questions:
    1. is it the plug or why do all my tweets show up double:
    http://www.quoteguruapp.com/blog/

    2. can you not put all tweets on 1 page i.e. http://www.quoteguruapp.com/twitterfeeds, instead of separate them as separate posts?

    thanks,
    rolf

  35. 35
    Ozh France »
    replied, on 03/Oct/11 at 9:08 pm # :

    rolf » 1: Dunno. Worksforme. 2: theme job. Code your frontpage so it doesnt display posts from category "tweets" or whatever and display them in another page. Out of the scope of this plugin.

  36. 36
    deval Indonesia »
    said, on 30/Oct/11 at 6:22 pm # :

    i think your plugin does not work on wpmu…
    have you tried?
    thanks…

  37. 37
    deval Indonesia »
    thought, on 05/Nov/11 at 6:10 pm # :

    sorry :D my bad…
    i give it few more chance to run on my server, now it works (on wpmu)!

    great plug-in indeed. thanks!

  38. 38
    XiaoKyun China »
    commented, on 10/Dec/11 at 6:28 am # :

    in wordpress hosted on dotcloud.com,
    it creates duplicates after running one day or two,
    all tweets imports twice,
    how to solve this error (may be aroused by dotcloud system)??

    thx

  39. 39
    Manuel Spain »
    thought, on 10/Dec/11 at 4:48 pm # :

    Hi there, the plugin looks awesome, but I'm having a small problem as I've just run a "Manual Archiving", and only the last 140 tweets were imported (I have more than 2.000). I've tried doing a manual archive a couple of times more, but the plugin tells me that it's finished importing..

    Thanks a lot for your help.

    http://twitter.mediosordo.com/

  40. 40
    Dennis Denmark »
    thought, on 23/Jan/12 at 3:29 pm # :

    Great plugin – keep up the good work! :)

    I'm having some trouble with the import of my tweets though. Your plugin worked for a very short while, where it imported 4 tweets. Since it haven't imported my tweets at all… :-S

    I have tried everything and searched the web for an answer, but without any luck. So now I turn to you for help.

    It is the tweet stream on this frontpage: http://www.svadabryg.dk

  41. 41
    Dennis Denmark »
    replied, on 23/Jan/12 at 3:55 pm # :

    FINALLY! I have just found the solution to my import problem, which I have been searching for for weeks now!

    In my Twitter account the "only HTTPS" box had been checked, which apparently blocked the import of my tweets.

  42. 42
    Qays Jordan »
    thought, on 19/Feb/12 at 9:19 am # :

    Hello,

    I'm considering installing this. You mention installing a new instance of WordPress. Is that necessary? Will there be negative consequences to installing it on a running instance?
    Thanks,
    Qays

  43. 43
    Ozh France »
    thought, on 20/Feb/12 at 12:07 am # :

    Qays » it'll import tweets as posts. Your blog posts will be mixed with your tweets.

  44. 44
    Qays Jordan »
    thought, on 20/Feb/12 at 12:19 am # :

    Ok. That should be fine- kind of what I had in mind anyway. I'll probably give it a shot then. Take care.

  45. 45
    Stéphane Thibault Canada »
    said, on 22/Mar/12 at 2:16 am # :

    Salut Ozh,

    Found a bug (post_tag parsing), found a bugfix. Are you still supporting this plugin ?

    I'd be happy to share this with you if you point me to the right place : )

  46. 46
    Ozh France »
    thought, on 22/Mar/12 at 9:27 am # :

    Stéphane Thibault » sure :)

  47. 47
    Murray New Zealand (Aotearoa) »
    commented, on 18/Apr/12 at 1:51 am # :

    Hi Ozh, am I able to select just tweets withing a certain date range to archive? For example, we run a twitter account that changes to a new tweeter each week. I want to preserve an record of each tweeters efforts, and archive on their profile page on our wordpress site. Could we adapt the plugin to somehow handle that? Thanks.

  48. 48
    gadelkareem Egypt »
    thought, on 18/Apr/12 at 2:08 am # :

    Hi Ozh!
    I am here again and I modified import.php to be able to process the link and display a 'Facebook like' feed…check this Gadelkareem Tweets

    Great plugin!

  49. 49
    gadelkareem Egypt »
    replied, on 17/May/12 at 2:47 pm # :

    I thought I would share the code for expanding the links with you, please let me if you have better idea.
    Add full previews to your twitter feed on WordPress using Ozh’ Tweet Archiver

  50. 50
    TwisterMc United States »
    commented, on 18/Jun/12 at 3:52 am # :

    We need to figure out how to get this to work with the new WordPress 3.4 Twitter shortcode.

Pages: [1] 2 3 » Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.