Copy tweets from Twitter (X) to the Diarly app.
This script converts the Twitter archive to a CSV file for importing into the Diarly app.
-
Group tweets by date.
-
Adds native Diarly time separator.
-
Add links to videos and photos (your profile should be public).
-
Skips retweets and tweets starting with mention (may be disabled, read further instructions).
Ruby 2.7.7 or higher is required to run this script.
The code is tested on macOS with ruby-2.7.7 [ arm64 ]
.
Skip these steps if you have already downloaded the archive of your tweets.
-
Open Twitter, select "Settings", "Your account", and "Download an archive of your data".
-
Press "Download archive". Verify identity with email or text message.
-
Press "Request archive". Twitter with email you when the archive will be ready.
-
When the archive is ready, press "Download archive".
- Unzip the archive and move its content to the
archive
folder inside of this project, so you will have the following structure:
archive
assets
data
tweets.js
Your archive.html
convert.rb
README.md
-
Run the script with
ruby convert.rb
. -
If everything is correct, the
result.csv
file will be generated and you will see the success message in the console.
-
Open Diarly app, and select "File", "Import", and "CSV". Select the generated
result.csv
file in this project folder. -
Click "Import". If you don't see all tweets imported in the app after a few seconds, restart the Diarly app.
You can adjust the configuration by changing the "true" and "false" values
inside the config.json
file:
-
with_mentions
: false = ignore tweets with "@" in the text. -
with_mentions_at_start
: false = ignore tweets starting with "@" (ignored ifwith_mentions
is false). -
retweets
: false = ignore retweets. -
with_media
: false = ignore tweets that have media. -
keep_media
: false = keep the text of tweets, but omit videos and photos (ignored ifwith_media
is false).