javascript:
(async () => {
const rss = [
'https://www.upwork.com/ab/feed/jobs/rss?api_params=1&orgUid=424151849314844673&paging=0%3B10&q=title%3A%28cto%29&securityToken=925852acb79387c67d921519fd18fed25f501cc940c417db8a53c2ee9530a5a4c9fb27ac83bd44992aaa39d2509a1aa6e7053c4795d714657bc4ac744b268718&sort=recency&userUid=424151849306456064&user_location_match=1'
];
let htm = '<section id="feed">';
rss.map(async feed => {
console.log('feed', feed);
const res = await fetch(feed);
const xml = await res.text();
console.log('xml', xml);
const node = new window.DOMParser().parseFromString(xml, "text/xml")
const items = [...node.querySelectorAll('item')];
items.map(item => {
const link = item.querySelector('link');
const title = item.querySelector('title');
htm += `
<div class="item">${link} - ${title}</div>
`;
});
});
htm += '</section>';
document.body.insertAdjacentHTML('beforeend', htm);
})();
Here is the one liner:
javascript: (async () => {const rss = ['https://www.upwork.com/ab/feed/jobs/rss?api_params=1&orgUid=424151849314844673&paging=0%3B10&q=title%3A%28cto%29&securityToken=925852acb79387c67d921519fd18fed25f501cc940c417db8a53c2ee9530a5a4c9fb27ac83bd44992aaa39d2509a1aa6e7053c4795d714657bc4ac744b268718&sort=recency&userUid=424151849306456064&user_location_match=1']; let htm = '<section id="feed">'; rss.map(async feed => {console.log('feed', feed); const res = await fetch(feed); const xml = await res.text(); console.log('xml', xml); const node = new window.DOMParser().parseFromString(xml, "text/xml") const items = [...node.querySelectorAll('item')]; items.map(item => {const link = item.querySelector('link'); const title = item.querySelector('title'); htm += ` <div class="item">${link} - ${title}</div> `; }); }); htm += '</section>'; document.body.insertAdjacentHTML('beforeend', htm); })();
I'm just trying to fetch and RSS feed and show results in a div on the page. But it throws an error on the first line with const