podverse-parser 5.0.2 → 5.0.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.
- package/LICENSE +661 -0
- package/README.md +37 -0
- package/dist/lib/compat/partytime/channel.d.ts +5 -5
- package/dist/lib/compat/partytime/channel.d.ts.map +1 -1
- package/dist/lib/compat/partytime/channel.js +70 -55
- package/dist/lib/compat/partytime/item.d.ts +2 -2
- package/dist/lib/compat/partytime/item.d.ts.map +1 -1
- package/dist/lib/compat/partytime/item.js +67 -60
- package/dist/lib/compat/partytime/value.d.ts.map +1 -1
- package/dist/lib/compat/partytime/value.js +20 -18
- package/dist/lib/rss/feed/feed.d.ts.map +1 -1
- package/dist/lib/rss/parser.d.ts.map +1 -1
- package/dist/lib/rss/parser.js +7 -0
- package/package.json +2 -2
- package/dist/lib/compat/channel.d.ts +0 -108
- package/dist/lib/compat/channel.d.ts.map +0 -1
- package/dist/lib/compat/channel.js +0 -279
- package/dist/lib/compat/partytime/funding.d.ts +0 -6
- package/dist/lib/compat/partytime/funding.d.ts.map +0 -1
- package/dist/lib/compat/partytime/funding.js +0 -10
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compatChannelValueDtos = exports.compatChannelTxtDtos = exports.compatChannelTrailerDtos = exports.compatChannelSeasonDtos = exports.compatChannelSocialInteractDtos = exports.compatChannelRemoteItemDtos = exports.compatChannelPublisherRemoteItemDtos = exports.compatChannelPodrollRemoteItemDtos = exports.compatChannelPersonDtos = exports.compatChannelLocationDto = exports.compatChannelLicenseDto = exports.compatChannelImageDtos = exports.compatChannelFundingDtos = exports.compatChannelDescriptionDto = exports.compatChannelChatDto = exports.compatChannelAboutDto = exports.compatChannelDto = void 0;
|
|
4
|
-
const podcast_partytime_1 = require("podcast-partytime");
|
|
5
|
-
const podverse_helpers_1 = require("podverse-helpers");
|
|
6
|
-
const podverse_orm_1 = require("podverse-orm");
|
|
7
|
-
const value_1 = require("@parser/lib/compat/partytime/value");
|
|
8
|
-
const compatChannelDto = (parsedFeed) => {
|
|
9
|
-
var _a;
|
|
10
|
-
return ({
|
|
11
|
-
podcast_guid: parsedFeed.guid,
|
|
12
|
-
title: parsedFeed.title,
|
|
13
|
-
sortable_title: (0, podverse_helpers_1.createSortableTitle)(parsedFeed.title),
|
|
14
|
-
medium: (0, podverse_orm_1.getMediumEnumValue)((_a = parsedFeed.medium) !== null && _a !== void 0 ? _a : podcast_partytime_1.Phase4Medium.Podcast)
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
exports.compatChannelDto = compatChannelDto;
|
|
18
|
-
const compatChannelAboutDto = (parsedFeed) => {
|
|
19
|
-
var _a;
|
|
20
|
-
return ({
|
|
21
|
-
author: ((_a = (Array.isArray(parsedFeed.author) ? parsedFeed.author : parsedFeed.author ? [parsedFeed.author] : [])) === null || _a === void 0 ? void 0 : _a.join(', ')) || null,
|
|
22
|
-
explicit: (0, podverse_helpers_1.getBooleanOrNull)(parsedFeed.explicit),
|
|
23
|
-
language: parsedFeed.language || null,
|
|
24
|
-
website_link_url: parsedFeed.link || null,
|
|
25
|
-
itunes_type: (0, podverse_orm_1.getChannelItunesTypeItunesTypeEnumValue)(parsedFeed.itunesType || 'episodic')
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
exports.compatChannelAboutDto = compatChannelAboutDto;
|
|
29
|
-
const compatChannelChatDto = (parsedFeed) => {
|
|
30
|
-
if (!parsedFeed.chat) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
server: parsedFeed.chat.server,
|
|
35
|
-
protocol: parsedFeed.chat.protocol,
|
|
36
|
-
account_id: parsedFeed.chat.accountId || null,
|
|
37
|
-
space: parsedFeed.chat.space || null
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
exports.compatChannelChatDto = compatChannelChatDto;
|
|
41
|
-
const compatChannelDescriptionDto = (parsedFeed) => {
|
|
42
|
-
if (!parsedFeed.description) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
value: parsedFeed.description
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
exports.compatChannelDescriptionDto = compatChannelDescriptionDto;
|
|
50
|
-
const compatChannelFundingDtos = (parsedFeed) => {
|
|
51
|
-
const dtos = [];
|
|
52
|
-
if (Array.isArray(parsedFeed.podcastFunding)) {
|
|
53
|
-
for (const f of parsedFeed.podcastFunding) {
|
|
54
|
-
if (f.url) {
|
|
55
|
-
dtos.push({
|
|
56
|
-
url: f.url,
|
|
57
|
-
title: f.message || null
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return dtos;
|
|
63
|
-
};
|
|
64
|
-
exports.compatChannelFundingDtos = compatChannelFundingDtos;
|
|
65
|
-
const compatChannelImageDtos = (parsedFeed) => {
|
|
66
|
-
var _a;
|
|
67
|
-
const dtos = [];
|
|
68
|
-
if (parsedFeed.itunesImage) {
|
|
69
|
-
dtos.push({
|
|
70
|
-
url: parsedFeed.itunesImage,
|
|
71
|
-
image_width_size: null
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else if ((_a = parsedFeed.image) === null || _a === void 0 ? void 0 : _a.url) {
|
|
75
|
-
dtos.push({
|
|
76
|
-
url: parsedFeed.image.url,
|
|
77
|
-
image_width_size: null
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
function hasWidth(image) {
|
|
81
|
-
return image.width !== undefined;
|
|
82
|
-
}
|
|
83
|
-
if (Array.isArray(parsedFeed.podcastImages)) {
|
|
84
|
-
for (const image of parsedFeed.podcastImages) {
|
|
85
|
-
if (image.parsed.url && hasWidth(image.parsed)) {
|
|
86
|
-
dtos.push({
|
|
87
|
-
url: image.parsed.url,
|
|
88
|
-
image_width_size: image.parsed.width
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return dtos;
|
|
94
|
-
};
|
|
95
|
-
exports.compatChannelImageDtos = compatChannelImageDtos;
|
|
96
|
-
const compatChannelLicenseDto = (parsedFeed) => {
|
|
97
|
-
var _a;
|
|
98
|
-
if (!((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.license) === null || _a === void 0 ? void 0 : _a.identifier)) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
identifier: parsedFeed.license.identifier,
|
|
103
|
-
url: parsedFeed.license.url || null
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
exports.compatChannelLicenseDto = compatChannelLicenseDto;
|
|
107
|
-
const compatChannelLocationDto = (parsedFeed) => {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
if (!((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.podcastLocation) === null || _a === void 0 ? void 0 : _a.geo) && !((_b = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.podcastLocation) === null || _b === void 0 ? void 0 : _b.osm)) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
geo: parsedFeed.podcastLocation.geo || null,
|
|
114
|
-
osm: parsedFeed.podcastLocation.osm || null,
|
|
115
|
-
name: parsedFeed.podcastLocation.name || null
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
exports.compatChannelLocationDto = compatChannelLocationDto;
|
|
119
|
-
const compatChannelPersonDtos = (parsedFeed) => {
|
|
120
|
-
var _a, _b;
|
|
121
|
-
const dtos = [];
|
|
122
|
-
if (Array.isArray(parsedFeed.podcastPeople)) {
|
|
123
|
-
for (const p of parsedFeed.podcastPeople) {
|
|
124
|
-
if (p.name) {
|
|
125
|
-
dtos.push({
|
|
126
|
-
name: p.name,
|
|
127
|
-
role: ((_a = p.role) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || null,
|
|
128
|
-
person_group: ((_b = p.group) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || 'cast',
|
|
129
|
-
img: p.img || null,
|
|
130
|
-
href: p.href || null
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return dtos;
|
|
136
|
-
};
|
|
137
|
-
exports.compatChannelPersonDtos = compatChannelPersonDtos;
|
|
138
|
-
const compatChannelPodrollRemoteItemDtos = (parsedFeed) => {
|
|
139
|
-
const dtos = [];
|
|
140
|
-
if (Array.isArray(parsedFeed.podroll)) {
|
|
141
|
-
for (const ri of parsedFeed.podroll) {
|
|
142
|
-
if (ri.feedGuid) {
|
|
143
|
-
dtos.push({
|
|
144
|
-
feed_guid: ri.feedGuid,
|
|
145
|
-
feed_url: ri.feedUrl || null,
|
|
146
|
-
item_guid: null,
|
|
147
|
-
title: /* PTDO: ri.title || */ null
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return dtos;
|
|
153
|
-
};
|
|
154
|
-
exports.compatChannelPodrollRemoteItemDtos = compatChannelPodrollRemoteItemDtos;
|
|
155
|
-
const compatChannelPublisherRemoteItemDtos = (parsedFeed) => {
|
|
156
|
-
const dtos = [];
|
|
157
|
-
if (Array.isArray(parsedFeed.podroll)) {
|
|
158
|
-
for (const ri of parsedFeed.podroll) {
|
|
159
|
-
if (ri.feedGuid) {
|
|
160
|
-
dtos.push({
|
|
161
|
-
feed_guid: ri.feedGuid,
|
|
162
|
-
feed_url: ri.feedUrl || null,
|
|
163
|
-
item_guid: null,
|
|
164
|
-
title: /* PTDO: ri.title || */ null
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return dtos;
|
|
170
|
-
};
|
|
171
|
-
exports.compatChannelPublisherRemoteItemDtos = compatChannelPublisherRemoteItemDtos;
|
|
172
|
-
const compatChannelRemoteItemDtos = (parsedFeed) => {
|
|
173
|
-
const dtos = [];
|
|
174
|
-
if (Array.isArray(parsedFeed.podcastRemoteItems)) {
|
|
175
|
-
for (const ri of parsedFeed.podcastRemoteItems) {
|
|
176
|
-
if (ri.feedGuid) {
|
|
177
|
-
dtos.push({
|
|
178
|
-
feed_guid: ri.feedGuid,
|
|
179
|
-
feed_url: ri.feedUrl || null,
|
|
180
|
-
item_guid: null,
|
|
181
|
-
title: /* PTDO: ri.title || */ null
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return dtos;
|
|
187
|
-
};
|
|
188
|
-
exports.compatChannelRemoteItemDtos = compatChannelRemoteItemDtos;
|
|
189
|
-
const compatChannelSocialInteractDtos = (parsedFeed) => {
|
|
190
|
-
var _a;
|
|
191
|
-
const dtos = [];
|
|
192
|
-
if ((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.podcastSocial) === null || _a === void 0 ? void 0 : _a.length) {
|
|
193
|
-
for (const ps of parsedFeed.podcastSocial) {
|
|
194
|
-
dtos.push({
|
|
195
|
-
// PTDO: fix keys mismatch between partytime and podverse
|
|
196
|
-
protocol: ps.platform,
|
|
197
|
-
uri: ps.url,
|
|
198
|
-
account_id: ps.id || null,
|
|
199
|
-
account_url: ps.name || null,
|
|
200
|
-
priority: ps.priority || null
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return dtos;
|
|
205
|
-
};
|
|
206
|
-
exports.compatChannelSocialInteractDtos = compatChannelSocialInteractDtos;
|
|
207
|
-
const compatChannelSeasonDtos = (parsedFeed) => {
|
|
208
|
-
var _a, _b;
|
|
209
|
-
const dtos = [];
|
|
210
|
-
const parsedItems = (parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.items) || [];
|
|
211
|
-
const seasonsIndex = {};
|
|
212
|
-
for (const parsedItem of parsedItems) {
|
|
213
|
-
const seasonNumber = ((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastSeason) === null || _a === void 0 ? void 0 : _a.number) || (parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.itunesSeason);
|
|
214
|
-
const seasonName = ((_b = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastSeason) === null || _b === void 0 ? void 0 : _b.name) || null;
|
|
215
|
-
if (Number.isInteger(seasonNumber)) {
|
|
216
|
-
const seasonNumberAsNumber = seasonNumber;
|
|
217
|
-
seasonsIndex[seasonNumberAsNumber] = {
|
|
218
|
-
name: seasonName
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
for (const [number, { name }] of Object.entries(seasonsIndex)) {
|
|
223
|
-
dtos.push({
|
|
224
|
-
number: parseInt(number),
|
|
225
|
-
name: name || null
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
return dtos;
|
|
229
|
-
};
|
|
230
|
-
exports.compatChannelSeasonDtos = compatChannelSeasonDtos;
|
|
231
|
-
const compatChannelTrailerDtos = (parsedFeed) => {
|
|
232
|
-
var _a;
|
|
233
|
-
const dtos = [];
|
|
234
|
-
if ((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.trailers) === null || _a === void 0 ? void 0 : _a.length) {
|
|
235
|
-
for (const pt of parsedFeed.trailers) {
|
|
236
|
-
dtos.push({
|
|
237
|
-
url: pt.url,
|
|
238
|
-
title: /* PTDO: add pt.title || */ null,
|
|
239
|
-
pubdate: pt.pubdate,
|
|
240
|
-
length: pt.length || null,
|
|
241
|
-
type: pt.type || null,
|
|
242
|
-
season: pt.season || null
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return dtos;
|
|
247
|
-
};
|
|
248
|
-
exports.compatChannelTrailerDtos = compatChannelTrailerDtos;
|
|
249
|
-
const compatChannelTxtDtos = (parsedFeed) => {
|
|
250
|
-
var _a;
|
|
251
|
-
const dtos = [];
|
|
252
|
-
if ((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.podcastTxt) === null || _a === void 0 ? void 0 : _a.length) {
|
|
253
|
-
for (const pt of parsedFeed.podcastTxt) {
|
|
254
|
-
dtos.push({
|
|
255
|
-
purpose: pt.purpose || null,
|
|
256
|
-
value: pt.value
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return dtos;
|
|
261
|
-
};
|
|
262
|
-
exports.compatChannelTxtDtos = compatChannelTxtDtos;
|
|
263
|
-
const compatChannelValueDtos = (parsedFeed) => {
|
|
264
|
-
let dtos = [];
|
|
265
|
-
if (parsedFeed.value) {
|
|
266
|
-
const dto = (0, value_1.compatChannelValue)(parsedFeed.value);
|
|
267
|
-
const formattedDto = {
|
|
268
|
-
channel_value: {
|
|
269
|
-
type: dto.type,
|
|
270
|
-
method: dto.method,
|
|
271
|
-
suggested: dto.suggested || null
|
|
272
|
-
},
|
|
273
|
-
channel_value_recipients: dto.channel_value_recipients
|
|
274
|
-
};
|
|
275
|
-
dtos.push(formattedDto);
|
|
276
|
-
}
|
|
277
|
-
return dtos;
|
|
278
|
-
};
|
|
279
|
-
exports.compatChannelValueDtos = compatChannelValueDtos;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"funding.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/funding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,eAAO,MAAM,aAAa,YAAa,aAAa;;;CAKnD,CAAC"}
|