feedscout 1.9.0 → 2.0.0-beta.2

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 (180) hide show
  1. package/dist/common/discover/defaults.js +1 -3
  2. package/dist/common/discover/utils.d.ts +2 -3
  3. package/dist/common/uris/feed/types.d.ts +2 -2
  4. package/dist/feeds/extractors.js +2 -2
  5. package/dist/feeds/platform/handlers/discourse.js +2 -6
  6. package/dist/feeds/platform/handlers/libsyn.js +1 -1
  7. package/package.json +23 -62
  8. package/dist/blogrolls/defaults.cjs +0 -57
  9. package/dist/blogrolls/defaults.d.cts +0 -16
  10. package/dist/blogrolls/extractors.cjs +0 -21
  11. package/dist/blogrolls/extractors.d.cts +0 -7
  12. package/dist/blogrolls/index.cjs +0 -25
  13. package/dist/blogrolls/index.d.cts +0 -7
  14. package/dist/blogrolls/types.d.cts +0 -6
  15. package/dist/blogrolls.cjs +0 -12
  16. package/dist/blogrolls.d.cts +0 -4
  17. package/dist/common/discover/defaults.cjs +0 -46
  18. package/dist/common/discover/defaults.d.cts +0 -6
  19. package/dist/common/discover/index.cjs +0 -105
  20. package/dist/common/discover/utils.cjs +0 -101
  21. package/dist/common/discover/utils.d.cts +0 -6
  22. package/dist/common/locales.cjs +0 -348
  23. package/dist/common/types.cjs +0 -10
  24. package/dist/common/types.d.cts +0 -90
  25. package/dist/common/uris/feed/index.cjs +0 -12
  26. package/dist/common/uris/feed/index.d.cts +0 -6
  27. package/dist/common/uris/feed/types.d.cts +0 -9
  28. package/dist/common/uris/guess/index.cjs +0 -8
  29. package/dist/common/uris/guess/index.d.cts +0 -7
  30. package/dist/common/uris/guess/types.d.cts +0 -10
  31. package/dist/common/uris/guess/utils.cjs +0 -42
  32. package/dist/common/uris/guess/utils.d.cts +0 -8
  33. package/dist/common/uris/headers/index.cjs +0 -26
  34. package/dist/common/uris/headers/index.d.cts +0 -6
  35. package/dist/common/uris/headers/types.d.cts +0 -9
  36. package/dist/common/uris/html/handlers.cjs +0 -59
  37. package/dist/common/uris/html/index.cjs +0 -35
  38. package/dist/common/uris/html/index.d.cts +0 -6
  39. package/dist/common/uris/html/types.d.cts +0 -13
  40. package/dist/common/uris/index.cjs +0 -32
  41. package/dist/common/uris/platform/index.cjs +0 -10
  42. package/dist/common/uris/platform/index.d.cts +0 -7
  43. package/dist/common/uris/platform/types.d.cts +0 -13
  44. package/dist/common/utils.cjs +0 -98
  45. package/dist/common/utils.d.cts +0 -12
  46. package/dist/favicons/defaults.cjs +0 -65
  47. package/dist/favicons/defaults.d.cts +0 -18
  48. package/dist/favicons/extractors.cjs +0 -25
  49. package/dist/favicons/extractors.d.cts +0 -7
  50. package/dist/favicons/index.cjs +0 -29
  51. package/dist/favicons/index.d.cts +0 -7
  52. package/dist/favicons/platform/handlers/bluesky.cjs +0 -27
  53. package/dist/favicons/platform/handlers/codeberg.cjs +0 -19
  54. package/dist/favicons/platform/handlers/deviantart.cjs +0 -29
  55. package/dist/favicons/platform/handlers/devto.cjs +0 -31
  56. package/dist/favicons/platform/handlers/github.cjs +0 -19
  57. package/dist/favicons/platform/handlers/githubGist.cjs +0 -19
  58. package/dist/favicons/platform/handlers/gitlab.cjs +0 -38
  59. package/dist/favicons/platform/handlers/lobsters.cjs +0 -21
  60. package/dist/favicons/platform/handlers/mastodon.cjs +0 -40
  61. package/dist/favicons/platform/handlers/reddit.cjs +0 -42
  62. package/dist/favicons/platform/handlers/sourceforge.cjs +0 -21
  63. package/dist/favicons/platform/handlers/tumblr.cjs +0 -16
  64. package/dist/favicons/types.d.cts +0 -4
  65. package/dist/favicons/utils.cjs +0 -10
  66. package/dist/favicons.cjs +0 -12
  67. package/dist/favicons.d.cts +0 -4
  68. package/dist/feeds/defaults.cjs +0 -290
  69. package/dist/feeds/defaults.d.cts +0 -21
  70. package/dist/feeds/extractors.cjs +0 -46
  71. package/dist/feeds/extractors.d.cts +0 -7
  72. package/dist/feeds/index.cjs +0 -26
  73. package/dist/feeds/index.d.cts +0 -7
  74. package/dist/feeds/platform/handlers/acast.cjs +0 -26
  75. package/dist/feeds/platform/handlers/ameblo.cjs +0 -36
  76. package/dist/feeds/platform/handlers/applePodcasts.cjs +0 -26
  77. package/dist/feeds/platform/handlers/arena.cjs +0 -42
  78. package/dist/feeds/platform/handlers/artstation.cjs +0 -52
  79. package/dist/feeds/platform/handlers/audioboom.cjs +0 -23
  80. package/dist/feeds/platform/handlers/bearblog.cjs +0 -45
  81. package/dist/feeds/platform/handlers/behance.cjs +0 -56
  82. package/dist/feeds/platform/handlers/blogspot.cjs +0 -72
  83. package/dist/feeds/platform/handlers/bluesky.cjs +0 -20
  84. package/dist/feeds/platform/handlers/bookwyrm.cjs +0 -48
  85. package/dist/feeds/platform/handlers/buttondown.cjs +0 -43
  86. package/dist/feeds/platform/handlers/buzzsprout.cjs +0 -22
  87. package/dist/feeds/platform/handlers/codeberg.cjs +0 -69
  88. package/dist/feeds/platform/handlers/csdn.cjs +0 -20
  89. package/dist/feeds/platform/handlers/dailymotion.cjs +0 -86
  90. package/dist/feeds/platform/handlers/deviantart.cjs +0 -85
  91. package/dist/feeds/platform/handlers/devto.cjs +0 -58
  92. package/dist/feeds/platform/handlers/discourse.cjs +0 -70
  93. package/dist/feeds/platform/handlers/douban.cjs +0 -56
  94. package/dist/feeds/platform/handlers/dreamwidth.cjs +0 -48
  95. package/dist/feeds/platform/handlers/exblog.cjs +0 -35
  96. package/dist/feeds/platform/handlers/fireside.cjs +0 -24
  97. package/dist/feeds/platform/handlers/friendica.cjs +0 -44
  98. package/dist/feeds/platform/handlers/ghost.cjs +0 -30
  99. package/dist/feeds/platform/handlers/github.cjs +0 -122
  100. package/dist/feeds/platform/handlers/githubGist.cjs +0 -56
  101. package/dist/feeds/platform/handlers/gitlab.cjs +0 -98
  102. package/dist/feeds/platform/handlers/goodreads.cjs +0 -49
  103. package/dist/feeds/platform/handlers/hackernews.cjs +0 -21
  104. package/dist/feeds/platform/handlers/hashnode.cjs +0 -16
  105. package/dist/feeds/platform/handlers/hatenablog.cjs +0 -56
  106. package/dist/feeds/platform/handlers/hearthis.cjs +0 -32
  107. package/dist/feeds/platform/handlers/heyWorld.cjs +0 -18
  108. package/dist/feeds/platform/handlers/insanejournal.cjs +0 -69
  109. package/dist/feeds/platform/handlers/itchio.cjs +0 -111
  110. package/dist/feeds/platform/handlers/kickstarter.cjs +0 -22
  111. package/dist/feeds/platform/handlers/lemmy.cjs +0 -88
  112. package/dist/feeds/platform/handlers/letterboxd.cjs +0 -46
  113. package/dist/feeds/platform/handlers/libsyn.cjs +0 -25
  114. package/dist/feeds/platform/handlers/listed.cjs +0 -20
  115. package/dist/feeds/platform/handlers/livejournal.cjs +0 -68
  116. package/dist/feeds/platform/handlers/lobsters.cjs +0 -57
  117. package/dist/feeds/platform/handlers/mastodon.cjs +0 -74
  118. package/dist/feeds/platform/handlers/mataroa.cjs +0 -16
  119. package/dist/feeds/platform/handlers/medium.cjs +0 -68
  120. package/dist/feeds/platform/handlers/microblog.cjs +0 -55
  121. package/dist/feeds/platform/handlers/misskey.cjs +0 -40
  122. package/dist/feeds/platform/handlers/myanimelist.cjs +0 -43
  123. package/dist/feeds/platform/handlers/naverBlog.cjs +0 -21
  124. package/dist/feeds/platform/handlers/nebula.cjs +0 -68
  125. package/dist/feeds/platform/handlers/note.cjs +0 -53
  126. package/dist/feeds/platform/handlers/observable.cjs +0 -34
  127. package/dist/feeds/platform/handlers/odysee.cjs +0 -20
  128. package/dist/feeds/platform/handlers/pagecord.cjs +0 -16
  129. package/dist/feeds/platform/handlers/paragraph.cjs +0 -20
  130. package/dist/feeds/platform/handlers/pika.cjs +0 -35
  131. package/dist/feeds/platform/handlers/pinterest.cjs +0 -57
  132. package/dist/feeds/platform/handlers/pixelfed.cjs +0 -46
  133. package/dist/feeds/platform/handlers/pleroma.cjs +0 -34
  134. package/dist/feeds/platform/handlers/podbean.cjs +0 -29
  135. package/dist/feeds/platform/handlers/podigee.cjs +0 -29
  136. package/dist/feeds/platform/handlers/posthaven.cjs +0 -24
  137. package/dist/feeds/platform/handlers/producthunt.cjs +0 -29
  138. package/dist/feeds/platform/handlers/prose.cjs +0 -26
  139. package/dist/feeds/platform/handlers/qiita.cjs +0 -58
  140. package/dist/feeds/platform/handlers/reddit.cjs +0 -149
  141. package/dist/feeds/platform/handlers/rssCom.cjs +0 -20
  142. package/dist/feeds/platform/handlers/seesaa.cjs +0 -22
  143. package/dist/feeds/platform/handlers/soundcloud.cjs +0 -39
  144. package/dist/feeds/platform/handlers/sourceforge.cjs +0 -53
  145. package/dist/feeds/platform/handlers/spreaker.cjs +0 -21
  146. package/dist/feeds/platform/handlers/stackExchange.cjs +0 -64
  147. package/dist/feeds/platform/handlers/steam.cjs +0 -35
  148. package/dist/feeds/platform/handlers/substack.cjs +0 -23
  149. package/dist/feeds/platform/handlers/tildes.cjs +0 -41
  150. package/dist/feeds/platform/handlers/tistory.cjs +0 -16
  151. package/dist/feeds/platform/handlers/transistor.cjs +0 -29
  152. package/dist/feeds/platform/handlers/tumblr.cjs +0 -24
  153. package/dist/feeds/platform/handlers/v2ex.cjs +0 -35
  154. package/dist/feeds/platform/handlers/velog.cjs +0 -24
  155. package/dist/feeds/platform/handlers/vimeo.cjs +0 -75
  156. package/dist/feeds/platform/handlers/weblogLol.cjs +0 -26
  157. package/dist/feeds/platform/handlers/weebly.cjs +0 -25
  158. package/dist/feeds/platform/handlers/wordpress.cjs +0 -209
  159. package/dist/feeds/platform/handlers/wpengine.cjs +0 -10
  160. package/dist/feeds/platform/handlers/writeas.cjs +0 -51
  161. package/dist/feeds/platform/handlers/ximalaya.cjs +0 -20
  162. package/dist/feeds/platform/handlers/youtube.cjs +0 -97
  163. package/dist/feeds/platform/handlers/zenn.cjs +0 -54
  164. package/dist/feeds/types.d.cts +0 -9
  165. package/dist/feeds.cjs +0 -16
  166. package/dist/feeds.d.cts +0 -4
  167. package/dist/hubs/discover/index.cjs +0 -30
  168. package/dist/hubs/discover/index.d.cts +0 -7
  169. package/dist/hubs/discover/types.d.cts +0 -15
  170. package/dist/hubs/feed/index.cjs +0 -32
  171. package/dist/hubs/headers/index.cjs +0 -17
  172. package/dist/hubs/html/index.cjs +0 -28
  173. package/dist/hubs.cjs +0 -0
  174. package/dist/hubs.d.cts +0 -2
  175. package/dist/index.cjs +0 -13
  176. package/dist/index.d.cts +0 -8
  177. package/dist/methods.cjs +0 -15
  178. package/dist/methods.d.cts +0 -7
  179. package/dist/utils.cjs +0 -9
  180. package/dist/utils.d.cts +0 -3
