reallysimple 0.4.6 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
- "name": "reallysimple",
3
- "description": "Reads an RSS-like feed and calls back with a JavaScript structure, hiding all the history. It really is simple. ;-)",
4
- "version": "0.4.6",
2
+ "name": "reallysimple",
3
+ "description": "A Node package that reads RSS-like feeds and calls back with a simple, consistent JavaScript object. Easy to use, hides the history.",
4
+ "version": "0.4.9",
5
5
  "author": "Dave Winer <dave@scripting.com>",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "reallysimple.js"
9
- ],
9
+ ],
10
10
  "main": "reallysimple.js",
11
11
  "repository": {
12
12
  "type": "git",
13
13
  "url": "https://github.com/scripting/reallysimple.git"
14
- },
15
- "dependencies" : {
16
- "opml": "*",
14
+ },
15
+ "dependencies": {
16
+ "davefeedread": "^0.5.19",
17
17
  "daveutils": "*",
18
- "davefeedread": "*"
19
- },
18
+ "opml": "^0.4.24"
19
+ },
20
20
  "engines": {
21
21
  "node": "*"
22
- }
23
22
  }
23
+ }
package/readme.md CHANGED
@@ -1,66 +1,28 @@
1
1
  # reallysimple
2
2
 
3
- JavaScript code to read a feed. Calls back with a simple JavaScript object, easily represented in JSON. Hides all the history.
3
+ A Node package that reads RSS-like feeds and calls back with a simple, consistent JavaScript object. Easy to use, hides the history.
4
4
 
5
- #### What formats are supported?
6
-
7
- RSS, Atom, and RDF.
8
-
9
- #### Why?
10
-
11
- I wanted to make reading a feed from a JavaScript app as easy as possible.
12
-
13
- To hide all the history to get it out of your way.
5
+ #### Code example
14
6
 
15
- If developers can quickly put together an app that uses feeds, people will try out more ideas, add feed support to more apps.
7
+ I always like to see the code first...
16
8
 
17
- I needed to simplify feed reading for the scripting system in Drummer. For scripting, simplicity is everything. Why not share the simplicity with lower level code.
9
+ ```javascript
18
10
 
19
- There probably is a small tradeoff in performance, you can probably write faster code by going straight to the feedparser level. And that's fine for applications that require the maximum performance, perhaps where you're reading a thousand feeds per sectond.
11
+ Here's <a href="https://github.com/scripting/reallysimple/blob/main/example/test.json">the file</a> that's created when you run the code.
20
12
 
21
- #### A coding example
13
+ #### Why?
22
14
 
23
- Here's how you call the package.
15
+ I needed a simple routine to call when I wanted to read a feed.
24
16
 
25
- ```javascript
17
+ #### What formats are supported?
26
18
 
27
- Here's <a href="https://github.com/scripting/reallysimple/blob/main/example/test.json">the file</a> that's created when you run that code.
19
+ RSS, Atom, and RDF.
28
20
 
29
21
  #### What we build on
30
22
 
31
23
  Thanks to Dan MacTough for the <a href="https://www.npmjs.com/package/feedparser">feedparser</a> package.
32
24
 
33
- It also builds on the davefeedread package, which simplifies the programming interface to feedparser.
34
-
35
- This package further simplifies the struct returned by <a href="https://www.npmjs.com/package/davefeedread">davefeedread</a>.
36
-
37
- #### Work notes
38
-
39
- 4/7/22; 11:37:16 AM by DW
40
-
41
- Clean up the readme file. Simplify the example app. Review docs. Start to invite collaborators to the repo, still private.
42
-
43
- 3/21/22; 10:19:22 AM by DW
44
-
45
- Reviewing the way we represent links in items in the API.
46
-
47
- The question is this -- how can we get a link to the item from the item.
48
-
49
- The answer, on reflection -- rely on the link element as the permalink.
50
-
51
- 3/7/22; 10:27:47 AM by DW
52
-
53
- Start the reallysimple repo. Publish the NPM package.
54
-
55
- 3/6/22; 11:27:52 AM by DW
56
-
57
- It now understands various elements from the source namespace, including source:account, source:localtime and source:outline.
58
-
59
- Started a new private GitHub repo for the project and saved the files.
60
-
61
- Added it to my NPM sub-menu, this is going to be a supported project.
62
-
63
25
  #### Comments, questions?
