如何使用帖子 ID 链接到 Blogger 帖子?

发布于 2024-09-16 09:56:50 字数 1369 浏览 4 评论 0原文

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

我的最终目标是将帖子从我的 Blogger 网站提取到我自己的网站,然后能够永久链接到实际的帖子。我通过使用 Javascript 解析博客的 RSS 提要来完成此操作。不幸的是,RSS 提要中的“链接”字段不是博客文章的 URL...而是评论提要的 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">

我想要的 URL 是:

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

If I have the ID of a post on a Blogger blog, how do I translate that ID into a URL which links to the post?

My ultimate goal is to pull posts from my Blogger site to my own site, and then be able to permalink to the actual posts. I'm doing this by parsing the RSS feed for my blog with Javascript. Unfortunately the "link" field in the RSS feed isn't a URL to the blog post... it's a URL to a feed of the comments. I can, however, grab the post ID, which I assumed would be a good way to find the post URL. Any other suggestions appreciated.

Edit: Upon further inspection, I found that the actual post link IS included in the RSS feed. The library I'm using to parse the RSS feed was giving me the wrong link. However, the main question still stands.

Edit: Still can't get a direct link. Here's an example of the links I get for a single entry:

<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">

The URL I want is:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

左耳近心 2024-09-23 09:56:50

阅读 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 import googleapiclientgoogle_auth_oauthlib
并使用 get(blogId=*, postId=*) 获取帖子对象,您要查找的属性是已发布帖子的 "url" 。但如果帖子是草稿,"url" 将保存博客的基本 url。

Reading the spec for post object in blogger rest api v3:
https://developers.google.com/resources/api-libraries/documentation/blogger/v3/python/latest/blogger_v3.posts.html

If you are using Python rest API v3 import googleapiclient and google_auth_oauthlib
and use get(blogId=*, postId=*) to get the post object the attribute you are looking for is "url" for a published post. But if the post is a draft "url" will hold the base url for the blog.

烟若柳尘 2024-09-23 09:56:50

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

Well, this may be a lame answer but using the Feedburner feeds I get a direct link to my posts.

缪败 2024-09-23 09:56:50

你在 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"/>

What platform are you on Alex? Is using one of the GData APIs a potential path forward for you?

I'm curious about one thing, the link rel="alternate" type="text/html" link for your blog is pointing at feed burner. Do you have your blogger set up to redirect feeds through feedburner? For my test blog my alternate link for text/html links directly to blogspot.com:

<link rel="alternate" type="text/html" href="http://brettmorgan-test-blawg.blogspot.com/2010/10/hello-world.html" title="Hello world"/>
南渊 2024-09-23 09:56:50

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

Trying to understand your question a bit more.
You can use Feedburner 'buzz-boost' under the 'Publicize' tab to repost a feed of your blog posts on your site.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文