Skip to content

Commit 592b864

Browse files
author
Ubuntu
committed
fix GUID
1 parent c79c2b1 commit 592b864

File tree

3 files changed

+29
-993
lines changed

3 files changed

+29
-993
lines changed

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var TOP_FIELDS = ['title', 'description', 'author', 'link'];
88
var ITEM_FIELDS = [
99
'title',
1010
'link',
11-
'guid',
1211
'pubDate',
1312
'author',
1413
]
@@ -19,6 +18,7 @@ var stripHtml = function(str) {
1918

2019
Parser.parseString = function(xml, callback) {
2120
XML2JS.parseString(xml, function(err, result) {
21+
if (err) throw err;
2222
var json = {feed: {}};
2323
var channel = result.rss.channel[0];
2424
if (channel['atom:link']) json.feed.feedUrl = channel['atom:link'][0].href;
@@ -35,6 +35,9 @@ Parser.parseString = function(xml, callback) {
3535
entry.content = item.description[0];
3636
entry.contentSnippet = Entities.decode(stripHtml(entry.content));
3737
}
38+
if (item.guid) {
39+
entry.guid = item.guid[0]._;
40+
}
3841
entry.categories = item.category;
3942
json.entries = json.entries || [];
4043
json.entries.push(entry);

0 commit comments

Comments
 (0)