Skip to content

Instantly share code, notes, and snippets.

Created Aug 8, 2017
What would you like to do?
function cleanUp(data) {
// Empty array to add cleaned up elements to
const items = []
// We are only interested in children of the 'channel' element
const channel =
channel.item.forEach(element => {
item = {
title: element.title,
description: element.description,
date: element.pubDate,
creator: element['dc:creator'],
media: []
// Iterates through all the elements named '<media:content>' extracting the info we care about
element['media:content'].forEach(mediaContent => {{
url: mediaContent.$.url, // Parses media:content url attribute
credit: mediaContent['media:credit']._ // Parses media:credit tag content
return items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment