google app scriptでconnpassの新着イベントをメール
7944 ワード
これ何?
connpassのページをいちいち開いて検索するのが面倒だったのでconnpassのapiとgasを利用して新着イベントを定期的にメール送信するスクリプトを書きました。
使用するapiのパラメータ
パラメータ名 | 説明 |
---|---|
count | 取ってくるイベントの個数 |
keyword_or | イベントのタイトル、キャッチ、概要、住所をOR条件部分一致で検索 |
order | 検索結果の表示順(3が新着順) |
詳しくはAPI リファレンスを参照
コード
function myFunction() {
//キーワードから開催している都道府県を限定
var keyword_or = 'keyword_or=東京&keyword_or=埼玉'
//新着順
var order = 'order=3'
//上位25件を取得
var count = 'count=25'
var url = 'https://connpass.com/api/v1/event/?' + keyword_or + '&' + order + '&' + count
var json = UrlFetchApp.fetch(url).getContentText("UTF-8");
var j = JSON.parse(json);
var events = j.events
var title = 'Connpass新着イベント';
var text = '★新着イベント★\n\n----------------------------------------------------------------------------\n';
for(i in events){
text = text + 'title : ' + events[i]['title'] + '\n';
text = text + 'catch : ' + events[i]['catch'] + '\n';
text = text + '開催日時 : ' + events[i]['started_at'] + ' ~ ' + events[i]['ended_at'] + '\n';
text = text + '開催場所 : ' + events[i]['address'] + events[i]['place'] + '\n';
text = text + events[i]['event_url'] + '\n\n';
}
text = text + '----------------------------------------------------------------------------\n';
MailApp.sendEmail('[email protected]', title, text);
}
定期実行にする
Author And Source
この問題について(google app scriptでconnpassの新着イベントをメール), 我々は、より多くの情報をここで見つけました https://qiita.com/muramasawani/items/14b82a190de1af826917著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .