最近更新时间:2023.02.28 17:57:49
首次发布时间:2021.10.18 11:12:18
火山引擎提供的H5详情页默认自带了相关推荐,当您需要实现Native的相关推荐时,可以通过此接口获取相关推荐数据,并自主实现UI。
说明
建议以Native方式实现相关推荐,对比详情页自带的H5相关推荐,UI自定义能力更强,数据上报更准确,更有助于推荐。
实现方案 | 优点 | 缺点 | 整体建议 |
---|---|---|---|
Native | 1.相关推荐列表页UI自定义能力更强; 2. 能够上报的信息更全 | 1. 开发成本相比h5高一些 | 建议 |
h5 | 1. 开发成本低一些 | 1.UI样式不支持自定义; 2. 上报的场景不全,比如home返回等,影响推荐效果 3.影响详情页停留时长统计,进而影响数据分析 | 不建议 |
请求方法
GET/POST(Content-Type: application/x-www-form-urlencoded)
请求url
https://mercury.volcengineapi.com/?Action=RelatedArticle&Version=2021-01-01
请求header
ServiceName:content
参数 | 描述 | 类型 | 是否必填 | 说明 |
---|---|---|---|---|
Partner | 渠道号 | String | 是 | |
AccessToken | 用户唯一标识 | String | 是 | |
GroupId | 内容id | String | 是 | 获取此内容的相关推荐内容 |
Count | 返回内容条数 | String | 否 | 注意 由于算法后置过滤等逻辑,会存在返回条数不足的情况。 |
参数 | 描述 | 类型 | 说明 |
---|---|---|---|
Result | 内容列表 | List<Result> | 相关推荐内容列表 |
public static void main(String[] args) { //初始化一个service StreamService streamService = StreamServiceImpl.getInstance(); //设置ak,sk 此为请求的凭证 streamService.setAccessKey("xxx"); streamService.setSecretKey("xxx"); //初始化一个request RelatedArticleRequest req = new RelatedArticleRequest(); req.setPartner("xxxx"); req.setAccessToken("xxx"); req.setGroupId("7008339270066766349"); try { RelatedArticleResponse response = streamService.relatedArticle(req); System.out.println(JSON.toJSONString(response)); } catch (Exception e) { e.printStackTrace(); } }
{ "ResponseMetadata": { "Action": "RelatedArticle", "Region": "cn-north-1", "RequestId": "202207191724470102120451971B119915", "Service": "content", "Version": "2021-01-01" }, "Result": [ { "Abstract": "...", "ArticleClass": "短视频", "ArticleUrl": "...", "CommentCount": 0, "CommentUrl": "...", "DiggCount": 2, "GroupId": "7121966136287035907", "HasVideo": true, "ImageList": [ { "Height": 196, "Mimetype": "jpeg", "Uri": "...", "Url": "...", "UrlList": [ { "Url": "...", } ], "Width": 300 } ], "MiddleImage": [ { "Height": 196, "Mimetype": "jpeg", "Uri": "...", "Url": "...", "UrlList": [ { "Url": "...", } ], "Width": 300 } ], "PublishTime": 1658211959, "ShareUrl": "...", "Source": "...", "Title": "...", "UserInfo": { "AvatarUrl": "...", "Description": "...", "FollowersCount": 184, "HomePage": "...", "Name": "...", "UserId": "1987552628492141" }, "VideoDuration": 632, "VideoId": "V2o5y7r3WC8EAkrEtyWBcHbTjB2QMkm3xcLg6DGU28rJTkCPcgbtvVSxHiYZWbdegMHQ6k1ia83951Wdr8Q", "VideoWatchCount": 171 }, ... ] }