You need to enable JavaScript to run this app.
导航

相关推荐

最近更新时间2023.11.21 14:41:58

首次发布时间2021.10.18 11:12:18

火山引擎提供的H5详情页默认自带了相关推荐,当您需要实现Native的相关推荐时,可以通过此接口获取相关推荐数据,并自主实现UI。

说明

建议以Native方式实现相关推荐,对比详情页自带的H5相关推荐,UI自定义能力更强,数据上报更准确,更有助于推荐。

实现方案优点缺点整体建议
Native1.相关推荐列表页UI自定义能力更强;
2. 能够上报的信息更全
1. 开发成本相比h5高一些建议
h51. 开发成本低一些1.UI样式不支持自定义;
2. 上报的场景不全,比如home返回等,影响推荐效果
3.影响详情页停留时长统计,进而影响数据分析
不建议

请求方式

请求方法

GET/POST(Content-Type: application/x-www-form-urlencoded)

请求url

https://mercury.volcengineapi.com/?Action=RelatedArticleV2&Version=2021-01-01

请求header

ServiceName:content

请求参数

参数描述类型是否必填说明
Partner渠道号String
AccessToken用户唯一标识String
GroupId内容idString获取此内容的相关推荐内容

Count

返回内容条数

String

注意

由于算法后置过滤等逻辑,会存在返回条数不足的情况。

Dt设备型号String如iphone5s、Galaxy。主要用于推荐分析,提升推荐效果
DeviceBrand设备厂商String如Apple、Samsung。主要用于推荐分析,提升推荐效果
Os操作系统String如 Android、IOS。主要用于推荐分析,提升推荐效果。注意:IOS系统如果没有正确传入此参数,返回的封面图可能为webp格式,导致图片解析失败。
OsVersion操作系统版本String如4.0.4。主要用于推荐分析,提升推荐效果。火山引擎侧内容详情页会根据此参数进行适配。
ClientVersion应用的版本号String比如1.0.1。主要用于数据排查,提升业务指标

响应参数

参数
描述
类型
说明
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.setOs("ios");
    req.setClientVersion("3.1.1");
    req.setAccessToken("xxx");
    req.setGroupId("7008339270066766349");
    try {
        RelatedArticleResponseV2 response = streamService.relatedArticleV2(req);      System.out.println(JSON.toJSONString(response));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

响应示例

{
    "ResponseMetadata": {
        "RequestId": "2023111521062120C027F5D2AF32965279",
        "Action": "RelatedArticleV2",
        "Version": "2021-01-01",
        "Service": "content",
        "Region": "cn-beijing"
    },
    "Result": [
        {
            "Abstract": "",
            "ArticleType": "短视频",
            "ArticleUrl": "https://open.toutiao.com/a7268610095200600610/?***",
            "CommentCount": 97,
            "CommentUrl": "https://open.toutiao.com/a7268610095200600610/comment/?***",
            "CoverImages": [
                {
                    "Url": "https://p3-open-sign.onewsimg.com/***",
                    "Height": 1080,
                    "Width": 1920
                }
            ],
            "CoverMode": 1,
            "DiggCount": 1967,
            "GroupId": "7268610095200600610",
            "HasVideo": true,
            "PublishTime": 1692586040,
            "ShareCount": 3611,
            "ShareUrl": "https://open.toutiao.com/a7268610095200600610/?***",
            "Title": "国家级名老中医推荐这杯自创的神气汤,有益气养阴、健脑生髓之效",
            "UserInfo": {
                "AvatarUrl": "https://p9-open-sign.onewsimg.com/***",
                "Description": "北京卫视《养生堂》栏目的官方运营号",
                "Follow": false,
                "FollowerCount": 16557938,
                "HomePage": "https://open.toutiao.com/u6635907835/?***",
                "Name": "北京卫视养生堂",
                "UserId": 6635907835,
                "UserVerified": true,
                "VerifiedContent": "北京卫视《养生堂》节目官方账号"
            },
            "VideoWatchCount": 101240,
            "VideoDetail": {
                "VideoDuration": 434.888,
                "VideoList": [
                    {
                        "Url": "http://open.toutiao.com/video/url/v1/?***",
                        "Height": 360,
                        "Width": 640,
                        "Definition": "360p"
                    }
                ]
            }
        }
    ]
}