gpt4 book ai didi

http - 如何从网站获取提要 URL?

转载 作者:可可西里 更新时间:2023-11-01 17:24:17 29 4
gpt4 key购买 nike

根据 the official documentation , 正确设置的网站应在礼貌询问时指出其 RSS/Atom 提要的 URL:

GET / HTTP/1.1
Host: example.com
Accept: application/rss+xml, application/xhtml+xml, text/html

When an HTTP server (or server-side script) gets this, it should redirect the HTTP client to the feed. It should do this with an HTTP 302 Found. Something like:

HTTP/1.1 302 Found
Location: http://example.com/feed

我想得到这个回应,但运气不好:

request(
{ method: 'GET',
url: 'https://stackoverflow.com',
followRedirect :false,
accept: ['application/rss+xml', 'application/xhtml+xml', 'text/html']
}, function (error, response, body) {
console.log('statusCode: ', response.statusCode);
}
);

产量

statusCode: 200

如何制定我的请求,以便网站使用 Feed URL 进行响应?

最佳答案

网站将其 RSS 提要从 HTTP 请求发送回主页并不常见> 标题。您链接的关于 Mozilla 的文档是我作为开发人员多年参与 RSS 工作后从未见过的建议。

站点识别其 RSS 提要的一种更成熟和广泛采用的方法是一种称为 RSS Autodiscovery 的技术。 .打开站点的主页并在 HEAD 部分中查找此标记:

<link rel="alternate" type="application/rss+xml" title="RSS"
href="http://feeds.example.com/rss-feed">

type 属性可以是 RSS、Atom 或 JSONFeed 提要的任何 MIME 类型。

关于http - 如何从网站获取提要 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49479712/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com