Tutorial: How to backup all your Steem posts ?

in #steem2 years ago

Hi guys !

With the recent "moves" on Steem, I thought how can I backup all the content I spent hours writing on Steem.
I found this script written by @yuxi (Give him some love for the good work !!)

Follows the short tutorial under Linux Fedora 29:

  • You need to have python2 installed (I tried with python3 but I had a few jokes)
  • First download the zip from https://github.com/yuxir/steemit_backup
  • Then, if missing, install steem, slugify via pip:
  • pip install steem
  • pip install slugify
  • In my case I had yaml missing, I had to install it via my distribution package manager: sudo dnf install python2-pyyaml
  • If you have an error message, when running the script, you can easily find the missing package

There are a few modifications to perform, I had a few minor issues for the Unicode encoding/filename encoding (title length) and the limit on the posts, because I have slightly more than 10 posts ^^

  • The limit on the number of posts is very simple, look for the variable number_of_batch and set to a large number, I put 1000 in my case
  • [Optional] Next, add a variable counter = 0 at the line 31, then modify the file_name variable as follows file_name = "Post%d.md" % counter, it will prevent to have long filename if you have very long title.
  • Then modify with open(target_md_file_name, 'w') as file: to this with open(target_md_file_name, 'wb') as file:
  • Finally, replace the next statement to give the correct encoding file.write(_body.encode('utf8'))

Usage, modify the config/system_config.yaml to suit your needs, in my case, I was looking to perform a full backup in a specified directory as follows:

latest_posts_only: false
check_back_hours: 24
backup_folder: /home/boucaron/Documents/steemit/sources/backup/
add_date_prefix: true
exclude_categories: test

Then run the script as follows:
python steemit_backup.py myUsername
and you are good to go, it will take some time and after you will see a list of files

The only downside, you are missing the images. But it is pretty neat to have a backup of all your posts !

Enjoy !