-
I ran into a problem today, where I was trying to get a list of all the episodes of the Shelved By Genre podcast, to see which I might want to listen to.
Their website didn’t have the full list, and while Spotify did, Spotify’s information-sparse UI meant I had to scroll for what felt like forever to get all the titles.
I ended up going to the podcast’s RSS feed, which had all the info I needed in one convenient place! But how to turn the XML into the list I wanted?
My first instinct was regex, and that would’ve worked, but then I remembered that the browser has a built-in XML parser!
Enter the following into your browser dev console (which you can open from the RSS page itself), and voilà !
const xml = `paste xml here`; const parser = new DOMParser(); const titles = [ ...parser .parseFromString(xml, 'text/xml') .querySelectorAll('item title') ] .map(x => x.innerHTML) .join('\n'); copy(titles);Discuss on Mastodon