98
61

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

自分の Qiita の投稿を markdown で全て手元に落とす

Last updated at Posted at 2020-03-25

何らかの事情で Qiita に書いた自分の投稿は手元に残したいときのスクリプト

環境

  • macOS 10.15.3
  • zsh 5.8 (x86_64-apple-darwin19.3.0)

落とすやつ

user_id=<your_qiita_id>
❯ curl -s "https://qiita.com/api/v2//users/${user_id}/items?per_page=100" \
  | jq -r ".[].url" \
  | xargs -n1 -I{} bash -c "curl -s  {}.md > \$(echo {} | awk -F / '{print \$NF}').md"

100記事以上投稿している場合は&page=2 とかで遷移させればよさそう
https://qiita.com/api/v2/docs#%E3%83%9A%E3%83%BC%E3%82%B8%E3%83%8D%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3

memo

何らかの事情が起きた時にこの記事が消える可能性もあるので dev.to にも投げた
https://dev.to/nekottyo/qiita-markdown-5dbp

98
61
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
98
61

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?