### 3.5.7 儿童笑话 #### (1) 功能说明 儿童笑话技能插件,精选适合儿童的笑话资源,支持笑话点播。返回最多包含10首单曲的播放列表。目前儿童笑话技能的数据主要来自工程师爸爸、喜马拉雅FM和蜻蜓FM,返回url包含mp3和m4a格式,客户可根据需求解析特定格式的url。 #### (2) 接口说明 **请求方法** * POST **请求地址** * [http://api.ruyi.ai/v1/message](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) 请求示例 **请求范例** _讲笑话_ _放一个笑话_ _换个笑话_ _笑话_ _儿童笑话_ **请求示例成功** (成功,返回符合结果的单曲,和该单曲所在专辑最多10个曲目的播放列表) * 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": "72b82949-1f9e-4e16-ae00-3d8cb19fc243", "intents": [{ "parameters": { "tag1": "笑话", "service": "kids_joke" }, "action": "标签点播", "name": "讲笑话", "result": { "code": 200, "response": { "code": 0, "msg": "成功", "result": { "track_list": [{ "name": "3755_搬弄是非", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-8", "identifier": "4572650", "image": "http://fdfs.xmcdn.com/group16/M04/9A/4A/wKgDaldqNt6haiF9AAA88x4dHwg810_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17400044", "position": 253, "durationInSeconds": 58, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group8/M01/99/EF/wKgDYFdqOEbxMFpKAAcnMmxUx1Y067.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group8/M01/99/EF/wKgDYFdqOEeCuNpEAAdB3aN_Ke8438.m4a", "encodingFormat": "m4a" }] }] }, { "name": "2708_绘画", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-6", "identifier": "4572578", "image": "http://fdfs.xmcdn.com/group14/M00/9B/33/wKgDZFdqMoixixkIAABtQjx-akc504_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17398358", "position": 207, "durationInSeconds": 24, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group6/M0B/A7/75/wKgDg1dqM6XS4vClAALw1BbzC7c087.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group6/M0B/A7/75/wKgDg1dqM6bjLk7vAAL-zx3v1rQ315.m4a", "encodingFormat": "m4a" }] }] }, { "name": "3617_观察了", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-8", "identifier": "4572650", "image": "http://fdfs.xmcdn.com/group16/M04/9A/4A/wKgDaldqNt6haiF9AAA88x4dHwg810_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17399833", "position": 115, "durationInSeconds": 57, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group5/M07/8E/45/wKgDtVdqN5vg7pnLAAcA1OrgJsQ232.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group5/M07/8E/45/wKgDtVdqN5zQvReCAAcbrqVsGyc531.m4a", "encodingFormat": "m4a" }] }] }, { "name": "3493_瓶盖拧紧", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-7", "identifier": "4572617", "image": "http://fdfs.xmcdn.com/group6/M09/A7/78/wKgDg1dqNRPS6AsZAAA445dKVsI082_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17399567", "position": 491, "durationInSeconds": 24, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group16/M04/9A/57/wKgDbFdqNrmRSfJJAALzRx5Qgts431.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group16/M04/9A/57/wKgDbFdqNrrgueA3AAMBwm_fhGw624.m4a", "encodingFormat": "m4a" }] }] }, { "name": "3868_草坪", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-8", "identifier": "4572650", "image": "http://fdfs.xmcdn.com/group16/M04/9A/4A/wKgDaldqNt6haiF9AAA88x4dHwg810_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17400209", "position": 366, "durationInSeconds": 36, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group10/M08/95/B4/wKgDZ1dqOI2jaUJMAAR2N0VS3jg394.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group10/M08/95/B4/wKgDZ1dqOI6A9OsfAASIWvhvitQ030.m4a", "encodingFormat": "m4a" }] }] }, { "name": "4809_壮胆", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-10", "identifier": "4572711", "image": "http://fdfs.xmcdn.com/group7/M00/9A/A2/wKgDWldqOWyRn1YJAADL8cZfaZA797_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17401810", "position": 307, "durationInSeconds": 21, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group10/M06/98/A7/wKgDaVdqPSnCh_KXAAKWN060h9w498.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group10/M06/95/BE/wKgDZ1dqPSnhBd0dAAKjxMesEm0929.m4a", "encodingFormat": "m4a" }] }] }, { "name": "1477_据理相争", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-3", "identifier": "4572433", "image": "http://fdfs.xmcdn.com/group13/M0B/9A/9A/wKgDXVdqKznANkRLAAAzx1sqpos931_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17396189", "position": 476, "durationInSeconds": 31, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group16/M0B/9A/48/wKgDbFdqLS3wqKyUAAPZe6x3ek4468.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group16/M0B/9A/48/wKgDbFdqLS2xeBHKAAPpwgHGT4k007.m4a", "encodingFormat": "m4a" }] }] }, { "name": "3098_怕说话", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-7", "identifier": "4572617", "image": "http://fdfs.xmcdn.com/group6/M09/A7/78/wKgDg1dqNRPS6AsZAAA445dKVsI082_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17398955", "position": 97, "durationInSeconds": 53, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group10/M0B/95/B1/wKgDZ1dqNY3TF1fVAAaAqsGAfG8938.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group10/M0B/95/B1/wKgDZ1dqNY7QdrB0AAaY_aVf01c561.m4a", "encodingFormat": "m4a" }] }] }, { "name": "4411_解除关系", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-9", "identifier": "4572704", "image": "http://fdfs.xmcdn.com/group14/M09/9B/3B/wKgDZFdqOTKyiFAnAADa2cdDXXI278_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17401206", "position": 410, "durationInSeconds": 20, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group8/M04/99/D1/wKgDYVdqO6niHUTrAAJ_XDTQmeY643.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group8/M04/99/D1/wKgDYVdqO6nBE6uVAAKMSAQiyws524.m4a", "encodingFormat": "m4a" }] }] }, { "name": "3456_讲文明", "@type": ["MusicRecording", "CreativeWork", "Thing"], "mergedFrom": [{ "inAlbum": { "name": "笑话大全(5000)-7", "identifier": "4572617", "image": "http://fdfs.xmcdn.com/group6/M09/A7/78/wKgDg1dqNRPS6AsZAAA445dKVsI082_mobile_meduim.jpg", "@type": ["MusicAlbum", "CreativeWork", "Thing"] }, "identifier": "17399530", "position": 454, "durationInSeconds": 51, "statedIn": "www.ximalaya.com", "@type": ["MusicRecording", "CreativeWork", "Thing"], "audio": [{ "contentUrl": "http://fdfs.xmcdn.com/group16/M04/9A/46/wKgDaldqNrDBHt6FAAZBzr3IiyI771.mp3", "encodingFormat": "mp3" }, { "contentUrl": "http://audio.xmcdn.com/group16/M04/9A/46/wKgDaldqNrCzQrPEAAZZ2dzIzLg275.m4a", "encodingFormat": "m4a" }] }] }], "msg": "ok" } }, "text": "即将播放笑话【3755_搬弄是非】", "type": "dialog" }, "outputs": [{ "type": "wechat.text", "property": { "text": "即将播放笑话【3755_搬弄是非】" } }, { "type": "dialog", "property": { "text": "即将播放笑话【3755_搬弄是非】", "emotion": "despite" } }], "score": "1.0", "scoreColor": "c4", "is_match": 1, "skill_id": "a2b49c1e-6c87-4fb1-be45-7dda35229585", "id": "b4772eaa-4711-49b5-a3ea-b575393a4074" }], "meta_process_milliseconds": 521 } } ``` **详细参数说明** | 名称 | 类型 | 说明 | | :--- | :--- | :--- | | service | String | 服务名称 | |tag|String | 标签名 | |trackName|String |识别到的音频名称| |statedIn|String |数据来源网站| |track_list|String |返回的音频列表| |name|String |音频名称| |@type|String |实体类型| |identifier|String|数据来源网站ID| |durationInSeconds|String|音频时长| |position|String|音频在专辑中的位置| |inAlbum|String|音频所在专辑| |image|String | 专辑封面地址 |