首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >用于RSS提要的正确MIME类型是什么?

用于RSS提要的正确MIME类型是什么?
EN

Stack Overflow用户
提问于 2009-02-27 16:56:31
回答 7查看 58.7K关注 0票数 149

为了确保与RSS阅读器和其他抓取器的兼容性,MIME类型更可取吗?

选项似乎是:

  • text/xml
  • text/rss+xml

有趣的是,Stackoverflow使用text/html。

EN

回答 7

Stack Overflow用户

回答已采纳

发布于 2009-02-27 16:58:19

都不是。我是application/rss+xml http://www.rssboard.org/rss-mime-type-application.txt

票数 252
EN

Stack Overflow用户

发布于 2011-08-10 03:13:05

其他评论者指出,唯一正确的mime类型是application/rss+xml,

但是,如果要为客户端设置accept标头,则

Accept: application/rss+xml, application/rdf+xml;q=0.8, application/atom+xml;q=0.6, application/xml;q=0.4, text/xml;q=0.4

可能是个不错的选择,因为它声明它接受RSS、Atom和XML (按降序或优先顺序)。

票数 40
EN

Stack Overflow用户

发布于 2016-04-19 11:44:56

这里有一个实用的答案:无论“正确”答案是什么(显然对此存在争议),几乎所有流行的提要都使用text/xml

以下是我检查过的一些内容:

代码语言:javascript
复制
$ for f in \
  https://feeds.feedburner.com/TechCrunch/ \
  http://feeds.bbci.co.uk/news/video_and_audio/news_front_page/rss.xml \
  http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml \
  https://daringfireball.net/thetalkshow/rss \
  http://www.npr.org/rss/podcast.php?id=381444908 \
  http://feeds.serialpodcast.org/serialpodcast \
  http://podcasts.joerogan.net/feed \
  https://feeds.feedburner.com/thetimferrissshow \
  http://feed.thisamericanlife.org/talpodcast ; do \
  curl -s -I $f | fgrep -i Content-Type: ; done
content-type:text/xml; charset=UTF-8
Content-Type: text/xml
Content-Type: text/xml
Content-Type: text/xml;charset=UTF-8
Content-Type: text/xml;charset=UTF-8
Content-Type: text/xml; charset=UTF-8
Content-Type: text/xml; charset=UTF-8
content-type:text/xml; charset=UTF-8
Content-Type: text/xml; charset=UTF-8

因此,您可以确保text/xml将被常用的RSS客户端正确解释。

票数 14
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/595616

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档