64
26
 
65
- Please post your comments and questions in the <a href="https://github.com/scripting/reallysimple/issues/new">issues section</a> of this repo.
27
+ Post comments and questions in the <a href="https://github.com/scripting/reallysimple/issues/new">issues section</a> of this repo.
66
28
 
package/readme.opml CHANGED
@@ -2,7 +2,7 @@
2
2
  <opml version="2.0">
3
3
  <head>
4
4
  <title>readme.md</title>
5
- <dateModified>Thu, 07 Apr 2022 15:38:10 GMT</dateModified>
5
+ <dateModified>Sat, 11 Jun 2022 20:01:27 GMT</dateModified>
6
6
  <expansionState></expansionState>
7
7
  <vertScrollState>1</vertScrollState>
8
8
  <windowTop>300</windowTop>
@@ -12,48 +12,24 @@
12
12
  </head>
13
13
  <body created="Sat, 05 Mar 2022 16:54:13 GMT" text="readme.md">
14
14
  <outline created="Sat, 05 Mar 2022 16:54:15 GMT" text="# reallysimple">
15
- <outline created="Mon, 07 Mar 2022 15:05:45 GMT" text="JavaScript code to read a feed. Calls back with a simple JavaScript object, easily represented in JSON. Hides all the history."></outline>
15
+ <outline created="Sat, 11 Jun 2022 15:59:23 GMT" text="A Node package that reads RSS-like feeds and calls back with a simple, consistent JavaScript object. Easy to use, hides the history."></outline>
16
16
  </outline>
17
- <outline created="Thu, 17 Mar 2022 15:42:49 GMT" text="#### What formats are supported?">
18
- <outline created="Thu, 17 Mar 2022 15:42:57 GMT" text="RSS, Atom, and RDF."></outline>
17
+ <outline created="Sat, 11 Jun 2022 16:24:18 GMT" text="#### Code example">
18
+ <outline created="Sat, 11 Jun 2022 16:20:10 GMT" text="I always like to see the code first..."></outline>
19
+ <outline text="&lt;%includeExample (&quot;example1&quot;)%&gt;"></outline>
20
+ <outline created="Mon, 07 Mar 2022 15:10:30 GMT" text="Here's &lt;a href=&quot;https://github.com/scripting/reallysimple/blob/main/example/test.json&quot;&gt;the file&lt;/a&gt; that's created when you run the code. "></outline>
19
21
  </outline>
20
- <outline text="#### Why?">
21
- <outline created="Thu, 17 Mar 2022 15:40:05 GMT" text="I wanted to make reading a feed from a JavaScript app as easy as possible. "></outline>
22
- <outline created="Thu, 17 Mar 2022 15:40:29 GMT" text="To hide all the history to get it out of your way. "></outline>
23
- <outline created="Mon, 07 Mar 2022 15:16:54 GMT" text="If developers can quickly put together an app that uses feeds, people will try out more ideas, add feed support to more apps."></outline>
24
- <outline created="Mon, 07 Mar 2022 15:17:44 GMT" text="I needed to simplify feed reading for the scripting system in Drummer. For scripting, simplicity is everything. Why not share the simplicity with lower level code."></outline>
25
- <outline created="Mon, 07 Mar 2022 15:18:12 GMT" text="There probably is a small tradeoff in performance, you can probably write faster code by going straight to the feedparser level. And that's fine for applications that require the maximum performance, perhaps where you're reading a thousand feeds per sectond. "></outline>
22
+ <outline created="Sat, 11 Jun 2022 16:00:30 GMT" text="#### Why?">
23
+ <outline created="Sat, 11 Jun 2022 16:00:36 GMT" text="I needed a simple routine to call when I wanted to read a feed. "></outline>
26
24
  </outline>
