lib/parser.js
function parseImage (node, nodeType, feedType) {
  var image, mediaGroup, mediaContent;

  if (node.image && (image = utils.get(utils.get(node.image, 'url') || node.image))) {
    return image;
  } else if (nodeType === 'meta') {
    return utils.getAttr(node['itunes:image'], 'href') || utils.getAttr(node['media:thumbnail'], 'url') || utils.get(node.logo);
  }
  else if (nodeType === 'item') {
    mediaGroup = node['media:group'];
    mediaContent = node['media:content'];

    //search for media:thumbnail url in the following order:.  node, node['media:content'], node['media:group'], node['media:group']['media:content']
    if (image = utils.getAttr(node['media:thumbnail'] || utils.get(mediaContent || mediaGroup, 'media:thumbnail') ||
      utils.get(mediaGroup && mediaGroup['media:content'], 'media:thumbnail'), 'url')) {
      return image;
    }
    //search for itunes:image href
    else if (image = utils.getAttr(node['itunes:image'], 'href')) {
      return image;
    }
    //fall back on node['media:content'] or node['media:group']['media:content'] url
    else if (image = utils.getAttr(mediaContent || (mediaGroup && mediaGroup['media:content']))) {
      if (image.url && (image.medium === 'image' || (image.type && image.type.indexOf('image') === 0) || /\.(jpg|jpeg|png|gif)/.test(image.url))) {
        return image.url;
      }
    }
  }
}
function parseImage (node, nodeType, feedType) {
  var image, mediaGroup, mediaContent;

  if (node.image && (image = utils.get(utils.get(node.image, 'url') || node.image))) {
    return image;
  } else if (nodeType === 'meta') {
    return utils.getAttr(node['itunes:image'], 'href') || utils.getAttr(node['media:thumbnail'], 'url') || utils.get(node.logo);
  }
  else if (nodeType === 'item') {
    mediaGroup = node['media:group'];
    mediaContent = node['media:content'];

    //search for media:thumbnail url in the following order:.  node, node['media:content'], node['media:group'], node['media:group']['media:content']
    if (image = utils.getAttr(node['media:thumbnail'] || utils.get(mediaContent || mediaGroup, 'media:thumbnail') ||
      utils.get(mediaGroup && mediaGroup['media:content'], 'media:thumbnail'), 'url')) {
      return image;
    }
    //search for itunes:image href
    else if (image = utils.getAttr(node['itunes:image'], 'href')) {
      return image;
    }
    //fall back on node['media:content'] or node['media:group']['media:content'] url
    else if (image = utils.getAttr(mediaContent || (mediaGroup && mediaGroup['media:content']))) {
      if (image.url && (image.medium === 'image' || (image.type && image.type.indexOf('image') === 0) || /\.(jpg|jpeg|png|gif)/.test(image.url))) {
        return image.url;
      }
    }
  }
}
function parseImage ( node , nodeType , feedType ) { var image , mediaGroup , mediaContent ; if ( node . image && ( image = utils . get ( utils . get ( node . image , 'url' ) || node . image ) ) ) { return image ; } else if ( nodeType === 'meta' ) { return utils . getAttr ( node [ 'itunes:image' ] , 'href' ) || utils . getAttr ( node [ 'media:thumbnail' ] , 'url' ) || utils . get ( node . logo ) ; } else if ( nodeType === 'item' ) { mediaGroup = node [ 'media:group' ] ; mediaContent = node [ 'media:content' ] ; //search for media:thumbnail url in the following order:.  node, node['media:content'], node['media:group'], node['media:group']['media:content'] if ( image = utils . getAttr ( node [ 'media:thumbnail' ] || utils . get ( mediaContent || mediaGroup , 'media:thumbnail' ) || utils . get ( mediaGroup && mediaGroup [ 'media:content' ] , 'media:thumbnail' ) , 'url' ) ) { return image ; } //search for itunes:image href else if ( image = utils . getAttr ( node [ 'itunes:image' ] , 'href' ) ) { return image ; } //fall back on node['media:content'] or node['media:group']['media:content'] url else if ( image = utils . getAttr ( mediaContent || ( mediaGroup && mediaGroup [ 'media:content' ] ) ) ) { if ( image . url && ( image . medium === 'image' || ( image . type && image . type . indexOf ( 'image' ) === 0 ) || / \.(jpg|jpeg|png|gif) / . test ( image . url ) ) ) { return image . url ; } } } }
Parses the image of a meta or item node.

- image
- highest priority for RSS feeds in both meta nd item nodes
- most frequent in meta nodes, less frequent in item nodes
- itunes:image
- second most frequent in RSS feeds for meta nodes
- less frequent and lesser priority than media:thumbnail in RSS feeds for item nodes
- media:thumbnail
- second highest priority for item nodes for RSS and ATOM feeds
- third most frequent in meta nodes for RSS and ATOM feeds
- for item nodes, the media:thumbnail is searched for in the main node, node['media:content'],
node['media:group'], and node['media:group']['media:content'] respectively
- media:content
- url attr is used as a fallback if media:thumbnail is not available.  Since medi:content can also contain non
images such as videos, extra logic must be performed to guarantee an image
- logo
- very infrequent but sometimes found in ATOM feeds for meta nodes


@param node
@param nodeType
@param feedType
@returns {*}
Parses the image of a meta or item node .