Thats a simples script to import yours tweets from any Twitter account to a Mastodon account, in any instance.
For this tutorial, you'll need to install Node.js and Git.
- Node.js: Download | Node.js (nodejs.org)
- Git: Git - Downloads (git-scm.com)
Go here for request your Twitter data. You'll recive a link to download a zip file. There will be tweets, images, information etc. It'll be in this configuration:
- twitter
- assets (folder)
- data (folder)
- Your archive (html file)
Extract the file in your Desktop folder. Will be more easy for manipulate. Find the tweets.js file. It'll be, probably inside "data" folder and move it to Desktop.
Clone this repo in your Desktop folder with the command:
git clone https://github.com/FGRibreau/import-tweets-to-mastodon.git
Or download the zip and extract in Desktop.
To request an API key from Mastodon, click here. Create an new application in "New Application". Set an Application Name (e. g.: api-mastodon-twitter) and, at the end of page, click in "Submit".
- Copy your "Your access token" from developer's page in Mastodon;
- Press "WIN + R" and write "cmd". Click ENTER;
- Go to your Desktop folder;
- Write
set MASTODON_API_BASEPATH=https://[YOUR-MASTODON-INSTANCE-DOMAIN]
set MASTODON_API_KEY=YOUR_ACCESS_TOKEN_FROM_MASTODON
set TWITTER_TWEETJS_FILEPATH=tweets.js
- Same thing as Windows;
- Open Terminal;
- Got to your Desktop folder;
- Write
export MASTODON_API_BASEPATH=https://[YOUR-MASTODON-INSTANCE-DOMAIN]
export MASTODON_API_KEY=YOUR_ACCESS_TOKEN_FROM_MASTODON
export TWITTER_TWEETJS_FILEPATH=../tweets.js
In the terminal (or CMD), enter in "import-tweets-mastodon" folder, located in Desktop. Write
npm install
After this
node import.js
- This project is open-sourced. Feel free to contribute;
- If you really want support please consider sponsoring me 👍