podverse-parser 5.1.12 → 5.1.14-alpha.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"loggerService.d.ts","sourceRoot":"","sources":["../../src/factories/loggerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGzE,eAAO,MAAM,aAAa,eAGxB,CAAC"}
1
+ {"version":3,"file":"loggerService.d.ts","sourceRoot":"","sources":["../../src/factories/loggerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGzE,eAAO,MAAM,aAAa,eAExB,CAAC"}
@@ -4,6 +4,5 @@ exports.loggerService = void 0;
4
4
  const logger_1 = require("podverse-helpers/dist/lib/backend/logger");
5
5
  const config_1 = require("../config");
6
6
  exports.loggerService = new logger_1.LoggerService({
7
- logDir: config_1.config.log.dir,
8
7
  logLevel: config_1.config.log.level,
9
8
  });
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,oBAAoB,CAAC;AAO9D,eAAO,MAAM,gBAAgB,GAAI,YAAY,UAAU;;;;;CAOtD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,YAAY,UAAU;;;;;;;;CAqB1D,CAAC;AAEH,eAAO,MAAM,yBAAyB,GAAI,YAAY,UAAU;;GAU/D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,UAAU;;;;;QAU1D,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,YAAY,UAAU;;QAOjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;GAe9D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU;;;;;;IA8B5D,CAA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AAM,sBAAsB,GAAI,YAAY,UAAU;;;;;;IA8B5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;QAQ7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;;QAU9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;;;;GAkB7D,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,YAAY,UAAU;;;;;GAgBxE,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAAI,YAAY,UAAU;;;;;GAa1E,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,YAAY,UAAU;;;;;GAiBjE,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,YAAY,UAAU;;;;;;GAiBrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;GA0B7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;;;;;GAkB9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,UAAU;;;GAY1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU;;;;;;;;;;;;;;;GAiB5D,CAAC"}
@@ -5,13 +5,18 @@ const podverse_partytime_1 = require("podverse-partytime");
5
5
  const podverse_helpers_1 = require("podverse-helpers");
6
6
  const podverse_orm_1 = require("podverse-orm");
7
7
  const value_1 = require("@parser/lib/compat/partytime/value");
8
+ const publisher_1 = require("./publisher");
8
9
  const compatChannelDto = (parsedFeed) => {
9
10
  var _a, _b, _c, _d;
11
+ let medium_id = (0, podverse_helpers_1.getMediumEnumValue)((_a = parsedFeed.medium) !== null && _a !== void 0 ? _a : podverse_partytime_1.Phase4Medium.Podcast);
12
+ const detected = (0, publisher_1.detectDuckTypedPublisherMediumId)(parsedFeed);
13
+ if (detected !== null)
14
+ medium_id = detected;
10
15
  return {
11
- podcast_guid: ((_a = parsedFeed.guid) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid)) || null,
12
- title: ((_b = parsedFeed.title) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
13
- sortable_title: ((_c = (0, podverse_helpers_1.createSortableTitle)(parsedFeed.title)) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
14
- medium_id: (0, podverse_helpers_1.getMediumEnumValue)((_d = parsedFeed.medium) !== null && _d !== void 0 ? _d : podverse_partytime_1.Phase4Medium.Podcast)
16
+ podcast_guid: ((_b = parsedFeed.guid) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid)) || null,
17
+ title: ((_c = parsedFeed.title) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
18
+ sortable_title: ((_d = (0, podverse_helpers_1.createSortableTitle)(parsedFeed.title)) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
19
+ medium_id
15
20
  };
16
21
  };
17
22
  exports.compatChannelDto = compatChannelDto;
@@ -0,0 +1,3 @@
1
+ import { FeedObject } from 'podverse-partytime';
2
+ export declare const detectDuckTypedPublisherMediumId: (parsedFeed: FeedObject) => import("podverse-helpers").MediumEnum | null;
3
+ //# sourceMappingURL=publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,eAAO,MAAM,gCAAgC,GAAI,YAAY,UAAU,iDA6BtE,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectDuckTypedPublisherMediumId = void 0;
4
+ const podverse_helpers_1 = require("podverse-helpers");
5
+ // Determine the most-appropriate publisher medium based on podcastRemoteItems
6
+ const detectDuckTypedPublisherMediumId = (parsedFeed) => {
7
+ const mediumRaw = parsedFeed.medium;
8
+ const isPublisher = (typeof mediumRaw === 'string' && mediumRaw.toLowerCase() === 'publisher');
9
+ if (!isPublisher)
10
+ return null;
11
+ let countPodcast = 0;
12
+ let countVideo = 0;
13
+ let countMusic = 0;
14
+ if (Array.isArray(parsedFeed.podcastRemoteItems)) {
15
+ for (const ri of parsedFeed.podcastRemoteItems) {
16
+ const m = ((ri === null || ri === void 0 ? void 0 : ri.medium) || '').toString().toLowerCase();
17
+ if (!m)
18
+ continue;
19
+ if (m.includes('music'))
20
+ countMusic++;
21
+ else if (m.includes('video'))
22
+ countVideo++;
23
+ else if (m.includes('podcast'))
24
+ countPodcast++;
25
+ }
26
+ }
27
+ const maxCount = Math.max(countPodcast, countVideo, countMusic);
28
+ if (maxCount === 0) {
29
+ return (0, podverse_helpers_1.getMediumEnumValue)('podcast');
30
+ }
31
+ else if (maxCount === countVideo) {
32
+ return (0, podverse_helpers_1.getMediumEnumValue)('publishervideo');
33
+ }
34
+ else if (maxCount === countMusic) {
35
+ return (0, podverse_helpers_1.getMediumEnumValue)('publishermusic');
36
+ }
37
+ return (0, podverse_helpers_1.getMediumEnumValue)('publisherpodcast');
38
+ };
39
+ exports.detectDuckTypedPublisherMediumId = detectDuckTypedPublisherMediumId;
@@ -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;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"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAKxB,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;AAgBD,eAAO,MAAM,6BAA6B,GACxC,KAAK,MAAM,EACX,kBAAkB,MAAM,EACxB,SAAS,oCAAoC;;;;;;EA4I9C,CAAC"}
@@ -42,6 +42,20 @@ const getAndParseRSSFeed = (url) => __awaiter(void 0, void 0, void 0, function*
42
42
  return parsedFeed;
43
43
  });
44
44
  exports.getAndParseRSSFeed = getAndParseRSSFeed;
45
+ // Handle request delay for specific domains to avoid rate limiting
46
+ function handleRateLimitRequestDelay(url) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const delayConfig = [
49
+ { regex: /^https?:\/\/(www\.)?wavlake\.com/, delay: 5000 },
50
+ ];
51
+ for (const { regex, delay } of delayConfig) {
52
+ if (regex.test(url)) {
53
+ yield (0, podverse_helpers_1.sleep)(delay);
54
+ break;
55
+ }
56
+ }
57
+ });
58
+ }
45
59
  const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id, options) => __awaiter(void 0, void 0, void 0, function* () {
46
60
  const { onDemandParserEvent } = options;
47
61
  const onDemandParserEventService = new podverse_orm_1.OnDemandParserEventService();
@@ -72,6 +86,7 @@ const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id, options) => __awai
72
86
  if (!url || !podcast_index_id) {
73
87
  throw new Error(`parseRSSFeedAndSaveToDatabase: url or podcast_index_id is missing for ${url} ${podcast_index_id}`);
74
88
  }
89
+ yield handleRateLimitRequestDelay(url);
75
90
  loggerService_1.loggerService.info(`parseRSSFeedAndSaveToDatabase url: ${url} podcast_index_id: ${podcast_index_id}`);
76
91
  feed = yield (0, feed_1.handleGetRSSFeed)(url, podcast_index_id);
77
92
  if (!(0, podverse_orm_1.checkIfFeedFlagStatusShouldParse)(feed.feed_flag_status.id)) {
@@ -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;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"}
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;AA4DD,eAAO,MAAM,+BAA+B,GAAU,SAAS,OAAO,EAAE,QAAQ,8BAA8B,KAAG,OAAO,CAAC,uBAAuB,EAAE,CAWjJ,CAAC"}
@@ -14,19 +14,6 @@ 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
16
  const loggerService_1 = require("@parser/factories/loggerService");
17
- function handleRequestDelay(url) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const delayConfig = [
20
- { regex: /^https?:\/\/(www\.)?wavlake\.com/, delay: 5000 },
21
- ];
22
- for (const { regex, delay } of delayConfig) {
23
- if (regex.test(url)) {
24
- yield (0, podverse_helpers_1.sleep)(delay);
25
- break;
26
- }
27
- }
28
- });
29
- }
30
17
  const handleRemoteItemsFeedParsing = (feedGuidsToParse, params) => __awaiter(void 0, void 0, void 0, function* () {
31
18
  var _a, _b;
32
19
  const { accountId, remoteParentPodcastIndexId } = params;
@@ -60,7 +47,6 @@ const handleRemoteItemsFeedParsing = (feedGuidsToParse, params) => __awaiter(voi
60
47
  podcast_index_id: piFeedData.id
61
48
  });
62
49
  if (!feed) {
63
- yield handleRequestDelay(piFeedData.url);
64
50
  loggerService_1.loggerService.info(`handleRemoteItemsFeedParsing: ${piFeedData.url} ${piFeedData.id}`);
65
51
  queueMessages.push({
66
52
  url: piFeedData.url,
@@ -83,10 +69,10 @@ const handleAllRemoteItemsFeedParsing = (channel, params) => __awaiter(void 0, v
83
69
  const latestChannel = yield channelService.get(channel.id);
84
70
  const results = [];
85
71
  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);
72
+ const publisherResults = yield handleRemoteItemsPublisherParsing(latestChannel, params);
73
+ const channelResults = yield handleRemoteItemsChannelParsing(latestChannel, params);
74
+ const timeSplitResults = yield handleRemoteItemsItemValueTimeSplitParsing(latestChannel, params);
75
+ results.push(...podrollResults, ...publisherResults, ...channelResults, ...timeSplitResults);
90
76
  return results;
91
77
  });
92
78
  exports.handleAllRemoteItemsFeedParsing = handleAllRemoteItemsFeedParsing;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-parser",
3
- "version": "5.1.12",
3
+ "version": "5.1.14-alpha.0",
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.14-alpha.0",
21
+ "podverse-helpers": "^5.1.14-alpha.0",
22
+ "podverse-orm": "^5.1.14-alpha.0",
23
23
  "podverse-partytime": "^5.0.0"
24
24
  },
25
25
  "devDependencies": {