podverse-parser 5.1.12-alpha.0 → 5.1.12
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/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +3 -0
- package/dist/lib/rss/item/itemValue.d.ts.map +1 -1
- package/dist/lib/rss/item/itemValue.js +4 -0
- package/dist/lib/rss/parser.d.ts +7 -1
- package/dist/lib/rss/parser.d.ts.map +1 -1
- package/dist/lib/rss/parser.js +10 -6
- package/dist/lib/rss/remoteItemParser.d.ts +8 -1
- package/dist/lib/rss/remoteItemParser.d.ts.map +1 -1
- package/dist/lib/rss/remoteItemParser.js +33 -17
- package/package.json +4 -4
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;CAmBlB,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -16,5 +16,8 @@ exports.config = {
|
|
|
16
16
|
authKey: process.env.PODCAST_INDEX_AUTH_KEY || '',
|
|
17
17
|
baseUrl: process.env.PODCAST_INDEX_BASE_URL || '',
|
|
18
18
|
secretKey: process.env.PODCAST_INDEX_SECRET_KEY || ''
|
|
19
|
+
},
|
|
20
|
+
parser: {
|
|
21
|
+
addRemoteItemsToMQ: process.env.PARSER_ADD_REMOTE_ITEMS_TO_MQ === 'true',
|
|
19
22
|
}
|
|
20
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemValue.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"itemValue.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,IAAI,EAG1B,OAAO,EACR,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,qBAAqB,GAChC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,SAAS,OAAO,EAChB,6BAA6B,aAAa,kBA8D3C,CAAC"}
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.handleParsedItemValue = void 0;
|
|
13
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
13
14
|
const podverse_orm_1 = require("podverse-orm");
|
|
14
15
|
const item_1 = require("@parser/lib/compat/partytime/item");
|
|
15
16
|
const handleParsedItemValue = (parsedItem, item, channel, transactionalEntityManager) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -53,6 +54,9 @@ const handleParsedItemValue = (parsedItem, item, channel, transactionalEntityMan
|
|
|
53
54
|
}
|
|
54
55
|
const itemValueTimeSplitRemoteItemDto = itemValueTimeSplitDto.item_value_time_splits_remote_item;
|
|
55
56
|
if (itemValueTimeSplitRemoteItemDto) {
|
|
57
|
+
if (!(0, podverse_helpers_1.hasValidFeedUuid)(itemValueTimeSplitRemoteItemDto)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
56
60
|
yield itemValueTimeSplitRemoteItemService.update(item_value_time_split, itemValueTimeSplitRemoteItemDto);
|
|
57
61
|
}
|
|
58
62
|
else {
|
package/dist/lib/rss/parser.d.ts
CHANGED
|
@@ -10,5 +10,11 @@ export type ParseRSSFeedAndSaveToDatabaseOptions = {
|
|
|
10
10
|
forceParse: boolean;
|
|
11
11
|
onDemandParserEvent: ParseRSSOnDemandParserEvent;
|
|
12
12
|
};
|
|
13
|
-
export declare const parseRSSFeedAndSaveToDatabase: (url: string, podcast_index_id: number, options: ParseRSSFeedAndSaveToDatabaseOptions) => Promise<
|
|
13
|
+
export declare const parseRSSFeedAndSaveToDatabase: (url: string, podcast_index_id: number, options: ParseRSSFeedAndSaveToDatabaseOptions) => Promise<{
|
|
14
|
+
remoteItemsToParse: {
|
|
15
|
+
url: string;
|
|
16
|
+
podcast_index_id: number;
|
|
17
|
+
options: ParseRSSFeedAndSaveToDatabaseOptions;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
14
20
|
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAIxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAa,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAIxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAa,MAAM,oBAAoB,CAAC;AAiC3D,eAAO,MAAM,kBAAkB,GAAU,KAAK,MAAM,wBAUnD,CAAC;AAQF,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,uBAAuB,GAAG,IAAI,CAAC;CACtC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,EAAE,2BAA2B,CAAC;CAClD,CAAA;AAED,eAAO,MAAM,6BAA6B,GACxC,KAAK,MAAM,EACX,kBAAkB,MAAM,EACxB,SAAS,oCAAoC;;;;;;EA0I9C,CAAC"}
|
package/dist/lib/rss/parser.js
CHANGED
|
@@ -27,6 +27,7 @@ const loggerService_1 = require("@parser/factories/loggerService");
|
|
|
27
27
|
// import { NotificationsServiceFactory } from '@parser/factories/notificationsService';
|
|
28
28
|
const _request_1 = require("../_request");
|
|
29
29
|
const parsedFeed_1 = require("./hash/parsedFeed");
|
|
30
|
+
const config_1 = require("@parser/config");
|
|
30
31
|
/*
|
|
31
32
|
NOTE: All RSS feeds that have a podcast_index_id will be saved to the database.
|
|
32
33
|
RSS feeds without podcast_index_id (Add By RSS feeds) will NOT be saved to the database.
|
|
@@ -151,12 +152,15 @@ const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id, options) => __awai
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
if (config_1.config.parser.addRemoteItemsToMQ) {
|
|
156
|
+
if (channel) {
|
|
157
|
+
const remoteItems = yield (0, remoteItemParser_1.handleAllRemoteItemsFeedParsing)(channel, {
|
|
158
|
+
accountId: (onDemandParserEvent === null || onDemandParserEvent === void 0 ? void 0 : onDemandParserEvent.accountId) || null,
|
|
159
|
+
remoteParentPodcastIndexId: podcast_index_id,
|
|
160
|
+
});
|
|
161
|
+
return { remoteItemsToParse: remoteItems };
|
|
162
|
+
}
|
|
159
163
|
}
|
|
160
|
-
return;
|
|
164
|
+
return { remoteItemsToParse: [] };
|
|
161
165
|
});
|
|
162
166
|
exports.parseRSSFeedAndSaveToDatabase = parseRSSFeedAndSaveToDatabase;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { Channel } from 'podverse-orm';
|
|
2
|
+
import type { ParseRSSFeedAndSaveToDatabaseOptions } from '@parser/lib/rss/parser';
|
|
2
3
|
export type OnDemandParserRemoteItemParams = {
|
|
3
4
|
accountId: number | null;
|
|
4
5
|
remoteParentPodcastIndexId: number;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
type RemoteItemsQueueMessage = {
|
|
8
|
+
url: string;
|
|
9
|
+
podcast_index_id: number;
|
|
10
|
+
options: ParseRSSFeedAndSaveToDatabaseOptions;
|
|
11
|
+
};
|
|
12
|
+
export declare const handleAllRemoteItemsFeedParsing: (channel: Channel, params: OnDemandParserRemoteItemParams) => Promise<RemoteItemsQueueMessage[]>;
|
|
13
|
+
export {};
|
|
7
14
|
//# sourceMappingURL=remoteItemParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteItemParser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/remoteItemParser.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EAUR,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"remoteItemParser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/remoteItemParser.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EAUR,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,wBAAwB,CAAC;AAQnF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,0BAA0B,EAAE,MAAM,CAAC;CACpC,CAAA;AAeD,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,oCAAoC,CAAC;CAC/C,CAAA;AA6DD,eAAO,MAAM,+BAA+B,GAAU,SAAS,OAAO,EAAE,QAAQ,8BAA8B,KAAG,OAAO,CAAC,uBAAuB,EAAE,CAWjJ,CAAC"}
|
|
@@ -13,7 +13,6 @@ exports.handleAllRemoteItemsFeedParsing = void 0;
|
|
|
13
13
|
const podverse_helpers_1 = require("podverse-helpers");
|
|
14
14
|
const podverse_orm_1 = require("podverse-orm");
|
|
15
15
|
const podcastIndex_1 = require("@parser/factories/podcastIndex");
|
|
16
|
-
const parser_1 = require("@parser/lib/rss/parser");
|
|
17
16
|
const loggerService_1 = require("@parser/factories/loggerService");
|
|
18
17
|
function handleRequestDelay(url) {
|
|
19
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -53,33 +52,42 @@ const handleRemoteItemsFeedParsing = (feedGuidsToParse, params) => __awaiter(voi
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
}
|
|
55
|
+
const queueMessages = [];
|
|
56
56
|
for (const piFeedData of piFeedDatas) {
|
|
57
57
|
const feedService = new podverse_orm_1.FeedService();
|
|
58
|
-
|
|
58
|
+
const feed = yield feedService.getByUrlAndPodcastIndexId({
|
|
59
59
|
url: piFeedData.url,
|
|
60
60
|
podcast_index_id: piFeedData.id
|
|
61
61
|
});
|
|
62
62
|
if (!feed) {
|
|
63
63
|
yield handleRequestDelay(piFeedData.url);
|
|
64
64
|
loggerService_1.loggerService.info(`handleRemoteItemsFeedParsing: ${piFeedData.url} ${piFeedData.id}`);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
queueMessages.push({
|
|
66
|
+
url: piFeedData.url,
|
|
67
|
+
podcast_index_id: piFeedData.id,
|
|
68
|
+
options: {
|
|
69
|
+
forceParse: false,
|
|
70
|
+
onDemandParserEvent: {
|
|
71
|
+
accountId,
|
|
72
|
+
remoteParentPodcastIndexId,
|
|
73
|
+
type: podverse_helpers_1.OnDemandParserEventType.REMOTE_ITEM,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
}
|
|
79
|
+
return queueMessages;
|
|
75
80
|
});
|
|
76
81
|
const handleAllRemoteItemsFeedParsing = (channel, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
82
|
const channelService = new podverse_orm_1.ChannelService();
|
|
78
83
|
const latestChannel = yield channelService.get(channel.id);
|
|
79
|
-
|
|
80
|
-
yield
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
const results = [];
|
|
85
|
+
const podrollResults = yield handleRemoteItemsPodrollParsing(latestChannel, params);
|
|
86
|
+
// const publisherResults = await handleRemoteItemsPublisherParsing(latestChannel, params);
|
|
87
|
+
// const channelResults = await handleRemoteItemsChannelParsing(latestChannel, params);
|
|
88
|
+
// const timeSplitResults = await handleRemoteItemsItemValueTimeSplitParsing(latestChannel, params);
|
|
89
|
+
results.push(...podrollResults);
|
|
90
|
+
return results;
|
|
83
91
|
});
|
|
84
92
|
exports.handleAllRemoteItemsFeedParsing = handleAllRemoteItemsFeedParsing;
|
|
85
93
|
const handleRemoteItemsPodrollParsing = (channel, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -89,8 +97,9 @@ const handleRemoteItemsPodrollParsing = (channel, params) => __awaiter(void 0, v
|
|
|
89
97
|
const channelPodrollRemoteItemService = new podverse_orm_1.ChannelPodrollRemoteItemService();
|
|
90
98
|
const channelPodrollRemoteItems = yield channelPodrollRemoteItemService.getAll(channelPodroll);
|
|
91
99
|
const feedGuidsToParse = channelPodrollRemoteItems.map(remoteItem => remoteItem.feed_guid);
|
|
92
|
-
yield handleRemoteItemsFeedParsing(feedGuidsToParse, params);
|
|
100
|
+
return yield handleRemoteItemsFeedParsing(feedGuidsToParse, params);
|
|
93
101
|
}
|
|
102
|
+
return [];
|
|
94
103
|
});
|
|
95
104
|
const handleRemoteItemsPublisherParsing = (channel, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
96
105
|
const channelPublisherService = new podverse_orm_1.ChannelPublisherService();
|
|
@@ -99,14 +108,15 @@ const handleRemoteItemsPublisherParsing = (channel, params) => __awaiter(void 0,
|
|
|
99
108
|
const channelPublisherRemoteItemService = new podverse_orm_1.ChannelPublisherRemoteItemService();
|
|
100
109
|
const channelPublisherRemoteItems = yield channelPublisherRemoteItemService.getAll(channelPublisher);
|
|
101
110
|
const feedGuidsToParse = channelPublisherRemoteItems.map(remoteItem => remoteItem.feed_guid);
|
|
102
|
-
yield handleRemoteItemsFeedParsing(feedGuidsToParse, params);
|
|
111
|
+
return yield handleRemoteItemsFeedParsing(feedGuidsToParse, params);
|
|
103
112
|
}
|
|
113
|
+
return [];
|
|
104
114
|
});
|
|
105
115
|
const handleRemoteItemsChannelParsing = (channel, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
116
|
const channelRemoteItemService = new podverse_orm_1.ChannelRemoteItemService();
|
|
107
117
|
const channelRemoteItems = yield channelRemoteItemService.getAll(channel);
|
|
108
118
|
const feedGuidsToParse = channelRemoteItems.map(remoteItem => remoteItem.feed_guid);
|
|
109
|
-
yield handleRemoteItemsFeedParsing(feedGuidsToParse, params);
|
|
119
|
+
return yield handleRemoteItemsFeedParsing(feedGuidsToParse, params);
|
|
110
120
|
});
|
|
111
121
|
const handleRemoteItemsItemValueTimeSplitParsing = (channel, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
122
|
var _a, _b;
|
|
@@ -120,6 +130,7 @@ const handleRemoteItemsItemValueTimeSplitParsing = (channel, params) => __awaite
|
|
|
120
130
|
'item_values.item_value_time_splits.item_value_time_split_remote_item'
|
|
121
131
|
]
|
|
122
132
|
});
|
|
133
|
+
const results = [];
|
|
123
134
|
for (const item of items) {
|
|
124
135
|
if (item) {
|
|
125
136
|
if (((_a = item.item_values) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
@@ -128,7 +139,10 @@ const handleRemoteItemsItemValueTimeSplitParsing = (channel, params) => __awaite
|
|
|
128
139
|
for (const itemValueTimeSplit of itemValue.item_value_time_splits) {
|
|
129
140
|
if (itemValueTimeSplit.item_value_time_split_remote_item) {
|
|
130
141
|
const feedGuid = itemValueTimeSplit.item_value_time_split_remote_item.feed_guid;
|
|
131
|
-
yield handleRemoteItemsFeedParsing([feedGuid], params);
|
|
142
|
+
const res = yield handleRemoteItemsFeedParsing([feedGuid], params);
|
|
143
|
+
if (res && res.length > 0) {
|
|
144
|
+
results.push(...res);
|
|
145
|
+
}
|
|
132
146
|
}
|
|
133
147
|
}
|
|
134
148
|
}
|
|
@@ -136,5 +150,7 @@ const handleRemoteItemsItemValueTimeSplitParsing = (channel, params) => __awaite
|
|
|
136
150
|
}
|
|
137
151
|
}
|
|
138
152
|
}
|
|
153
|
+
return results;
|
|
139
154
|
}
|
|
155
|
+
return [];
|
|
140
156
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podverse-parser",
|
|
3
|
-
"version": "5.1.12
|
|
3
|
+
"version": "5.1.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"license": "AGPLv3",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"module-alias": "^2.2.3",
|
|
20
|
-
"podverse-external-services": "^5.1.12
|
|
21
|
-
"podverse-helpers": "^5.1.12
|
|
22
|
-
"podverse-orm": "^5.1.12
|
|
20
|
+
"podverse-external-services": "^5.1.12",
|
|
21
|
+
"podverse-helpers": "^5.1.12",
|
|
22
|
+
"podverse-orm": "^5.1.12",
|
|
23
23
|
"podverse-partytime": "^5.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|