DEV Community

nekottyo
nekottyo

Posted on

7

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

何らかの事情で 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

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay