Created
November 9, 2017 07:48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /home/{user}/Carwler/NCTU | |
o_str="<aid=\"gvYear_ctl02_gvItem_ctl05__hlnk\"title=\"榜單查詢\"target=\"_blank\">榜單查詢</a>" | |
str=$(curl -s "http://exam.nctu.edu.tw/bulletin.aspx?id=af576c6a-ff5a-42ff-9278-5c5f6391d480&id2=f2a7e67a-4378-4e29-8b99-ab56bb451ac7" | iconv -f big5 -t utf8 | grep "gvYear_ctl02_gvItem_ctl05__hlnk" | tr -d '\t' | tr -d ' ' | tr -d '\r'); | |
if [ "$str" != "$o_str" ];then | |
text="放榜囉~~~ (應該吧" | |
chat_id="{chat_id}" | |
token="{telegram_bot_token}" | |
if [[ ! -f nctu.done ]];then | |
curl -s -d "chat_id=$chat_id" -d "text=$text" "https://api.telegram.org/bot$token/sendMessage" > /dev/null | |
touch nctu.done | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment