Skip to content

休講情報をWebスクレイピングしてGoogleCalendarに入力

License

Notifications You must be signed in to change notification settings

tomoyk/cancelChecker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cancelChcker

学内サイトの休講情報をスクレイピングしてTwitterに投げる。

使い方

パッケージを導入

$ python3 -m venv env
$ . env/bin/activate
$ pip install -r requirements.txt

クレデンシャルの取得

GoogleカレンダーAPIのcredentialを取得する。

https://console.developers.google.com/apis/credentials

プロジェクトの選択→クライアントIDを選択→JSONをダウンロード→ credential.json として保存

認証の取得

$ python calAdd.py --noauth_local_webserver

ブラウザに表示された認証コードをターミナルに貼り付ける。

実行

走らせる。

$ python main.py

Cronに登録する場合は以下のようにCronを登録する。

#!/bin/bash -xe

cd /home/foo/cancelChecker
. env/bin/activate
python main.py
$ crontab -e
*/5 * * * *  /bin/bash /home/foo/run.sh                                          

概要

  1. bs4で学内サイトをスクレピング
  2. 取得したデータを解析して過去のデータと比較
  3. 新たなデータのみを取り出してTwitterに投稿

Note

Googleカレンダの扱い: https://gist.github.com/tomoyk/a46b2e181ff76a82fddf45566d68a9f0

About

休講情報をWebスクレイピングしてGoogleCalendarに入力

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages