Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 1.24 KB

README.md

File metadata and controls

63 lines (41 loc) · 1.24 KB

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