xml - 如何在 shell 脚本中解析 rss-feeds/xml

标签 xml bash rss scripting

我想解析 rss 提要并下载 podcasts在我的 ReadyNas 上,它无论如何都在 24/7 运行。

所以我正在考虑让一个 shell 脚本定期检查提要并生成 wget 来下载文件。

进行解析的最佳方法是什么?

谢谢!

最佳答案

有时一个简单的 shell 标准命令就足够了:

 wget -q -O- "http://www.rss-specifications.com/rss-podcast.xml" | grep -o '<enclosure url="[^"]*' | grep -o '[^"]*$' | xargs wget -c

当然这并不是在所有情况下都有效,但通常已经足够了。

关于xml - 如何在 shell 脚本中解析 rss-feeds/xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/443991/

相关文章:

c++ - 通过 TinyXML 深度复制 XML

java - 如何在 XML 中嵌入二进制数据?

bash - 如何在 bash 中控制 IFS 分词

html - 在 RSS 中显示 HTML

c# - 读取 DataTable 中的 XML 数据和架构

android - 如何更改 EditText 中的线条颜色

git clone 致命的 : cannot create work tree dir permission denied

bash - 在 Bash PS1 提示符中动态更改主机名

android - 推送新 rss 提要的通知?

wordpress - 新浪微博在 Wordpress 中提供?