Showing posts with label Blogger (service). Show all posts
Showing posts with label Blogger (service). Show all posts

Sunday, May 21, 2017

Cron: Copying all Labels from Blog to a File (Example)

Command:

$ cat smashingtheory_label_urls.sh


Result:

if [ $# -eq 1 ]; then
curl -s https://smashingtheory.blogspot.jp | sed -n "s/.*dir='ltr' href='https:\/\/smashingtheory.blogspot.jp\/search\/label\/\\([^']*\\).*/\1/p" > $1
else
echo "Usage: smashingtheory_label_urls.sh FILENAME" >&2
fi


Note:

Double backslashes before the round brackets should be single backslash. I did this to escape Mathjax's behavior.

Wednesday, June 8, 2016

Blogger: Total Posts in This Month

Command:

$ curl -vs "http://smashingtheory.blogspot.jp" 2>&1 | grep -o -m 2 "<span class='post-count' dir='ltr'>([0-9]*)" | tail -1 | sed -e 's/[^[[:digit:]]]*//g'

Result:

33

Blogger: Total Posts in This Year

Command:

$ curl -vs "http://smashingtheory.blogspot.jp" 2>&1 | grep -o -m 1 "<span class='post-count' dir='ltr'>([0-9]*)" | sed -e 's/[^[[:digit:]]]*//g'

Result:

477