{"id":1528,"date":"2010-09-21T23:12:10","date_gmt":"2010-09-21T21:12:10","guid":{"rendered":"http:\/\/planetozh.com\/blog\/"},"modified":"2015-12-06T14:25:12","modified_gmt":"2015-12-06T13:25:12","slug":"ozh-tweet-archiver-backup-twitter-with-wordpress","status":"publish","type":"page","link":"https:\/\/planetozh.com\/blog\/my-projects\/ozh-tweet-archiver-backup-twitter-with-wordpress\/","title":{"rendered":"Ozh&#8217; Tweet Archiver (Backup Twitter With WordPress)"},"content":{"rendered":"<p><strong>Current version : <em>2.0<\/em> &#8211; compatible with Twitter&#39;s OAuth API<\/strong><\/p>\n<p>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&#39;re toast. You can use #hashtags in your tweets but they won&#39;t be of any use to help you organize them. Oh, and those horrible <tt>t.co<\/tt> links.<\/p>\n<p>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.<\/p>\n<h2>Live Example<\/h2>\n<p>My tweet archive: <a href=\"http:\/\/planetozh.com\/tweets\/\">Ozh&#39; Tweets<\/a> (notice the cool stats in the sidebar)<\/p>\n<h2>Download<\/h2>\n<div class=\"download\">\nDownload the plugin :<br \/>\n<a href=\"https:\/\/wordpress.org\/plugins\/ozh-tweet-archiver\/\">ozh-tweet-archiver.zip<\/a><br \/>\nExtract and upload to your blog, preserving directory structure.\n<\/div>\n<h2>Plugin Usage<\/h2>\n<ul>\n<li>Install a fresh new empty blog (a subdirectory of your current blog will be fine, or a <tt>tweet.domain.com<\/tt> subdomain, it doesn&#39;t matter)<\/li>\n<li>Install, activate the plugin, follow configuration instructions.<\/li>\n<\/ul>\n<h2>Features, Plugin Configuration<\/h2>\n<p>You&#39;ll need to <a href=\"https:\/\/apps.twitter.com\/app\/new\">create a Twitter application<\/a> to obtain the consumer and secret keys. That&#39;ll be the hardest part.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/planetozh.com\/blog\/wp-content\/uploads\/2010\/09\/screenshot-11.png\" alt=\"screenshot-1\" width=\"585\" height=\"1713\" class=\"aligncenter size-full wp-image-3118\" srcset=\"https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2010\/09\/screenshot-11.png 585w, https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2010\/09\/screenshot-11-102x300.png 102w\" sizes=\"auto, (max-width: 585px) 100vw, 585px\" \/><\/p>\n<h2>FAQ<\/h2>\n<p><strong>Q:<\/strong> The [whatever] does not work!<br \/>\n<strong>A:<\/strong> <a href=\"http:\/\/planetozh.com\/tweets\/\">WorksForMe<\/a>.<\/p>\n<p><strong>Q:<\/strong> But [Other guy&#39;s plugin] does the same and more!<br \/>\n<strong>A:<\/strong> Exactly. &quot;And more&quot;. I didn&#39;t need this.<\/p>\n<p><strong>Q:<\/strong> How are tweets imported?<br \/>\n<strong>A:<\/strong> As regular posts, with a few post custom fields (containing tweet source, &quot;in reply to&quot; data, etc). Hashtags can be converted as post tags if you wish (you&#39;ll want to do this), <tt>t.co<\/tt> links can be expanded to their original URLs, and some proper markup will be applied (see below, developer info)<\/p>\n<p><strong>Q:<\/strong> I tried to import all my tweets for the first time but the page died with an error \/ timeout \/ alien abduction !!1<br \/>\n<strong>A:<\/strong> Just hit F5 to reload the page. There will be no duplicates.<\/p>\n<p><strong>Q:<\/strong> I have more than 3200 tweets. How do I import &#038; archive the old ones?<br \/>\n<strong>A:<\/strong> I wrote an importer script that uses this plugin. If it doesn&#39;t work for you, see first question of this FAQ (or write something yourself). The script: <a href=\"https:\/\/gist.github.com\/ozh\/11166845\">https:\/\/gist.github.com\/ozh\/11166845<\/a>. There is another script with a similar approach, using data from the JSON files instead of the CSV one: <a href=\"https:\/\/gist.github.com\/ozh\/f5deafcffd8d271bfa92\">https:\/\/gist.github.com\/ozh\/f5deafcffd8d271bfa92<\/a><\/p>\n<p><strong>Q:<\/strong> What theme did you use for your <a href=\"http:\/\/planetozh.com\/tweets\/\">Tweet archive<\/a>?<br \/>\n<strong>A:<\/strong> I made a theme for my own needs but it&#39;s freely available, feel free to use and hack it to make something for yourself: <a href=\"http:\/\/planetozh.com\/blog\/my-projects\/ozh-tweet-archive-theme-for-wordpress\/\">Ozh&#39; Tweet Archive Theme<\/a>.<\/p>\n<p><strong>Q:<\/strong> Can you add this or that feature?<br \/>\n<strong>A:<\/strong> This plugin was made to fit <em>my<\/em> needs. But hey, who knows, maybe I&#39;ll feel the need for your idea? Head to the <a href=\"https:\/\/github.com\/ozh\/ozh-tweet-archiver\">Github repository<\/a> and file a pull request.<\/p>\n<p><strong>Q:<\/strong> That one tweet got weirdly formatted\/truncated when imported!<br \/>\n<strong>A:<\/strong> There&#39;s an &quot;Edit post&quot; link somewhere. That&#39;s the beauty of WordPress when compared to Twitter.<\/p>\n<p><strong>Q:<\/strong> Something doesn&#39;t work<br \/>\n<strong>A:<\/strong> Create a file named <tt>debug.log<\/tt> in this plugin&#39;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.<\/p>\n<h2>Theme developer stuff<\/h2>\n<p>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&#8230;) to allow fine styling.<\/p>\n<h3>@mentions<\/h3>\n<p>When linked to Twitter profiles:<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">span<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;username username_linked&quot;<\/span>&gt;<\/span>@<span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">a<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;https:\/\/twitter.com\/ozh&quot;<\/span> <span style=\"color: #000066\">title<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;Ozh Richard&quot;<\/span>&gt;<\/span>ozh<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">a<\/span>&gt;&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">span<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>Not linked:<\/p>\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">span<\/span> <span style=\"color: #000066\">title<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;@ozh&quot;<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;username username_unlinked&quot;<\/span>&gt;<\/span>@ozh<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">span<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<h3>#hashtags<\/h3>\n<p>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 <tt>#bleh<\/tt> will be:<\/p>\n<p>When linked to Twitter:<\/p>\n<div id=\"ig-sh-3\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">span<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;hashtag hashtag_twitter&quot;<\/span>&gt;<\/span>#<span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">a<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;https:\/\/twitter.com\/search?q=#bleh&quot;<\/span>&gt;<\/span>bleh<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">a<\/span>&gt;&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">span<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>When locally linked to WordPress tags:<\/p>\n<div id=\"ig-sh-4\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">span<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;hashtag hashtag_local&quot;<\/span>&gt;<\/span>#<span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">a<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;http:\/\/yoursite.com\/tag\/bleh&quot;<\/span>&gt;<\/span>bleh<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">a<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>Not linked:<\/p>\n<div id=\"ig-sh-5\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">span<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;hashtag hashtag_no&quot;<\/span>&gt;<\/span>#bleh<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">span<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<h3>Links<\/h3>\n<p>Links can be &quot;un-t.co&#39;d&quot; (expanded)<\/p>\n<div id=\"ig-sh-6\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">a<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;http:\/\/example.com&quot;<\/span> <span style=\"color: #000066\">title<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;http:\/\/example.com&quot;<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;link link_untco&quot;<\/span>&gt;<\/span>example.com<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">a<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>Or kept as original t.co links:<\/p>\n<div id=\"ig-sh-7\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">a<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;http:\/\/t.co\/L4m3l1nk&quot;<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;link link_tco&quot;<\/span>&gt;<\/span>http:\/\/t.co\/L4m3l1nk<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">a<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<h3>Embedded media<\/h3>\n<p>If you enable embedding images from <tt>pic.twitter.com<\/tt>, you&#39;ll get the following:<\/p>\n<div id=\"ig-sh-8\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">span<\/span> <span style=\"color: #000066\">class<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;embed_image embed_image_yes&quot;<\/span>&gt;&lt;<span style=\"color: #000000;font-weight: bold\">a<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;&amp;#91;image link&amp;#93;&quot;<\/span>&gt;&lt;<span style=\"color: #000000;font-weight: bold\">img<\/span> <span style=\"color: #000066\">src<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;&amp;#91;image src&amp;#93;&quot;<\/span> <span style=\"color: #66cc66\">\/<\/span>&gt;&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">a<\/span>&gt;&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">span<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<h3>Template tags<\/h3>\n<p>The plugin comes with a bunch of template tags to be used into your theme. Refer to file <tt>template_tags.php<\/tt> that comes with the plugin.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Current version : 2.0 &#8211; compatible with Twitter&#39;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&#39;re toast. You can use #hashtags in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":241,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1528","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/1528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=1528"}],"version-history":[{"count":14,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/1528\/revisions"}],"predecessor-version":[{"id":3770,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/1528\/revisions\/3770"}],"up":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/241"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=1528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}