fix: Correctly parse XML response from CORS proxy in RSS ticker
This commit is contained in:
@@ -73,13 +73,13 @@
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
console.log('Proxy response:', response);
|
||||
if (response.ok) return response.json();
|
||||
if (response.ok) return response.text();
|
||||
throw new Error('Network response was not ok.');
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Raw data from proxy:', data);
|
||||
.then(xmlText => {
|
||||
console.log('Raw XML from proxy:', xmlText);
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(data.contents, "text/xml");
|
||||
const xmlDoc = parser.parseFromString(xmlText, "text/xml");
|
||||
console.log('Parsed XML Doc:', xmlDoc);
|
||||
const items = xmlDoc.querySelectorAll("item");
|
||||
let headlines = [];
|
||||
|
||||
Reference in New Issue
Block a user