ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 3.5.2 新闻广播 #### (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": "eb7635ef-e6c7-4a4c-861c-404e9e3b3ae9", "intents": [{ "parameters": { "defaulttext": "我没找到你要的声音,换个别的听吧", "听的企图": "来一段", "q": "娱乐", "service": "news_audio" }, "action": "sys.action.xmly/news", "name": "按类别点新闻", "result": { "id": "xmly:sound:52458882", "html_link": "http://www.ximalaya.com/sound/52458882", "source": "喜马拉雅", "source_link": "http://www.ximalaya.com/", "sound_id": "52458882", "title": "两个月饼的热量相当于一个全家桶!", "media_url": "http://audio.xmcdn.com/group30/M01/09/CC/wKgJXlnLQG3TcEMUAEO9Cc5vVpw951.m4a", "cover_url": "http://fdfs.xmcdn.com/group30/M01/09/C9/wKgJXlnLQFfTXFrrAABjb0XNaBY701_mobile_small.jpg", "mp3_audio_url": "http://fdfs.xmcdn.com/group30/M04/09/F9/wKgJXlnLQfmBw12tACF2AJ_b5Mk553.mp3", "album": "不得不说", "album_id": "266944", "type": "sound", "tracks": { "id": 52458882, "kind": "track", "category_id": 1, "track_title": "两个月饼的热量相当于一个全家桶!", "track_tags": "话题,自媒体,头条,娱乐,段子", "cover_url_small": "http://fdfs.xmcdn.com/group30/M01/09/C9/wKgJXlnLQFfTXFrrAABjb0XNaBY701_mobile_small.jpg", "cover_url_middle": "http://fdfs.xmcdn.com/group30/M01/09/C9/wKgJXlnLQFfTXFrrAABjb0XNaBY701_web_large.jpg", "cover_url_large": "http://fdfs.xmcdn.com/group30/M01/09/C9/wKgJXlnLQFfTXFrrAABjb0XNaBY701_mobile_large.jpg", "announcer": { "id": 10885843, "kind": "user", "nickname": "DJ小不", "avatar_url": "http://fdfs.xmcdn.com/group4/M04/E3/BE/wKgDs1QAFZejcwa_AAHbaCr1Dh4422_web_large.jpg", "is_verified": true }, "duration": 548, "play_count": 1442, "favorite_count": 13, "comment_count": 2, "can_download": true, "order_num": 0, "subordinated_album": { "id": 266944, "album_title": "不得不说", "cover_url_small": "http://fdfs.xmcdn.com/group21/M02/87/5B/wKgJLVikAm7z4-tOAAAtPWwzdo4886_mobile_small.jpg", "cover_url_middle": "http://fdfs.xmcdn.com/group21/M02/87/5B/wKgJLVikAm7z4-tOAAAtPWwzdo4886_mobile_meduim.jpg", "cover_url_large": "http://fdfs.xmcdn.com/group21/M02/87/5B/wKgJLVikAm7z4-tOAAAtPWwzdo4886_mobile_large.jpg" }, "source": 1, "updated_at": 1506504595000, "created_at": 1506492532000, "is_paid": false, "is_free": false, "is_trailer": false, "has_sample": false, "sample_duration": 0, "play_url_32": "http://fdfs.xmcdn.com/group30/M04/09/F9/wKgJXlnLQfmBw12tACF2AJ_b5Mk553.mp3", "play_size_32": 2192896, "play_url_64": "http://fdfs.xmcdn.com/group30/M01/09/CC/wKgJXlnLQG2jYSC8AELrtumq5GY802.mp3", "play_size_64": 4385718, "play_url_24_m4a": "http://audio.xmcdn.com/group30/M07/09/D1/wKgJXlnLQJ-jrf5wABnoqjvCwJg651.m4a", "play_size_24_m4a": 1697962, "play_url_64_m4a": "http://audio.xmcdn.com/group30/M01/09/CC/wKgJXlnLQG3TcEMUAEO9Cc5vVpw951.m4a", "play_size_64_m4a": 4439305, "play_size_amr": 0, "download_url": "http://download.xmcdn.com/group30/M06/2E/ED/wKgJWlnLQ_DSHWiUACF4p_hq5I8635.aac", "download_size": 2193575, "download_count": 0 }, "current_order_num": 0, "match_rule": "match", "track_list": [{ "track_title": "两个月饼的热量相当于一个全家桶!", "album_title": "不得不说", "cover_url": "http://fdfs.xmcdn.com/group30/M01/09/C9/wKgJXlnLQFfTXFrrAABjb0XNaBY701_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group30/M01/09/CC/wKgJXlnLQG3TcEMUAEO9Cc5vVpw951.m4a", "announcer": "DJ小不", "track_id": 52458882, "order_num": 0, "album_id": "266944", "break_in_seconds": 0 }, { "track_title": "朱时茂带来喜剧力作《胡杨的夏天》 力邀陈佩斯潘长江众多大咖加盟", "album_title": "饭爱豆", "cover_url": "http://fdfs.xmcdn.com/group13/M07/A1/A9/wKgDXVdzQgziumwWAACQ7QqxCFw709_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group30/M00/30/87/wKgJWlnLU3jC68O3ABTmL9H25Mg337.m4a", "announcer": "饭爱豆", "track_id": 52465951, "order_num": 1, "album_id": "4619035" }, { "track_title": "我距离成为网红就差一大笔整容费", "album_title": "不得不说", "cover_url": "http://fdfs.xmcdn.com/group32/M0A/00/1F/wKgJnFnEwXCBkBr_AAJtPIhLOKE219_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group31/M00/7D/EB/wKgJX1nEwZLSHGkWAD5EJwKV-h4926.m4a", "announcer": "DJ小不", "track_id": 51802179, "order_num": 2, "album_id": "266944" }, { "track_title": "我有的是时间,可是没钱呐", "album_title": "不得不说", "cover_url": "http://fdfs.xmcdn.com/group33/M05/24/20/wKgJnVnIoNzzEYYXAAGpazErofw403_mobile_small.png", "media_url": "http://audio.xmcdn.com/group30/M03/CC/9D/wKgJXlnIoRWw1Ge5AEPBb_b-xfw264.m4a", "announcer": "DJ小不", "track_id": 52183684, "order_num": 1, "album_id": "266944" }, { "track_title": "《英伦对决》成龙尝试突破自我 现场亲友团阵容豪华亮相", "album_title": "饭爱豆", "cover_url": "http://fdfs.xmcdn.com/group13/M07/A1/A9/wKgDXVdzQgziumwWAACQ7QqxCFw709_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group30/M00/30/86/wKgJWlnLU3OTvcOyAAxRBd41NC8872.m4a", "announcer": "饭爱豆", "track_id": 52465950, "order_num": 2, "album_id": "4619035" }, { "track_title": "冯小刚携《芳华》亮相广州 分享拍摄台前幕后故事", "album_title": "饭爱豆", "cover_url": "http://fdfs.xmcdn.com/group13/M07/A1/A9/wKgDXVdzQgziumwWAACQ7QqxCFw709_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group30/M0B/09/2C/wKgJWlnKALyiwF1wABO3Tf96OlU899.m4a", "announcer": "饭爱豆", "track_id": 52332196, "order_num": 3, "album_id": "4619035" }, { "track_title": "彭于晏angelababy有爱互怼 被好友调侃快点结婚!", "album_title": "饭爱豆", "cover_url": "http://fdfs.xmcdn.com/group13/M07/A1/A9/wKgDXVdzQgziumwWAACQ7QqxCFw709_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group30/M02/CF/88/wKgJXlnIu1zgOuN1AAdZux-z-9M584.m4a", "announcer": "饭爱豆", "track_id": 52195532, "order_num": 5, "album_id": "4619035" }, { "track_title": "新专辑《A.I. 爱》MV曝光 音乐才子王力宏呼吁关注饶舌", "album_title": "饭爱豆", "cover_url": "http://fdfs.xmcdn.com/group13/M07/A1/A9/wKgDXVdzQgziumwWAACQ7QqxCFw709_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group33/M06/01/AD/wKgJnVnE1M7Rl1AaAA-KR-0ayPo890.m4a", "announcer": "饭爱豆", "track_id": 51812700, "order_num": 7, "album_id": "4619035" }, { "track_title": "《羞羞的铁拳》上海点映好评爆棚 艾伦马丽首演情侣搞笑趣事多", "album_title": "饭爱豆", "cover_url": "http://fdfs.xmcdn.com/group13/M07/A1/A9/wKgDXVdzQgziumwWAACQ7QqxCFw709_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group30/M0B/09/2B/wKgJWlnKALfzyZrPABBgriueEpw977.m4a", "announcer": "饭爱豆", "track_id": 52332195, "order_num": 4, "album_id": "4619035" }, { "track_title": "韩庚私下爱好拍照 张亮服饰穿搭亮眼", "album_title": "饭爱豆", "cover_url": "http://fdfs.xmcdn.com/group13/M07/A1/A9/wKgDXVdzQgziumwWAACQ7QqxCFw709_mobile_small.jpg", "media_url": "http://audio.xmcdn.com/group30/M08/5A/38/wKgJWlnMtNqiDF9FAAmUk4XJX3Y750.m4a", "announcer": "饭爱豆", "track_id": 52609718, "order_num": 0, "album_id": "4619035" }], "text": "即将为您播放【两个月饼的热量相当于一个全家桶!】,来自专辑【不得不说】" }, "outputs": [{ "type": "wechat.music", "property": { "title": "两个月饼的热量相当于一个全家桶!", "description": "不得不说", "music_url": "http://audio.xmcdn.com/group30/M01/09/CC/wKgJXlnLQG3TcEMUAEO9Cc5vVpw951.m4a" } }, { "type": "wechat.text", "property": { "text": "即将为您播放娱乐新闻" } }, { "type": "dialog", "property": { "text": "即将为您播放【两个月饼的热量相当于一个全家桶!】,来自专辑【不得不说】", "emotion": "like" } }], "score": "1.0", "scoreColor": "c4", "is_match": 1, "skill_id": "d7d3579e-bb65-4120-b1a3-f9d4ff9a90f4", "id": "3b930137-0a83-4bd8-83d0-8e49769bdd7c" }], "meta_process_milliseconds": 229 } } ``` **详细参数说明** |名称 |类型| 说明 |:---|:---|:--- |service| String |服务名称 |html_link| String |网页链接 |source|String|来源 |source_link|String|来源链接 |sound_id|String|音频ID |title|String|题目标题 |media_url|String|音频链接 |cover_url|String|封面链接 |mp3_audio_url|String|mp3链接 |album|String|专辑名称 |album_id|String|专辑ID |tracks|Array|声音列表 |category_id|String|类别ID |track_title|String|声音标题 |track_tags|String|声音标签 |track_intro|String|声音简介 |track_id|String|声音ID |cover_url_small|String|分类封面小图| |cover_url_middle|String|分类封面中图| |cover_url_large|String| 分类封面大图| |announcer|String|主播信息 |play_count|Integer|专辑播放次数 |favorite_count|Integer|专辑收藏次数 |comment_count|Integer|专辑评论次数 |download_count|Integer|专辑下载次数 |can_download|Boolean|可否下载,true 则为可下载 |download_url|String|下载链接 |download_size|Integer|声音下载大小 |updated_at|String|专辑更新时间 |created_at|String|专辑创建时间 |order_num|String|排序值,值越小排序越在前 |current_order_num|String|当前排序值 |track_list|Array|声音列表