podverse-parser 5.0.0-beta.2 → 5.0.0-beta.3

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.
Files changed (55) hide show
  1. package/package.json +4 -1
  2. package/.nvmrc +0 -1
  3. package/eslint.config.mjs +0 -38
  4. package/src/index.ts +0 -3
  5. package/src/lib/chapters/chapters.ts +0 -54
  6. package/src/lib/compat/channel.ts +0 -287
  7. package/src/lib/compat/chapters/chapters.ts +0 -23
  8. package/src/lib/compat/partytime/channel.ts +0 -289
  9. package/src/lib/compat/partytime/compatFull.ts +0 -7
  10. package/src/lib/compat/partytime/funding.ts +0 -8
  11. package/src/lib/compat/partytime/item.ts +0 -273
  12. package/src/lib/compat/partytime/liveItem.ts +0 -18
  13. package/src/lib/compat/partytime/value.ts +0 -64
  14. package/src/lib/rss/base/handleParsedManyData.ts +0 -16
  15. package/src/lib/rss/base/handleParsedOneData.ts +0 -17
  16. package/src/lib/rss/channel/channel.ts +0 -55
  17. package/src/lib/rss/channel/channelAbout.ts +0 -13
  18. package/src/lib/rss/channel/channelChat.ts +0 -14
  19. package/src/lib/rss/channel/channelDescription.ts +0 -14
  20. package/src/lib/rss/channel/channelFunding.ts +0 -14
  21. package/src/lib/rss/channel/channelImage.ts +0 -14
  22. package/src/lib/rss/channel/channelLicense.ts +0 -14
  23. package/src/lib/rss/channel/channelLocation.ts +0 -14
  24. package/src/lib/rss/channel/channelPerson.ts +0 -14
  25. package/src/lib/rss/channel/channelPodroll.ts +0 -21
  26. package/src/lib/rss/channel/channelRemoteItem.ts +0 -14
  27. package/src/lib/rss/channel/channelSeason.ts +0 -14
  28. package/src/lib/rss/channel/channelSocialInteract.ts +0 -14
  29. package/src/lib/rss/channel/channelTrailer.ts +0 -31
  30. package/src/lib/rss/channel/channelTxt.ts +0 -14
  31. package/src/lib/rss/channel/channelValue.ts +0 -30
  32. package/src/lib/rss/feed/feed.ts +0 -79
  33. package/src/lib/rss/hash/parsedFeed.ts +0 -9
  34. package/src/lib/rss/item/item.ts +0 -85
  35. package/src/lib/rss/item/itemAbout.ts +0 -13
  36. package/src/lib/rss/item/itemChaptersFeed.ts +0 -14
  37. package/src/lib/rss/item/itemChat.ts +0 -14
  38. package/src/lib/rss/item/itemContentLink.ts +0 -0
  39. package/src/lib/rss/item/itemDescription.ts +0 -14
  40. package/src/lib/rss/item/itemEnclosure.ts +0 -35
  41. package/src/lib/rss/item/itemImage.ts +0 -14
  42. package/src/lib/rss/item/itemLicense.ts +0 -14
  43. package/src/lib/rss/item/itemLocation.ts +0 -14
  44. package/src/lib/rss/item/itemPerson.ts +0 -14
  45. package/src/lib/rss/item/itemSeason.ts +0 -26
  46. package/src/lib/rss/item/itemSeasonEpisode.ts +0 -14
  47. package/src/lib/rss/item/itemSocialInteract.ts +0 -14
  48. package/src/lib/rss/item/itemSoundbite.ts +0 -14
  49. package/src/lib/rss/item/itemTranscript.ts +0 -14
  50. package/src/lib/rss/item/itemTxt.ts +0 -14
  51. package/src/lib/rss/item/itemValue.ts +0 -60
  52. package/src/lib/rss/liveItem/liveItem.ts +0 -34
  53. package/src/lib/rss/parser.ts +0 -85
  54. package/src/module-alias-config.ts +0 -8
  55. package/tsconfig.json +0 -25
