【问题标题】:How do I link to a Blogger post with a post ID?如何使用帖子 ID 链接到 Blogger 帖子?
【发布时间】:2020-09-12 16:40:41
【问题描述】:

如果我有 Blogger 博客上帖子的 ID,如何将该 ID 转换为链接到该帖子的 URL?

我的最终目标是将帖子从我的 Blogger 站点拉到我自己的站点,然后能够永久链接到实际帖子。我通过使用 Javascript 为我的博客解析 RSS 提要来做到这一点。不幸的是,RSS 提要中的“链接”字段不是博客文章的 URL……它是 cmets 提要的 URL。但是,我可以获取帖子 ID,我认为这是查找帖子 URL 的好方法。任何其他建议表示赞赏。

编辑:经过进一步检查,我发现实际的帖子链接包含在 RSS 提要中。我用来解析 RSS 提要的库给了我错误的链接。但是,主要问题仍然存在。

编辑:仍然无法获得直接链接。这是我为单个条目获得的链接示例:

<link rel=​"replies" type=​"application/​atom+xml" href=​"http:​/​/​chadsharpe.blogspot.com/​feeds/​2276618748913180797/​comments/​default" title=​"Post Comments">​
<link rel=​"replies" type=​"text/​html" href=​"https:​/​/​www.blogger.com/​comment.g?blogID=4528045192864780582&postID=2276618748913180797" title=​"2 Comments">​
<link rel=​"edit" type=​"application/​atom+xml" href=​"http:​/​/​www.blogger.com/​feeds/​4528045192864780582/​posts/​default/​2276618748913180797?v=2">​
<link rel=​"self" type=​"application/​atom+xml" href=​"http:​/​/​www.blogger.com/​feeds/​4528045192864780582/​posts/​default/​2276618748913180797?v=2">​
<link rel=​"alternate" type=​"text/​html" href=​"http:​/​/​feedproxy.google.com/​~r/​Funwhenwet/​~3/​PuX-Fqz_xKE/​sharpe-watson-bomb-chris-o-jimmy.html" title=​"Sharpe, Watson, Bomb, Chris O, Jimmy">

我要的网址是:

http://chadsharpe.blogspot.com/2010/08/sharpe-watson-bomb-chris-o-jimmy.html

【问题讨论】:

    标签: javascript blogger


    【解决方案1】:

    在 blogger rest api v3 中阅读 post 对象的规范: https://developers.google.com/resources/api-libraries/documentation/blogger/v3/python/latest/blogger_v3.posts.html

    如果您使用 Python REST API v3 导入 googleapiclientgoogle_auth_oauthlib 并使用get(blogId=*, postId=*) 获取帖子对象,您要查找的属性是"url" 用于发布的帖子。但如果帖子是草稿,"url" 将保存博客的基本 URL。

    【讨论】:

      【解决方案2】:

      嗯,这可能是一个蹩脚的答案,但使用 Feedburner 提要,我可以直接链接到我的帖子。

      【讨论】:

      • 应该这么简单,这就是我很困惑的原因。有关详细信息,请参阅上面的编辑。
      【解决方案3】:

      你在 Alex 上的哪个平台?使用其中一个 GData API 对您来说是一条潜在的前进道路吗?

      我对一件事感到好奇,您博客的链接 rel="alternate" type="text/html" 链接指向 Feed Burner。您是否已将博主设置为通过 feedburner 重定向提要?对于我的测试博客,我的文本/html 替代链接直接链接到 blogspot.com:

      <link rel="alternate" type="text/html" href="http://brettmorgan-test-blawg.blogspot.com/2010/10/hello-world.html" title="Hello world"/>
      

      【讨论】:

        【解决方案4】:

        尝试更多地理解您的问题。 您可以使用“发布”标签下的 Feedburner 的“buzz-boost”在您的网站上重新发布您的博客文章的提要。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-04-06
          • 2016-03-28
          • 1970-01-01
          • 2011-08-05
          • 2017-02-20
          • 1970-01-01
          • 2017-07-25
          • 1970-01-01
          相关资源
          最近更新 更多