-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsource.opml
1068 lines (1066 loc) · 57.8 KB
/
source.opml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- OPML generated by OPML Editor v10.1b19 on Thu, 22 Jun 2023 22:01:35 GMT -->
<!--
Hi this is Dave Winer. I write all my project code in an outliner, which
generates all the files that make up this GitHub project. You'll see a
source.opml file like this in each of my projects. It contains the outline
source that the repo files were generated from. This is the most logical place
to store them. You can read the code in any outliner that supports OPML, which
includes http://drummer.scripting.com. You can use the Open URL command in
Drummer's File menu to open the "raw" version of this file straight from the
GitHub repo.
-->
<opml version="2.0">
<head>
<title>nodeEditor: feedRead</title>
<dateCreated>Sat, 31 Mar 2018 14:44:58 GMT</dateCreated>
<dateModified>Thu, 22 Jun 2023 22:01:35 GMT</dateModified>
<ownerName>Dave Winer</ownerName>
<ownerId>http://davewiner.com/</ownerId>
<expansionState>1, 3, 4, 16, 19, 69, 70, 74, 80, 94</expansionState>
<vertScrollState>12</vertScrollState>
<windowTop>186</windowTop>
<windowLeft>532</windowLeft>
<windowBottom>843</windowBottom>
<windowRight>1694</windowRight>
</head>
<body>
<outline text="/scripting.com/code/feedread/">
<outline text="worknotes.md">
<outline text="#### 5/18/23 by DW" created="Thu, 18 May 2023 14:08:27 GMT">
<outline text="Feeds with no items that have <cloud> elements are not getting them through the 9/29/22 workaround." created="Thu, 18 May 2023 14:08:38 GMT"/>
<outline text="Added code to workWithNoItemsFeed to fix this. The issue was that cloud elements can have attributes, the others don't." created="Thu, 18 May 2023 14:09:06 GMT"/>
</outline>
<outline text="#### 9/29/22 by DW" created="Thu, 29 Sep 2022 16:00:03 GMT">
<outline text="If a feed has no items, feedread returns nothing. This is because feedparser sends back head info in each item. If there are no items, we have to head info. So I built a very simple little parser that handles this case." created="Thu, 29 Sep 2022 16:00:11 GMT"/>
</outline>
<outline text="#### 1/30/19 by DW">
<outline text="Added code to parseFeedString to be sure the callback is only called once. "/>
</outline>
<outline text="#### 1/26/19 by DW">
<outline text="Wired off console.log calls. This level should be reporting the errors, not logging them. "/>
</outline>
</outline>
<outline text="package.json">
<outline text="{">
<outline text=""name": "davefeedread", "/>
<outline text=""description": "Read a feed and call back with a JavaScript structure.","/>
<outline text=""author": "Dave Winer <[email protected]>","/>
<outline text=""version": "0.5.25", "/>
<outline text=""dependencies" : {">
<outline text=""request": "*","/>
<outline text=""iconv-lite": "*","/>
<outline text=""xml2js": "*"," created="Wed, 30 Jun 2021 13:10:12 GMT"/>
<outline text=""daveutils": "*","/>
<outline text=""davehttp": "*","/>
<outline text=""feedparser": "*""/>
<outline text="}, "/>
</outline>
<outline text=""files": [">
<outline text=""feedread.js""/>
<outline text="],"/>
</outline>
<outline text=""main": "feedread.js","/>
<outline text=""repository": {">
<outline text=""type": "git","/>
<outline text=""url": "https://github.com/scripting/feedread.git""/>
<outline text="},"/>
</outline>
<outline text=""license": "MIT","/>
<outline text=""engines": {">
<outline text=""node": "*""/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
</outline>
<outline text="feedread.js">
<outline text="var myProductName = "davefeedread"; myVersion = "0.5.25"; "/>
<outline text=""/>
<outline text="/* The MIT License (MIT)">
<outline text="Copyright (c) 2014-2023 Dave Winer"/>
<outline text=""/>
<outline text="Permission is hereby granted, free of charge, to any person obtaining a copy"/>
<outline text="of this software and associated documentation files (the "Software"), to deal"/>
<outline text="in the Software without restriction, including without limitation the rights"/>
<outline text="to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"/>
<outline text="copies of the Software, and to permit persons to whom the Software is"/>
<outline text="furnished to do so, subject to the following conditions:"/>
<outline text=""/>
<outline text="The above copyright notice and this permission notice shall be included in all"/>
<outline text="copies or substantial portions of the Software."/>
<outline text=""/>
<outline text="THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"/>
<outline text="IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"/>
<outline text="FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"/>
<outline text="AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"/>
<outline text="LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"/>
<outline text="OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"/>
<outline text="SOFTWARE."/>
<outline text="*/"/>
</outline>
<outline text="" isComment="true"/>
<outline text="Notes" isComment="true">
<outline text="11/27/19; 10:44:16 AM by DW">
<outline text="In feedbase, we'd get lots of errors when theFeed is undefined in checkForNoneLengthEnclosures. Added defensive driving. "/>
</outline>
<outline text="5/14/19; 11:37:45 AM by DW">
<outline text="Handle enclosure lengths of "None"."/>
</outline>
<outline text="4/30/19; 8:48:50 AM by DW">
<outline text="Adding support for rssCloud. New entrypoint -- startCloud."/>
</outline>
<outline text="4/18/18; 11:06:26 AM by DW">
<outline text="People are having a trouble installing iconv because it needs to run something that it downloads, and the machines protect against that. So lets see if iconv-lite will help here."/>
</outline>
<outline text="4/17/18; 11:49:14 AM by DW">
<outline text="If there's an error parsing the feed, we weren't returning the error from parseFeedUrl. so feedbase would think the feed is okay, even if for example, the server returned an error page in HTML. Fixed."/>
</outline>
<outline text="3/30/18; 12:04:40 PM by DW">
<outline text="Basic idea. I love feedParser, but it's too much work to just throw it into an app. I want a single call that takes a URL and returns a JavaScript object with the prsed version of the feed. All the work done behind the scenes. "/>
</outline>
</outline>
<outline text=""/>
<outline text="exports.parseString = parseFeedString;"/>
<outline text="exports.parseUrl = parseFeedUrl;"/>
<outline text="exports.getCharset = getCharset;"/>
<outline text="exports.startCloud = startCloud; //4/30/19 by DW"/>
<outline text=""/>
<outline text="const utils = require ("daveutils");"/>
<outline text="const feedParser = require ("feedparser");"/>
<outline text="const request = require ("request");"/>
<outline text="const stream = require ("stream");"/>
<outline text="const Iconv = require ("iconv").Iconv;" isComment="true"/>
<outline text="const iconv = require ("iconv-lite");"/>
<outline text="const qs = require ("querystring");"/>
<outline text="const davehttp = require ("davehttp"); "/>
<outline text="const xml2js = require ("xml2js"); //9/29/22 by DW"/>
<outline text=""/>
<outline text="const metaNames = { ">
<outline text="title: true,"/>
<outline text="link: true,"/>
<outline text="description: true,"/>
<outline text="pubDate: true,"/>
<outline text="language: true,"/>
<outline text="copyright: true,"/>
<outline text="generator: true,"/>
<outline text="cloud: true,"/>
<outline text="image: true,"/>
<outline text="categories: true,"/>
<outline text=""atom:link": true //6/14/22 by DW" created="Tue, 14 Jun 2022 16:11:40 GMT"/>
<outline text="};"/>
</outline>
<outline text=""/>
<outline text="//rssCloud support -- 4/30/19 by DW">
<outline text="var cloudConfig = { ">
<outline text="flPingEnabled: false, //if true, we set up a server to receive pings from the cloud server"/>
<outline text="port: 1414, //the port the ping receiver runs on"/>
<outline text="path: "/feedping", //the message we ask the ping server to send us"/>
<outline text="timeOutSecs: 30,"/>
<outline text="feedUpdatedCallback: function (feedUrl, callback) {">
<outline text="if (callback !== undefined) {">
<outline text="callback ();"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="};"/>
</outline>
<outline text="var cloudFeeds = new Object (); "/>
<outline text=""/>
<outline text="function pleaseNotify (feedUrl, theCloud, callback) {">
<outline text="var urlCloudServer = "http://" + theCloud.domain + ":" + theCloud.port + theCloud.path;"/>
<outline text="var now = new Date ();"/>
<outline text="var theRequest = {">
<outline text="url: urlCloudServer,"/>
<outline text="followRedirect: true, "/>
<outline text="headers: {Accept: "application/json"},"/>
<outline text="method: "POST","/>
<outline text="form: {">
<outline text="port: cloudConfig.port,"/>
<outline text="path: cloudConfig.path,"/>
<outline text="url1: feedUrl,"/>
<outline text="protocol: "http-post""/>
<outline text="}"/>
</outline>
<outline text="};"/>
</outline>
<outline text="console.log ("pleaseNotify: theRequest == " + utils.jsonStringify (theRequest));" isComment="true"/>
<outline text="request (theRequest, function (err, response, body) {">
<outline text="if (err) {">
<outline text="console.log ("pleaseNotify: err.message == " + err.message);"/>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="console.log ("pleaseNotify: response == " + utils.jsonStringify (response));"/>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
<outline text="function checkForCloud (feedUrl, theFeed) { //4/30/19 by DW">
<outline text="if (cloudConfig.flPingEnabled) {">
<outline text="if (theFeed.head.cloud !== undefined) {">
<outline text="if (cloudFeeds [feedUrl] === undefined) { //haven't registered with cloud server for this feed">
<outline text="pleaseNotify (feedUrl, theFeed.head.cloud);"/>
<outline text="cloudFeeds [feedUrl] = new Date ();"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="function startCloud (options, callback) { //4/30/19 by DW">
<outline text="Changes" isComment="true">
<outline text="4/30/19; 8:50:21 AM by DW">
<outline text="options allows you to override any of the values in cloudConfig."/>
</outline>
</outline>
<outline text="function everyHour () {">
<outline text="cloudFeeds = new Object (); //re-request notification every hour"/>
<outline text="}"/>
</outline>
<outline text="function startServer (callback) {">
<outline text="var httpconfig = {">
<outline text="port: cloudConfig.port,"/>
<outline text="flPostEnabled: true,"/>
<outline text="flLogToConsole: true"/>
<outline text="};"/>
</outline>
<outline text="davehttp.start (httpconfig, function (theRequest) {">
<outline text="console.log ("davehttp.start: theRequest.lowerpath == " + theRequest.lowerpath + ", theRequest.method == " + theRequest.method);" isComment="true"/>
<outline text="if (theRequest.lowerpath == cloudConfig.path) {">
<outline text="var jstruct = qs.parse (theRequest.postBody);"/>
<outline text="console.log (theRequest.lowerpath + " -- jstruct.url == " + jstruct.url);" isComment="true"/>
<outline text="cloudConfig.feedUpdatedCallback (jstruct.url, function (err, data) {">
<outline text="if (err) {">
<outline text="theRequest.httpReturn (500, "text/plain", err.message);"/>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="if (data) {">
<outline text="theRequest.httpReturn (200, "application/json", utils.jsonStringify (data));"/>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="theRequest.httpReturn (200, "text/plain", "Thanks for the update! ;-)");"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="theRequest.httpReturn (404, "text/plain", "Not found.");"/>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="if (callback !== undefined) {">
<outline text="callback ();"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text=""/>
<outline text="if (options !== undefined) {">
<outline text="for (var x in options) {">
<outline text="cloudConfig [x] = options [x];"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="cloudConfig.flPingEnabled = true;"/>
<outline text=""/>
<outline text="console.log ("startCloud: options == " + utils.jsonStringify (options));"/>
<outline text=""/>
<outline text="startServer (callback);"/>
<outline text="setInterval (everyHour, 60 * 60 * 1000); "/>
<outline text="}"/>
</outline>
</outline>
<outline text=""/>
<outline text="function getCharset (httpResponse) {">
<outline text="var contentType = httpResponse.headers ["content-type"];"/>
<outline text="if (contentType !== undefined) {">
<outline text="var encoding = utils.trimWhitespace (utils.stringNthField (contentType, ";", 2));"/>
<outline text="if (encoding.length > 0) {">
<outline text="var charset = utils.trimWhitespace (utils.stringNthField (encoding, "=", 2));"/>
<outline text="console.log ("getCharset: charset == " + charset);" isComment="true"/>
<outline text="return (charset);"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="return (undefined); //no charset specified"/>
<outline text="}"/>
</outline>
<outline text="function checkForNoneLengthEnclosures (theFeed) { //5/14/19 by DW">
<outline text="//feedparser under some circumstances will return a length for an enclosure of "None". ">
<outline text="//this is not what my apps were expecting and as a result we missed a bunch of podcasts due to errors."/>
<outline text="//zero is much easier to handle, and there really is no correct value if the length is omitted, since it is required by RSS 2.0."/>
<outline text="//but what can you do -- this is the real world, and this happens. examples -- Radio Lab, Here's the Thing."/>
</outline>
<outline text="if (theFeed !== undefined) { //11/27/19 by DW -- this happens in feedbase">
<outline text="theFeed.items.forEach (function (item) {">
<outline text="if (item.enclosures !== undefined) {">
<outline text="item.enclosures.forEach (function (enc) {">
<outline text="if (enc.length == "None") {">
<outline text="enc.length = 0;"/>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="" created="Thu, 29 Sep 2022 16:04:52 GMT"/>
<outline text="function workWithNoItemsFeed (xmltext, callback) {" created="Thu, 29 Sep 2022 16:04:52 GMT">
<outline text="Changes" isComment="true" created="Thu, 29 Sep 2022 16:05:17 GMT">
<outline text="5/18/23; 10:39:31 AM by DW" created="Thu, 18 May 2023 14:39:31 GMT">
<outline text="If there's an object whose name is $, move all its properties up to the same level as the $." created="Thu, 18 May 2023 14:39:31 GMT"/>
<outline text="this is for cloud elements, who come through to us like this:" created="Thu, 18 May 2023 14:39:59 GMT">
<outline text=""cloud": {">
<outline text=""$": {">
<outline text=""domain": "firesky-prod.sw.workers.dev","/>
<outline text=""port": "80","/>
<outline text=""path": "/rss-cloud-notify","/>
<outline text=""registerProcedure": "","/>
<outline text=""protocol": "http-post""/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
</outline>
</outline>
<outline text="10/2/22; 7:48:00 AM by DW" created="Sun, 02 Oct 2022 11:48:00 GMT">
<outline text="In getChannelValue, if there is no rss property of jstruct, we'd get an error parsing some feeds, so we catch it in a try and return undefined for such values. " created="Sun, 02 Oct 2022 11:48:01 GMT"/>
</outline>
<outline text="9/29/22; 12:05:20 PM by DW" created="Thu, 29 Sep 2022 16:05:19 GMT">
<outline text="There are no items in the feed. So we parse the XML text to get the head info. " created="Thu, 29 Sep 2022 16:05:21 GMT"/>
</outline>
</outline>
<outline text="let options = {">
<outline text="explicitArray: false"/>
<outline text="};"/>
</outline>
<outline text="xml2js.parseString (xmltext.toString (), options, function (err, jstruct) {">
<outline text="if (err) { ">
<outline text="callback (err);"/>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="if (jstruct == null) { //12/27/21 by DW" created="Mon, 27 Dec 2021 15:06:51 GMT">
<outline text="let message = "Internal error: xml2js.parseString returned null.";" created="Mon, 27 Dec 2021 15:07:32 GMT"/>
<outline text="callback ({message});" created="Mon, 27 Dec 2021 15:07:32 GMT"/>
<outline text="}" created="Mon, 27 Dec 2021 15:07:04 GMT"/>
</outline>
<outline text="else {" created="Mon, 27 Dec 2021 15:07:06 GMT">
<outline text="function getChannelValue (name) {" created="Thu, 29 Sep 2022 16:19:23 GMT">
<outline text="try { //10/2/22 by DW" created="Sun, 02 Oct 2022 11:47:28 GMT">
<outline text="if (jstruct.rss.channel [name] === undefined) {" created="Thu, 29 Sep 2022 16:27:24 GMT">
<outline text="return (undefined);" created="Thu, 29 Sep 2022 16:27:48 GMT"/>
<outline text="}" created="Thu, 29 Sep 2022 16:27:39 GMT"/>
</outline>
<outline text="else {" created="Thu, 29 Sep 2022 16:27:40 GMT">
<outline text="var val = jstruct.rss.channel [name];" created="Thu, 18 May 2023 14:23:59 GMT"/>
<outline text="if (typeof val == "object") { //5/18/23 by DW" created="Thu, 18 May 2023 14:26:59 GMT">
<outline text="if (val ["$"] !== undefined) {" created="Thu, 18 May 2023 14:27:34 GMT">
<outline text="val = val ["$"];" created="Thu, 18 May 2023 14:29:31 GMT"/>
<outline text="}" created="Thu, 18 May 2023 14:27:55 GMT"/>
</outline>
<outline text="}" created="Thu, 18 May 2023 14:27:11 GMT"/>
</outline>
<outline text="return (val);" created="Thu, 29 Sep 2022 16:27:48 GMT"/>
<outline text="}" created="Thu, 29 Sep 2022 16:27:41 GMT"/>
</outline>
<outline text="}" created="Sun, 02 Oct 2022 11:47:32 GMT"/>
</outline>
<outline text="catch (err) {" created="Sun, 02 Oct 2022 11:47:33 GMT">
<outline text="return (undefined);" created="Thu, 29 Sep 2022 16:27:48 GMT"/>
<outline text="}" created="Sun, 02 Oct 2022 11:47:38 GMT"/>
</outline>
<outline text="}" created="Thu, 29 Sep 2022 16:27:12 GMT"/>
</outline>
<outline text="let theFeed = {" created="Thu, 29 Sep 2022 16:19:23 GMT">
<outline text="head: {" created="Thu, 29 Sep 2022 19:36:22 GMT">
<outline text="title: getChannelValue ("title"),"/>
<outline text="description: getChannelValue ("description"),"/>
<outline text="pubDate: getChannelValue ("pubDate"),"/>
<outline text="link: getChannelValue ("link"),"/>
<outline text="language: getChannelValue ("language"),"/>
<outline text="copyright: getChannelValue ("copyright"),"/>
<outline text="generator: getChannelValue ("generator"),"/>
<outline text="managingEditor: getChannelValue ("managingEditor"),"/>
<outline text="webMaster: getChannelValue ("webMaster"),"/>
<outline text="lastBuildDate: getChannelValue ("lastBuildDate"),"/>
<outline text="category: getChannelValue ("category"),"/>
<outline text="docs: getChannelValue ("docs"),"/>
<outline text="cloud: getChannelValue ("cloud") //5/18/23 by DW"/>
<outline text="}," created="Thu, 29 Sep 2022 19:36:25 GMT"/>
</outline>
<outline text="items: []" created="Thu, 29 Sep 2022 16:19:52 GMT"/>
<outline text="};" created="Thu, 29 Sep 2022 16:19:42 GMT"/>
</outline>
<outline text="callback (undefined, theFeed);" created="Thu, 29 Sep 2022 16:14:05 GMT"/>
<outline text="}" created="Mon, 27 Dec 2021 15:07:08 GMT"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="}" created="Thu, 29 Sep 2022 16:04:58 GMT"/>
</outline>
<outline text="" created="Thu, 29 Sep 2022 16:04:53 GMT"/>
<outline text="function parseFeedString (theString, charset, callback, errMsgPrefix) {">
<outline text="Changes" isComment="true">
<outline text="1/29/19; 7:51:46 PM by DW">
<outline text="Make sure the callback is only called once."/>
</outline>
<outline text="1/26/19; 1:25:55 PM by DW">
<outline text="Wired off consoleMessage. This level shouldn't be doing the error reporting. "/>
</outline>
</outline>
<outline text="var feedparser = new feedParser ();"/>
<outline text="var theFeed = {">
<outline text="head: new Object (),"/>
<outline text="items: new Array ()"/>
<outline text="};"/>
</outline>
<outline text="var flCalledBack = false; //1/29/19 by DW"/>
<outline text="function consoleMessage (s) {">
<outline text="if (errMsgPrefix !== undefined) {" isComment="true">
<outline text="console.log (errMsgPrefix + ", " + s);"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="if (charset !== undefined) {">
<outline text="try {">
<outline text="theString = iconv.decode (theString, charset); //4/18/18 by DW -- use iconv-lite"/>
<outline text="" isComment="true"/>
<outline text="var iconv = new Iconv (charset, "UTF-8");" isComment="true"/>
<outline text="theString = iconv.convert (theString).toString ();" isComment="true"/>
<outline text="}"/>
</outline>
<outline text="catch (err) {">
<outline text="consoleMessage ("err.message == " + err.message);"/>
<outline text="if (callback !== undefined) { //1/26/19 by DW">
<outline text="flCalledBack = true;"/>
<outline text="callback (err);"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text=""/>
<outline text="var theStream = new stream.Readable;"/>
<outline text="theStream.push (theString);"/>
<outline text="theStream.push (null);"/>
<outline text=""/>
<outline text="feedparser.on ("readable", function () {">
<outline text="try {">
<outline text="var item = this.read ();"/>
<outline text="if (item !== null) {">
<outline text="theFeed.items.push (item);"/>
<outline text="for (var x in item.meta) {">
<outline text="if (metaNames [x] !== undefined) {">
<outline text="if (x == "atom:link") {" created="Tue, 14 Jun 2022 16:11:58 GMT">
<outline text="try {" created="Tue, 14 Jun 2022 16:15:34 GMT">
<outline text="item.meta [x].forEach (function (link) {" created="Tue, 14 Jun 2022 16:15:34 GMT">
<outline text="var rel = link ["@"].rel;" created="Tue, 14 Jun 2022 16:37:22 GMT"/>
<outline text="if (rel == "self") {" created="Tue, 14 Jun 2022 16:17:51 GMT">
<outline text="theFeed.head.linkToSelf = link ["@"].href;" created="Tue, 14 Jun 2022 16:18:31 GMT"/>
<outline text="}" created="Tue, 14 Jun 2022 16:18:07 GMT"/>
</outline>
<outline text="if (rel == "search") {" isComment="true" created="Tue, 14 Jun 2022 16:17:51 GMT">
<outline text="theFeed.head.linkToSearch = link ["@"].href;" created="Tue, 14 Jun 2022 16:18:31 GMT"/>
<outline text="}" created="Tue, 14 Jun 2022 16:18:07 GMT"/>
</outline>
<outline text="});" created="Tue, 14 Jun 2022 16:15:49 GMT"/>
</outline>
<outline text="}" created="Tue, 14 Jun 2022 16:15:57 GMT"/>
</outline>
<outline text="catch (err) {" created="Tue, 14 Jun 2022 16:15:58 GMT">
<outline text="}" created="Tue, 14 Jun 2022 16:16:01 GMT"/>
</outline>
<outline text="}" created="Tue, 14 Jun 2022 16:12:17 GMT"/>
</outline>
<outline text="else {" created="Tue, 14 Jun 2022 16:12:18 GMT">
<outline text="theFeed.head [x] = item.meta [x];"/>
<outline text="}" created="Tue, 14 Jun 2022 16:12:21 GMT"/>
</outline>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="catch (err) {">
<outline text="console.log ("parseFeedString: err.message == " + err.message);"/>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="feedparser.on ("error", function (err) {">
<outline text="consoleMessage ("err.message == " + err.message);"/>
<outline text="if (!flCalledBack) { //make sure the callback is only called once -- 1/29/19 by DW">
<outline text="flCalledBack = true;"/>
<outline text="if (callback !== undefined) {">
<outline text="callback (err, theFeed);"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="feedparser.on ("end", function () {">
<outline text="if (!flCalledBack) {">
<outline text="flCalledBack = true;"/>
<outline text="if (theFeed.items.length == 0) { //9/29/22 by DW" created="Thu, 29 Sep 2022 16:01:56 GMT">
<outline text="workWithNoItemsFeed (theString, function (err, theNewFeed) {" created="Thu, 29 Sep 2022 16:02:33 GMT">
<outline text="if (err) {" created="Thu, 29 Sep 2022 16:03:05 GMT">
<outline text="if (callback !== undefined) {" created="Thu, 29 Sep 2022 16:04:11 GMT">
<outline text="callback (err);" created="Thu, 29 Sep 2022 16:03:29 GMT"/>
<outline text="}" created="Thu, 29 Sep 2022 16:04:12 GMT"/>
</outline>
<outline text="}" created="Thu, 29 Sep 2022 16:03:11 GMT"/>
</outline>
<outline text="else {" created="Thu, 29 Sep 2022 16:03:12 GMT">
<outline text="if (callback !== undefined) {" created="Thu, 29 Sep 2022 16:04:11 GMT">
<outline text="callback (undefined, theNewFeed);"/>
<outline text="}" created="Thu, 29 Sep 2022 16:04:12 GMT"/>
</outline>
<outline text="}" created="Thu, 29 Sep 2022 16:03:14 GMT"/>
</outline>
<outline text="});" created="Thu, 29 Sep 2022 16:02:48 GMT"/>
</outline>
<outline text="}" created="Thu, 29 Sep 2022 16:02:05 GMT"/>
</outline>
<outline text="else {" created="Thu, 29 Sep 2022 16:03:48 GMT">
<outline text="if (callback !== undefined) {">
<outline text="callback (undefined, theFeed);"/>
<outline text="}"/>
</outline>
<outline text="}" created="Thu, 29 Sep 2022 16:03:49 GMT"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text=""/>
<outline text="if (charset !== undefined) {" isComment="true">
<outline text="var iconv = new Iconv (charset, "UTF-8");"/>
<outline text="theStream = theStream.pipe (iconv);"/>
<outline text="}"/>
</outline>
<outline text="theStream.pipe (feedparser);"/>
<outline text="}"/>
</outline>
<outline text="function parseFeedUrl (feedUrl, timeOutSecs, callback) {">
<outline text="var theRequest = {">
<outline text="url: feedUrl, "/>
<outline text="encoding: null,"/>
<outline text="jar: true,"/>
<outline text="gzip: true,"/>
<outline text="maxRedirects: 5,"/>
<outline text="headers: {">
<outline text=""User-Agent": myProductName + " v" + myVersion"/>
<outline text="}"/>
</outline>
<outline text="};"/>
</outline>
<outline text="if (timeOutSecs !== undefined) {">
<outline text="theRequest.timeout = timeOutSecs * 1000;"/>
<outline text="}"/>
</outline>
<outline text="request (theRequest, function (err, response, theString) {">
<outline text="if (err) {">
<outline text="if (callback !== undefined) {">
<outline text="var theErrorResponse = {">
<outline text="statusCode: 400 //something like ENOTFOUND or ETIMEDOUT"/>
<outline text="};"/>
</outline>
<outline text="callback (err, undefined, theErrorResponse);"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="if (response.statusCode != 200) {">
<outline text="if (callback !== undefined) {">
<outline text="var theErrorResponse = {">
<outline text="message: "Error reading the feed, response.statusCode == " + response.statusCode + ".","/>
<outline text="statusCode: response.statusCode"/>
<outline text="};"/>
</outline>
<outline text="callback (theErrorResponse, undefined, response);"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="console.log (theString);" isComment="true"/>
<outline text="parseFeedString (theString, getCharset (response), function (err, theFeed) {">
<outline text="checkForCloud (feedUrl, theFeed); //4/30/19 by DW"/>
<outline text="checkForNoneLengthEnclosures (theFeed); //5/14/19 by DW"/>
<outline text="if (callback !== undefined) {">
<outline text="callback (err, theFeed, response); //4/17/18 by DW -- pass err back to caller"/>
<outline text="}"/>
</outline>
<outline text="}, myProductName + ": feedUrl == " + feedUrl);"/>
</outline>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
</outline>
<outline text="readme.md">
<outline text="# feedRead" created="Thu, 22 Jun 2023 21:54:52 GMT">
<outline text="If you came here looking for a super-simple way to read a feed in Node.js, this is no longer the simplest or best API I have. The new package is <a href="https://github.com/scripting/reallysimple">reallySimple</a> it's open source too, and it builds on this package, so this is still being maintained. " created="Thu, 22 Jun 2023 21:55:00 GMT"/>
<outline text="If you're using this package and are happy, keep using it. ;-)" created="Thu, 22 Jun 2023 21:59:15 GMT"/>
<outline text="6/22/23 by DW" created="Thu, 22 Jun 2023 21:57:06 GMT"/>
</outline>
<outline text="### What is this?">
<outline text="It's a <a href="https://www.npmjs.com/package/davefeedread">Node package</a> that contains everything you need to read a feed. "/>
<outline text="It builds on the <a href="https://github.com/danmactough/node-feedparser">feedParser package</a>. It's simpler to call, no need to master <a href="https://nodejs.org/api/stream.html#stream_stream">streams</a> or <a href="https://www.npmjs.com/package/iconv">iconv</a>. "/>
<outline text="You can also parse a string, so you can deal with files that contain feed data, not just feeds accessible over the web. Or the feed text could come from a database. "/>
<outline text="Because we use feedParser, we handle all the formats and variability that it handles. "/>
<outline text="It's an entry-level feed parser that will be useful to people who haven't mastered all of JavaScript. "/>
</outline>
<outline text="### Why?">
<outline text="Sometimes you need to quickly read a feed and do something with it, and don't have time for a major project. This package is for those times. "/>
<outline text="It also provides good sample code for more advanced feed reading projects. "/>
</outline>
<outline text="### Example code">
<outline text="There are two very basic examples, one that parses a feed that it reads <a href="https://github.com/scripting/feedRead/blob/master/examples/readurl/read.js">over the web</a>, and one that it reads from a <a href="https://github.com/scripting/feedRead/blob/master/examples/readfile/read.js">local file</a>."/>
<outline text="A third example is a realistic <a href="https://github.com/scripting/feedRead/blob/master/examples/cloud/read.js">feed polling app</a>, it checks a feed every five minutes and writes the JSON structure out to a local disk. It automatically supports <a href="https://en.blog.wordpress.com/2009/09/07/rss-in-the-clouds/">rssCloud</a>, so you get realtime updates if the feed supports that protocol, which is part of RSS 2.0. "/>
</outline>
</outline>
<outline text="examples/readurl/read.js">
<outline text="const fs = require ("fs");"/>
<outline text="const utils = require ("daveutils");"/>
<outline text="const feedRead = require ("davefeedread");" isComment="true"/>
<outline text="const feedRead = require ("../../feedread.js");"/>
<outline text=""/>
<outline text="const urlTestFeed = "https://rss.firesky.tv?filter=from%3Aacarvin.bsky.social"; //5/18/23 by DW" created="Sat, 05 Mar 2022 17:19:45 GMT"/>
<outline text="const urlTestFeed = "http://www.kenrockwell.com/rss.php";" isComment="true" created="Sat, 05 Mar 2022 17:19:45 GMT"/>
<outline text="const urlTestFeed = "https://blog.docuverse.com/feed/";" isComment="true" created="Sat, 05 Mar 2022 17:19:45 GMT"/>
<outline text="const urlTestFeed = "http://rss.nytimes.com/services/xml/rss/nyt/Technology.xml";" isComment="true"/>
<outline text="const urlTestFeed = "http://feeds.wnyc.org/radiolab";" isComment="true"/>
<outline text="const urlTestFeed = "https://www.presseportal.de/rss/dienststelle_110972.rss2";" isComment="true"/>
<outline text="const urlTestFeed = "http://scripting.com/rss.xml";" isComment="true"/>
<outline text="const timeOutSecs = 30;"/>
<outline text="const whenstart = new Date ();"/>
<outline text=""/>
<outline text="feedRead.parseUrl (urlTestFeed, timeOutSecs, function (err, theFeed) {">
<outline text="if (err) {">
<outline text="console.log (err.message);"/>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="console.log ("It took " + utils.secondsSince (whenstart) + " seconds to read and parse the feed.");"/>
<outline text=""/>
<outline text="console.log ("theFeed.head == " + utils.jsonStringify (theFeed.head));"/>
<outline text="if (theFeed.items.length > 0) {" created="Thu, 18 May 2023 14:13:52 GMT">
<outline text="var item = theFeed.items [0];"/>
<outline text="var rssguid = item ["rss:guid"];"/>
<outline text="console.log ("rssguid == " + utils.jsonStringify (rssguid));"/>
<outline text="console.log ("theFeed.items [0] == " + utils.jsonStringify (theFeed.items [0]));"/>
<outline text="theFeed.items.forEach (function (item, i) {">
<outline text="var theLength = "";" isComment="true"/>
<outline text="if ((item.enclosures !== undefined) && (item.enclosures.length > 0)) {" isComment="true">
<outline text="theLength = item.enclosures [0].length;"/>
<outline text="if (theLength == "None") {">
<outline text="theLength = 0;"/>
<outline text="}"/>
</outline>
<outline text="theLength = Number (theLength);"/>
<outline text="}"/>
</outline>
<outline text="console.log ("Item #" + utils.padWithZeros (i, 3) + ": " + theLength);" isComment="true"/>
<outline text="console.log ("Item #" + utils.padWithZeros (i, 2) + ": " + item.title + ".");"/>
<outline text="});"/>
</outline>
<outline text="}" created="Thu, 18 May 2023 14:13:58 GMT"/>
</outline>
<outline text=""/>
<outline text="fs.writeFile ("feed.xml", utils.jsonStringify (theFeed), function (err) {">
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
</outline>
<outline text="examples/readurl/package.json">
<outline text="{">
<outline text=""name": "example1","/>
<outline text=""description": "A test app for the davefeedread package, reads a feed from the NY Times website, parses it, and displays some of the information.","/>
<outline text=""author": "Dave Winer <[email protected]>","/>
<outline text=""version": "0.4.0","/>
<outline text=""dependencies" : {">
<outline text=""davefeedread": "*","/>
<outline text=""daveutils": "*""/>
<outline text="}, "/>
</outline>
<outline text=""license": "MIT","/>
<outline text=""engines": {">
<outline text=""node": "*""/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
</outline>
<outline text="examples/readfile/read.js">
<outline text="const utils = require ("daveutils");"/>
<outline text="const feedRead = require (""../../feedread.js");"/>
<outline text="const feedRead = require ("davefeedread");" isComment="true"/>
<outline text="const fs = require ("fs");"/>
<outline text=""/>
<outline text="fs.readFile ("rss.xml", function (err, filetext) {">
<outline text="if (err) {">
<outline text="console.log (err.message);"/>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="console.log (filetext.toString ());" isComment="true"/>
<outline text="feedRead.parseString (filetext, undefined, function (err, theFeed) {">
<outline text="console.log (utils.jsonStringify (theFeed.head));"/>
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
</outline>
<outline text="examples/readfile/package.json">
<outline text="{">
<outline text=""name": "example2","/>
<outline text=""description": "A test app for the davefeedread package, reads a feed from a local file.","/>
<outline text=""author": "Dave Winer <[email protected]>","/>
<outline text=""version": "0.4.0","/>
<outline text=""dependencies" : {">
<outline text=""davefeedread": "*","/>
<outline text=""daveutils": "*""/>
<outline text="}, "/>
</outline>
<outline text=""license": "MIT","/>
<outline text=""engines": {">
<outline text=""node": "*""/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
</outline>
<outline text="examples/cloud/read.js">
<outline text="const utils = require ("daveutils");"/>
<outline text="const feedRead = require ("davefeedread");"/>
<outline text="const fs = require ("fs");"/>
<outline text=""/>
<outline text="const urlTestFeed = "http://scripting.com/rss.xml"; //has to be a feed that supports rssCloud"/>
<outline text="const timeOutSecs = 30;"/>
<outline text="const fnameFeedJson = "theFeed.json";"/>
<outline text="var whenLastCheck;"/>
<outline text=""/>
<outline text="function checkFeed (feedUrl, callback) {">
<outline text="whenLastCheck = new Date ();"/>
<outline text="feedRead.parseUrl (feedUrl, timeOutSecs, function (err, theFeed) {">
<outline text="if (err) {">
<outline text="console.log ("checkFeed: err.message == " + err.message);"/>
<outline text="}"/>
</outline>
<outline text="else {">
<outline text="var nowstring = new Date ().toLocaleTimeString ();"/>
<outline text="console.log (nowstring + ": The title of the feed is \"" + theFeed.head.title + ",\" there are " + theFeed.items.length + " items in the feed.");"/>
<outline text="fs.writeFile (fnameFeedJson, utils.jsonStringify (theFeed), function (err) { //write out the object so you have something to study">
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
<outline text="if (callback !== undefined) {">
<outline text="callback ();"/>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text="}"/>
</outline>
<outline text="function everySecond () {">
<outline text="if (utils.secondsSince (whenLastCheck) > 5 * 60) { //five minutes between polls">
<outline text="checkFeed (urlTestFeed);"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text=""/>
<outline text="const options = {">
<outline text="port: 1415,"/>
<outline text="feedUpdatedCallback: checkFeed"/>
<outline text="};"/>
</outline>
<outline text="feedRead.startCloud (options, function () {">
<outline text="checkFeed (urlTestFeed);"/>
<outline text="setInterval (everySecond, 1000); "/>
<outline text="});"/>
</outline>
</outline>
<outline text="examples/cloud/package.json">
<outline text="{">
<outline text=""name": "cloudread","/>
<outline text=""description": "A test app for the davefeedread package, reads a feed that has rssCloud support, handles realtime updates.","/>
<outline text=""author": "Dave Winer <[email protected]>","/>
<outline text=""version": "0.4.0","/>
<outline text=""dependencies" : {">
<outline text=""davefeedread": "*","/>
<outline text=""daveutils": "*""/>
<outline text="}, "/>
</outline>
<outline text=""license": "MIT","/>
<outline text=""engines": {">
<outline text=""node": "*""/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
</outline>
<outline text="test0.js" isComment="true">
<outline text="const utils = require ("daveutils");"/>
<outline text="const feedReader = require ("./reader2.js");"/>
<outline text="const request = require ("request");"/>
<outline text=""/>
<outline text="const urlTestFeed = "http://www.guardian.co.uk/world/usa/rss";" isComment="true"/>
<outline text="const urlTestFeed = "https://www.presseportal.de/rss/dienststelle_110972.rss2";"/>
<outline text="console.log ("\n" + myProductName + " v" + myVersion + ".\n"); " isComment="true"/>
<outline text=""/>
<outline text="var whenstart = new Date ();"/>
<outline text="feedReader.parseUrl (urlTestFeed, undefined, function (err, theFeed) {">
<outline text="console.log (theFeed.items.length);"/>
<outline text="console.log (utils.secondsSince (whenstart));"/>
<outline text="console.log (utils.jsonStringify (theFeed.head));"/>
<outline text="});"/>
</outline>
<outline text=""/>
<outline text="request ({url: urlTestFeed, encoding: null}, function (error, response, theString) {" isComment="true">
<outline text="var whenstart = new Date ();"/>
<outline text="feedReader.parseString (theString, "ISO-8859-1", function (err, theFeed) {">
<outline text="console.log (theFeed.items.length);"/>
<outline text="console.log (utils.secondsSince (whenstart));"/>
<outline text="console.log (utils.jsonStringify (theFeed.head));"/>
<outline text="console.log (utils.jsonStringify (theFeed.items [0].meta));" isComment="true"/>
<outline text="function pad (num) { " created="Thu, 06 Jun 2013 19:04:01 GMT" pgfnum="25297">
<outline text="var s = num.toString (), ctplaces = 3;" created="Thu, 06 Jun 2013 19:04:50 GMT" pgfnum="25301"/>
<outline text="while (s.length < ctplaces) {" created="Thu, 06 Jun 2013 19:04:23 GMT" pgfnum="25299">
<outline text="s = "0" + s;" created="Thu, 06 Jun 2013 19:05:07 GMT" pgfnum="25302"/>
<outline text="}" created="Thu, 06 Jun 2013 19:04:43 GMT" pgfnum="25300"/>
</outline>
<outline text="return (s);" created="Thu, 06 Jun 2013 19:12:58 GMT" pgfnum="25311"/>
<outline text="}" created="Thu, 06 Jun 2013 19:04:11 GMT" pgfnum="25298"/>
</outline>
<outline text="console.log ("There are " + theFeed.items.length + " items in the feed.\n");"/>
<outline text="for (var i = 0; i < theFeed.items.length; i++) {">
<outline text="console.log ("Item #" + pad (i) + ": " + theFeed.items [i].title + ".\n");"/>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text=""/>
<outline text=""/>
<outline text=""/>
<outline text="if (!error && response.statusCode == 200) {" isComment="true">
<outline text="console.log (utils.jsonStringify (response.headers));"/>
<outline text="}"/>
</outline>
<outline text="else {" isComment="true">
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text=""/>
<outline text=""/>
<outline text="feedReader.read (urlTestFeed, function (err, feedItems) {" isComment="true">
<outline text="if (!err) {">
<outline text="function pad (num) { " created="Thu, 06 Jun 2013 19:04:01 GMT" pgfnum="25297">
<outline text="var s = num.toString (), ctplaces = 3;" created="Thu, 06 Jun 2013 19:04:50 GMT" pgfnum="25301"/>
<outline text="while (s.length < ctplaces) {" created="Thu, 06 Jun 2013 19:04:23 GMT" pgfnum="25299">
<outline text="s = "0" + s;" created="Thu, 06 Jun 2013 19:05:07 GMT" pgfnum="25302"/>
<outline text="}" created="Thu, 06 Jun 2013 19:04:43 GMT" pgfnum="25300"/>
</outline>
<outline text="return (s);" created="Thu, 06 Jun 2013 19:12:58 GMT" pgfnum="25311"/>
<outline text="}" created="Thu, 06 Jun 2013 19:04:11 GMT" pgfnum="25298"/>
</outline>
<outline text="console.log ("There are " + feedItems.length + " items in the feed.\n");"/>
<outline text="for (var i = 0; i < feedItems.length; i++) {">
<outline text="console.log ("Item #" + pad (i) + ": " + feedItems [i].title + ".\n");"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
<outline text=""/>
<outline text=""/>
</outline>
<outline text="testing/test.js" isComment="true">
<outline text="const utils = require ("daveutils");"/>
<outline text="const feedRead = require ("davefeedread");"/>
<outline text=""/>
<outline text="const urlTestFeed = "https://www.presseportal.de/rss/dienststelle_110972.rss2";" isComment="true"/>
<outline text="const urlTestFeed = "http://scripting.com/rss.xml";"/>
<outline text="const whenstart = new Date ();"/>
<outline text=""/>
<outline text="feedRead.parseUrl (urlTestFeed, undefined, function (err, theFeed) {">
<outline text="if (!err) {">
<outline text="console.log ("It took " + utils.secondsSince (whenstart) + " seconds to read and parse the feed.");"/>
<outline text="console.log ("theFeed.head == " + utils.jsonStringify (theFeed.head));"/>
<outline text="console.log ("theFeed.items [0] == " + utils.jsonStringify (theFeed.items [0]));"/>
<outline text="for (var i = 0; i < theFeed.items.length; i++) {">
<outline text="console.log ("Item #" + utils.padWithZeros (i, 2) + ": " + theFeed.items [i].title + ".");"/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
<outline text="});"/>
</outline>
</outline>
<outline text="testing/package.json" isComment="true">
<outline text="{">
<outline text=""name": "test","/>
<outline text=""description": "A test app for the davefeedread package.","/>
<outline text=""author": "Dave Winer <[email protected]>","/>
<outline text=""version": "0.4.0","/>
<outline text=""dependencies" : {">
<outline text=""davefeedread": "*","/>
<outline text=""daveutils": "*""/>
<outline text="}, "/>
</outline>
<outline text=""license": "MIT","/>
<outline text=""engines": {">
<outline text=""node": "*""/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
</outline>
</outline>
<outline text="/scripting.com/code/testing/iconvlite/">
<outline text="feedread.js">
<outline text="[[http://scripting.com/code/feedread/feedread.js]]"/>
</outline>
<outline text="package.json">
<outline text="{">
<outline text=""name": "iconvlitetest","/>
<outline text=""description": "Test the iconv-lite package.","/>
<outline text=""author": "Dave Winer <[email protected]>","/>
<outline text=""version": "0.4.11","/>
<outline text=""dependencies" : {">
<outline text=""request": "*","/>
<outline text=""iconv-lite": "*","/>
<outline text=""daveutils": "*","/>
<outline text=""feedparser": "*""/>
<outline text="}, "/>
</outline>
<outline text=""repository": {">
<outline text=""type": "git","/>
<outline text=""url": "https://github.com/scripting/feedread.git""/>
<outline text="},"/>
</outline>
<outline text=""license": "MIT","/>
<outline text=""engines": {">
<outline text=""node": "*""/>
<outline text="}"/>
</outline>
<outline text="}"/>
</outline>
</outline>
<outline text="test.js">
<outline text="const iconv = require ("iconv-lite");"/>
<outline text="const request = require ("request");"/>
<outline text="const utils = require ("daveutils");"/>
<outline text=""/>
<outline text="var feedUrl = "https://www.presseportal.de/rss/dienststelle_110972.rss2";"/>