27
- <outline created="Mon, 07 Mar 2022 15:11:02 GMT" text="#### A coding example">
28
- <outline created="Mon, 07 Mar 2022 15:11:09 GMT" text="Here's how you call the package."></outline>
29
- <outline text="&lt;%includeExample (&quot;example1&quot;)%&gt;"></outline>
30
- <outline created="Mon, 07 Mar 2022 15:10:30 GMT" text="Here's &lt;a href=&quot;https://github.com/scripting/reallysimple/blob/main/example/test.json&quot;&gt;the file&lt;/a&gt; that's created when you run that code. "></outline>
25
+ <outline created="Thu, 17 Mar 2022 15:42:49 GMT" text="#### What formats are supported?">
26
+ <outline created="Thu, 17 Mar 2022 15:42:57 GMT" text="RSS, Atom, and RDF."></outline>
31
27
  </outline>
32
28
  <outline created="Mon, 07 Mar 2022 15:25:06 GMT" text="#### What we build on">
33
29
  <outline created="Mon, 07 Mar 2022 15:25:07 GMT" text="Thanks to Dan MacTough for the &lt;a href=&quot;https://www.npmjs.com/package/feedparser&quot;&gt;feedparser&lt;/a&gt; package."></outline>
34
- <outline created="Mon, 07 Mar 2022 15:25:33 GMT" text="It also builds on the davefeedread package, which simplifies the programming interface to feedparser."></outline>
35
- <outline created="Thu, 17 Mar 2022 15:46:06 GMT" text="This package further simplifies the struct returned by &lt;a href=&quot;https://www.npmjs.com/package/davefeedread&quot;&gt;davefeedread&lt;/a&gt;."></outline>
36
- </outline>
37
- <outline created="Sat, 05 Mar 2022 17:30:26 GMT" text="#### Work notes">
38
- <outline created="Thu, 07 Apr 2022 15:37:15 GMT" text="4/7/22; 11:37:16 AM by DW">
39
- <outline created="Thu, 07 Apr 2022 15:37:17 GMT" text="Clean up the readme file. Simplify the example app. Review docs. Start to invite collaborators to the repo, still private."></outline>
40
- </outline>
41
- <outline created="Mon, 21 Mar 2022 14:19:22 GMT" text="3/21/22; 10:19:22 AM by DW">
42
- <outline created="Mon, 21 Mar 2022 14:19:22 GMT" text="Reviewing the way we represent links in items in the API. "></outline>
43
- <outline created="Mon, 21 Mar 2022 14:27:17 GMT" text="The question is this -- how can we get a link to the item from the item. "></outline>
44
- <outline created="Mon, 21 Mar 2022 14:27:44 GMT" text="The answer, on reflection -- rely on the link element as the permalink. "></outline>
45
- </outline>
46
- <outline created="Mon, 07 Mar 2022 15:27:46 GMT" text="3/7/22; 10:27:47 AM by DW">
47
- <outline created="Mon, 07 Mar 2022 15:27:47 GMT" text="Start the reallysimple repo. Publish the NPM package. "></outline>
48
- </outline>
49
- <outline created="Sun, 06 Mar 2022 16:27:50 GMT" text="3/6/22; 11:27:52 AM by DW">
50
- <outline created="Sun, 06 Mar 2022 16:27:53 GMT" text="It now understands various elements from the source namespace, including source:account, source:localtime and source:outline."></outline>
51
- <outline created="Sun, 06 Mar 2022 16:28:33 GMT" text="Started a new private GitHub repo for the project and saved the files. "></outline>
52
- <outline created="Sun, 06 Mar 2022 16:29:01 GMT" text="Added it to my NPM sub-menu, this is going to be a supported project."></outline>
53
- </outline>
54
30
  </outline>
