我有这段代码,我从网站上选择RSS-feed。这个想法是,每个星期一,每周,RSS-feed在网站上发生变化。在我的代码中自动更新RSS的最简单方法是什么?我在我的项目中使用JavaScript和XML。
提前致谢
编辑:发布当前代码;
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title></title>
<!-- <description></description>
<link>http://www.sodexo.fi/</link>
<language>fi</language>
<copyright>Sodexo</copyright>
<pubDate>Mon, 17 Apr 2017 12:00:00 +0300</pubDate>
<lastBuildDate>Mon, 17 Apr 2017 12:00:00 +0300</lastBuildDate>
<generator>sxomenuoutput</generator>
<ttl>60</ttl> -->
<atom:link href="http://www.sodexo.fi/ruokalistat/rss/weekly_rss/873/fi" rel="self" type="application/rss+xml"/>
<item>
<title></title>
<description>
<![CDATA[
// Content that changes each week.
]]>
</description>
<!-- <link>http://www.sodexo.fi/frami</link> -->
<guid isPermaLink="false">http://www.sodexo.fi/frami/1492376400</guid>
<!--<pubDate>Mon, 17 Apr 2017 12:00:00 +0300</pubDate>
<source url="http://www.sodexo.fi/">Sodexo.fi</source> -->
</item>
</channel>
</rss>
澄清;位于CDATA内部的内容每周都会更改。有没有办法自动更新我的代码中的更改?
答案 0 :(得分:-2)
平台? 每个星期一更新Rss?网站跨域?
如果不是跨域,请在加载页面时使用ajax更新
如果是跨域,请使用您的程序(C#,python ...)或工具(curl,wget ...)获取RSS数据,设置schedue进行更新,从api返回页面。
OS任务工具: windows:任务计划程序 linux:crontab