@@ -1,85 +0,0 @@
1
- import { parseFeed } from 'podcast-partytime';
2
- import { request } from 'podverse-helpers';
3
- import { ChannelService, ChannelSeasonService, FeedLogService, FeedService } from 'podverse-orm';
4
- import { handleParsedChannel } from "@parser/lib/rss/channel/channel";
5
- import { handleParsedItems } from './item/item';
6
- import { handleParsedChannelSeasons } from './channel/channelSeason';
7
- import { handleParsedLiveItems } from './liveItem/liveItem';
8
- import { handleGetRSSFeed, handleParsedFeed } from './feed/feed';
9
-
10
- /*
11
- NOTE: All RSS feeds that have a podcast_index_id will be saved to the database.
12
- RSS feeds without podcast_index_id (Add By RSS feeds) will NOT be saved to the database.
13
- */
14
-
15
- // TEMP: exists for development purposes
16
- export const parseAllRSSFeeds = async () => {
17
- const feedService = new FeedService();
18
- const feeds = await feedService.getAll();
19
- for (const feed of feeds) {
20
- return await parseRSSFeedAndSaveToDatabase(feed.url, feed?.channel?.podcast_index_id);
21
- }
22
- };
23
-
24
- export const getAndParseRSSFeed = async (url: string) => {
25
- const xml: string = await request(url);
26
- const parsedFeed = parseFeed(xml, { allowMissingGuid: true });
27
-
28
- if (!parsedFeed) {
29
- throw new Error(`getAndParseRSSFeed: parsedFeed not found for ${url}`);
30
- }
31
-
32
- return parsedFeed;
33
- };
34
-
35
- // export const parseRSSAddByRSSFeed = async (url: string) => {
36
- // const parsedFeed = await getAndParseRSSFeed(url);
37
- // const compatData = convertParsedRSSFeedToCompat(parsedFeed);
38
- // return compatData;
39
- // };
40
-
41
- export const parseRSSFeedAndSaveToDatabase = async (url: string, podcast_index_id: number) => {
42
- const feedService = new FeedService();
43
-
44
- let feed = await feedService.getBy({ url, podcast_index_id });
45
- if (!feed) {
46
- throw new Error(`parseRSSFeedAndSaveToDatabase: feed not found for ${url}`);
47
- }
48
-
49
- const parsedFeed = await handleGetRSSFeed(feed);
50
- feed = await handleParsedFeed(parsedFeed, url, podcast_index_id);
51
-
52
- try {
53
- await feedService.update(feed.id, { is_parsing: new Date() });
54
-
55
- const channelService = new ChannelService();
56
- const channel = await channelService.getOrCreateByPodcastIndexId({ feed, podcast_index_id });
57
-
58
- // ChannelSeason must be parsed before anything else, because the channel season rows
59
- // need to be created for other data to have a foreign key to them.
60
- await handleParsedChannelSeasons(parsedFeed, channel);
61
- const channelSeasonService = new ChannelSeasonService();
62
- const channelSeasonIndex = await channelSeasonService.getChannelSeasonIndex(channel);
63
-
64
- await handleParsedChannel(parsedFeed, channel, channelSeasonIndex);
65
-
66
- // PTDO: if publisher feed, handle publisher remote item data
67
- // else handle parsed items
68
- await handleParsedItems(parsedFeed.items, channel, channelSeasonIndex);
69
-
70
- if (parsedFeed.podcastLiveItems) {
71
- await handleParsedLiveItems(parsedFeed.podcastLiveItems, channel, channelSeasonIndex);
72
- }
73
-
74
- // TODO: handle new item notifications
75
-
76
- // TODO: handle new live_item notifications
77
-
78
- const feedLogService = new FeedLogService();
79
- await feedLogService.update(feed, { last_finished_parse_time: new Date() });
80
- } finally {
81
- await feedService.update(feed.id, { is_parsing: null });
82
- }
83
-
84
- return feed;
85
- };
@@ -1,8 +0,0 @@
1
- const moduleAlias = require('module-alias');
2
- const path = require('path');
3
-
4
- moduleAlias.addAliases({
5
- '@parser': path.join(__dirname, '')
6
- });
7
-
8
- export {};
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES6",
4
- "module": "commonjs",
5
- "strict": true,
6
- "noImplicitAny": true,
7
- "esModuleInterop": true,
8
- "experimentalDecorators": true,
9
- "emitDecoratorMetadata": true,
10
- "skipLibCheck": true,
11
- "declaration": true,
12
- "declarationMap": true,
13
- "forceConsistentCasingInFileNames": true,
14
- "outDir": "./dist",
15
- "rootDir": "./src",
16
- "baseUrl": "./",
17
- "paths": {
18
- "@parser/*": ["src/*"]
19
- }
20
- },
21
- "include": [
22
- "./src/**/*.ts"
23
- ],
24
- "exclude": ["node_modules"]
25
- }