如何将RSS频道项目的列表合并到一个页面中,而不是一个页面中的每个频道?
在图像中显示了一个RSS频道列表,它们仅在页面中显示每个频道,我想合并所有RSS频道到一个页面
const urlsData = ['example1.xml','channel2.xml','example3.xml']
for (var ii = 0; ii < urlsData.length; ii++) {
Promise.all(fetch('https://rss.app/feeds/'+urlsData[ii])
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(data => {
this.xmlContent = [].slice.call([...data.getElementsByTagName('item')])
console.log(this.xmlContect)
})
const urlsData = ['example1.xml','channel2.xml','example3.xml']
for (var ii = 0; ii < urlsData.length; ii++) {
Promise.all(fetch('https://rss.app/feeds/'+urlsData[ii])
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(data => {
this.xmlContent = [].slice.call([...data.getElementsByTagName('item')])
console.log(this.xmlContect)
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Promise.All
的想法是将作为参数作为...承诺的数组?无论如何,这应该起作用(测试)。The idea of
Promise.all
is to get as argument an array of ... promises? Anyhow this should work (tested).