Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fgribreau/import-tweets-to-mastodon
How to import tweets to mastodon (e.g. https://framapiaf.org )
https://github.com/fgribreau/import-tweets-to-mastodon
mastodon tweets twitter
Last synced: 2 months ago
JSON representation
How to import tweets to mastodon (e.g. https://framapiaf.org )
- Host: GitHub
- URL: https://github.com/fgribreau/import-tweets-to-mastodon
- Owner: FGRibreau
- Created: 2019-11-03T17:00:50.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-23T09:16:32.000Z (over 1 year ago)
- Last Synced: 2024-05-23T03:33:57.578Z (7 months ago)
- Topics: mastodon, tweets, twitter
- Language: JavaScript
- Homepage: https://framapiaf.org/@fgribreau
- Size: 777 KB
- Stars: 105
- Watchers: 6
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Importing tweets for a Mastodon instance :bird::arrow_right::elephant:
Thats a simples script to import yours tweets from any Twitter account to a Mastodon account, in any instance.## Steps
For this tutorial, you'll need to install **Node.js** and **Git**.
- Node.js: [Download | Node.js (nodejs.org)](https://nodejs.org/en/download/)
- Git: [Git - Downloads (git-scm.com)](https://git-scm.com/downloads)
### #1 - Request your Twitter data in link below;
Go [here](https://twitter.com/settings/your_twitter_data) 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:
- assets (folder)
- data (folder)
- Your archive (html file)### #2 - Extract archive and look for `tweets.js`
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.### #3 - Clone this repo
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.
### #4 - Set an API key from Mastodon
To request an API key from Mastodon, click [here](https://mastodon.cloud/settings/applications). 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".
### #5 - Set the environment variables
#### Windows
1. Copy your "Your access token" from developer's page in Mastodon;
2. Press "WIN + R" and write "cmd". Click ENTER;
3. Go to your Desktop folder;
4. 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
```
#### Linux and MacOS
1. Same thing as Windows;
2. Open Terminal;
3. Got to your Desktop folder;
4. 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
```### #6 - Setting the script
In the terminal (or CMD), enter in "import-tweets-mastodon" folder, located in Desktop. Write
```
npm install```
After this
```
node import.js```
#### Need help?
- This project is open-sourced. Feel free to contribute;
- If you really want support please consider [sponsoring me](https://github.com/sponsors/FGRibreau) :+1: