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. There is another script with a similar approach, using data from the JSON files instead of the CSV one: https://gist.github.com/ozh/f5deafcffd8d271bfa92

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

  1. Rachelle says:

    Hi Ozh,
    Love this plugin, however, I may have found a bug.
    I have your Tweet Archiver installed on my main site…no problems. Everything works perfectly. Then I installed it on a subdirectory: /news on the same site.

    Everything works perfectly EXCEPT the Link #hashtags setting. If I set it to: 'Yes, pointing to Twitter search' it interferes with the 'More Tag' in posts. If I add a 'more tag' it displays on home page as: '#more-24″ class="more-link">More' instead of the word 'More' with hyperlink. If I set Link #hashtags to 'no' the More Tag works as it's supposed to.

    I have the same version of WordPress 3.4.1, same theme Grido, and same plugins on both the main site and subdirectory site.

    Any idea why this is happening?
    Thank you!

  2. Ozh says:

    Rachelle » "more tag" within posts that are less than 140 characters? Kidding, right?

  3. Rachelle says:

    Hahaha… not on Tweet posts.
    I wanted a plugin where I could archive all my tweets as private posts but also publish the pertinent ones as blog posts. Twitter Tools, quite frankly, sux and doesn't archive the way your plugin does.
    I'm using a customized version of the Grido theme, so on the homepage I have Tweet posts mixed with blog posts/articles etc in a tumblog/pinterest style. The "more tag" is on the lengthy blog posts.

    Anyway, when I saw your reply this morning, I realized there was one more thing I didn't try. I had created a child theme for my blog and added the plugin in to the child theme. So, this morning I removed it from the child theme, added it to the parent theme et voila! the "more tag" issue disappeared.

    Have no idea what the problem was. I know enough php to make minor changes or additions but not enough to solve all problems. There must be a directory issue with my child theme and your plugin… but anyway, it's working again now… that's all that matters! :)

    On a side note: Will your plugin continue to work with the new Twitter API changes? Cheers!

  4. jiva says:

    Brilliant plugin. Looking forward to using it more! Thanks again for sharing.

  5. jiva says:

    Hi, had a quick question on using #'s. My setting is to convert #'s into wordpress tags; however, when the tag is clicked in the wordpress post the url points to /tag/%post_tag%/ for all tags (resulting in no posts found). Do you have any suggestions to how I can fix this?

  6. Ozh says:

    jiva » indeed, that's a bug, I didn't notice that. I'll check and fix when I have some time

  7. Jiva says:

    Thanks Ozh, great plugin otherwise. Looking forward to the update when you have some time!

    Cheers

  8. Mark C says:

    I've noticed that the "new" RTs are not being archived. Here's a diff that I think should work.

    https://gist.github.com/3775868

  9. TwisterMc says:

    It took a bit of digging, but I made this plugin 100x better in my opinion.

    I modified the import script to save the tweet id, then used WordPress' embed code to embed the Twitter URL into the post.

    Now instead of text, I get tweets with images and interactivity!

    Example: http://goo.gl/kQJEo

    My code may not be prefect (as my username is hard coded) but you can see what I changed here: http://pastebin.com/LACne6hB

  10. Ozh says:

    TwisterMc » Thanks for sharing. Not something I'd use but it may interest others, thanks for sharing

  11. Aldo says:

    Hi all,
    for those having the "%post_tag%" issue, you can fix it editing a very little piece of the plugin.

    Open the ozh-ta.php file and change the line 165 from this:

    1. $link = str_replace( '%tag%', $tag, $link );

    into this:

    1. $link = str_replace( '%post_tag%', $tag, $link );

    Hope this help and thanks to Ozh for sharing this plugin.

  12. Jiva says:

    Thanks Aldo! This helped me!

  13. iair1234 says:

    Hi. Your plugin is great, got a site running my twitter backup in 30 minutes.

    Then, are you changing twitter connection to allow authorization? because twitter is dropping public rss support and I guess this plugin will break then.

    Thank you!

  14. Ozh says:

    iair1234 » we'll see. Twitter is a gigantic pain in the ass with its API.

  15. WPStuffs says:

    Thanks Ozh I have created my own Tweet blog with the help of your plugin…here it is – http://vivek.techiestuffs.com/tweets/

    Thanks again

  16. iair1234@gmail.com says:

    Hi again, finally twitter will be breaking rss support on March 5th,

    I've found code to possibly add OAUTH support to your plugin:

    http://stackoverflow.com/questions/12916539/simplest-php-example-retrieving-user-timeline-with-twitter-api-version-1-1

    Your plugin is the only one doing this great task of archiving tweets in our own database, thus allowing real RSS!

    Thank you!

  17. Jiva says:

    Just wanted to check in… is this plugin still working/supported? Mine seemed to stop updating in Mid March. I was going to uninstall/reinstall the plugin, but cannot find it via the Twitter "add a plugin" page…

  18. Ozh says:

    Jiva » Still working? http://planetozh.com/tweets/ yep. Supported? "Worksforme". Existing? http://wordpress.org/extend/plugins/ozh-tweet-archiver/ yep.

  19. oriste says:

    @Jiva Still works perfectly for me. See it at oriste.gr

  20. Jiva says:

    Your right, it still works. Sorry for the false alarm – I disabled and reneabled it a few times and it started working again. Must have been my server or a conflicting plugin. Once again, great plugin – thanks again.

  21. iair says:

    Is it working? I noticed twitter deprecated API V1, and now requires authentication.
    Please update on this!

    Thank you!

  22. oriste says:

    Hi Ozh, I thought I keep patient for a while, but then it dawned on me, if nobody reacts you don't know how much interest there still is in your plugin. I for one would hate to see it go away, so if you have any plans to bring it up to date with Twitter's API 1.1 I'd like to hear it. Otherwise I'd be forced to have a stab at it myself and god only knows how bad that will be or how long it will take :P

  23. Ozh says:

    oriste » I'll definitely update it, but I'm lacking time right now. Probably second half of July, or early August.

  24. Jeff says:

    Glad to hear you're looking to do an update for the new API. It's a nifty tool.

  25. JSantos says:

    Hi Ozh,
    Good to know that you will update Ozh' Tweet Archiver. Please don't quit on it :)
    It is a very nice plugin, works perfectly (till API change) and it would be problematic for me to change to another setup (don't even want to think about it).
    Anyway, thanks for your work.

  26. iair says:

    For those still stuck on this.

    I've found this to be useful:
    Twitter to rss:

    either try this (php twitter to rss):

    http://webapps.stackexchange.com/questions/41499/any-alternatives-for-twitter-rss-after-native-service-is-shut-down

    or this: (free, twitter to rss)
    http://www.rssitfor.me/

    And if you need to post Tweets to a blog, try this WP plugin:

    http://wordpress.org/plugins/wp-rss-multi-importer/

    Thank you Ozh though, for trying to keep this project up. (maybe this suggestions also provide for the neccesary tweaks your plugin needs to be back on track)

  27. JSantos says:

    Hi Ozh,
    I'm sure your lacking time, but could you let us know if you will or not update your plugin please? Just to know if i should look into a new way or still waiting for plugin update.
    Thanks man
    JS

  28. Ozh says:

    JSantos: I still want to update that plugin, but I need to find a perfect and no-maintenance (ie maintained by someone else) Twitter oauth lib first

  29. JSantos says:

    Ok, thanks. I'll keep waiting for the updated version ;)

  30. oriste says:

    Ditto. Patiently and loyally… :P

  31. Ozh says:

    Peeps! I'm currently updating that plugin, at last. Expect an updated version in the next few days!

  32. JSantos says:

    The champagne is ready in the fridge :)

  33. oriste says:

    w00t!

  34. Ozh says:

    Peeps, it's almost there: https://github.com/ozh/ozh-tweet-archiver

    Still 2 minor bugs to fix but overall it seems to be working nicely. If you have a test install somewhere and want to play with it too, I'd appreciate feedback :)

  35. oriste says:

    Oops! Only just now seeing this. Will get to work right away (as soon as I can bring this F@#$%&ng server back on its feet)…

  36. oriste says:

    Took a while, as my server was still playing up, some rogue process or something according to the host. Anyway, got the new plugin loaded, applied the modification that I did to version 1.0.1 again, launched…. et voilà! Took about the time to prepare dinner to update since June 2013 when it stopped working. I'm a happy camper now, see it at http://oriste.me

    Thanks a gazillion, Ozh!

  37. Ozh says:

    oriste » I'll update it soon, there's something that doesn't work as intended with the backup (it reads all tweets each time). In the meantime consider setting it to "once daily" if not done already

  38. Pierre Chaffard says:

    Awesome news, can't wait for the upgrade

  39. Ozh says:

    Plugin updated and pushed to wp.org, doc here updated. Have fun.

  40. JSantos says:

    Thanks ;)

  41. JSantos says:

    Hi there,
    I dont know if I am doing something wrong, but first manual archive goes just fine and then later (with auto archive) some "tweets posts" lose the content of the post (entry) and they just keep the title of the post. It is very strange. Any idea?
    Thanks
    JS

  42. Ozh says:

    JSantos » show me a tweet that failed, I'll check

  43. Ozh says:

    JSantos » a *tweet* please, not a blog post. Also, I see you're importing tweets as a category of your blog, so it may well be something on your side

  44. JSantos says:

    Sorry, here it goes:

    https://twitter.com/thegoldenaura/status/436838557710553089

    Yes, i am importing them in the category tweets.

  45. Ozh says:

    JSantos » Works on my test install… I was suspecting maybe the line break would make the plugin trip-up, but it went fine. Nope, don't know.

  46. JSantos says:

    It won't see the problem mentioned in last message in jfasantos.net. I have made a WP3.9 upgrade, deleted all post, reseted tweet archiver and made another manual archiving.
    Lets see if entries will be "eaten" again or not during the automatic archiving again…
    thanks

  47. Jason says:

    What if I don't want to import all my previous tweets? I'd like to just import tweets from now on. Can I do that?

  48. Ozh says:

    Jason » simplest way is to let the plugin import everything as advertised, then delete all/some posts in WP and just let the plugin continue to import afterward

  49. Chip Bennett says:

    Ozh,

    Great Plugin! Would you accept a patch that adds post-format support? I'd love to use this Plugin, but I could only do so with post-format support – and I'd much prefer to contribute than to fork it for my own needs.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar and sign for a free account
Spam: Various spam plugins may be activated. I'll put pins in a Voodoo doll if you spam me.