podverse-parser 5.1.6-alpha.3 → 5.1.6-alpha.4
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.
|
@@ -90,7 +90,7 @@ const handleParsedFeed = (parsedFeed_2, feed_1, ...args_1) => __awaiter(void 0,
|
|
|
90
90
|
throw new errors_1.FeedNoChangesSinceLastParsedError(feed.id);
|
|
91
91
|
}
|
|
92
92
|
const feedService = new podverse_orm_1.FeedService();
|
|
93
|
-
return feedService.update(feed.id, { last_parsed_file_hash:
|
|
93
|
+
return feedService.update(feed.id, { last_parsed_file_hash: null });
|
|
94
94
|
});
|
|
95
95
|
exports.handleParsedFeed = handleParsedFeed;
|
|
96
96
|
const checkIfFeedIsParsing = (feed) => {
|
package/dist/lib/rss/parser.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { FeedObject } from 'podcast-partytime';
|
|
2
|
+
export declare const getAndParseRSSFeed: (url: string) => Promise<FeedObject>;
|
|
2
3
|
export type ParseRSSFeedAndSaveToDatabase = {
|
|
3
4
|
forceParse?: boolean;
|
|
4
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAC;AAuB1D,eAAO,MAAM,kBAAkB,GAAU,KAAK,MAAM,wBAUnD,CAAC;AAQF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,6BAA6B,GACxC,KAAK,MAAM,EACX,kBAAkB,MAAM,EACxB,SAAS,6BAA6B,kBAgGvC,CAAC"}
|
package/dist/lib/rss/parser.js
CHANGED
|
@@ -25,6 +25,7 @@ const loggerService_1 = require("@parser/factories/loggerService");
|
|
|
25
25
|
// import { firebaseAccessTokenServiceFactory } from '@parser/factories/firebaseAccessTokenService';
|
|
26
26
|
// import { NotificationsServiceFactory } from '@parser/factories/notificationsService';
|
|
27
27
|
const _request_1 = require("../_request");
|
|
28
|
+
const parsedFeed_1 = require("./hash/parsedFeed");
|
|
28
29
|
/*
|
|
29
30
|
NOTE: All RSS feeds that have a podcast_index_id will be saved to the database.
|
|
30
31
|
RSS feeds without podcast_index_id (Add By RSS feeds) will NOT be saved to the database.
|
|
@@ -45,6 +46,7 @@ const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id, options) => __awai
|
|
|
45
46
|
let channel = null;
|
|
46
47
|
const timerFullRunLabel = `parseRSSFeedAndSaveToDatabase ${url} ${podcast_index_id}`;
|
|
47
48
|
timerManager_1.timerManager.start(timerFullRunLabel);
|
|
49
|
+
let parsedFeed = null;
|
|
48
50
|
try {
|
|
49
51
|
if (!url || !podcast_index_id) {
|
|
50
52
|
throw new Error(`parseRSSFeedAndSaveToDatabase: url or podcast_index_id is missing for ${url} ${podcast_index_id}`);
|
|
@@ -54,7 +56,7 @@ const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id, options) => __awai
|
|
|
54
56
|
if (!(0, podverse_orm_1.checkIfFeedFlagStatusShouldParse)(feed.feed_flag_status.id)) {
|
|
55
57
|
throw new Error(`parseRSSFeedAndSaveToDatabase: feed_flag_status.status is not Active or AlwaysAllow for ${feed.id} ${feed.podcast_index_id} ${feed.url}`);
|
|
56
58
|
}
|
|
57
|
-
|
|
59
|
+
parsedFeed = yield (0, feed_1.handleRequestRSSFeed)(feed);
|
|
58
60
|
feed = yield (0, feed_1.handleParsedFeed)(parsedFeed, feed, options);
|
|
59
61
|
yield feedService.update(feed.id, { is_parsing: new Date() });
|
|
60
62
|
if ((0, podverse_orm_1.checkIfSpamFeed)(parsedFeed)) {
|
|
@@ -105,7 +107,13 @@ const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id, options) => __awai
|
|
|
105
107
|
loggerService_1.loggerService.info(`Finished parsing channel: ${channel === null || channel === void 0 ? void 0 : channel.id} ${channel === null || channel === void 0 ? void 0 : channel.id_text} feed: ${feed === null || feed === void 0 ? void 0 : feed.id} url: ${url} podcast_index_id: ${podcast_index_id}`);
|
|
106
108
|
timerManager_1.timerManager.endAll();
|
|
107
109
|
if (feed) {
|
|
108
|
-
|
|
110
|
+
if (parsedFeed) {
|
|
111
|
+
const currentFeedFileHash = (0, parsedFeed_1.getParsedFeedMd5Hash)(parsedFeed);
|
|
112
|
+
yield feedService.update(feed.id, {
|
|
113
|
+
is_parsing: null,
|
|
114
|
+
last_parsed_file_hash: currentFeedFileHash
|
|
115
|
+
});
|
|
116
|
+
}
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
119
|
if (channel) {
|