本页面为机器翻译。英文版本为原文,可能更准确或更及时。 查看英文版

文章对象

v3 在所有地方都提供同一种文章对象:REST 搜索和查询、WebSocket 数据流以及 webhooks。本页列出每个字段、它何时出现,以及 null 和 [] 的含义。


字段参考

骨架字段在每个通道上都始终存在。最后三个字段(sentiment、companies、events)取决于您的套餐和 include。

  • Name
    id
    Type
    string
    Description

    始终存在。文章 id:由 A-Z a-z 0-9 _ - 组成的 22 个字符。它在 REST、WebSocket 和 webhooks 中相同,只要链接不变,它就不变。请把它视为不透明值。配合 GET /v3/articles/{id} 使用。

  • Name
    link
    Type
    string
    Description

    始终存在。文章 URL。配合 GET /v3/articles/by-link 使用。

  • Name
    source
    Type
    object
    Description

    始终存在。domain(string)是来源的域名,也是关联 /v3/sources 的键。type(string 或 null)是来源类型。

  • Name
    title
    Type
    string
    Description

    始终存在。文章原始语言的标题。

  • Name
    summary
    Type
    string | null
    Description

    始终存在。简短摘要。没有摘要时为 null。永远不会是空字符串。

  • Name
    language
    Type
    string | null
    Description

    始终存在。文章的语言,采用 ISO 639-1 格式,例如 en。

  • Name
    media
    Type
    object[]
    Description

    始终存在,可以是 []。文章的图片,最多 3 张。每一项为 {"url": "..."}。

  • Name
    publishedAt
    Type
    string | null
    Description

    始终存在。来源声明的发布时间。

  • Name
    firstSeenAt
    Type
    string | null
    Description

    始终存在。finlight 首次看到这篇文章的时间。在 v2 中为 createdAt。

  • Name
    revisedAt
    Type
    string | null
    Description

    始终存在。来源报告的最后修订时间。来源未报告或与 publishedAt 相同时为 null。它描述的是文章本身,并不表示"这次投递是一次更新"。

  • Name
    availableAt
    Type
    string | null
    Description

    始终存在。增强版文章首次在 finlight 可用的时间。只设置一次,之后不会改变。

  • Name
    countries
    Type
    string[]
    Description

    始终存在,可以是 []。报道所涉及的国家,采用 ISO 3166-1 alpha-2 格式。这是报道的关注点,而不是公司的所在地。

  • Name
    categories
    Type
    string[]
    Description

    始终存在,可以是 []。主题分类,例如 markets、business 或 technology。开放列表。

  • Name
    sentiment
    Type
    object | null
    Description

    受权限控制。当您的套餐有 sentimentAnalysisAccess 时出现。不需要 include。格式为 {"label": string | null, "confidence": number | null}。目前的标签有 positive、neutral 和 negative;列表是开放的。confidence 介于 0 和 1 之间。null 表示没有计算情绪。没有 score 字段。

  • Name
    companies
    Type
    Company[]
    Description

    受权限控制。只有当 include 中包含 companies 且您的套餐有 entityAccess 时才会出现。[] 表示文章已经过标记,但没有找到公司。请参阅公司与角色。

  • Name
    events
    Type
    Event[]
    Description

    受权限控制。只有当 include 中包含 events 且您的套餐有 eventAccess(Pro Standard 及以上)时才会出现。[] 表示文章已经过分类,但没有事件。请参阅事件。

所有数字都是 JSON 数字,不做四舍五入。JSON 中键的顺序不属于约定的一部分。


时间戳

每个时间戳的格式都是 YYYY-MM-DDTHH:mm:ss.sssZ,使用 UTC 并带毫秒,例如 2026-09-18T12:01:03.000Z。

字段含义适用场景
publishedAt来源声明的发布时间向读者显示日期
firstSeenAtfinlight 首次看到文章的时间衡量新闻有多新
revisedAt来源报告的修订时间显示来源编辑过该报道
availableAt增强版文章可用的时间断线后无缺口地补齐文章