55
31
  <outline created="Mon, 07 Mar 2022 15:26:41 GMT" text="#### Comments, questions?">
56
- <outline created="Mon, 07 Mar 2022 15:26:47 GMT" text="Please post your comments and questions in the &lt;a href=&quot;https://github.com/scripting/reallysimple/issues/new&quot;&gt;issues section&lt;/a&gt; of this repo."></outline>
32
+ <outline created="Mon, 07 Mar 2022 15:26:47 GMT" text="Post comments and questions in the &lt;a href=&quot;https://github.com/scripting/reallysimple/issues/new&quot;&gt;issues section&lt;/a&gt; of this repo."></outline>
57
33
  </outline>
58
34
  </body>
59
35
  </opml>
package/reallysimple.js CHANGED
@@ -1,4 +1,4 @@
1
- var myProductName = "reallysimple"; myVersion = "0.4.6";
1
+ var myProductName = "reallysimple"; myVersion = "0.4.9";
2
2
 
3
3
  exports.readFeed = readFeed;
4
4
  exports.convertFeedToOpml = convertFeedToOpml;
@@ -10,18 +10,26 @@ const davefeedread = require ("davefeedread");
10
10
 
11
11
  const allowedHeadNames = [
12
12
  "title", "link", "description", "language", "copyright", "managingEditor", "webMaster", "lastBuildDate", "pubDate", "category",
13
- "generator", "docs", "cloud", "ttl", "image", "rating", "textInput", "skipHours", "skipDays", "source:account", "source:localtime"
13
+ "generator", "docs", "cloud", "ttl", "image", "rating", "textInput", "skipHours", "skipDays", "source:account", "source:localtime", "linkToSelf"
14
14
  ];
15
15
  const allowedItemNames = [
16
16
  "title", "link", "description", "author", "category", "comments", "enclosures", "guid", "pubDate", "source", "source:outline", "source:likes"
17
17
  ];
18
+ const allowedEnclosureNames = [
19
+ "url", "type", "length"
20
+ ];
18
21
 
19
22
  var config = {
20
23
  timeOutSecs: 3
21
24
  }
22
25
 
23
26
  function isEmptyObject (obj) {
24
- return (Object.keys (obj).length === 0);
27
+ try {
28
+ return (Object.keys (obj).length === 0);
29
+ }
30
+ catch (err) {
31
+ return (true); //6/8/22 by DW
32
+ }
25
33
  }
26
34
  function getItemPermalink (item) {
27
35
  var rssguid = item ["rss:guid"], returnedval = undefined;
@@ -155,6 +163,11 @@ function convertFeed (oldFeed) {
155
163
  delete newFeed.image;
156
164
  }
157
165
  }
166
+ if (newFeed.cloud !== undefined) { //6/11/22 by DW
167
+ if (isEmptyObject (newFeed.cloud)) {
168
+ delete newFeed.cloud;
169
+ }
170
+ }
158
171
 
159
172
  newFeed.items = new Array ();
160
173
  oldFeed.items.forEach (function (item) {
@@ -189,6 +202,21 @@ function convertFeed (oldFeed) {
189
202
  delete newItem.source;
190
203
  }
191
204
  }
205
+
206
+ if (newItem.enclosure !== undefined) { //6/11/22 by DW
207
+ var enc = new Object ();
208
+ for (var x in newItem.enclosure) {
209
+ allowedEnclosureNames.forEach (function (name) {
210
+ if (x == name) {
211
+ if (newItem.enclosure [x] != null) {
212
+ enc [x] = newItem.enclosure [x];
213
+ }
214
+ }
215
+ });
216
+ }
217
+ newItem.enclosure = enc;
218
+ }
219
+
192
220
  newFeed.items.push (newItem);
193
221
  });
194
222