reallysimple 0.4.3 → 0.4.6
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 +1 -1
- package/readme.md +15 -15
- package/readme.opml +13 -13
- package/reallysimple.js +24 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reallysimple",
|
|
3
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.
|
|
4
|
+
"version": "0.4.6",
|
|
5
5
|
"author": "Dave Winer <dave@scripting.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# reallysimple
|
|
2
2
|
|
|
3
|
-
JavaScript code to read a feed. Calls back with a JavaScript
|
|
3
|
+
JavaScript code to read a feed. Calls back with a simple JavaScript object, easily represented in JSON. Hides all the history.
|
|
4
4
|
|
|
5
5
|
#### What formats are supported?
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ RSS, Atom, and RDF.
|
|
|
8
8
|
|
|
9
9
|
#### Why?
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
I wanted to make reading a feed from a JavaScript app as easy as possible.
|
|
12
12
|
|
|
13
13
|
To hide all the history to get it out of your way.
|
|
14
14
|
|
|
@@ -22,31 +22,31 @@ There probably is a small tradeoff in performance, you can probably write faster
|
|
|
22
22
|
|
|
23
23
|
Here's how you call the package.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
```javascript
|
|
26
26
|
|
|
27
|
-
|
|
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.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
#### What we build on
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Thanks to Dan MacTough for the <a href="https://www.npmjs.com/package/feedparser">feedparser</a> package.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
It also builds on the davefeedread package, which simplifies the programming interface to feedparser.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
This package further simplifies the struct returned by <a href="https://www.npmjs.com/package/davefeedread">davefeedread</a>.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
#### Work notes
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
4/7/22; 11:37:16 AM by DW
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Clean up the readme file. Simplify the example app. Review docs. Start to invite collaborators to the repo, still private.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
3/21/22; 10:19:22 AM by DW
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Reviewing the way we represent links in items in the API.
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
The question is this -- how can we get a link to the item from the item.
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
The answer, on reflection -- rely on the link element as the permalink.
|
|
50
50
|
|
|
51
51
|
3/7/22; 10:27:47 AM by DW
|
|
52
52
|
|
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>
|
|
5
|
+
<dateModified>Thu, 07 Apr 2022 15:38:10 GMT</dateModified>
|
|
6
6
|
<expansionState></expansionState>
|
|
7
7
|
<vertScrollState>1</vertScrollState>
|
|
8
8
|
<windowTop>300</windowTop>
|
|
@@ -12,13 +12,13 @@
|
|
|
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 JavaScript
|
|
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>
|
|
16
16
|
</outline>
|
|
17
17
|
<outline created="Thu, 17 Mar 2022 15:42:49 GMT" text="#### What formats are supported?">
|
|
18
18
|
<outline created="Thu, 17 Mar 2022 15:42:57 GMT" text="RSS, Atom, and RDF."></outline>
|
|
19
19
|
</outline>
|
|
20
20
|
<outline text="#### Why?">
|
|
21
|
-
<outline created="Thu, 17 Mar 2022 15:40:05 GMT" text="
|
|
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
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
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
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>
|
|
@@ -26,16 +26,8 @@
|
|
|
26
26
|
</outline>
|
|
27
27
|
<outline created="Mon, 07 Mar 2022 15:11:02 GMT" text="#### A coding example">
|
|
28
28
|
<outline created="Mon, 07 Mar 2022 15:11:09 GMT" text="Here's how you call the package."></outline>
|
|
29
|
-
<outline
|
|
30
|
-
<outline created="Mon, 07 Mar 2022 15:
|
|
31
|
-
<outline created="Mon, 07 Mar 2022 15:11:18 GMT" text="reallysimple.readFeed (url, function (err, theFeed) {">
|
|
32
|
-
<outline created="Mon, 07 Mar 2022 15:12:40 GMT" text="if (!err) {">
|
|
33
|
-
<outline created="Mon, 07 Mar 2022 15:12:44 GMT" text="console.log ("theFeed == " + JSON.stringify (theFeed));"></outline>
|
|
34
|
-
<outline created="Mon, 07 Mar 2022 15:13:04 GMT" text="}"></outline>
|
|
35
|
-
</outline>
|
|
36
|
-
<outline created="Mon, 07 Mar 2022 15:11:54 GMT" text="}):"></outline>
|
|
37
|
-
</outline>
|
|
38
|
-
<outline created="Mon, 07 Mar 2022 15:10:30 GMT" text="Here's what shows up in the console when you run that code. "></outline>
|
|
29
|
+
<outline text="<%includeExample ("example1")%>"></outline>
|
|
30
|
+
<outline created="Mon, 07 Mar 2022 15:10:30 GMT" text="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. "></outline>
|
|
39
31
|
</outline>
|
|
40
32
|
<outline created="Mon, 07 Mar 2022 15:25:06 GMT" text="#### What we build on">
|
|
41
33
|
<outline created="Mon, 07 Mar 2022 15:25:07 GMT" text="Thanks to Dan MacTough for the <a href="https://www.npmjs.com/package/feedparser">feedparser</a> package."></outline>
|
|
@@ -43,6 +35,14 @@
|
|
|
43
35
|
<outline created="Thu, 17 Mar 2022 15:46:06 GMT" text="This package further simplifies the struct returned by <a href="https://www.npmjs.com/package/davefeedread">davefeedread</a>."></outline>
|
|
44
36
|
</outline>
|
|
45
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
46
|
<outline created="Mon, 07 Mar 2022 15:27:46 GMT" text="3/7/22; 10:27:47 AM by DW">
|
|
47
47
|
<outline created="Mon, 07 Mar 2022 15:27:47 GMT" text="Start the reallysimple repo. Publish the NPM package. "></outline>
|
|
48
48
|
</outline>
|
package/reallysimple.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
var myProductName = "reallysimple"; myVersion = "0.4.
|
|
1
|
+
var myProductName = "reallysimple"; myVersion = "0.4.6";
|
|
2
2
|
|
|
3
3
|
exports.readFeed = readFeed;
|
|
4
4
|
exports.convertFeedToOpml = convertFeedToOpml;
|
|
5
5
|
|
|
6
6
|
const utils = require ("daveutils");
|
|
7
7
|
const request = require ("request");
|
|
8
|
+
const opml = require ("opml");
|
|
8
9
|
const davefeedread = require ("davefeedread");
|
|
9
10
|
|
|
10
11
|
const allowedHeadNames = [
|
|
@@ -95,6 +96,19 @@ function convertFeed (oldFeed) {
|
|
|
95
96
|
}
|
|
96
97
|
return (theNewOutline);
|
|
97
98
|
}
|
|
99
|
+
function removeExtraAttributes (theNode) {
|
|
100
|
+
function visit (theNode) {
|
|
101
|
+
if (theNode.flincalendar !== undefined) {
|
|
102
|
+
delete theNode.flincalendar;
|
|
103
|
+
}
|
|
104
|
+
if (theNode.subs !== undefined) {
|
|
105
|
+
theNode.subs.forEach (function (sub) {
|
|
106
|
+
visit (sub);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
visit (theNode);
|
|
111
|
+
}
|
|
98
112
|
function getHeadValuesFromFirstItem () { //3/6/22 by DW
|
|
99
113
|
if (oldFeed.items.length > 0) {
|
|
100
114
|
var item = oldFeed.items [0];
|
|
@@ -136,8 +150,10 @@ function convertFeed (oldFeed) {
|
|
|
136
150
|
|
|
137
151
|
getHeadValuesFromFirstItem (); //3/6/22 by DW
|
|
138
152
|
|
|
139
|
-
if (
|
|
140
|
-
|
|
153
|
+
if (newFeed.image !== undefined) { //5/17/22 by DW
|
|
154
|
+
if (isEmptyObject (newFeed.image)) {
|
|
155
|
+
delete newFeed.image;
|
|
156
|
+
}
|
|
141
157
|
}
|
|
142
158
|
|
|
143
159
|
newFeed.items = new Array ();
|
|
@@ -150,6 +166,7 @@ function convertFeed (oldFeed) {
|
|
|
150
166
|
if (x == name) {
|
|
151
167
|
if (x == "source:outline") {
|
|
152
168
|
val = convertOutline (item ["source:outline"]);
|
|
169
|
+
removeExtraAttributes (val); //3/27/22 by DW
|
|
153
170
|
newItem.outline = val;
|
|
154
171
|
}
|
|
155
172
|
else {
|
|
@@ -167,8 +184,10 @@ function convertFeed (oldFeed) {
|
|
|
167
184
|
}
|
|
168
185
|
}
|
|
169
186
|
newItem.guid = getItemPermalink (item);
|
|
170
|
-
if (
|
|
171
|
-
|
|
187
|
+
if (newItem.source !== undefined) { //5/17/22 by DW
|
|
188
|
+
if (isEmptyObject (newItem.source)) {
|
|
189
|
+
delete newItem.source;
|
|
190
|
+
}
|
|
172
191
|
}
|
|
173
192
|
newFeed.items.push (newItem);
|
|
174
193
|
});
|