Update to fix some RSS issues with hugo

This commit is contained in:
William Moore 2023-06-14 03:53:56 -05:00
parent 7b10128e8a
commit 73415a4a0d

View File

@ -39,8 +39,9 @@ export class RSS extends LitElement {
const allItems: RSSItem[] = []; const allItems: RSSItem[] = [];
const response = await fetch(url, options); const response = await fetch(url, options);
const result = await response.text(); const result = await response.text();
const rss = (new DOMParser()).parseFromString(result, 'text/xml'); const rss = (new DOMParser()).parseFromString(result.trim(), 'text/xml');
const channel = rss.getElementsByTagName('channel')[0] ?? null; const channel = rss.getElementsByTagName('channel')[0] ?? null;
console.log(rss);
for (let channelI = 0; channelI < channel?.children?.length; channelI++) { for (let channelI = 0; channelI < channel?.children?.length; channelI++) {
const channelChild = channel?.children?.item(channelI); const channelChild = channel?.children?.item(channelI);
@ -77,7 +78,6 @@ export class RSS extends LitElement {
console.error(error); console.error(error);
} }
// setTimeout(() => this.pullValueFromBackend(), 1000);
} }
static override styles = [ static override styles = [