【PS】PowerShell 脚本读取 rss 新闻(转载)
代码
$sapi = New-Object -Com Sapi.SpVoice
$WebClient = New-Object System.Net.WebClient
#$WebClient.Encoding=[System.Text.Encoding]::GBK
$rss = [XML]($WebClient.DownloadString("http://news.com/special//rss_newstop.xml"))
foreach($item in $rss.rss.channel.Item){
$title = $item.title.InnerText
$content = $item.description.InnerText.Replace(" ","")
$title
$sapi.Speak($title)
$content
$sapi.Speak($content + " ")
}
$WebClient = New-Object System.Net.WebClient
#$WebClient.Encoding=[System.Text.Encoding]::GBK
$rss = [XML]($WebClient.DownloadString("http://news.com/special//rss_newstop.xml"))
foreach($item in $rss.rss.channel.Item){
$title = $item.title.InnerText
$content = $item.description.InnerText.Replace(" ","")
$title
$sapi.Speak($title)
$content
$sapi.Speak($content + " ")
}