Mastodon
  • 什么是 Mastodon?
  • 使用 Mastodon
    • 注册帐户
    • 设置你的个人资料
    • 在你的账户发布内容
    • 使用网络功能
    • 处理不想看到的内容
    • 推广你和他人
    • 进行偏好设置
    • 更多设置
    • 在站点外使用 Mastodon
    • 迁移或离开账户
    • 运行你自己的站点
  • 运营 Mastodon
    • 准备你的服务器
    • 从源代码安装
    • 配置你的环境
    • 安装可选功能
      • 对象存储
      • 洋葱服务
      • 验证码
      • 单点登录
    • 配置全文搜索
    • 设置你的新实例
    • 使用管理 CLI
    • 升级到新版本
    • 备份你的服务器
    • 迁移到新机器
    • 扩大你的站点规模
    • 审核操作
    • 故障排除
      • 数据库索引损坏
    • 用户组
  • 开发 Mastodon 应用
    • API 入门指南
    • 使用公开数据
    • 获取客户端应用访问权限
    • 使用帐户登录
    • 库与实现
  • 向 Mastodon 项目做贡献
    • 技术概览
    • 设置开发环境
    • 代码结构
    • 路由
    • 漏洞赏金与责任披露
  • 遵循的标准
    • ActivityPub
    • WebFinger
    • 安全性
    • Microformats
    • OAuth
    • Bearcaps
  • REST API
    • Datetime 格式
    • 指南与最佳实践
    • OAuth 令牌
    • OAuth 作用域
    • 速率限制
  • API 方法
    • apps
      • oauth
      • emails
    • accounts
      • bookmarks
      • favourites
      • mutes
      • blocks
      • domain_blocks
      • filters
      • reports
      • follow_requests
      • endorsements
      • featured_tags
      • preferences
      • followed_tags
      • suggestions
      • tags
    • profile
    • statuses
      • media
      • polls
      • scheduled_statuses
    • timelines
      • conversations
      • lists
      • markers
      • streaming
    • grouped notifications
    • notifications
      • push
    • search
    • instance
      • trends
      • directory
      • custom_emojis
      • announcements
    • admin
      • accounts
      • canonical_email_blocks
      • dimensions
      • domain_allows
      • domain_blocks
      • email_domain_blocks
      • ip_blocks
      • measures
      • reports
      • retention
      • trends
    • proofs
    • oembed
  • API 实体
    • Account
    • AccountWarning
    • Admin::Account
    • Admin::CanonicalEmailBlock
    • Admin::Cohort
    • Admin::Dimension
    • Admin::DomainAllow
    • Admin::DomainBlock
    • Admin::EmailDomainBlock
    • Admin::Ip
    • Admin::IpBlock
    • Admin::Measure
    • Admin::Report
    • Announcement
    • Appeal
    • Application
    • Context
    • Conversation
    • CustomEmoji
    • DomainBlock
    • Error
    • ExtendedDescription
    • FamiliarFollowers
    • FeaturedTag
    • Filter
    • FilterKeyword
    • FilterResult
    • FilterStatus
    • IdentityProof
    • Instance
    • List
    • Marker
    • MediaAttachment
    • Notification
    • NotificationPolicy
    • NotificationRequest
    • Poll
    • Preferences
    • PreviewCard
    • PreviewCardAuthor
    • PrivacyPolicy
    • Reaction
    • Relationship
    • RelationshipSeveranceEvent
    • Report
    • Role
    • Rule
    • ScheduledStatus
    • Search
    • Status
    • StatusEdit
    • StatusSource
    • Suggestion
    • Tag
    • TermsOfService
    • Token
    • Translation
    • V1::Filter
    • V1::Instance
    • V1::NotificationPolicy
    • WebPushSubscription

PreviewCard

表示使用来自 URL 的 OpenGraph 标签生成的富媒体预览卡片。

    • 示例
      • 视频
      • 图片
      • 链接
    • 属性
      • url
      • title
      • description
      • type
      • authors
      • author_name
      • author_url
      • provider_name
      • provider_url
      • html
      • width
      • height
      • image
      • embed_url
      • blurhash
    • Trends::Link 实体属性
      • history
    • 参见

示例

视频

{
  "url": "https://www.youtube.com/watch?v=OMv_EPMED8Y",
  "title": "♪ Brand New Friend (Christmas Song!)",
  "description": "",
  "type": "video",
  "author_name": "YOGSCAST Lewis & Simon",
  "author_url": "https://www.youtube.com/user/BlueXephos",
  "provider_name": "YouTube",
  "provider_url": "https://www.youtube.com/",
  "html": "<iframe width=\"480\" height=\"270\" src=\"https://www.youtube.com/embed/OMv_EPMED8Y?feature=oembed\" frameborder=\"0\" allowfullscreen=\"\"></iframe>",
  "width": 480,
  "height": 270,
  "image": "https://files.mastodon.social/preview_cards/images/014/179/145/original/9cf4b7cf5567b569.jpeg",
  "embed_url": "",
  "blurhash": "UvK0HNkV,:s9xBR%njog0fo2W=WBS5ozofV@"
}

图片

{
  "url": "https://www.flickr.com/photos/tomfenskephotography/49088768431/",
  "title": "Oregon",
  "description": "",
  "type": "photo",
  "author_name": "Tom Fenske Photography",
  "author_url": "https://www.flickr.com/photos/tomfenskephotography/",
  "provider_name": "Flickr",
  "provider_url": "https://www.flickr.com/",
  "html": "",
  "width": 1024,
  "height": 427,
  "image": "https://files.mastodon.social/preview_cards/images/014/287/139/original/651b1c6976817824.jpeg",
  "embed_url": "https://live.staticflickr.com/65535/49088768431_6a4322b3bb_b.jpg",
  "blurhash": "UnE{@jt6M_oIAhjYs+ayT2WBf9ayRkkDXAj["
}

