我正在编写一个VBScript文件(* .vbs),该文件应从此RSS获取数据并将其导出到文本文件。我搜索了互联网,但没有发现这一点。 有没有人知道用于创建此类功能的任何来源?
P.S。 RSS只显示日期的货币汇率。感谢。
答案 0 :(得分:1)
为了帮助您入门,您可以在vbscript
DomDocument
,因为RSS是XML Option Explicit
dim xmldoc: set xmldoc = CreateObject("MSXML2.DomDocument.6.0")
xmldoc.async = false
xmldoc.setProperty "SelectionLanguage", "XPath"
xmldoc.load "https://www.cba.am/_layouts/rssreader.aspx?rss=280F57B8-763C-4EE4-90E0-8136C13E47DA"
' obviously, you need to change this to your requirements
' here, we're just getting every item node
dim items: set items = xmldoc.selectNodes("//item")
dim fso: set fso = CreateObject("Scripting.FileSystemObject")
dim stream: set stream = fso.OpenTextFile("data.txt", 2, true)
dim item
for each item in items
' again, this changes to your requirements
' this just writes the text content of all the items and child
' nodes
stream.WriteLine item.text
next 'item
stream.Close