【问题标题】:Linkedin API Post preview IssueLinkedin API 发布预览问题
【发布时间】:2021-09-05 02:39:00
【问题描述】:

我联系了 Linkedin 寻求支持,他们建议在这里发帖。 所以向市场上的#linkedin 开发者询问。

我的问题在于 Linkedin Rest API。 API 为:https://api.linkedin.com/v2/ugcPosts 您可以在此处找到有关 API 的更多信息:https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin

我正在使用如下示例所示的请求:

{
"author": "urn:li:person:8675309",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Learning more about LinkedIn by reading the LinkedIn Blog!"
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"description": {
"text": "Official LinkedIn Blog - Your source for insights and information about LinkedIn."
},
"originalUrl": "https://blog.linkedin.com/",
"title": {
"text": "Official LinkedIn Blog"
}
}
]
}[enter image description here][1]
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}

在 Linkedin API 最近更新之前一切正常,我在上述请求的“originalUrl”键中传递了我的文章链接,它正在生成正确的预览,如附件所示:old_correct_preview.png

但是现在在 Linkedin 上发布时不会生成 url 的预览,如您在所附图片中所见:current_wrong_preview.png 我还检查了 Linkedin 后检查器工具中的 URL,它正在生成正确的预览,如您在所附图像中所见:post-preview-in-linkedin-post-inspector.png

我不认为这是浏览器问题,因为它发生在 Linkedin 本身。

另请注意,通过 Linkedin 直接发布链接时,会生成正确的预览,但只有在我使用 API 时才会出现问题。 通过 API 发布时出现问题的示例 url 是:https://chetu.ctnt.co/video/112/ah-290-376-l

我为这个问题制作了两个视频。

您可以在这里查看:

  1. http://integration.blazingsocial.com/linkedin_preview_issue/
  2. http://integration.blazingsocial.com/wp-content/uploads/2021/06/Linkedin-Problem.mp4

enter image description here 当前错误的预览图片

enter image description here 老正确的预览图

enter image description here linkedin 发布预览图

【问题讨论】:

  • 我发现登录帖子时的“预览”与未登录帖子时的“预览”有很大不同。但是会有相同的 URL,但行为与这些视图有很大不同。现在,登录时通常根本没有预览。注销时,有一个预览。邮政检查员似乎与“未登录”视图相匹配。由于有两种不同的行为,我建议这是 LinkedIn 方面的一个错误。行为应该是一致的,IMO。
  • 嗨,瑞克,但这东西以前可以用。所以我认为最近的一些 Linkedin API 更新已经打破了这一点。我试图与 Linkedin 支持联系,但他们让我在这里寻找解决方案...

标签: linkedin linkedin-api linkedin-jsapi


【解决方案1】:

我就这个问题联系了 LinkedIn,并特别指出了这篇文章以及另一篇类似的文章,这是他们给我的回复。我按照他们提到的去做,现在它也对我有用。我只是粘贴他们对我的回复,希望您可以按照相同的步骤来修复您的代码。

对于我们的回复延迟表示歉意。我们目前的支持量高于预期。 我很好奇您从 API 创建的共享中看到的问题是否来自我们最近对文章类型帖子所做的更改。 https://docs.microsoft.com/en-us/linkedin/marketing/integrations/recent-changes#page-management

What’s happening: Starting May 31, 2021, for article type posts the description, title, and thumbnail will be set from LinkedIn’s URL Preview of the URL only if the description, title, and thumbnail are not provided from the API call. Prior to this change, each field was set from LinkedIn’s URL Preview if the specific field was not set. If a specific representation of the post is desired, set the description, title, or thumbnail fields, rather than rely on automatic preview. Use the Post Inspector tool to determine what the LinkedIn URL Preview looks like.

总而言之,因为您仍在传递一些字段,所以我们没有抓取图像。因此,如果您从通话中删除除了要删除的链接之外的所有字段,您应该会看到图像、标题和描述都已被删除。因此,现在抓取基本上是全有或全无的事情,您要么提供所有信息,要么不提供所有信息,让我们的抓取器完成其​​余的工作。 您能否尝试仅传递 URL 并让我知道这是否可以为您解决问题?

【讨论】:

  • 我需要从文章发布 html 页面中删除 og 元标记吗???
  • @PawanLakhera 是的,只需为 originalUrl 字段发送一个值。不要填写description.texttitle.text
猜你喜欢
  • 1970-01-01
  • 2011-12-22
  • 1970-01-01
  • 2011-01-20
  • 1970-01-01
  • 1970-01-01
  • 2015-08-10
  • 1970-01-01
相关资源
最近更新 更多