链接

{
  "url": "https://www.theguardian.com/money/2019/dec/07/i-lost-my-193000-inheritance-with-one-wrong-digit-on-my-sort-code",
  "title": "‘I lost my £193,000 inheritance – with one wrong digit on my sort code’",
  "description": "When Peter Teich’s money went to another Barclays customer, the bank offered £25 as a token gesture",
  "type": "link",
  "authors": [],
  "author_name": "",
  "author_url": "",
  "provider_name": "",
  "provider_url": "",
  "html": "",
  "width": 0,
  "height": 0,
  "image": null,
  "embed_url": "",
  "blurhash": null
}

属性

url

描述: 链接资源的地址。
类型: 字符串 (URL)
版本历史:
1.0.0 - 添加

title

描述: 链接资源的标题。
类型: 字符串
版本历史:
1.0.0 - 添加

description

描述: 预览的描述。
类型: 字符串
版本历史:
1.0.0 - 添加

type

描述: 预览卡片的类型。
类型: 字符串 (可枚举, oneOf)
link = 链接 OEmbed
photo = 图片 OEmbed
video = 视频 OEmbed
rich = iframe OEmbed。当前不接受,因此实际上不会显示。
版本历史:
1.3.0 - 添加

authors

描述: 原始资源的作者的 Fediverse 账号。
类型: Array of PreviewCardAuthor
版本历史:
4.3.0 - 添加

author_name

描述: 原始资源的作者。自 4.3.0 起已弃用,客户端应改用 authors。
类型: 字符串
版本历史:
1.3.0 - 添加
4.3.0 - deprecated

author_url

描述: 指向原始资源作者的链接。自 4.3.0 起已弃用,客户端应改用 authors。
类型: 字符串 (URL)
版本历史:
1.3.0 - 添加
4.3.0 - deprecated

provider_name

描述: 原始资源的提供者。
类型: 字符串
版本历史:
1.3.0 - 添加

provider_url

描述: 指向原始资源提供者的链接。
类型: 字符串 (URL)
版本历史:
1.3.0 - 添加

html

描述: 用于生成预览卡片的 HTML。
类型: 字符串 (HTML)
版本历史:
1.3.0 - 添加

width

描述: 预览的宽度,以像素为单位。
类型: 整数
版本历史:
1.3.0 - 添加

height

描述: 预览的高度,以像素为单位。
类型: 整数
版本历史:
1.3.0 - 添加

image

描述: 预览缩略图。
类型: nullable 字符串 (URL)
版本历史:
1.0.0 - 添加

embed_url

描述: 用于照片嵌入,替代自定义的 html。
类型: 字符串 (URL)
版本历史:
2.1.0 - 添加

blurhash

描述: 由 BlurHash 算法计算出的哈希值,用于在媒体尚未下载时生成彩色预览缩略图。
类型: nullable 字符串
版本历史:
3.2.0 - 添加

Trends::Link 实体属性

{
  "url": "https://www.nbcnews.com/specials/plan-your-vote-2022-elections/index.html",
  "title": "Plan Your Vote: 2022 Elections",
  "description": "Everything you need to know about the voting rules where you live, including registration, mail-in voting, changes since 2020, and more.",
  "type": "link",
  "author_name": "NBC News",
  "author_url": "",
  "provider_name": "NBC News",
  "provider_url": "",
  "html": "",
  "width": 400,
  "height": 225,
  "image": "https://files.mastodon.social/cache/preview_cards/images/045/027/478/original/0783d5e91a14fd49.jpeg",
  "embed_url": "",
  "blurhash": "UcQmF#ay~qofj[WBj[j[~qof9Fayofofayay",
  "history": [
    {
      "day": "1661817600",
      "accounts": "7",
      "uses": "7"
    },
    {
      "day": "1661731200",
      "accounts": "23",
      "uses": "23"
    },
    {
      "day": "1661644800",
      "accounts": "0",
      "uses": "0"
    },
    {
      "day": "1661558400",
      "accounts": "0",
      "uses": "0"
    },
    {
      "day": "1661472000",
      "accounts": "0",
      "uses": "0"
    },
    {
      "day": "1661385600",
      "accounts": "0",
      "uses": "0"
    },
    {
      "day": "1661299200",
      "accounts": "0",
      "uses": "0"
    }
  ]
}

history

描述: 给定日期的使用统计信息(通常是过去一周)。
类型: 哈希值的数组
版本历史:
3.5.0 - 添加

history[][day]

描述: 给定日期午夜的 UNIX 时间戳。
类型: 字符串 (UNIX 时间戳)
版本历史:
3.5.0 - 添加

history[][accounts]

描述: 当天使用该链接的已计数帐户数。
类型: 字符串 (从整数转换而来)
版本历史:
3.5.0 - 添加

history[][uses]

描述: 当天使用该链接的已计数嘟文数。
类型: 字符串 (从整数转换而来)
版本历史:
3.5.0 - 添加

参见

Status (card 属性)
app/serializers/rest/preview_card_serializer.rb
app/serializers/rest/trends/link_serializer.rb
app/models/trends/links.rb

翻译状态: 本文是英文页面 PreviewCard 的翻译,最后翻译时间:2025-04-21,点击这里可以查看翻译后页面的改动。

最后更新于 April 21, 2025 · 改进此页面
也可在此找到: English

赞助商

Dotcom-Monitor LoadView Stephen Tures Swayable SponsorMotion

加入Mastodon · 博客 ·

查看源代码 · CC BY-SA 4.0 · 版权信息