### 3.3.5 娱乐推送
#### (1) 功能说明
娱乐推送主要面向微信端。提供百万娱乐数据资源涵盖各类风格的趣图、段子、漫画以及图文消息,实现智能关键词推送。在微信端给用户返回文本、图片、图文等娱乐消息
#### (2) 接口说明
**请求方法**
* POST
**请求地址**
* http://api.ruyi.ai/v1/message
**请求参数说明**
|参数名 |参数类型 | 是否必须 |参数说明
| :-----| :---| :---:|:-----
|q |String| 是| 自然语言表达,例如“我要看漫画"等
|app_key| String|是 |应用开发者秘钥,注册开发者后台账号,建立虚拟助理后获得
|user_id |String| 是 |用户唯一标识,便于支持个性化语义解析。建议开发者使用 UUID 字符,且不同用户必须用不同的 user_id,防止意图串。
#### (3) 返回说明
**返回参数说明**
|名称 |类型| 说明
|:---|:---|:---
|code |Integer | 返回代码
|msg | String |返回代码描述
|parameters|JSON Object |解析到的实体以及服务说明
|action|String|服务的接口名称
|name| String|匹配的意图名称
|result | JSON Object| 接口返回内容
|outputs| Array| 服务输出结果,微信端使用 type 类型为 wechat 开头的内容;硬件端收到所有内容,依据需求解析使用
**返回代码说明**
|返回代码 |错误类型|说明
|:---|:---|:---
|0/200 |成功 |请求成功
|400 |无效请求 |某些必需参数缺失或参数值错误,详见msg字段
|401 |未授权 |授权失败,app_key 缺失或错误
|403 |请求被禁止|有效请求,但服务拒绝响应,请联系contact@ruyi.ai
|408 |请求超时 |请求响应超时,一般响应时间设置为2000ms以内
|429 |短时间内大量访问 |短时间内请求数过多
|500 |内部错误 |服务处理异常
|503 |服务不可用|服务异常或正在维护
#### (4) 请求示例
**请求范例**
_来个漫画;再来一个_
_讲个笑话_
_我想看趣图_
_我想看图文_
**请求示例**
(返回文本信息)
* http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=讲个笑话
返回结果
``` json
{
"code": 0,
"msg": "ok",
"result": {
"_text": "讲个笑话",
"msg_id": "63815c88-10a3-4441-bb0d-27c50e9d29a4",
"intents": [{
"parameters": {
"tag1": "段子",
"请求": "讲个",
"service": "entertainment"
},
"action": "sys.action.xxhh",
"name": "通用笑话点播",
"result": {
"category": "段子",
"article": "今天我终于鼓足了勇气去跟我的男神表白了,\r\n但是男神看了看我说:“我有女盆友了,不信给你看!”\r\n我心里面特别不是滋味,男神掏出手机对着我,我看着手机黑色屏幕上印出我的模样欣喜若狂!\r\n只见男神看了下手机,连忙说:“对不起,我忘了开机了!”",
"type": "dialog",
"id": "329746",
"tags": [
"雷人",
"囧",
"段子"
],
"item_list": [{
"category": "段子",
"article": "今天我终于鼓足了勇气去跟我的男神表白了,\r\n但是男神看了看我说:“我有女盆友了,不信给你看!”\r\n我心里面特别不是滋味,男神掏出手机对着我,我看着手机黑色屏幕上印出我的模样欣喜若狂!\r\n只见男神看了下手机,连忙说:“对不起,我忘了开机了!”",
"type": "dialog",
"id": "329746",
"tags": [
"雷人",
"囧",
"段子"
]
}, {
"category": "段子",
"article": "在超市门口,看到一送快递的小哥,\r\n刚把他的摩托车发动,不到3秒就听“嘭”的一声他人和车就倒地上了。\r\n只见他默默的爬了起来,掏出钥匙把车子前轮的锁打开。",
"type": "dialog",
"id": "250778",
"tags": [
"囧事",
"悲催",
"糗事",
"段子"
]
}, {
"category": "段子",
"article": "最近我们一同事要跳槽,问其原因,这货来了句“跟咱们公司文化不合”。\r\n我说什么情况?这货痛苦的解释到:“TM别提了,我左边那哥们和我右边那女的没事经常抠鼻屎,这还不算,老是到处乱弹,搞的我提心吊胆。我实在受不了了~~”",
"type": "dialog",
"id": "69811",
"tags": [
"囧事",
"苦逼",
"悲催",
"职场",
"段子"
]
}, {
"category": "段子",
"article": "今天下午和一群女同事聊天,突然有人说我不是男人。\r\n我火了,我说,你说我不是,我掏出来给你看。\r\n女生都笑了,有一个最牛,说,你掏啊…………\r\n于是我就把身份证掏出来了。",
"type": "dialog",
"id": "405875",
"tags": [
"机智",
"二货",
"段子"
]
}, {
"category": "段子",
"article": "我问老妈咱家有什么祖传的东西,老妈点了点头。\r\n我开心的问:“是啥呀,值钱不,给我看看。”\r\n老妈笑着说:“你看过的呀。”\r\n看着我疑惑的眼神老妈掏出一面镜子:“来,看看你家祖传的丑。”",
"type": "dialog",
"id": "360648",
"tags": [
"雷人",
"搞笑",
"段子"
]
}, {
"category": "段子",
"article": "女儿:妈妈,给我编小辫儿。\r\n妈妈:你要是男孩就不用这么麻烦了。\r\n女儿:怎么,你是想让我出去打架?想让我不写作业?想被老师叫去学校了?",
"type": "dialog",
"id": "233784",
"tags": [
"机智",
"熊孩子",
"段子"
]
}, {
"category": "段子",
"article": "今天晚饭后,和二货老婆聊天中,老婆突然说:你在炫富吗?\r\n我不解,二货继续说道:你牙齿缝里夹了一丝肉!\r\n我!!!!!",
"type": "dialog",
"id": "460740",
"tags": [
"邪恶",
"吐槽",
"段子"
]
}, {
"category": "段子",
"article": "方才在麦当当吃饭,邻桌一个看着就傻不啦叽的男高中生拍桌大喊:\r\n“一个30人的群,我吆喝一嗓子,只有29个搭话的!剩下那个是谁!看不起我吗?!有种说话啊!”",
"type": "dialog",
"id": "51725",
"tags": [
"囧",
"雷人",
"2B青年",
"二货",
"段子"
]
}, {
"category": "段子",
"article": "昨天坐地铁,右前方有个帅小哥一直在看我。我先想是不是脸上有什么东西,然后就在懊恼之前吃面条把漂亮的口红擦没了,失策!再抬眼帅小哥还在看我,并且唇角勾起了一个阳光温暖的笑容,我猜他一定是被我的人格魅力震慑住了。\r\n最后下地铁的时候,我发现我头顶的电视广告在放Tom And Jerry。呵。",
"type": "dialog",
"id": "438967",
"tags": [
"雷人",
"趣事",
"真相",
"段子"
]
}, {
"category": "段子",
"article": "上课的时候,发现是同桌大姨妈来了,她的裙子上有一丝血。\r\n我知道她不敢给老师说,于是我狠狠的给了自己鼻子一拳,瞬间血流成河。。\r\n我举手,老师我流鼻血了我出去洗一下鼻子,出去后直接到商店买了卫生巾。。。。\r\n后来,她成了我老婆!",
"type": "dialog",
"id": "30703",
"tags": [
"霸气",
"碉堡",
"老婆",
"段子"
]
}],
"text": "今天我终于鼓足了勇气去跟我的男神表白了,\r\n但是男神看了看我说:“我有女盆友了,不信给你看!”\r\n我心里面特别不是滋味,男神掏出手机对着我,我看着手机黑色屏幕上印出我的模样欣喜若狂!\r\n只见男神看了下手机,连忙说:“对不起,我忘了开机了!”\\n还想看,说【继续】;还可以让我【来个蛋疼段子】【来个搞笑图片】哦!"
},
"outputs": [{
"type": "wechat.text",
"property": {
"text": "今天我终于鼓足了勇气去跟我的男神表白了,\r\n但是男神看了看我说:“我有女盆友了,不信给你看!”\r\n我心里面特别不是滋味,男神掏出手机对着我,我看着手机黑色屏幕上印出我的模样欣喜若狂!\r\n只见男神看了下手机,连忙说:“对不起,我忘了开机了!”\\n还想看,说【继续】;还可以让我【来个机智段子】【来个搞笑图片】哦!"
}
}, {
"type": "dialog",
"property": {
"text": "今天我终于鼓足了勇气去跟我的男神表白了,\r\n但是男神看了看我说:“我有女盆友了,不信给你看!”\r\n我心里面特别不是滋味,男神掏出手机对着我,我看着手机黑色屏幕上印出我的模样欣喜若狂!\r\n只见男神看了下手机,连忙说:“对不起,我忘了开机了!”\\n还想看,说【继续】;还可以让我【来个吃货段子】【来个搞笑图片】哦!",
"emotion": "worry"
}
}],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"id": "794cdf6c-f311-48a4-b965-14333af882f3"
}],
"meta_process_milliseconds": 346
}
}
```
**请求示例**
(返回图片信息)
* http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=我想看趣图
返回结果
```json
{
"code": 0,
"msg": "ok",
"result": {
"_text": "我想看趣图",
"msg_id": "742ef88e-b433-432a-a3bc-584f32019155",
"intents": [{
"parameters": {
"tag1": "趣图",
"请求": "我想看",
"service": "entertainment"
},
"action": "sys.action.xxhh",
"name": "通用笑话点播",
"result": {
"category": "趣图",
"tags": [
"找亮点",
"动物",
"真相",
"雷人",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20151226/312a07ea21a2e459.jpg",
"article": "养龟的人都懂~",
"type": "image",
"id": "415544",
"item_list": [{
"category": "趣图",
"tags": [
"找亮点",
"动物",
"真相",
"雷人",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20151226/312a07ea21a2e459.jpg",
"article": "养龟的人都懂~",
"type": "image",
"id": "415544"
}, {
"category": "趣图",
"tags": [
"搞笑",
"内涵",
"邪恶",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20140626/67f26f27d53036aa.jpg",
"article": "果然够长~",
"type": "image",
"id": "119434"
}, {
"category": "趣图",
"tags": [
"碉堡",
"霸气",
"高手",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20140526/4ad2c4d0d598f6b4.jpg",
"article": "大叔一看就是练家子!",
"type": "image",
"id": "91075"
}, {
"category": "趣图",
"tags": [
"熊孩子",
"搞笑",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20140113/03217e1398970e14.jpg",
"article": "这就是传说中的王八和绿豆看对眼了么?",
"type": "image",
"id": "59016"
}, {
"category": "趣图",
"tags": [
"碉堡",
"搞笑",
"真相",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20150323/83b8567ad1b0d65f.jpg",
"article": "遥控器坏了,天才的老公是这样调台的",
"type": "image",
"id": "324552"
}, {
"category": "趣图",
"tags": [
"汪星人",
"搞笑",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20140105/45f9592cbd69be17.jpg",
"article": "严肃点!我站岗呢",
"type": "image",
"id": "56760"
}, {
"category": "趣图",
"tags": [
"搞笑",
"动物",
"吐槽",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20160606/2a0c0729ebb2e479.jpg",
"article": "夏天去游泳的你",
"type": "image",
"id": "454074"
}, {
"category": "趣图",
"tags": [
"熊孩子",
"小盆友",
"搞笑",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20150209/1fa5fd5402826c9b.jpg",
"article": "酱紫就不怕你不跟我玩了",
"type": "image",
"id": "311205"
}, {
"category": "趣图",
"tags": [
"二货",
"恶搞",
"雷人",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20150916/f0ac3533a8f974ac.jpg",
"article": "喜欢美少女有什么错",
"type": "image",
"id": "381772"
}, {
"category": "趣图",
"tags": [
"2B青年",
"恶搞",
"趣图",
"搞笑图片"
],
"image_url": "http://pic.xxhh.com/cons/20150216/d2b79e4e40be4055.jpg",
"article": "这才是真正的装逼起飞的节奏",
"type": "image",
"id": "314436"
}],
"text": "http://pic.xxhh.com/cons/20151226/312a07ea21a2e459.jpg"
},
"outputs": [{
"type": "wechat.image",
"property": {
"image_url": "http://pic.xxhh.com/cons/20151226/312a07ea21a2e459.jpg"
}
}, {
"type": "wechat.text",
"property": {
"text": "http://pic.xxhh.com/cons/20151226/312a07ea21a2e459.jpg"
}
}, {
"type": "dialog",
"property": {
"text": "http://pic.xxhh.com/cons/20151226/312a07ea21a2e459.jpg",
"emotion": "calm"
}
}],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"id": "794cdf6c-f311-48a4-b965-14333af882f3"
}],
"meta_process_milliseconds": 546
}
}
```
**请求示例**
(返回图文信息)
* http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=我想看图文
返回结果
```json
{
"code": 0,
"msg": "ok",
"result": {
"_text": "我想看图文",
"msg_id": "a2a2606b-9bf5-4501-ba44-b102d56225a6",
"intents": [{
"parameters": {
"tag1": "B格自习室",
"请求": "我想看",
"service": "entertainment"
},
"action": "sys.action.xxhh",
"name": "通用笑话点播",
"result": {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20160114/159c182682343b12.jpg!270",
"description": "",
"tags": [
"B格自习室",
"B格自习室",
"父母为了让你努力学习,都过什么丧尽天良的方法?"
],
"url": "http://www.xxhh.com/daily/4537.html",
"title": "父母为了让你努力学习,都过什么丧尽天良的方法?",
"type": "news",
"id": "4537",
"item_list": [{
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20160114/159c182682343b12.jpg!270",
"description": "",
"tags": [
"B格自习室",
"B格自习室",
"父母为了让你努力学习,都过什么丧尽天良的方法?"
],
"url": "http://www.xxhh.com/daily/4537.html",
"title": "父母为了让你努力学习,都过什么丧尽天良的方法?",
"type": "news",
"id": "4537"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20150728/33280818e968f658.jpg!270",
"description": "",
"tags": [
"B格自习室",
"B格自习室",
"你挣的几个钱都死哪去了?看完才晓得。。。"
],
"url": "http://www.xxhh.com/daily/2887.html",
"title": "你挣的几个钱都死哪去了?看完才晓得。。。",
"type": "news",
"id": "2887"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20151212/8ba89c11c3287ae6.jpg!270",
"description": "",
"tags": [
"B格自习室",
"B格自习室",
"女生胸部小!男生是怎么想的?"
],
"url": "http://www.xxhh.com/daily/4193.html",
"title": "女生胸部小!男生是怎么想的?",
"type": "news",
"id": "4193"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20151116/4575c8185eb283a5.jpg!270",
"description": "",
"tags": [
"B格自习室",
"B格自习室",
"鸡汤喝多了难免会腻,来看看这些!!"
],
"url": "http://www.xxhh.com/daily/3909.html",
"title": "鸡汤喝多了难免会腻,来看看这些!!",
"type": "news",
"id": "3909"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20141201/7d72c65b59629545.jpg!270",
"description": "",
"tags": [
"B格自习室",
"B格自习室",
"朋友圈的真相!!人生已经如此艰难,又何必拆穿。"
],
"url": "http://www.xxhh.com/daily/588.html",
"title": "朋友圈的真相!!人生已经如此艰难,又何必拆穿。",
"type": "news",
"id": "588"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20150211/e8f8299d1aeefd98.jpg!270",
"description": "",
"tags": [
"B格自习室",
"B格自习室",
"兄弟,那些绿茶碧池们是怎样坑害你的?"
],
"url": "http://www.xxhh.com/daily/1395.html",
"title": "兄弟,那些绿茶碧池们是怎样坑害你的?",
"type": "news",
"id": "1395"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20150330/832c7328aeba3d9f.jpg!270",
"description": "",
"tags": [
"B格自习室",
"B格自习室",
"看看这些明星的子女,就知道什么叫基因强大!"
],
"url": "http://www.xxhh.com/daily/1733.html",
"title": "看看这些明星的子女,就知道什么叫基因强大!",
"type": "news",
"id": "1733"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20150605/5c579e13d99a95ab.jpg",
"description": "",
"tags": [
"大湿兄与小湿妹",
"B格自习室",
"想当年哥也是有媳妇的人,可是万万没想到!"
],
"url": "http://www.xxhh.com/daily/2414.html",
"title": "想当年哥也是有媳妇的人,可是万万没想到!",
"type": "news",
"id": "2414"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20150706/54e7dff032c9577d.jpg!270",
"description": "",
"tags": [
"节操回收站",
"B格自习室",
"【节操回收站】别人都脱光了,你还好意思穿着吗?"
],
"url": "http://www.xxhh.com/daily/2677.html",
"title": "【节操回收站】别人都脱光了,你还好意思穿着吗?",
"type": "news",
"id": "2677"
}, {
"category": "B格自习室",
"image_url": "http://pic.xxhh.com/day/20150506/d5790cc0b08c2706.jpg",
"description": "",
"tags": [
"大湿兄与小湿妹",
"B格自习室",
"爱她,就和她做最浪漫的事!"
],
"url": "http://www.xxhh.com/daily/2104.html",
"title": "爱她,就和她做最浪漫的事!",
"type": "news",
"id": "2104"
}],
"text": "http://pic.xxhh.com/day/20160114/159c182682343b12.jpg!270"
},
"outputs": [{
"type": "wechat.news",
"list": [{
"title": "父母为了让你努力学习,都过什么丧尽天良的方法?",
"description": "",
"pic_url": "http://pic.xxhh.com/day/20160114/159c182682343b12.jpg!270",
"url": "http://www.xxhh.com/daily/4537.html"
}]
}, {
"type": "wechat.text",
"property": {
"text": "http://pic.xxhh.com/day/20160114/159c182682343b12.jpg!270"
}
}, {
"type": "dialog",
"property": {
"text": "http://pic.xxhh.com/day/20160114/159c182682343b12.jpg!270",
"emotion": "calm"
}
}],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"id": "794cdf6c-f311-48a4-b965-14333af882f3"
}],
"meta_process_milliseconds": 272
}
}
```
**详细参数说明**
|名称 |类型| 说明
|:---|:---|:---
|service| String |服务名称
|tags|Array|内容标签
|article|String|内容
|id|String|源网站ID
|item_list|Array |内容列表
|image_url|String|图片链接
|type|String|消息类型,包含dialog、image、news 三种类型
|url|String|图文链接
|description|String|图文摘要
|title|String|图文标题
- 1. 海知智能第三方技能插件开放平台概述
- 2. 快速接入API
- 2.1 硬件接口调用
- 2.2 快速接入微信
- 2.3 API接入常见问题
- 3. 技能插件
- 3.1 基础能力类
- 顶级过滤器
- 用户知识图谱
- 机器人档案
- 通用闲聊
- 儿童闲聊
- Smart Reply
- 轻量闲聊
- 3.2 语音游戏类
- 成语接龙
- 词汇乐园
- 词语接龙
- 鹦鹉学舌
- 动脑猜猜
- 挑战单词
- 冒险世界
- 猜猜我是谁
- 阿拉丁学诗词
- 猫猫托管所
- 漂流瓶
- 诗词大会
- 国学大会
- 我爱猜歌名
- 我在看着你
- 灯谜猜猜
- 3.3 休闲娱乐类
- 星座运势
- 悦耳声音
- 幸运签
- 调教机器人
- 娱乐推送
- 3.4 生活服务类
- 黄历
- 计算器
- 古诗词
- 时间询问
- 翻译类技能
- 天气资讯
- 日程创建
- 日程创建指令
- 闹钟
- 食材知识
- 冥想音乐
- 格言
- 每日英语
- 汉语词典
- 豆果菜谱
- 古文翻译
- 3.5 音频点播类
- 喜马拉雅FM
- 新闻广播
- 音乐点播
- Smart Music
- 儿童听听
- Smart Audio
- 儿童笑话
- 点播控制指令
- 3.6 视频点播类
- 影视点播
- 3.7 百科知识类
- 人物百科
- 百科问答
- 实时百科
- 3.8 体育健康类
- 五分钟健身
- 4. 开发者初级教程
- 4.1 开通服务
- 4.2 创建机器人
- 4.3 设置机器人
- 4.4 获取技能插件
- 4.5 让机器人学会聊天
- 4.6 导入知识库
- 4.7 多种问答形式
- 4.8 数据统计
- 4.9 粉丝管理
- 5. 开发者中级教程
- 5.1 词典运用
- 5.2 意图处理
- 5.3 暗号使用
- 5.4 事件触发
- 5.5 优先级
- 5.6 触发器
- 5.7 快捷键
- 5.8 意图报错
- 6. 开发者高级教程
- 6.1 handlebars模版语言
- 6.2 JavaScript简单介绍
- 6.3 JavaScript使用说明
- 6.4 JavaScript使用案例
- 6.5 JavaScript常见问题
- 7. 快速发布技能
- 8. 帮助中心
- 8.1 常见概念
- 8.2 帮助视频
- 8.3 联系我们