pokeloc_parser

pokeloc_parser

Waveshare 4.2inch e-Paper Moduleに最寄りのバス停の接近情報を出したらおもしろいかと思って、ポケロケをパースして情報を取得するgemを書いた。
ポケロケの http://blsetup.city.kyoto.jp/blsp/show.php?sid=36428bad4f799a90e5d2be7fbfe99c4c の画面をパースしているので、変更があるとCSSセレクタを書き直して対応する必要がある。
そもそもバス停で出ている表示はこれを映している みたいな噂があるので、そんなに変わらなさそう。変わっても年1とかでは……? みたいな気はする。

これを呼ぶだけのlambdaも書いた(gh:nna774/pokeloc_getter https://github.com/nna774/pokeloc_getter )。
example
Copied!
$ curl https://xxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/Prod/?id=36428bad4f799a90e5d2be7fbfe99c4c | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 648 100 648 0 0 1503 0 --:--:-- --:--:-- --:--:-- 1503
{
"station": "京都駅前",
"got_at": "13:35",
"numbers": [
{
"approaching": "接近中のバスがあります。",
"number": "206",
"destination": "東山通・北大路BT",
"statuses": [
"バス運行中(この停留所から2つ前までの区間)",
"バス運行中(2つ前から4つ前までの区間)",
""
]
},
{
"approaching": "接近中のバスがあります。",
"number": "4",
"destination": "四条河原町・上賀茂神社",
"statuses": [
"バス運行中(この停留所から2つ前までの区間)",
"",
""
]
},
{
"approaching": "接近するバスはありません。",
"number": "特33",
"destination": "桂駅東口・洛西BT",
"statuses": [
"",
"",
""
]
}
]
}

ポケロケの画面がほっといても1分に1回自動更新されるから、1分に1回これを叩くぐらいだったらおこられないんでは……みたいなきもちでやっている。

Powered by Helpfeel