腳本curl_luoo.sh內容以下: chrome
#!/bin/bash # login luoo luoo_url="http://www.luoo.net/login/" name="你的帳號" password="你的密碼" # create cookie curl -v -c cookies.luoo -X POST -d "name=${name}&password=${password}" ${luoo_url} # get msg curl -v -b cookies.luoo -X GET -H "Accept-Encoding: gzip" http://www.luoo.net/message/latest | gunzip | jsonpp > ./$(date +%Y%m%d%H%M).msg # count curl -b cookies.luoo -X GET http://www.luoo.net/user/12549 | grep "<span class=\"playcnt\">.*</span>" | awk -F"[<|>]" '{print '"\"$(date +%Y%m%d%H%M%S)\""'"\t\t"$3}' >> count.txt
ps:腳本中-X指定的方法,-d指定的參數,及url地址,以chrome-F12跟蹤到的爲準json
腳本執行結果:bash
# cat count.txtcookie
20170723104356 已經在落網上累計聽過 5022 首音樂。
20170723105351 已經在落網上累計聽過 5024 首音樂。curl