需要了解的几点:

  • 一些旧文章的 publishedAt 为 1970-01-01T00:00:00.000Z。这来自旧数据,会按原样提供。请把它当作"未知"。
  • 在该字段引入之前存储的文章,其 availableAt 为 null;在原始数据流和原始 webhooks 上它始终为 null。
  • 旧数据中的 firstSeenAt 可能为 null。
  • 您可以用 orderBy 按这四个字段中的任意一个对搜索结果排序和过滤。请参阅搜索文章。

缺失、null 与空值

一个键可能缺失、为 null、为空数组,或有一个值。每种状态的含义都不同。

状态含义
键缺失没有用 include 请求、不在您的套餐中,或在此通道(原始)上不可用。
null已请求且在您的套餐中,但(暂时)没有值。
[]真正的空集合:例如已经标记,但没有找到公司。
有值就是这个值。

规则:

  1. 只有三个受权限控制的键可能缺失:sentiment、companies 和 events。events[].companyIds 遵循自己的规则(请参阅事件)。
  2. 其他每个键都始终存在。
  3. 数组永远不会是 null。
  4. 文本永远不会是 ""。没有文本时为 null。
  5. 永远不要把缺失的键当作 false、0 或 []。缺失的 companies 并不表示"没有公司"。

哪个套餐标志对应哪个键,以及原始通道有何不同,请参阅套餐与权益。

SDK 会区分这些状态,并提供存在性辅助函数:

存在性检查

import { companiesPresent, eventsPresent, toDate } from 'finlight-client'

if (companiesPresent(article)) {
  // article.companies is Company[]; [] means "tagged, no company"
} else {
  // not requested, not in your plan, or the raw channel
}
const published: Date | null = toDate(article.publishedAt) // strict, null when unreadable

完整示例

在拥有全部权益的套餐上,带 include: ["companies", "events"] 的增强版文章:

Article

{
  "id": "pXhK9f2aQ1mZ0bT7cY3rLw",
  "link": "https://www.reuters.com/markets/amd-zt-systems",
  "source": { "domain": "www.reuters.com", "type": "newswire" },
  "title": "AMD to buy ZT Systems",
  "summary": "AMD agreed to buy server maker ZT Systems to strengthen its AI data center business.",
  "language": "en",
  "media": [{ "url": "https://www.reuters.com/resizer/lead.jpg" }],
  "publishedAt": "2026-09-18T12:01:03.000Z",
  "firstSeenAt": "2026-09-18T12:01:41.000Z",
  "revisedAt": null,
  "availableAt": "2026-09-18T12:03:05.000Z",
  "countries": ["US"],
  "categories": ["markets", "technology"],
  "sentiment": { "label": "positive", "confidence": 0.98 },
  "companies": [
    {
      "companyId": 13,
      "name": "Advanced Micro Devices, Inc.",
      "isin": "US0079031078",
      "primaryListing": { "ticker": "AMD", "mic": "XNAS", "country": "US" },
      "confidence": 0.97,
      "role": "acquirer",
      "relevance": 0.95
    }
  ],
  "events": [
    { "type": "mna", "direction": "positive", "importance": "high", "confidence": 0.9, "companyIds": [13] }
  ]
}

同一篇文章在同一套餐上不带任何 include 时,只有骨架字段加上 sentiment。在原始数据流上,它只有骨架字段,并且 availableAt: null。


兼容性规则

  • 随时可能增加新字段。忽略您不认识的键。
  • 响应中的取值列表是开放的:sentiment.label、categories、source.type、companies[].role 以及事件字段都可能出现新取值。请把未知取值保留为字符串。
  • 文章 id 和搜索游标是不透明的。不要解析它们。

相关内容:公司与角色 · 事件 · 来源类型 · 套餐与权益