为了确保与RSS阅读器和其他抓取器的兼容性,MIME类型更可取吗?
选项似乎是:
有趣的是,Stackoverflow使用text/html。
发布于 2009-02-27 16:58:19
都不是。我是application/rss+xml
http://www.rssboard.org/rss-mime-type-application.txt
发布于 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 (按降序或优先顺序)。
发布于 2016-04-19 11:44:56
这里有一个实用的答案:无论“正确”答案是什么(显然对此存在争议),几乎所有流行的提要都使用text/xml
。
以下是我检查过的一些内容:
$ 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客户端正确解释。
https://stackoverflow.com/questions/595616
复制相似问题