dylang / node-rss

RSS feed generator for Node.
https://npmjs.org/package/rss
MIT License
999 stars 133 forks source link

confusing documentation: first time running app fails #39

Closed shuhblam closed 9 years ago

shuhblam commented 9 years ago

maybe you can help me understand how to fix this

screen shot 2015-01-08 at 6 22 36 pm

running app.js:

var RSS = require('rss');

/* lets create an rss feed */
var feed = new RSS({
    title: 'title',
    description: 'description',
    feed_url: 'http://example.com/rss.xml',
    site_url: 'http://example.com',
    image_url: 'http://example.com/icon.png',
    docs: 'http://example.com/rss/docs.html',
    managingEditor: 'Dylan Greene',
    webMaster: 'Dylan Greene',
    copyright: '2013 Dylan Greene',
    language: 'en',
    categories: ['Category 1','Category 2','Category 3'],
    pubDate: 'May 20, 2012 04:00:00 GMT',
    ttl: '60',
    customNamespaces: {
      'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd'
    },
    custom: [
      {'itunes:subtitle': 'A show about everything'},
      {'itunes:author': 'John Doe'},
      {'itunes:summary': 'All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our podcast in the Podcasts app or in the iTunes Store'},
      {'itunes:owner': [
        {'itunes:name': 'John Doe'},
        {'itunes:email': 'john.doe@example.com'}
      ]},
      {'itunes:image': {
        _attr: {
          href: 'http://example.com/podcasts/everything/AllAboutEverything.jpg'
        }
      }},
      {'itunes:category': [
        {_attr: {
          text: 'Technology'
        }},
        {'itunes:category': {
          _attr: {
            text: 'Gadgets'
          }
        }}
      ]}
    ]
});

/* loop over data and add to feed */
feed.item({
    title:  'item title',
    description: 'use this for the content. It can include html.',
    url: 'http://example.com/article4?this&that', // link to the item
    guid: '1123', // optional - defaults to url
    categories: ['Category 1','Category 2','Category 3','Category 4'], // optional - array of item categories
    author: 'Guest Author', // optional - defaults to feed author property
    date: 'May 27, 2012', // any format that js Date can parse.
    lat: 33.417974, //optional latitude field for GeoRSS
    long: -111.933231, //optional longitude field for GeoRSS
    enclosure: {url:'...', file:'path-to-file'}, // optional enclosure
    custom: [
      {'itunes:author': 'John Doe'},
      {'itunes:subtitle': 'A short primer on table spices'},
      {'itunes:image': {
        _attr: {
          href: 'http://example.com/podcasts/everything/AllAboutEverything/Episode1.jpg'
        }
      }},
      {'itunes:duration': '7:04'}
    ]
});

// cache the xml to send to clients
var xml = feed.xml();
djthread commented 9 years ago

Looks to me like the enclosure filename you specify doesn't exist.

  enclosure: {url:'...', file:'path-to-file'}, // optional enclosure
shuhblam commented 9 years ago

@djthread i guess i missed this in the readme. do you have to specify a file to hold the rss feed?

dylang commented 9 years ago

@coleGillespie

Look at this line from the example:

enclosure: {url:'...', file:'path-to-file'}, // optional enclosure

Try commenting it out.

dylang commented 9 years ago

do you have to specify a file to hold the rss feed?

No, the filename is only for the optional enclosure.

@djthread Thanks for providing support!

shuhblam commented 9 years ago

doh, duh. thanks for specifying. awesome module!