@Tim@mastodon.timnolte.com recommended and introduced me to @shawnhooper@fosstodon.org on Mastodon who created a plugin called Twitter Archive to WP. This plugin uses the Twitter Archive. Previously, I was experimenting with a plugin to import my tweets. There appeared to be a limit of 199 tweets and I have 3,590 tweets, I tried the Twitter Archive to WP to see if it would import all of the tweets.
Setup
Install the Plugin
This post won’t include all of the instructions because I followed Shawn’s instruction in the readme.txt file. I will point out a few extra instructions.
I downloaded the plugin as a zip file. This took a few minutes because I wasn’t sure where the zip file was. ๐ But then found it.
Aside: I found the setting that was causing all of my zip file to download and unzip automatically on my Mac. But I digress.
I uploaded the plugin into my WordPress Multisite website and enabled in my sandbox site. (This becomes important later on.)
Upload the Tweet Archive to the WordPress Uploads Folder
I made a copy of the Tweet archive on my local computer. I deleted all of the files except for the one’s that Shawn said to include in the instructions.
I zipped that file and uploaded to my site using the cPanel file manager. I then extracted the file.
Open the WP-CLI
You will have to figure out how to do this on your own. ๐
Run the Command
Tip: The username is not the username that you log into WordPress with, it is a number. Since I am the only user on my site, the username was “1”.
When I ran the original command I received this message.
import-twitter’ is not a registered wp command
Shawn had me ensure the plugin was activated and it was on the sandbox site. I network activated the plugin and this error went away. I did not go back to see if I could have corrected this using the proper command line commands.
I ran it again and received the following error.
Warning: file_get_contents(/home/xxx/tmichellemoore.com/wp-content/uploads/twitter-archive/account.js): Failed to open stream: No such file or directory in /home/xxx/tmichellemoore.com/wp-content/plugins/twitter-archive-to-wp-main/classes/import-twitter-command.php on line 209
Error: Error while reading account.js: Syntax error
Tip: Ensure your files are in the correct folder. Mine were in a data subfolder and I had to move them up one level.
I ran the command again and receive this error.
Error: invalid post author ID.
Once all of the issues above were resolved the command ran correctly and the command line indicated that I imported 3,561 tweets. I possibly tweeted a few more after I downloaded the archive which may be why the numbers are different.
Results
- Twitter says I have 3,590 tweets.
- The plugin imported 3,561 tweets.
- The plugin imported the tweets to my primary site but there was a way to import them to the specific site in my multi-site install and thanks to Shawn for providing that information.
- The tweets imported into a new โTweetsโ custom post type.
- Images were imported.
- Most of my tweets with photos originate from my website because its my photography as a featured image or the image from the website that is linked to.
- If any are missing, its ok because I have the image.
- This doesn’t appear to be a function of the plugin.
- A Tweets Archive was created.
- All Tweets can be viewed individually.
- The permalink of the Tweet is the URL of the original.
Screenshots
Conclusion
Being able to import all of these tweets is a nice to have. If was not able to recover them, it would have been ok. Thanks to Shawn for his plugin because now I have them.
At this point, I will probably migrate them to a custom post type that I created so that I can have control over their disposition.
I would rate the skills needed to do this as intermediate and not beginner level.
Leave a Reply