|
| 1 | +# jsonfeed-to-rss [![stability][0]][1] |
| 2 | +[![npm version][2]][3] [![build status][4]][5] [![coverage][12]][13] |
| 3 | +[![downloads][8]][9] [![js-standard-style][10]][11] |
| 4 | + |
| 5 | +Convert a JSON feed to an rss feed ([RSS 2.0.11][rss]). |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +## Installation |
| 10 | +```console |
| 11 | +$ npm install jsonfeed-to-rss |
| 12 | +``` |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +```js |
| 17 | +const jsonfeedToRSS = require('jsonfeed-to-rss') |
| 18 | +const someJSONFeed = require('./load-some-json-feed-data.json') |
| 19 | + |
| 20 | +const rssFeed = jsonfeedToRSS(someJSONFeed) // Returns an rss 2.0.11 formatted json feed |
| 21 | +``` |
| 22 | + |
| 23 | +Example input: |
| 24 | + |
| 25 | +```json |
| 26 | +{ |
| 27 | + "version": "https://jsonfeed.org/version/1", |
| 28 | + "title": "bret.io log", |
| 29 | + "home_page_url": "https://bret.io", |
| 30 | + "feed_url": "https://bret.io/feed.json", |
| 31 | + "description": "A running log of announcements, projects and accomplishments.", |
| 32 | + "next_url": "https://bret.io/2017.json", |
| 33 | + "icon": "https://bret.io/icon-512x512.png", |
| 34 | + "author": { |
| 35 | + "name": "Bret Comnes", |
| 36 | + "url": "https://bret.io", |
| 37 | + "avatar": "https://gravatar.com/avatar/8d8b82740cb7ca994449cccd1dfdef5f?size=512" |
| 38 | + }, |
| 39 | + "items": [ |
| 40 | + { |
| 41 | + "date_published": "2018-04-07T20:48:02.000Z", |
| 42 | + "content_text": "Wee wooo this is some content. \n Maybe a new paragraph too", |
| 43 | + "url": "https://bret.io/my-text-post", |
| 44 | + "id": "https://bret.io/my-text-post-2018-04-07T20:48:02.000Z" |
| 45 | + }, |
| 46 | + { |
| 47 | + "date_published": "2018-04-07T22:06:43.000Z", |
| 48 | + "content_html": "<p>Hello, world!</p>", |
| 49 | + "title": "This is a blog title", |
| 50 | + "url": "https://bret.io/my-blog-post", |
| 51 | + "external_url": "https://example.com/some-external-link", |
| 52 | + "id": "https://bret.io/my-blog-post-2018-04-07T22:06:43.000Z" |
| 53 | + } |
| 54 | + ] |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +Example output: |
| 59 | + |
| 60 | +```xml |
| 61 | +<?xml version="1.0" encoding="utf-8"?> |
| 62 | +<feed xmlns="http://www.w3.org/2005/Atom"> |
| 63 | + <title>bret.io log</title> |
| 64 | + <id>https://bret.io/feed.xml</id> |
| 65 | + <updated>2018-04-07T22:06:43.000Z</updated> |
| 66 | + <link rel="self" type="application/atom+xml" href="https://bret.io/feed.xml"/> |
| 67 | + <link rel="alternate" type="application/json" href="https://bret.io/feed.json"/> |
| 68 | + <link rel="alternate" type="text/html" href="https://bret.io"/> |
| 69 | + <link rel="next" href="https://bret.io/2017.xml"/> |
| 70 | + <author> |
| 71 | + <name>Bret Comnes</name> |
| 72 | + <uri>https://bret.io</uri> |
| 73 | + </author> |
| 74 | + <generator uri="https://github.com/bcomnes/jsonfeed-to-atom#readme" version="1.0.0">jsonfeed-to-atom</generator> |
| 75 | + <rights>© 2018 Bret Comnes</rights> |
| 76 | + <subtitle>A running log of announcements, projects and accomplishments.</subtitle> |
| 77 | + <entry> |
| 78 | + <id>https://bret.io/my-text-post-2018-04-07T20:48:02.000Z</id> |
| 79 | + <title>Wee wooo this is some content.</title> |
| 80 | + <updated>2018-04-07T20:48:02.000Z</updated> |
| 81 | + <published>2018-04-07T20:48:02.000Z</published> |
| 82 | + <content type="text">Wee wooo this is some content. |
| 83 | + Maybe a new paragraph too</content> |
| 84 | + <link rel="alternate" href="https://bret.io/my-text-post"/> |
| 85 | + </entry> |
| 86 | + <entry> |
| 87 | + <id>https://bret.io/my-blog-post-2018-04-07T22:06:43.000Z</id> |
| 88 | + <title>This is a blog title</title> |
| 89 | + <updated>2018-04-07T22:06:43.000Z</updated> |
| 90 | + <published>2018-04-07T22:06:43.000Z</published> |
| 91 | + <content type="html"> |
| 92 | + <![CDATA[<p>Hello, world!</p>]]> |
| 93 | + </content> |
| 94 | + <link rel="alternate" href="https://bret.io/my-blog-post"/> |
| 95 | + <link rel="related" href="https://example.com/some-external-link"/> |
| 96 | + </entry> |
| 97 | +</feed> |
| 98 | +``` |
| 99 | + |
| 100 | +## API |
| 101 | +### `jsonfeedToAtom(parsedJsonfeed, opts)` |
| 102 | +Coverts a parsed JSON feed into an atom feed. Returns the string of the atom feed. |
| 103 | + |
| 104 | +Opts include: |
| 105 | + |
| 106 | +```js |
| 107 | +{ |
| 108 | + // a function that returns the atom feed url |
| 109 | + feedURLFn: (feedURL, jf) => feedURL.replace(/\.json\b/, '.xml') |
| 110 | +} |
| 111 | +``` |
| 112 | + |
| 113 | +## See also |
| 114 | + |
| 115 | +- [JSON Feed: Mapping RSS and Atom to JSON Feed](https://jsonfeed.org/mappingrssandatom) |
| 116 | +- [AtomEnabled: Developers > Syndication](https://web.archive.org/web/20160113103647/http://atomenabled.org/developers/syndication/#link) |
| 117 | +- [bcomnes/generate-feed](https://github.com/bcomnes/generate-feed) |
| 118 | + |
| 119 | +## License |
| 120 | +[MIT](https://tldrlegal.com/license/mit-license) |
| 121 | + |
| 122 | +[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square |
| 123 | +[1]: https://nodejs.org/api/documentation.html#documentation_stability_index |
| 124 | +[2]: https://img.shields.io/npm/v/jsonfeed-to-atom.svg?style=flat-square |
| 125 | +[3]: https://npmjs.org/package/jsonfeed-to-atom |
| 126 | +[4]: https://img.shields.io/travis/bcomnes/jsonfeed-to-atom/master.svg?style=flat-square |
| 127 | +[5]: https://travis-ci.org/bcomnes/jsonfeed-to-atom |
| 128 | +[8]: http://img.shields.io/npm/dm/jsonfeed-to-atom.svg?style=flat-square |
| 129 | +[9]: https://npmjs.org/package/jsonfeed-to-atom |
| 130 | +[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square |
| 131 | +[11]: https://github.com/feross/standard |
| 132 | +[12]: https://img.shields.io/coveralls/bcomnes/jsonfeed-to-atom/master.svg?style=flat-square |
| 133 | +[13]: https://coveralls.io/github/bcomnes/jsonfeed-to-atom |
| 134 | +[rss]: http://www.rssboard.org/rss-specification |
| 135 | + |
| 136 | + |
| 137 | +RSS LINKS: |
| 138 | + |
| 139 | +http://www.rssboard.org/rss-specification |
| 140 | +https://jsonfeed.org/mappingrssandatom |
| 141 | +https://jsonfeed.org/version/1 |
| 142 | +http://www.rssboard.org/rss-profile |
| 143 | +https://validator.w3.org/feed/docs/rss2.html |
| 144 | +http://web.resource.org/rss/1.0/modules/content/ |
| 145 | + |
| 146 | + |
| 147 | +ITUNES RSS LINKS |
| 148 | + |
| 149 | +https://help.apple.com/itc/podcasts_connect/#/itc1723472cb |
| 150 | +https://help.apple.com/itc/podcasts_connect/#/itcbaf351599 |
| 151 | +https://help.apple.com/itc/podcasts_connect/#/itca5b22233a |
| 152 | +https://gist.github.com/bcomnes/defb825462722d96da7b877e22dd7588 |
| 153 | +https://www.apple.com/itunes/marketing-on-podcasts/identity-guidelines.html#messaging-and-style |
0 commit comments