You need to enable JavaScript to run this app.
导航
SingleArticleV2 - 获取单条内容
最近更新时间:2024.05.28 18:13:35首次发布时间:2024.05.28 18:13:35

通过GroupId获取单条文章/视频内容的详情。

使用场景

本接口主要针对需要实现收藏场景的客户。您可以通过调用该接口获取内容状态和内容详情,避免C端用户访问到已下架的内容。
您需要自行实现在列表页或者详情页收藏文章/视频内容,在用户收藏内容时,将用户及内容id的对应关系存下,在用户进入收藏列表页时,调用本接口以获取内容标题、封面图、作者信息等,并实现自定义UI。

请求说明

  • 请求方式:GET/POST(Content-Type: application/x-www-form-urlencoded)
  • 请求地址:https://mercury.volcengineapi.com/?Action=SingleArticleV2&Version=2021-01-01
  • 请求头:ServiceName:content

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

SingleArticleV2

要执行的操作,取值:SingleArticleV2。

Version
String

2021-01-01

API的版本,取值:2021-01-01。

ApiVersion
Integer

4

接口版本,固定传4。

Partner
String

demo_default_content

渠道号。

AccessToken
String

AT6zTZuXzffKpQamerBKVv8mp94LRxxxdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12

用户唯一标识。

CustomVideoDefinition
String

360p

指定视频分辨率。

  • 枚举值:360p、480p、540p、720p、1080p、all(全部)。
  • 横版短视频支持:360p(默认)、480p、540p、720p、1080p;
  • 竖版小视频支持:540p(默认);
  • 默认不传时,短视频下发360p,小视频下发540p,传all时下发视频所有的分辨率。
  • 如果请求的分辨率对于该视频不存在,则会自动降级一档返回内容作为兜底。

注意

分辨率的升档会增加cdn的播放成本,需客户侧谨慎评估,详细咨询火山引擎侧。

GroupID
String

7304704552752808499

内容ID。
获取个性化内容”接口返回该字段。

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
Abstract
String

内容摘要。

ArticleUrl
String

https://open.toutiao.com/a7304704552752808499/?a_t=AT6zTZuXzffxxxamerBKVv8mp94LR2ARdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12&biz_log=BhZy1qxxxRKyi&form_scen=FROM_ARTICLE&group_id=7304704552752808499&item_id=7304704552752808499&label=article&req_id=202405221151476EEB7F859xxxD29946D9&utm_campaign=open&utm_medium=webview&utm_source=xxx_default_content"

详情页H5页面。

  • 火山引擎提供H5详情页,默认是由正文+评论+相关推荐三部分组成,如果您需要在详情页中插入其他原生模块,可参考“详情页拼接业务模块”说明来满足需求。
  • 建议实时请求内容,不要在本地缓存,以免访问到已下架的文章。
  • 若您还处于调试阶段,建议在ArticleUrl后面拼接&is_tt_test_env=1来访问H5测试环境,上线前注意删除该拼接参数。
GroupId
String

7304704552752808499

内容id。

Title
String

标题

内容标题

PublishTime
Long

1700759062

内容发布时间,10位时间戳,单位:秒。

ShareUrl
String

https://open.toutiao.com/a7304704552752808499/?a_t=AT6zTZuXzffKpxxxerBKVv8mp94LR2ARdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12&biz_log=BhZxxxRKyi&form_scen=FROM_ARTICLE&group_id=7304704552752808499&label=share&req_id=202405221151476EExxx8591E1D29946D9&utm_campaign=open&utm_medium=webview&utm_source=xxx_default_content

分享页H5页面。
分享场景需要使用该地址,具体请参见分享文档说明。

ShareCount
Long

1000

内容分享数。

HasVideo
Boolean

true

内容是否包含视频。

  • true:是,内容包含视频;
  • false:否,内容不包含视频;
  • 当返回为true时,建议客户端在封面图上加一个播放的图标(封面图本身不带有播放图标),这样更容易辨认视频内容。
VideoWatchCount
Long

500

视频观看量,当HasVideo为true时,返回此字段。

DiggCount
Long

500

内容点赞数。

CommentUrl
String

https://open.toutiao.com/a7304704552752808499/comment/?a_t=AT6zTZuXzffKpQamerxxxv8mp94LR2ARdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12&biz_log=BhZyxxxRKyi&form_scen=FROM_ARTICLE&group_id=7304704552752808499&label=share&req_id=2024052211514xxxEB7F8591E1D29946D9&utm_source=xxx_default_content

评论H5页面。
火山引擎支持展示评论H5页面,暂不支持评论互动,具体请参见展示评论文档说明。

CommentCount
Long

500

内容评论数。

DiggStatus
Boolean

false

点赞状态。

  • true:已点赞;
  • false:未点赞。
