Last active
March 1, 2017 02:41
-
-
Save shd101wyy/5fa8df76484f56cd2258cf3c77585e1d to your computer and use it in GitHub Desktop.
trigger and action model script
This file contains hidden or 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
{ | |
name: bilibili, | |
triggers: { | |
subscribe_user: { | |
title: "up主最新视频更新", | |
config: { | |
id: { | |
type: "string", | |
title: "up主数字id", | |
description: "例如 space.bilibili.com/**122879**", | |
default: "", | |
order: 1 | |
} | |
} | |
func: function(event) { | |
const config = event.config | |
const url = `http://space.bilibili.com/ajax/member/getSubmitVideos?mid=${config.id}&pagesize=1` | |
event.$get({ | |
url, | |
}, function(error, body) { | |
if (error) event.return(false) | |
const newestVideoData = json.data.vlist[0] | |
const title = newestVideoData.title | |
const description = newestVideoData.description | |
const pic = newestVideoData.pic | |
const videoLink = `http://www.bilibili.com/video/av${newestVideoData.aid}/` | |
event.return({ | |
title, | |
description, | |
pic, | |
videoLink | |
}) | |
}) | |
} | |
}, | |
subscribe_bangumi: { | |
}, | |
}, | |
actions: { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment