🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### 3.5.5 儿童听听 #### (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=播放故事 返回结果 ``` { "_text": "播放故事", "msg_id": "5b5d07ba-03ee-4175-8e03-e58a7ddb77d7", "intents": [{ "parameters": { "tag1": "故事", "service": "kids_audio" }, "action": "标签点播", "name": "标签点播", "result": { "code": 200, "response": { "code": 0, "msg": "成功", "result": { "track_list": [{ "name": "苹果姑娘", "@type": [ "MusicRecording", "CreativeWork", "Thing" ], "mergedFrom": [{ "identifier": "ADcGNFA0DTw=", "durationInSeconds": 0, "position": 0, "inAlbum": { "name": "苹果姑娘", "identifier": "ADcGNFA0DTw=", "image": "http://img.idaddy.cn/b/9/bka1kr5l.jpg", "@type": [ "MusicAlbum", "CreativeWork", "Thing" ] }, "audio": [{ "contentUrl": "http://cdn.open.idaddy.cn/apsmp3/fedd/haizhi0000000001/201709130000/0/YS8wL2JrYTFrcjVsLmF1ZGlv.mp3", "encodingFormat": "mp3" }] }] }, { "name": "捍卫家园的大战", "@type": [ "MusicRecording", "CreativeWork", "Thing" ], "mergedFrom": [{ "identifier": "ADIGMFAwDTI=", "durationInSeconds": 0, "position": 0, "inAlbum": { "name": "捍卫家园的大战", "identifier": "ADIGMFAwDTI=", "image": "http://img.idaddy.cn/b/7/90w41fla.jpg", "@type": [ "MusicAlbum", "CreativeWork", "Thing" ] }, "audio": [{ "contentUrl": "http://cdn.open.idaddy.cn/apsmp3/02b7/haizhi0000000001/201709130000/0/YTY0LzcvaGd2aTltanguYXVkaW8=.mp3", "encodingFormat": "mp3" }] }] }, { "name": "解开圆周之谜的科学家祖冲之", "@type": [ "MusicRecording", "CreativeWork", "Thing" ], "mergedFrom": [{ "identifier": "ADYGMFAyDTQ=", "durationInSeconds": 0, "position": 0, "inAlbum": { "name": "解开圆周之谜的科学家祖冲之", "identifier": "ADYGMFAyDTQ=", "image": "http://img.idaddy.cn/b/1/630pcgu4.jpg", "@type": [ "MusicAlbum", "CreativeWork", "Thing" ] }, "audio": [{ "contentUrl": "http://cdn.open.idaddy.cn/apsmp3/c552/haizhi0000000001/201709130000/0/YS8xL3loanFqd3ppLmF1ZGlv.mp3", "encodingFormat": "mp3" }] }] } ], "msg": "ok" } }, "text": "即将播放【苹果姑娘】", "type": "dialog" }, "outputs": [{ "type": "wechat.text", "property": { "text": "即将播放【苹果姑娘】" } }, { "type": "dialog", "property": { "text": "即将播放【苹果姑娘】", "emotion": "calm" } } ], "score": "1.0", "scoreColor": "c4", "is_match": 1, "skill_id": "5e3b3bd9-52b7-4039-b5eb-5f1223f80b67", "id": "3a6c0f3c-f895-4661-bd9c-f229cc19915c" }], "meta_process_milliseconds": 488 } ``` **请求示例** (失败,返回推荐最多10个曲目的播放列表,同时结果中以字段code 404表示未搜索到符合条件的资源) * http://api.ruyi.ai/ruyi-api/v1/message?app\_key=APP\_KEY&user\_id=user0&q=我要听相声小红帽 返回结果 ``` { "_text": "我要听相声小红帽", "msg_id": "a8405059-ac10-4d65-888c-5c1244a4b1db", "intents": [{ "parameters": { "tag1": "相声", "trackName": "小红帽", "statedIn": "www.idaddy.cn", "service": "kids_audio" }, "action": "标签点播", "name": "标签+单曲", "result": { "code": 200, "response": { "code": 0, "msg": "成功", "result": { "track_list": [{ "name": "3、小红帽", "@type": [ "MusicRecording", "CreativeWork", "Thing" ], "mergedFrom": [{ "identifier": "ADEGMFAwDTZRbg==", "durationInSeconds": 0, "position": 3, "inAlbum": { "name": "吴颂今经典儿歌1:幼儿萌曲", "identifier": "ADwGNlA1DTE=", "image": "http://img.idaddy.cn/b/4/cy4hivbv.png", "@type": [ "MusicAlbum", "CreativeWork", "Thing" ] }, "audio": [{ "contentUrl": "http://cdn.open.idaddy.cn/apsmp3/9604/haizhi0000000001/201709130000/1/YS8wLzh4NGt3N2J4LmF1ZGlv.mp3", "encodingFormat": "mp3" }] }] }, { "name": "1、铃儿响叮当", "@type": [ "MusicRecording", "CreativeWork", "Thing" ], "mergedFrom": [{ "identifier": "ADEGMFAwDTZRYA==", "durationInSeconds": 0, "position": 1, "inAlbum": { "name": "吴颂今经典儿歌1:幼儿萌曲", "identifier": "ADwGNlA1DTE=", "image": "http://img.idaddy.cn/b/4/cy4hivbv.png", "@type": [ "MusicAlbum", "CreativeWork", "Thing" ] }, "audio": [{ "contentUrl": "http://cdn.open.idaddy.cn/apsmp3/0dd3/haizhi0000000001/201709130000/0_adidaddy/YS8wL3dkaGZtZWZjLmF1ZGlv.mp3", "encodingFormat": "mp3" }] }] }, { "name": "2、机器猫", "@type": [ "MusicRecording", "CreativeWork", "Thing" ], "mergedFrom": [{ "identifier": "ADEGMFAwDTZRbw==", "durationInSeconds": 0, "position": 2, "inAlbum": { "name": "吴颂今经典儿歌1:幼儿萌曲", "identifier": "ADwGNlA1DTE=", "image": "http://img.idaddy.cn/b/4/cy4hivbv.png", "@type": [ "MusicAlbum", "CreativeWork", "Thing" ] }, "audio": [{ "contentUrl": "http://cdn.open.idaddy.cn/apsmp3/e481/haizhi0000000001/201709130000/1/YS8wLzhseWpqNGt2LmF1ZGlv.mp3", "encodingFormat": "mp3" }] }] } ], "msg": "未搜索到相应结果", "code": 404 } }, "text": "未找到相应资源,为您推荐【3、小红帽】", "type": "dialog" }, "outputs": [{ "type": "wechat.text", "property": { "text": "未找到相应资源,为您推荐【3、小红帽】" } }, { "type": "dialog", "property": { "text": "未找到相应资源,为您推荐【3、小红帽】", "emotion": "happy" } } ], "score": "0.9999541586510267", "scoreColor": "c4", "is_match": 1, "skill_id": "5e3b3bd9-52b7-4039-b5eb-5f1223f80b67", "id": "45c1b182-69fd-4bb4-8e3c-a36c46af56d4" }], "meta_process_milliseconds": 752 } ``` **详细参数说明** | 名称 | 类型 | 说明 | | :--- | :--- | :--- | | service | String | 服务名称 | |tag|String | 标签名,包含儿歌、故事、国学、诗词等,多个标签用后缀1,2...数字区分 | |trackName|String |识别到的音频名称| |statedIn|String |数据来源网站| |track_list|String |返回的音频列表| |name|String |音频名称| |@type|String |实体类型| |identifier|String|数据来源网站ID| |durationInSeconds|String|音频时长| |position|String|音频在专辑中的位置| |inAlbum|String|音频所在专辑| |image|String | 专辑封面地址 |