@@ -1,51 +0,0 @@
1
- const require_utils = require("../../../common/utils.cjs");
2
- //#region src/feeds/platform/handlers/writeas.ts
3
- const hosts = ["write.as", "www.write.as"];
4
- const excludedPaths = [
5
- "about",
6
- "api",
7
- "blog",
8
- "docs",
9
- "legal",
10
- "login",
11
- "me",
12
- "pricing",
13
- "privacy",
14
- "settings",
15
- "signup",
16
- "terms"
17
- ];
18
- const tagRegex = /^\/([^/]+)\/tag:([^/]+)/;
19
- const writeasHandler = {
20
- match: (url) => {
21
- return require_utils.isHostOf(url, hosts);
22
- },
23
- resolve: (url) => {
24
- const { pathname } = new URL(url);
25
- const uris = [];
26
- const tagMatch = pathname.match(tagRegex);
27
- if (tagMatch?.[1] && tagMatch?.[2]) {
28
- const username = tagMatch[1];
29
- const tag = tagMatch[2];
30
- uris.push({
31
- uri: `https://write.as/${username}/tag:${tag}/feed/`,
32
- hint: require_utils.composeHint("writeas:tag")
33
- });
34
- uris.push({
35
- uri: `https://write.as/${username}/feed/`,
36
- hint: require_utils.composeHint("writeas:blog")
37
- });
38
- return uris;
39
- }
40
- const pathSegments = pathname.split("/").filter(Boolean);
41
- if (pathSegments.length === 0) return [];
42
- const username = pathSegments[0];
43
- if (require_utils.isAnyOf(username, excludedPaths)) return [];
44
- return [{
45
- uri: `https://write.as/${username}/feed/`,
46
- hint: require_utils.composeHint("writeas:blog")
47
- }];
48
- }
49
- };
50
- //#endregion
51
- exports.writeasHandler = writeasHandler;
@@ -1,20 +0,0 @@
1
- const require_utils = require("../../../common/utils.cjs");
2
- //#region src/feeds/platform/handlers/ximalaya.ts
3
- const albumRegex = /(?:^|\/)album\/(\d+)/;
4
- const hosts = ["www.ximalaya.com", "ximalaya.com"];
5
- const ximalayaHandler = {
6
- match: (url) => {
7
- return require_utils.isHostOf(url, hosts);
8
- },
9
- resolve: (url) => {
10
- const { pathname } = new URL(url);
11
- const id = pathname.match(albumRegex)?.[1];
12
- if (!id) return [];
13
- return [{
14
- uri: `https://www.ximalaya.com/album/${id}.xml`,
15
- hint: require_utils.composeHint("ximalaya:album")
16
- }];
17
- }
18
- };
19
- //#endregion
20
- exports.ximalayaHandler = ximalayaHandler;
@@ -1,97 +0,0 @@
1
- const require_utils = require("../../../common/utils.cjs");
2
- //#region src/feeds/platform/handlers/youtube.ts
3
- const channelIdRegex = /"(?:channelId|externalId)":"(UC[a-zA-Z0-9_-]+)"/;
4
- const channelRegex = /^\/channel\/(UC[a-zA-Z0-9_-]+)/;
5
- const handleRegex = /^\/@([^/]+)/;
6
- const userRegex = /^\/user\/([^/]+)/;
7
- const customRegex = /^\/c\/([^/]+)/;
8
- const shortsRegex = /^\/shorts\/[\w-]+/;
9
- const liveRegex = /^\/live\/[\w-]+/;
10
- const channelPrefixRegex = /^UC/;
11
- const hosts = [
12
- "youtube.com",
13
- "www.youtube.com",
14
- "m.youtube.com",
15
- "music.youtube.com",
16
- "youtu.be",
17
- "www.youtu.be"
18
- ];
19
- const extractChannelIdFromContent = (content) => {
20
- return content.match(channelIdRegex)?.[1];
21
- };
22
- const playlistPrefix = (prefix, channelId) => {
23
- return channelId.replace(channelPrefixRegex, prefix);
24
- };
25
- const feedUrl = (param, value) => {
26
- return `https://www.youtube.com/feeds/videos.xml?${param}=${value}`;
27
- };
28
- const pushChannelUris = (uris, channelId) => {
29
- uris.push({
30
- uri: [feedUrl("channel_id", channelId), feedUrl("playlist_id", playlistPrefix("UU", channelId))],
31
- hint: require_utils.composeHint("youtube:all")
32
- });
33
- uris.push({
34
- uri: feedUrl("playlist_id", playlistPrefix("UULF", channelId)),
35
- hint: require_utils.composeHint("youtube:videos")
36
- });
37
- uris.push({
38
- uri: feedUrl("playlist_id", playlistPrefix("UUSH", channelId)),
39
- hint: require_utils.composeHint("youtube:shorts")
40
- });
41
- uris.push({
42
- uri: feedUrl("playlist_id", playlistPrefix("UULV", channelId)),
43
- hint: require_utils.composeHint("youtube:live")
44
- });
45
- uris.push({
46
- uri: feedUrl("playlist_id", playlistPrefix("UULP", channelId)),
47
- hint: require_utils.composeHint("youtube:popular-videos")
48
- });
49
- uris.push({
50
- uri: feedUrl("playlist_id", playlistPrefix("UUPS", channelId)),
51
- hint: require_utils.composeHint("youtube:popular-shorts")
52
- });
53
- uris.push({
54
- uri: feedUrl("playlist_id", playlistPrefix("UUPV", channelId)),
55
- hint: require_utils.composeHint("youtube:popular-live")
56
- });
57
- uris.push({
58
- uri: feedUrl("playlist_id", playlistPrefix("UUMO", channelId)),
59
- hint: require_utils.composeHint("youtube:member-videos")
60
- });
61
- uris.push({
62
- uri: feedUrl("playlist_id", playlistPrefix("UUMS", channelId)),
63
- hint: require_utils.composeHint("youtube:member-shorts")
64
- });
65
- uris.push({
66
- uri: feedUrl("playlist_id", playlistPrefix("UUMV", channelId)),
67
- hint: require_utils.composeHint("youtube:member-live")
68
- });
69
- };
70
- const youtubeHandler = {
71
- match: (url) => {
72
- return require_utils.isHostOf(url, hosts);
73
- },
74
- resolve: (url, content) => {
75
- const parsedUrl = new URL(url);
76
- const uris = [];
77
- const channelMatch = parsedUrl.pathname.match(channelRegex);
78
- if (channelMatch?.[1]) {
79
- const channelId = channelMatch[1];
80
- pushChannelUris(uris, channelId);
81
- }
82
- const playlistId = parsedUrl.searchParams.get("list");
83
- if (playlistId) uris.push({
84
- uri: feedUrl("playlist_id", playlistId),
85
- hint: require_utils.composeHint("youtube:playlist")
86
- });
87
- if (uris.length === 0 && content) {
88
- if (parsedUrl.searchParams.has("v") || parsedUrl.hostname.includes("youtu.be") && parsedUrl.pathname.length > 1 || shortsRegex.test(parsedUrl.pathname) || liveRegex.test(parsedUrl.pathname) || parsedUrl.pathname.match(handleRegex) || parsedUrl.pathname.match(userRegex) || parsedUrl.pathname.match(customRegex)) {
89
- const channelId = extractChannelIdFromContent(content);
90
- if (channelId) pushChannelUris(uris, channelId);
91
- }
92
- }
93
- return uris;
94
- }
95
- };
96
- //#endregion
97
- exports.youtubeHandler = youtubeHandler;
@@ -1,54 +0,0 @@
1
- const require_utils = require("../../../common/utils.cjs");
2
- //#region src/feeds/platform/handlers/zenn.ts
3
- const hosts = ["zenn.dev", "www.zenn.dev"];
4
- const excludedPaths = [
5
- "about",
6
- "api",
7
- "articles",
8
- "books",
9
- "login",
10
- "notifications",
11
- "p",
12
- "privacy",
13
- "publications",
14
- "scraps",
15
- "search",
16
- "settings",
17
- "signup",
18
- "terms",
19
- "topics"
20
- ];
21
- const topicRegex = /^\/topics\/([^/]+)/;
22
- const publicationShortRegex = /^\/p\/([^/]+)/;
23
- const publicationLongRegex = /^\/publications\/([^/]+)/;
24
- const zennHandler = {
25
- match: (url) => {
26
- return require_utils.isHostOf(url, hosts);
27
- },
28
- resolve: (url) => {
29
- const { pathname } = new URL(url);
30
- const topicMatch = pathname.match(topicRegex);
31
- if (topicMatch?.[1]) return [{
32
- uri: `https://zenn.dev/topics/${topicMatch[1]}/feed`,
33
- hint: require_utils.composeHint("zenn:topic")
34
- }];
35
- const pubMatch = pathname.match(publicationShortRegex) ?? pathname.match(publicationLongRegex);
36
- if (pubMatch?.[1]) return [{
37
- uri: `https://zenn.dev/p/${pubMatch[1]}/feed`,
38
- hint: require_utils.composeHint("zenn:publication")
39
- }];
40
- const pathSegments = pathname.split("/").filter(Boolean);
41
- if (pathSegments.length === 0) return [{
42
- uri: "https://zenn.dev/feed",
43
- hint: require_utils.composeHint("zenn:trending")
44
- }];
45
- const username = pathSegments[0];
46
- if (require_utils.isAnyOf(username, excludedPaths)) return [];
47
- return [{
48
- uri: `https://zenn.dev/${username}/feed`,
49
- hint: require_utils.composeHint("zenn:posts")
50
- }];
51
- }
52
- };
53
- //#endregion
54
- exports.zennHandler = zennHandler;
@@ -1,9 +0,0 @@
1
- //#region src/feeds/types.d.ts
2
- type FeedResult = {
3
- format: 'rss' | 'atom' | 'json' | 'rdf';
4
- title?: string;
5
- description?: string;
6
- siteUrl?: string;
7
- };
8
- //#endregion
9
- export { FeedResult };
package/dist/feeds.cjs DELETED
@@ -1,16 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defaults = require("./feeds/defaults.cjs");
3
- const require_extractors = require("./feeds/extractors.cjs");
4
- exports.anchorLabels = require_defaults.anchorLabels;
5
- exports.anchorPathSegments = require_defaults.anchorPathSegments;
6
- exports.defaultExtractFn = require_extractors.defaultExtractFn;
7
- exports.defaultGuessOptions = require_defaults.defaultGuessOptions;
8
- exports.defaultHeadersOptions = require_defaults.defaultHeadersOptions;
9
- exports.defaultHtmlOptions = require_defaults.defaultHtmlOptions;
10
- exports.defaultPlatformOptions = require_defaults.defaultPlatformOptions;
11
- exports.ignoredUris = require_defaults.ignoredUris;
12
- exports.linkSelectors = require_defaults.linkSelectors;
13
- exports.mimeTypes = require_defaults.mimeTypes;
14
- exports.urisBalanced = require_defaults.urisBalanced;
15
- exports.urisComprehensive = require_defaults.urisComprehensive;
16
- exports.urisMinimal = require_defaults.urisMinimal;
package/dist/feeds.d.cts DELETED
@@ -1,4 +0,0 @@
1
- import { anchorLabels, anchorPathSegments, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal } from "./feeds/defaults.cjs";
2
- import { FeedResult } from "./feeds/types.cjs";
3
- import { defaultExtractFn } from "./feeds/extractors.cjs";
4
- export { FeedResult, anchorLabels, anchorPathSegments, defaultExtractFn, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
@@ -1,30 +0,0 @@
1
- const require_utils = require("../../common/discover/utils.cjs");
2
- const require_defaults = require("../../common/discover/defaults.cjs");
3
- const require_index = require("../feed/index.cjs");
4
- const require_index$1 = require("../headers/index.cjs");
5
- const require_index$2 = require("../html/index.cjs");
6
- //#region src/hubs/discover/index.ts
7
- const discoverHubs = async (input, options = {}) => {
8
- const { methods = [
9
- "headers",
10
- "feed",
11
- "html"
12
- ], fetchFn = require_defaults.defaultFetchFn, resolveUrlFn = require_defaults.defaultResolveUrlFn } = options;
13
- const normalizedInput = await require_utils.normalizeInput(input, fetchFn);
14
- const results = [];
15
- if (methods.includes("headers") && normalizedInput.headers) {
16
- const headerHubs = require_index$1.discoverHubsFromHeaders(normalizedInput.headers, normalizedInput.url, resolveUrlFn);
17
- results.push(...headerHubs);
18
- }
19
- if (methods.includes("feed") && normalizedInput.content) {
20
- const feedHubs = require_index.discoverHubsFromFeed(normalizedInput.content, normalizedInput.url, resolveUrlFn);
21
- results.push(...feedHubs);
22
- }
23
- if (methods.includes("html") && normalizedInput.content) {
24
- const htmlHubs = require_index$2.discoverHubsFromHtml(normalizedInput.content, normalizedInput.url, resolveUrlFn);
25
- results.push(...htmlHubs);
26
- }
27
- return results;
28
- };
29
- //#endregion
30
- exports.discoverHubs = discoverHubs;
@@ -1,7 +0,0 @@
1
- import { DiscoverInput } from "../../common/types.cjs";
2
- import { DiscoverHubsOptions, HubResult } from "./types.cjs";
3
-
4
- //#region src/hubs/discover/index.d.ts
5
- declare const discoverHubs: (input: DiscoverInput, options?: DiscoverHubsOptions) => Promise<Array<HubResult>>;
6
- //#endregion
7
- export { discoverHubs };
@@ -1,15 +0,0 @@
1
- import { DiscoverFetchFn, DiscoverResolveUrlFn } from "../../common/types.cjs";
2
-
3
- //#region src/hubs/discover/types.d.ts
4
- type HubResult = {
5
- hub: string;
6
- topic: string;
7
- };
8
- type DiscoverHubsMethodsConfig = Array<'headers' | 'html' | 'feed'>;
9
- type DiscoverHubsOptions = {
10
- methods?: DiscoverHubsMethodsConfig;
11
- fetchFn?: DiscoverFetchFn;
12
- resolveUrlFn?: DiscoverResolveUrlFn;
13
- };
14
- //#endregion
15
- export { DiscoverHubsMethodsConfig, DiscoverHubsOptions, HubResult };
@@ -1,32 +0,0 @@
1
- const require_defaults = require("../../common/discover/defaults.cjs");
2
- let feedsmith = require("feedsmith");
3
- //#region src/hubs/feed/index.ts
4
- const getLinksWithRel = (links, rel) => {
5
- return links?.filter((link) => link.rel === rel && link.href).map((link) => link.href) ?? [];
6
- };
7
- const discoverHubsFromFeed = (content, baseUrl, resolveUrlFn = require_defaults.defaultResolveUrlFn) => {
8
- try {
9
- const { format, feed } = (0, feedsmith.parseFeed)(content);
10
- if (format === "json") {
11
- const hubs = feed.hubs ?? [];
12
- const topic = feed.feed_url ? resolveUrlFn(feed.feed_url, baseUrl) ?? feed.feed_url : baseUrl;
13
- return hubs.filter((hub) => hub.url).map((hub) => ({
14
- hub: resolveUrlFn(hub.url, baseUrl) ?? hub.url,
15
- topic
16
- }));
17
- }
18
- const links = format === "atom" ? feed.links : feed.atom?.links;
19
- const hubUris = getLinksWithRel(links, "hub");
20
- if (hubUris.length > 0) {
21
- const selfUris = getLinksWithRel(links, "self");
22
- const topic = selfUris[0] ? resolveUrlFn(selfUris[0], baseUrl) ?? selfUris[0] : baseUrl;
23
- return hubUris.map((hub) => ({
24
- hub: resolveUrlFn(hub, baseUrl) ?? hub,
25
- topic
26
- }));
27
- }
28
- } catch {}
29
- return [];
30
- };
31
- //#endregion
32
- exports.discoverHubsFromFeed = discoverHubsFromFeed;
@@ -1,17 +0,0 @@
1
- const require_defaults = require("../../common/discover/defaults.cjs");
2
- const require_index = require("../../common/uris/headers/index.cjs");
3
- //#region src/hubs/headers/index.ts
4
- const hubSelector = [{ rel: "hub" }];
5
- const selfSelector = [{ rel: "self" }];
6
- const discoverHubsFromHeaders = (headers, baseUrl, resolveUrlFn = require_defaults.defaultResolveUrlFn) => {
7
- const hubUris = require_index.discoverUrisFromHeaders(headers, { linkSelectors: hubSelector });
8
- if (hubUris.length === 0) return [];
9
- const selfUris = require_index.discoverUrisFromHeaders(headers, { linkSelectors: selfSelector });
10
- const topic = selfUris[0] ? resolveUrlFn(selfUris[0], baseUrl) ?? selfUris[0] : baseUrl;
11
- return hubUris.map((hub) => ({
12
- hub: resolveUrlFn(hub, baseUrl) ?? hub,
13
- topic
14
- }));
15
- };
16
- //#endregion
17
- exports.discoverHubsFromHeaders = discoverHubsFromHeaders;
@@ -1,28 +0,0 @@
1
- const require_defaults = require("../../common/discover/defaults.cjs");
2
- const require_index = require("../../common/uris/html/index.cjs");
3
- //#region src/hubs/html/index.ts
4
- const hubSelector = [{ rel: "hub" }];
5
- const selfSelector = [{ rel: "self" }];
6
- const htmlOptions = {
7
- anchorUris: [],
8
- anchorIgnoredUris: [],
9
- anchorLabels: []
10
- };
11
- const discoverHubsFromHtml = (content, baseUrl, resolveUrlFn = require_defaults.defaultResolveUrlFn) => {
12
- const hubUris = require_index.discoverUrisFromHtml(content, {
13
- ...htmlOptions,
14
- linkSelectors: hubSelector
15
- });
16
- if (hubUris.length === 0) return [];
17
- const selfUris = require_index.discoverUrisFromHtml(content, {
18
- ...htmlOptions,
19
- linkSelectors: selfSelector
20
- });
21
- const topic = selfUris[0] ? resolveUrlFn(selfUris[0], baseUrl) ?? selfUris[0] : baseUrl;
22
- return hubUris.map((hub) => ({
23
- hub: resolveUrlFn(hub, baseUrl) ?? hub,
24
- topic
25
- }));
26
- };
27
- //#endregion
28
- exports.discoverHubsFromHtml = discoverHubsFromHtml;
package/dist/hubs.cjs DELETED
File without changes
package/dist/hubs.d.cts DELETED
@@ -1,2 +0,0 @@
1
- import { DiscoverHubsMethodsConfig, DiscoverHubsOptions, HubResult } from "./hubs/discover/types.cjs";
2
- export { DiscoverHubsMethodsConfig, DiscoverHubsOptions, HubResult };
package/dist/index.cjs DELETED
@@ -1,13 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_utils = require("./common/discover/utils.cjs");
3
- const require_defaults = require("./common/discover/defaults.cjs");
4
- const require_index = require("./blogrolls/index.cjs");
5
- const require_index$1 = require("./favicons/index.cjs");
6
- const require_index$2 = require("./feeds/index.cjs");
7
- const require_index$3 = require("./hubs/discover/index.cjs");
8
- exports.defaultResolveSiteUrlFn = require_defaults.defaultResolveSiteUrlFn;
9
- exports.discoverBlogrolls = require_index.discoverBlogrolls;
10
- exports.discoverFavicons = require_index$1.discoverFavicons;
11
- exports.discoverFeeds = require_index$2.discoverFeeds;
12
- exports.discoverHubs = require_index$3.discoverHubs;
13
- exports.getFeedSiteUrl = require_utils.getFeedSiteUrl;
package/dist/index.d.cts DELETED
@@ -1,8 +0,0 @@
1
- import { DiscoverExtractFn, DiscoverFetchFn, DiscoverFetchFnOptions, DiscoverFetchFnResponse, DiscoverInput, DiscoverInputObject, DiscoverMethod, DiscoverMethodsConfig, DiscoverOnProgressFn, DiscoverOptions, DiscoverProgress, DiscoverResolveSiteUrlFn, DiscoverResolveUrlFn, DiscoverResult, DiscoverUriEntry, DiscoverUriHint, UriEntry } from "./common/types.cjs";
2
- import { discoverBlogrolls } from "./blogrolls/index.cjs";
3
- import { defaultResolveSiteUrlFn } from "./common/discover/defaults.cjs";
4
- import { getFeedSiteUrl } from "./common/discover/utils.cjs";
5
- import { discoverFavicons } from "./favicons/index.cjs";
6
- import { discoverFeeds } from "./feeds/index.cjs";
7
- import { discoverHubs } from "./hubs/discover/index.cjs";
8
- export { type DiscoverExtractFn, type DiscoverFetchFn, type DiscoverFetchFnOptions, type DiscoverFetchFnResponse, type DiscoverInput, type DiscoverInputObject, type DiscoverMethod, type DiscoverMethodsConfig, type DiscoverOnProgressFn, type DiscoverOptions, type DiscoverProgress, type DiscoverResolveSiteUrlFn, type DiscoverResolveUrlFn, type DiscoverResult, type DiscoverUriEntry, type DiscoverUriHint, type UriEntry, defaultResolveSiteUrlFn, discoverBlogrolls, discoverFavicons, discoverFeeds, discoverHubs, getFeedSiteUrl };
package/dist/methods.cjs DELETED
@@ -1,15 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_index = require("./common/uris/feed/index.cjs");
3
- const require_utils = require("./common/uris/guess/utils.cjs");
4
- const require_index$1 = require("./common/uris/guess/index.cjs");
5
- const require_index$2 = require("./common/uris/headers/index.cjs");
6
- const require_index$3 = require("./common/uris/html/index.cjs");
7
- const require_index$4 = require("./common/uris/platform/index.cjs");
8
- exports.discoverUrisFromFeed = require_index.discoverUrisFromFeed;
9
- exports.discoverUrisFromGuess = require_index$1.discoverUrisFromGuess;
10
- exports.discoverUrisFromHeaders = require_index$2.discoverUrisFromHeaders;
11
- exports.discoverUrisFromHtml = require_index$3.discoverUrisFromHtml;
12
- exports.discoverUrisFromPlatform = require_index$4.discoverUrisFromPlatform;
13
- exports.generateUrlCombinations = require_utils.generateUrlCombinations;
14
- exports.getSubdomainVariants = require_utils.getSubdomainVariants;
15
- exports.getWwwCounterpart = require_utils.getWwwCounterpart;
@@ -1,7 +0,0 @@
1
- import { discoverUrisFromFeed } from "./common/uris/feed/index.cjs";
2
- import { discoverUrisFromGuess } from "./common/uris/guess/index.cjs";
3
- import { generateUrlCombinations, getSubdomainVariants, getWwwCounterpart } from "./common/uris/guess/utils.cjs";
4
- import { discoverUrisFromHeaders } from "./common/uris/headers/index.cjs";
5
- import { discoverUrisFromHtml } from "./common/uris/html/index.cjs";
6
- import { discoverUrisFromPlatform } from "./common/uris/platform/index.cjs";
7
- export { discoverUrisFromFeed, discoverUrisFromGuess, discoverUrisFromHeaders, discoverUrisFromHtml, discoverUrisFromPlatform, generateUrlCombinations, getSubdomainVariants, getWwwCounterpart };
package/dist/utils.cjs DELETED
@@ -1,9 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_utils = require("./common/utils.cjs");
3
- exports.anyWordMatchesAnyOf = require_utils.anyWordMatchesAnyOf;
4
- exports.endsWithAnyOf = require_utils.endsWithAnyOf;
5
- exports.includesAnyOf = require_utils.includesAnyOf;
6
- exports.isAnyOf = require_utils.isAnyOf;
7
- exports.isHostOf = require_utils.isHostOf;
8
- exports.isSubdomainOf = require_utils.isSubdomainOf;
9
- exports.omitEmpty = require_utils.omitEmpty;
package/dist/utils.d.cts DELETED
@@ -1,3 +0,0 @@
1
- import { Pattern } from "./common/types.cjs";
2
- import { anyWordMatchesAnyOf, endsWithAnyOf, includesAnyOf, isAnyOf, isHostOf, isSubdomainOf, omitEmpty } from "./common/utils.cjs";
3
- export { type Pattern, anyWordMatchesAnyOf, endsWithAnyOf, includesAnyOf, isAnyOf, isHostOf, isSubdomainOf, omitEmpty };