Posts

First take at backing up my Hive blog (part 1)

avatar of @helcim
25
@helcim
·
·
0 views
·
1 min read

You may wonder why, in the first place, anyone might want to backup data stored in the blockchain, which is the safest way to store data. First, making a backup is always the right thing to do. Second, almost nobody publishes posts without images, and the images are not stored in the blockchain (will they ever be?). So your texts stored in the blockchain are significantly safer than your images. If your data are important you should make their backup. I was looking for an existing tool to do it, but so far could not find any. Fortunately, Hive makes it very simple. It allows downloading any page of your blog as json by just adding ".json" to the URL and there are plenty of tools to extract the data you need from json. The most important for us will be of course the image URL which will allow us to download images.

So what would be the most simple approach that almost anybody, with very little knowledge of programming, could take to backup his data?

  1. Get a list of all posts.
  2. Get json representation of each post.
  3. Extract image URLs.
  4. Get the images from the post.

You can see that image URL is part of "json metadata" stored with the key "image". So our script will have to make use of that field to backup our images.

P.S. Pretty-printed json representation of my former post was obtained by using:

curl -s 'https://hive.blog/polish/@helcim/jacek-malczewski-muzyka-pol.json' | python -mjson.tool 
 

part 2

Posted Using LeoFinance Beta