reallysimple 0.4.0 → 0.4.3
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 +7 -7
- package/readme.md +15 -7
- package/readme.opml +12 -7
- package/reallysimple.js +16 -7
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
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.3",
|
|
4
5
|
"author": "Dave Winer <dave@scripting.com>",
|
|
6
|
+
"license": "MIT",
|
|
5
7
|
"files": [
|
|
6
|
-
"
|
|
8
|
+
"reallysimple.js"
|
|
7
9
|
],
|
|
8
10
|
"main": "reallysimple.js",
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/scripting/
|
|
12
|
-
},
|
|
13
|
-
"license": "MIT",
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": "*"
|
|
13
|
+
"url": "https://github.com/scripting/reallysimple.git"
|
|
16
14
|
},
|
|
17
|
-
"version": "0.4.0",
|
|
18
15
|
"dependencies" : {
|
|
19
16
|
"opml": "*",
|
|
20
17
|
"daveutils": "*",
|
|
21
18
|
"davefeedread": "*"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": "*"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/readme.md
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
# reallysimple
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JavaScript code to read a feed. Calls back with a JavaScript structure, hiding all the history.
|
|
4
|
+
|
|
5
|
+
#### What formats are supported?
|
|
6
|
+
|
|
7
|
+
RSS, Atom, and RDF.
|
|
4
8
|
|
|
5
9
|
#### Why?
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
To make reading a feed from a JavaScript app as easy as possible.
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
To hide all the history to get it out of your way.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
If developers can quickly put together an app that uses feeds, people will try out more ideas, add feed support to more apps.
|
|
12
16
|
|
|
13
|
-
|
|
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.
|
|
18
|
+
|
|
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.
|
|
14
20
|
|
|
15
21
|
#### A coding example
|
|
16
22
|
|
|
@@ -34,9 +40,11 @@ Here's what shows up in the console when you run that code.
|
|
|
34
40
|
|
|
35
41
|
#### What we build on
|
|
36
42
|
|
|
37
|
-
Thanks to Dan MacTough for the feedparser package
|
|
43
|
+
Thanks to Dan MacTough for the <a href="https://www.npmjs.com/package/feedparser">feedparser</a> package.
|
|
44
|
+
|
|
45
|
+
It also builds on the davefeedread package, which simplifies the programming interface to feedparser.
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
This package further simplifies the struct returned by <a href="https://www.npmjs.com/package/davefeedread">davefeedread</a>.
|
|
40
48
|
|
|
41
49
|
#### Work notes
|
|
42
50
|
|
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>Sun, 20 Mar 2022 15:42:26 GMT</dateModified>
|
|
6
6
|
<expansionState></expansionState>
|
|
7
7
|
<vertScrollState>1</vertScrollState>
|
|
8
8
|
<windowTop>300</windowTop>
|
|
@@ -12,14 +12,18 @@
|
|
|
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="
|
|
15
|
+
<outline created="Mon, 07 Mar 2022 15:05:45 GMT" text="JavaScript code to read a feed. Calls back with a JavaScript structure, hiding all the history."></outline>
|
|
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>
|
|
16
19
|
</outline>
|
|
17
20
|
<outline text="#### Why?">
|
|
18
|
-
<outline created="
|
|
19
|
-
<outline created="
|
|
21
|
+
<outline created="Thu, 17 Mar 2022 15:40:05 GMT" text="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>
|
|
20
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>
|
|
21
26
|
</outline>
|
|
22
|
-
<outline created="Mon, 07 Mar 2022 15:10:25 GMT" text="#### An example"></outline>
|
|
23
27
|
<outline created="Mon, 07 Mar 2022 15:11:02 GMT" text="#### A coding example">
|
|
24
28
|
<outline created="Mon, 07 Mar 2022 15:11:09 GMT" text="Here's how you call the package."></outline>
|
|
25
29
|
<outline created="Mon, 07 Mar 2022 15:12:02 GMT" text="const reallysimple = require ("reallysimple");"></outline>
|
|
@@ -34,8 +38,9 @@
|
|
|
34
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>
|
|
35
39
|
</outline>
|
|
36
40
|
<outline created="Mon, 07 Mar 2022 15:25:06 GMT" text="#### What we build on">
|
|
37
|
-
<outline created="Mon, 07 Mar 2022 15:25:07 GMT" text="Thanks to Dan MacTough for the feedparser package
|
|
38
|
-
<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
|
|
41
|
+
<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>
|
|
42
|
+
<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>
|
|
43
|
+
<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>
|
|
39
44
|
</outline>
|
|
40
45
|
<outline created="Sat, 05 Mar 2022 17:30:26 GMT" text="#### Work notes">
|
|
41
46
|
<outline created="Mon, 07 Mar 2022 15:27:46 GMT" text="3/7/22; 10:27:47 AM by DW">
|
package/reallysimple.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var myProductName = "reallysimple"; myVersion = "0.4.
|
|
1
|
+
var myProductName = "reallysimple"; myVersion = "0.4.3";
|
|
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
|
|
8
|
+
const davefeedread = require ("davefeedread");
|
|
9
9
|
|
|
10
10
|
const allowedHeadNames = [
|
|
11
11
|
"title", "link", "description", "language", "copyright", "managingEditor", "webMaster", "lastBuildDate", "pubDate", "category",
|
|
12
12
|
"generator", "docs", "cloud", "ttl", "image", "rating", "textInput", "skipHours", "skipDays", "source:account", "source:localtime"
|
|
13
13
|
];
|
|
14
14
|
const allowedItemNames = [
|
|
15
|
-
"title", "link", "description", "author", "category", "comments", "
|
|
15
|
+
"title", "link", "description", "author", "category", "comments", "enclosures", "guid", "pubDate", "source", "source:outline", "source:likes"
|
|
16
16
|
];
|
|
17
17
|
|
|
18
18
|
var config = {
|
|
@@ -42,7 +42,7 @@ function getItemPermalink (item) {
|
|
|
42
42
|
}
|
|
43
43
|
return (undefined);
|
|
44
44
|
}
|
|
45
|
-
function convertFeedToOpml (theFeed) {
|
|
45
|
+
function convertFeedToOpml (theFeed) { //use this if you want to show an RSS feed in an outline
|
|
46
46
|
var theOutline = {
|
|
47
47
|
opml: {
|
|
48
48
|
head: {
|
|
@@ -150,8 +150,18 @@ function convertFeed (oldFeed) {
|
|
|
150
150
|
if (x == name) {
|
|
151
151
|
if (x == "source:outline") {
|
|
152
152
|
val = convertOutline (item ["source:outline"]);
|
|
153
|
+
newItem.outline = val;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
if (x == "enclosures") {
|
|
157
|
+
if (item.enclosures.length > 0) {
|
|
158
|
+
newItem.enclosure = item.enclosures [0];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
newItem [x] = val;
|
|
163
|
+
}
|
|
153
164
|
}
|
|
154
|
-
newItem [x] = val;
|
|
155
165
|
}
|
|
156
166
|
});
|
|
157
167
|
}
|
|
@@ -167,7 +177,7 @@ function convertFeed (oldFeed) {
|
|
|
167
177
|
}
|
|
168
178
|
|
|
169
179
|
function readFeed (url, callback) {
|
|
170
|
-
|
|
180
|
+
davefeedread.parseUrl (url, config.timeOutSecs, function (err, theFeed) {
|
|
171
181
|
if (err) {
|
|
172
182
|
callback (err);
|
|
173
183
|
}
|
|
@@ -176,4 +186,3 @@ function readFeed (url, callback) {
|
|
|
176
186
|
}
|
|
177
187
|
});
|
|
178
188
|
}
|
|
179
|
-
|