Skip to content

Instantly share code, notes, and snippets.

@mikeda
Created December 23, 2013 13:43
Show Gist options
  • Save mikeda/8097331 to your computer and use it in GitHub Desktop.
Save mikeda/8097331 to your computer and use it in GitHub Desktop.
はてなダイアリーの年ごとのブログ投稿数を集計する方法
# http://d.hatena.ne.jp/<USERNAME>/archiveにアクセスて50日ずつのページ数がいくつあるか確認しておく・・・
USERNAME=mikeda
PAGES=5
for((i=0;$i<$((50*PAGES));i+=50));do curl -g "http://d.hatena.ne.jp/${USERNAME}/archive?of=${i}" > archive_${i}.html;done
cat archive_*.html | grep "archive archive-section" | perl -lne 'm|'${USERNAME}'/(\d{4})\d{4}/| or next;print $1' | sort | uniq -c
# 44 2008
# 88 2009
# 26 2010
# 40 2011
# 35 2012
# 9 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment