LoginSignup
4
6

More than 5 years have passed since last update.

雑にQiitaの記事をバックアップする

Last updated at Posted at 2017-04-16

ちょっと他に今までの記事を移行したいと思った時は、以下のコマンドでバックアップするとよい。

認証すれば、http://qiita.com/api/v2/docs#get-apiv2authenticated_useritems を見ればわかるとおりGET /api/v2/authenticated_user/itemsで自分の記事を取得できる。
しかし、認証は面倒なので、/api/v2/itemsでユーザ名を指定することで、上記と同等の結果を認証せずに取得できる。

$ curl "qiita.com/api/v2/items?query=user%3Aakameco&per_page=100"

zshrcか何かに雑に以下のコマンドを書いておくと捗る。

qiita-items() {
    curl "qiita.com/api/v2/items?query=user%3A$1&per_page=100"
}

こうすることで雑に整形してバックアップするのも簡単。

$ qiita-items akameco | jq -r . > backup.json
4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6