ArticleType
String

图文

内容体裁。
目前的内容体裁包含:图文、短视频、图文内嵌视频、小视频。

CoverMode
Integer

1

封面类型。
0:无封面图,1:大图,2:三图,3:右图。

VideoDetail
VideoDetail

视频资源,当HasVideo为true时,返回此字段。

CoverImages
Array of Image

封面图列表。

UserInfo
UserInfo

作者信息。

ContentImageList
Array of Image

正文图片列表,当内容体裁是图文时,返回此字段。

说明

  • 默认不返回此字段,若需要返回请联系火山引擎技术支持;
  • 视频体裁不返回此字段;
  • 当正文内容中没有图片时,不返回此字段。

请求示例

GET /?Action=SingleArticleV2&Version=2021-01-01&ApiVersion=4&Partner=demo_default_content&AccessToken=AT6zTZuXzffKpQamerBKVv8mp94LRxxxdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12&GroupID=7304704552752808499 HTTP/1.1
Host: https://mercury.volcengineapi.com/?Action=SingleArticleV2&Version=2021-01-01
X-Date: 20240522T064902Z
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20240522/cn-north-1/content/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f


返回示例

{
  "ResponseMetadata": {
    "RequestId": "2024052214492200405412104008D606",
    "Action": "SingleArticleV2",
    "Version": "2021-01-01",
    "Service": "content",
    "Region": "cn-north-1"
  },
  "Result": {
    "Abstract": "-",
    "ArticleUrl": "https://open.toutiao.com/a7304704552752808499/?a_t=AT6zTZuXzffxxxamerBKVv8mp94LR2ARdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12&biz_log=BhZy1qxxxRKyi&form_scen=FROM_ARTICLE&group_id=7304704552752808499&item_id=7304704552752808499&label=article&req_id=202405221151476EEB7F859xxxD29946D9&utm_campaign=open&utm_medium=webview&utm_source=xxx_default_content\"",
    "GroupId": "7304704552752808499",
    "Title": "标题",
    "PublishTime": 1700759062,
    "ShareUrl": "https://open.toutiao.com/a7304704552752808499/?a_t=AT6zTZuXzffKpxxxerBKVv8mp94LR2ARdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12&biz_log=BhZxxxRKyi&form_scen=FROM_ARTICLE&group_id=7304704552752808499&label=share&req_id=202405221151476EExxx8591E1D29946D9&utm_campaign=open&utm_medium=webview&utm_source=xxx_default_content",
    "ShareCount": 1000,
    "HasVideo": true,
    "VideoWatchCount": 500,
    "DiggCount": 500,
    "CommentUrl": "https://open.toutiao.com/a7304704552752808499/comment/?a_t=AT6zTZuXzffKpQamerxxxv8mp94LR2ARdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12&biz_log=BhZyxxxRKyi&form_scen=FROM_ARTICLE&group_id=7304704552752808499&label=share&req_id=2024052211514xxxEB7F8591E1D29946D9&utm_source=xxx_default_content",
    "CommentCount": 500,
    "DiggStatus": true,
    "ArticleType": "图文",
    "CoverMode": 1,
    "VideoDetail": {
      "VideoDuration": 2230.115,
      "VideoList": [
        {
          "Definition": "360p",
          "Height": 360,
          "Width": 640,
          "Url": "http://mercury.snssdk.com/video/url/?param=ZvBxCXxxxyK2je&partner=xxx_default_content&version=2&trans_vdata_to_content=1"
        }
      ]
    },
    "CoverImages": [
      {
        "Url": "https://p6-open-sign.byteimg.com/tos-cn-i-pk90l89vgd/1c6a1776374c4486a46a5a5cbb145ffa~tplv-tt-cut:3216:1810.jpeg?scene=content&x-expires=1747815830&x-signature=ElLytAjeIfSe2O2WkFMqOBY2VUw%3D",
        "Width": 3216,
        "Height": 1810
      }
    ],
    "UserInfo": {
      "AvatarUrl": "-",
      "Description": "-",
      "HomePage": "-",
      "Name": "-",
      "Follow": true,
      "FollowerCount": 0,
      "UserId": "-",
      "UserVerified": true,
      "VerifiedContent": "-"
    },
    "ContentImageList": [
      {
        "Url": "https://p6-open-sign.byteimg.com/tos-cn-i-pk90l89vgd/1c6a1776374c4486a46a5a5cbb145ffa~tplv-tt-cut:3216:1810.jpeg?scene=content&x-expires=1747815830&x-signature=ElLytAjeIfSe2O2WkFMqOBY2VUw%3D",
        "Width": 3216,
        "Height": 1810
      }
    ]
  }
}

错误码

您可访问公共错误码,获取更多错误码信息。