feedscout 1.8.0 → 1.9.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.
- package/README.md +1 -1
- package/dist/blogrolls/defaults.cjs +16 -10
- package/dist/blogrolls/defaults.d.cts +1 -2
- package/dist/blogrolls/defaults.d.ts +1 -2
- package/dist/blogrolls/defaults.js +17 -10
- package/dist/blogrolls/extractors.cjs +2 -2
- package/dist/blogrolls/extractors.d.cts +2 -2
- package/dist/blogrolls/extractors.d.ts +2 -2
- package/dist/blogrolls/extractors.js +2 -2
- package/dist/blogrolls/index.cjs +9 -10
- package/dist/blogrolls/index.js +4 -5
- package/dist/blogrolls.cjs +1 -2
- package/dist/blogrolls.d.cts +3 -3
- package/dist/blogrolls.d.ts +3 -3
- package/dist/blogrolls.js +3 -3
- package/dist/common/discover/defaults.cjs +46 -0
- package/dist/common/discover/defaults.d.cts +6 -0
- package/dist/common/discover/defaults.d.ts +6 -0
- package/dist/common/discover/defaults.js +44 -0
- package/dist/common/discover/index.cjs +7 -7
- package/dist/common/discover/index.js +2 -2
- package/dist/common/discover/utils.cjs +0 -29
- package/dist/common/discover/utils.d.cts +1 -3
- package/dist/common/discover/utils.d.ts +1 -3
- package/dist/common/discover/utils.js +1 -28
- package/dist/common/locales.cjs +214 -10
- package/dist/common/locales.js +214 -10
- package/dist/common/types.d.cts +3 -2
- package/dist/common/types.d.ts +3 -2
- package/dist/common/uris/html/handlers.cjs +14 -0
- package/dist/common/uris/html/handlers.js +14 -0
- package/dist/common/uris/html/index.cjs +17 -1
- package/dist/common/uris/html/index.js +17 -1
- package/dist/common/uris/html/types.d.cts +5 -4
- package/dist/common/uris/html/types.d.ts +5 -4
- package/dist/common/utils.cjs +12 -11
- package/dist/common/utils.d.cts +6 -4
- package/dist/common/utils.d.ts +6 -4
- package/dist/common/utils.js +13 -11
- package/dist/favicons/extractors.cjs +2 -2
- package/dist/favicons/extractors.d.cts +2 -2
- package/dist/favicons/extractors.d.ts +2 -2
- package/dist/favicons/extractors.js +2 -2
- package/dist/favicons/index.cjs +11 -12
- package/dist/favicons/index.js +4 -5
- package/dist/favicons.cjs +1 -1
- package/dist/favicons.d.cts +2 -2
- package/dist/favicons.d.ts +2 -2
- package/dist/favicons.js +2 -2
- package/dist/feeds/defaults.cjs +121 -9
- package/dist/feeds/defaults.d.cts +4 -3
- package/dist/feeds/defaults.d.ts +4 -3
- package/dist/feeds/defaults.js +121 -10
- package/dist/feeds/extractors.cjs +6 -6
- package/dist/feeds/extractors.d.cts +2 -2
- package/dist/feeds/extractors.d.ts +2 -2
- package/dist/feeds/extractors.js +4 -4
- package/dist/feeds/index.cjs +9 -10
- package/dist/feeds/index.js +4 -5
- package/dist/feeds/platform/handlers/acast.cjs +26 -0
- package/dist/feeds/platform/handlers/acast.js +26 -0
- package/dist/feeds/platform/handlers/ameblo.cjs +36 -0
- package/dist/feeds/platform/handlers/ameblo.js +36 -0
- package/dist/feeds/platform/handlers/applePodcasts.cjs +1 -1
- package/dist/feeds/platform/handlers/applePodcasts.js +1 -1
- package/dist/feeds/platform/handlers/arena.cjs +42 -0
- package/dist/feeds/platform/handlers/arena.js +42 -0
- package/dist/feeds/platform/handlers/artstation.cjs +52 -0
- package/dist/feeds/platform/handlers/artstation.js +52 -0
- package/dist/feeds/platform/handlers/audioboom.cjs +23 -0
- package/dist/feeds/platform/handlers/audioboom.js +23 -0
- package/dist/feeds/platform/handlers/bearblog.cjs +45 -0
- package/dist/feeds/platform/handlers/bearblog.js +45 -0
- package/dist/feeds/platform/handlers/behance.cjs +7 -0
- package/dist/feeds/platform/handlers/behance.js +7 -0
- package/dist/feeds/platform/handlers/blogspot.cjs +38 -2
- package/dist/feeds/platform/handlers/blogspot.js +38 -2
- package/dist/feeds/platform/handlers/bookwyrm.cjs +48 -0
- package/dist/feeds/platform/handlers/bookwyrm.js +48 -0
- package/dist/feeds/platform/handlers/buttondown.cjs +43 -0
- package/dist/feeds/platform/handlers/buttondown.js +43 -0
- package/dist/feeds/platform/handlers/buzzsprout.cjs +22 -0
- package/dist/feeds/platform/handlers/buzzsprout.js +22 -0
- package/dist/feeds/platform/handlers/codeberg.cjs +5 -5
- package/dist/feeds/platform/handlers/codeberg.js +5 -5
- package/dist/feeds/platform/handlers/dailymotion.cjs +16 -0
- package/dist/feeds/platform/handlers/dailymotion.js +16 -0
- package/dist/feeds/platform/handlers/deviantart.cjs +25 -6
- package/dist/feeds/platform/handlers/deviantart.js +25 -6
- package/dist/feeds/platform/handlers/devto.cjs +8 -0
- package/dist/feeds/platform/handlers/devto.js +8 -0
- package/dist/feeds/platform/handlers/discourse.cjs +70 -0
- package/dist/feeds/platform/handlers/discourse.js +70 -0
- package/dist/feeds/platform/handlers/dreamwidth.cjs +48 -0
- package/dist/feeds/platform/handlers/dreamwidth.js +48 -0
- package/dist/feeds/platform/handlers/exblog.cjs +35 -0
- package/dist/feeds/platform/handlers/exblog.js +35 -0
- package/dist/feeds/platform/handlers/fireside.cjs +24 -0
- package/dist/feeds/platform/handlers/fireside.js +24 -0
- package/dist/feeds/platform/handlers/friendica.cjs +44 -0
- package/dist/feeds/platform/handlers/friendica.js +44 -0
- package/dist/feeds/platform/handlers/ghost.cjs +30 -0
- package/dist/feeds/platform/handlers/ghost.js +30 -0
- package/dist/feeds/platform/handlers/github.cjs +6 -0
- package/dist/feeds/platform/handlers/github.js +6 -0
- package/dist/feeds/platform/handlers/githubGist.cjs +16 -5
- package/dist/feeds/platform/handlers/githubGist.js +16 -5
- package/dist/feeds/platform/handlers/gitlab.cjs +31 -13
- package/dist/feeds/platform/handlers/gitlab.js +31 -13
- package/dist/feeds/platform/handlers/goodreads.cjs +18 -8
- package/dist/feeds/platform/handlers/goodreads.js +18 -8
- package/dist/feeds/platform/handlers/hackernews.cjs +21 -0
- package/dist/feeds/platform/handlers/hackernews.js +21 -0
- package/dist/feeds/platform/handlers/hashnode.cjs +1 -1
- package/dist/feeds/platform/handlers/hashnode.js +1 -1
- package/dist/feeds/platform/handlers/hatenablog.cjs +4 -1
- package/dist/feeds/platform/handlers/hatenablog.js +4 -1
- package/dist/feeds/platform/handlers/hearthis.cjs +32 -0
- package/dist/feeds/platform/handlers/hearthis.js +32 -0
- package/dist/feeds/platform/handlers/heyWorld.cjs +18 -0
- package/dist/feeds/platform/handlers/heyWorld.js +18 -0
- package/dist/feeds/platform/handlers/insanejournal.cjs +69 -0
- package/dist/feeds/platform/handlers/insanejournal.js +69 -0
- package/dist/feeds/platform/handlers/itchio.cjs +24 -1
- package/dist/feeds/platform/handlers/itchio.js +24 -1
- package/dist/feeds/platform/handlers/lemmy.cjs +46 -4
- package/dist/feeds/platform/handlers/lemmy.js +46 -4
- package/dist/feeds/platform/handlers/letterboxd.cjs +4 -0
- package/dist/feeds/platform/handlers/letterboxd.js +4 -0
- package/dist/feeds/platform/handlers/libsyn.cjs +25 -0
- package/dist/feeds/platform/handlers/libsyn.js +25 -0
- package/dist/feeds/platform/handlers/listed.cjs +20 -0
- package/dist/feeds/platform/handlers/listed.js +20 -0
- package/dist/feeds/platform/handlers/livejournal.cjs +68 -0
- package/dist/feeds/platform/handlers/livejournal.js +68 -0
- package/dist/feeds/platform/handlers/mastodon.cjs +32 -0
- package/dist/feeds/platform/handlers/mastodon.js +32 -0
- package/dist/feeds/platform/handlers/mataroa.cjs +16 -0
- package/dist/feeds/platform/handlers/mataroa.js +16 -0
- package/dist/feeds/platform/handlers/medium.cjs +2 -2
- package/dist/feeds/platform/handlers/medium.js +2 -2
- package/dist/feeds/platform/handlers/microblog.cjs +55 -0
- package/dist/feeds/platform/handlers/microblog.js +55 -0
- package/dist/feeds/platform/handlers/misskey.cjs +40 -0
- package/dist/feeds/platform/handlers/misskey.js +40 -0
- package/dist/feeds/platform/handlers/myanimelist.cjs +43 -0
- package/dist/feeds/platform/handlers/myanimelist.js +43 -0
- package/dist/feeds/platform/handlers/naverBlog.cjs +21 -0
- package/dist/feeds/platform/handlers/naverBlog.js +21 -0
- package/dist/feeds/platform/handlers/nebula.cjs +68 -0
- package/dist/feeds/platform/handlers/nebula.js +68 -0
- package/dist/feeds/platform/handlers/note.cjs +53 -0
- package/dist/feeds/platform/handlers/note.js +53 -0
- package/dist/feeds/platform/handlers/observable.cjs +34 -0
- package/dist/feeds/platform/handlers/observable.js +34 -0
- package/dist/feeds/platform/handlers/odysee.cjs +20 -0
- package/dist/feeds/platform/handlers/odysee.js +20 -0
- package/dist/feeds/platform/handlers/pagecord.cjs +16 -0
- package/dist/feeds/platform/handlers/pagecord.js +16 -0
- package/dist/feeds/platform/handlers/paragraph.cjs +1 -2
- package/dist/feeds/platform/handlers/paragraph.js +1 -2
- package/dist/feeds/platform/handlers/pika.cjs +35 -0
- package/dist/feeds/platform/handlers/pika.js +35 -0
- package/dist/feeds/platform/handlers/pinterest.cjs +13 -0
- package/dist/feeds/platform/handlers/pinterest.js +13 -0
- package/dist/feeds/platform/handlers/pixelfed.cjs +46 -0
- package/dist/feeds/platform/handlers/pixelfed.js +46 -0
- package/dist/feeds/platform/handlers/pleroma.cjs +34 -0
- package/dist/feeds/platform/handlers/pleroma.js +34 -0
- package/dist/feeds/platform/handlers/podbean.cjs +29 -0
- package/dist/feeds/platform/handlers/podbean.js +29 -0
- package/dist/feeds/platform/handlers/podigee.cjs +29 -0
- package/dist/feeds/platform/handlers/podigee.js +29 -0
- package/dist/feeds/platform/handlers/posthaven.cjs +24 -0
- package/dist/feeds/platform/handlers/posthaven.js +24 -0
- package/dist/feeds/platform/handlers/prose.cjs +26 -0
- package/dist/feeds/platform/handlers/prose.js +26 -0
- package/dist/feeds/platform/handlers/qiita.cjs +58 -0
- package/dist/feeds/platform/handlers/qiita.js +58 -0
- package/dist/feeds/platform/handlers/reddit.cjs +83 -9
- package/dist/feeds/platform/handlers/reddit.js +83 -9
- package/dist/feeds/platform/handlers/rssCom.cjs +20 -0
- package/dist/feeds/platform/handlers/rssCom.js +20 -0
- package/dist/feeds/platform/handlers/seesaa.cjs +22 -0
- package/dist/feeds/platform/handlers/seesaa.js +22 -0
- package/dist/feeds/platform/handlers/sourceforge.cjs +37 -4
- package/dist/feeds/platform/handlers/sourceforge.js +37 -4
- package/dist/feeds/platform/handlers/spreaker.cjs +21 -0
- package/dist/feeds/platform/handlers/spreaker.js +21 -0
- package/dist/feeds/platform/handlers/stackExchange.cjs +26 -2
- package/dist/feeds/platform/handlers/stackExchange.js +26 -2
- package/dist/feeds/platform/handlers/steam.cjs +7 -0
- package/dist/feeds/platform/handlers/steam.js +7 -0
- package/dist/feeds/platform/handlers/tildes.cjs +41 -0
- package/dist/feeds/platform/handlers/tildes.js +41 -0
- package/dist/feeds/platform/handlers/tistory.cjs +16 -0
- package/dist/feeds/platform/handlers/tistory.js +16 -0
- package/dist/feeds/platform/handlers/transistor.cjs +29 -0
- package/dist/feeds/platform/handlers/transistor.js +29 -0
- package/dist/feeds/platform/handlers/velog.cjs +24 -0
- package/dist/feeds/platform/handlers/velog.js +24 -0
- package/dist/feeds/platform/handlers/vimeo.cjs +6 -0
- package/dist/feeds/platform/handlers/vimeo.js +6 -0
- package/dist/feeds/platform/handlers/weblogLol.cjs +26 -0
- package/dist/feeds/platform/handlers/weblogLol.js +26 -0
- package/dist/feeds/platform/handlers/weebly.cjs +25 -0
- package/dist/feeds/platform/handlers/weebly.js +25 -0
- package/dist/feeds/platform/handlers/wordpress.cjs +173 -28
- package/dist/feeds/platform/handlers/wordpress.js +173 -28
- package/dist/feeds/platform/handlers/writeas.cjs +51 -0
- package/dist/feeds/platform/handlers/writeas.js +51 -0
- package/dist/feeds/platform/handlers/ximalaya.cjs +1 -1
- package/dist/feeds/platform/handlers/ximalaya.js +1 -1
- package/dist/feeds/platform/handlers/youtube.cjs +4 -1
- package/dist/feeds/platform/handlers/youtube.js +4 -1
- package/dist/feeds/platform/handlers/zenn.cjs +54 -0
- package/dist/feeds/platform/handlers/zenn.js +54 -0
- package/dist/feeds.cjs +2 -1
- package/dist/feeds.d.cts +3 -3
- package/dist/feeds.d.ts +3 -3
- package/dist/feeds.js +3 -3
- package/dist/hubs/discover/index.cjs +4 -4
- package/dist/hubs/discover/index.js +3 -3
- package/dist/hubs/feed/index.cjs +2 -2
- package/dist/hubs/feed/index.js +2 -2
- package/dist/hubs/headers/index.cjs +2 -2
- package/dist/hubs/headers/index.js +2 -2
- package/dist/hubs/html/index.cjs +2 -2
- package/dist/hubs/html/index.js +2 -2
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Finds feeds by scanning links and anchors in HTML content, parsing HTTP headers,
|
|
|
23
23
|
| Feeds | RSS, Atom, JSON Feed, and RDF. Each feed is validated and returns metadata like format, title, description, and site URL. |
|
|
24
24
|
| Blogrolls | OPML files containing feed subscriptions. Validated and returns title. |
|
|
25
25
|
| Favicons | Site icons from HTML, feeds, platform APIs, and common paths. Validated to ensure URLs point to actual images. |
|
|
26
|
-
| WebSub
|
|
26
|
+
| WebSub | Find hubs for real-time feed update notifications. |
|
|
27
27
|
|
|
28
28
|
### Discovery Methods
|
|
29
29
|
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
//#region src/blogrolls/defaults.ts
|
|
2
|
-
const mimeTypes = [
|
|
3
|
-
"text/x-opml",
|
|
4
|
-
"application/xml",
|
|
5
|
-
"text/xml"
|
|
6
|
-
];
|
|
7
2
|
const urisMinimal = [
|
|
8
3
|
"/.well-known/recommendations.opml",
|
|
9
4
|
"/blogroll.opml",
|
|
@@ -27,10 +22,22 @@ const anchorLabels = [
|
|
|
27
22
|
"subscriptions",
|
|
28
23
|
"reading list"
|
|
29
24
|
];
|
|
30
|
-
const linkSelectors = [
|
|
31
|
-
rel: "
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
const linkSelectors = [
|
|
26
|
+
{ rel: "blogroll" },
|
|
27
|
+
{
|
|
28
|
+
rel: "outline",
|
|
29
|
+
types: [
|
|
30
|
+
"text/x-opml",
|
|
31
|
+
"application/opml+xml",
|
|
32
|
+
"application/xml",
|
|
33
|
+
"text/xml"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
rel: "alternate",
|
|
38
|
+
types: ["text/x-opml", "application/opml+xml"]
|
|
39
|
+
}
|
|
40
|
+
];
|
|
34
41
|
const defaultHtmlOptions = {
|
|
35
42
|
linkSelectors,
|
|
36
43
|
anchorUris: urisComprehensive,
|
|
@@ -45,7 +52,6 @@ exports.defaultGuessOptions = defaultGuessOptions;
|
|
|
45
52
|
exports.defaultHeadersOptions = defaultHeadersOptions;
|
|
46
53
|
exports.defaultHtmlOptions = defaultHtmlOptions;
|
|
47
54
|
exports.linkSelectors = linkSelectors;
|
|
48
|
-
exports.mimeTypes = mimeTypes;
|
|
49
55
|
exports.urisBalanced = urisBalanced;
|
|
50
56
|
exports.urisComprehensive = urisComprehensive;
|
|
51
57
|
exports.urisMinimal = urisMinimal;
|
|
@@ -4,7 +4,6 @@ import { HtmlMethodOptions } from "../common/uris/html/types.cjs";
|
|
|
4
4
|
import { LinkSelector } from "../common/types.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/blogrolls/defaults.d.ts
|
|
7
|
-
declare const mimeTypes: string[];
|
|
8
7
|
declare const urisMinimal: string[];
|
|
9
8
|
declare const urisBalanced: string[];
|
|
10
9
|
declare const urisComprehensive: string[];
|
|
@@ -14,4 +13,4 @@ declare const defaultHtmlOptions: Omit<HtmlMethodOptions, 'baseUrl'>;
|
|
|
14
13
|
declare const defaultHeadersOptions: Omit<HeadersMethodOptions, 'baseUrl'>;
|
|
15
14
|
declare const defaultGuessOptions: Omit<GuessMethodOptions, 'baseUrl'>;
|
|
16
15
|
//#endregion
|
|
17
|
-
export { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors,
|
|
16
|
+
export { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal };
|
|
@@ -4,7 +4,6 @@ import { HtmlMethodOptions } from "../common/uris/html/types.js";
|
|
|
4
4
|
import { LinkSelector } from "../common/types.js";
|
|
5
5
|
|
|
6
6
|
//#region src/blogrolls/defaults.d.ts
|
|
7
|
-
declare const mimeTypes: string[];
|
|
8
7
|
declare const urisMinimal: string[];
|
|
9
8
|
declare const urisBalanced: string[];
|
|
10
9
|
declare const urisComprehensive: string[];
|
|
@@ -14,4 +13,4 @@ declare const defaultHtmlOptions: Omit<HtmlMethodOptions, 'baseUrl'>;
|
|
|
14
13
|
declare const defaultHeadersOptions: Omit<HeadersMethodOptions, 'baseUrl'>;
|
|
15
14
|
declare const defaultGuessOptions: Omit<GuessMethodOptions, 'baseUrl'>;
|
|
16
15
|
//#endregion
|
|
17
|
-
export { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors,
|
|
16
|
+
export { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal };
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
//#region src/blogrolls/defaults.ts
|
|
2
|
-
const mimeTypes = [
|
|
3
|
-
"text/x-opml",
|
|
4
|
-
"application/xml",
|
|
5
|
-
"text/xml"
|
|
6
|
-
];
|
|
7
2
|
const urisMinimal = [
|
|
8
3
|
"/.well-known/recommendations.opml",
|
|
9
4
|
"/blogroll.opml",
|
|
@@ -27,10 +22,22 @@ const anchorLabels = [
|
|
|
27
22
|
"subscriptions",
|
|
28
23
|
"reading list"
|
|
29
24
|
];
|
|
30
|
-
const linkSelectors = [
|
|
31
|
-
rel: "
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
const linkSelectors = [
|
|
26
|
+
{ rel: "blogroll" },
|
|
27
|
+
{
|
|
28
|
+
rel: "outline",
|
|
29
|
+
types: [
|
|
30
|
+
"text/x-opml",
|
|
31
|
+
"application/opml+xml",
|
|
32
|
+
"application/xml",
|
|
33
|
+
"text/xml"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
rel: "alternate",
|
|
38
|
+
types: ["text/x-opml", "application/opml+xml"]
|
|
39
|
+
}
|
|
40
|
+
];
|
|
34
41
|
const defaultHtmlOptions = {
|
|
35
42
|
linkSelectors,
|
|
36
43
|
anchorUris: urisComprehensive,
|
|
@@ -40,4 +47,4 @@ const defaultHtmlOptions = {
|
|
|
40
47
|
const defaultHeadersOptions = { linkSelectors };
|
|
41
48
|
const defaultGuessOptions = { uris: urisBalanced };
|
|
42
49
|
//#endregion
|
|
43
|
-
export { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors,
|
|
50
|
+
export { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let feedsmith = require("feedsmith");
|
|
2
2
|
//#region src/blogrolls/extractors.ts
|
|
3
|
-
const
|
|
3
|
+
const defaultExtractFn = ({ content, url }) => {
|
|
4
4
|
if (!content) return {
|
|
5
5
|
url,
|
|
6
6
|
isValid: false
|
|
@@ -18,4 +18,4 @@ const defaultExtractor = ({ content, url }) => {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
|
-
exports.
|
|
21
|
+
exports.defaultExtractFn = defaultExtractFn;
|
|
@@ -2,6 +2,6 @@ import { DiscoverExtractFn } from "../common/types.cjs";
|
|
|
2
2
|
import { BlogrollResult } from "./types.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/blogrolls/extractors.d.ts
|
|
5
|
-
declare const
|
|
5
|
+
declare const defaultExtractFn: DiscoverExtractFn<BlogrollResult>;
|
|
6
6
|
//#endregion
|
|
7
|
-
export {
|
|
7
|
+
export { defaultExtractFn };
|
|
@@ -2,6 +2,6 @@ import { DiscoverExtractFn } from "../common/types.js";
|
|
|
2
2
|
import { BlogrollResult } from "./types.js";
|
|
3
3
|
|
|
4
4
|
//#region src/blogrolls/extractors.d.ts
|
|
5
|
-
declare const
|
|
5
|
+
declare const defaultExtractFn: DiscoverExtractFn<BlogrollResult>;
|
|
6
6
|
//#endregion
|
|
7
|
-
export {
|
|
7
|
+
export { defaultExtractFn };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseOpml } from "feedsmith";
|
|
2
2
|
//#region src/blogrolls/extractors.ts
|
|
3
|
-
const
|
|
3
|
+
const defaultExtractFn = ({ content, url }) => {
|
|
4
4
|
if (!content) return {
|
|
5
5
|
url,
|
|
6
6
|
isValid: false
|
|
@@ -18,4 +18,4 @@ const defaultExtractor = ({ content, url }) => {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
|
-
export {
|
|
21
|
+
export { defaultExtractFn };
|
package/dist/blogrolls/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_utils$1 = require("../common/discover/utils.cjs");
|
|
1
|
+
const require_defaults = require("../common/discover/defaults.cjs");
|
|
3
2
|
const require_index = require("../common/discover/index.cjs");
|
|
4
|
-
const require_defaults = require("./defaults.cjs");
|
|
3
|
+
const require_defaults$1 = require("./defaults.cjs");
|
|
5
4
|
const require_extractors = require("./extractors.cjs");
|
|
6
5
|
//#region src/blogrolls/index.ts
|
|
7
6
|
const discoverBlogrolls = (input, options = {}) => {
|
|
@@ -12,14 +11,14 @@ const discoverBlogrolls = (input, options = {}) => {
|
|
|
12
11
|
"headers",
|
|
13
12
|
"guess"
|
|
14
13
|
],
|
|
15
|
-
fetchFn: options.fetchFn ??
|
|
16
|
-
extractFn: options.extractFn ?? require_extractors.
|
|
17
|
-
resolveUrlFn: options.resolveUrlFn ??
|
|
18
|
-
resolveSiteUrlFn: options.resolveSiteUrlFn ??
|
|
14
|
+
fetchFn: options.fetchFn ?? require_defaults.defaultFetchFn,
|
|
15
|
+
extractFn: options.extractFn ?? require_extractors.defaultExtractFn,
|
|
16
|
+
resolveUrlFn: options.resolveUrlFn ?? require_defaults.defaultResolveUrlFn,
|
|
17
|
+
resolveSiteUrlFn: options.resolveSiteUrlFn ?? require_defaults.defaultResolveSiteUrlFn
|
|
19
18
|
}, {
|
|
20
|
-
html: require_defaults.defaultHtmlOptions,
|
|
21
|
-
headers: require_defaults.defaultHeadersOptions,
|
|
22
|
-
guess: require_defaults.defaultGuessOptions
|
|
19
|
+
html: require_defaults$1.defaultHtmlOptions,
|
|
20
|
+
headers: require_defaults$1.defaultHeadersOptions,
|
|
21
|
+
guess: require_defaults$1.defaultGuessOptions
|
|
23
22
|
});
|
|
24
23
|
};
|
|
25
24
|
//#endregion
|
package/dist/blogrolls/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defaultFetchFn, defaultResolveSiteUrlFn } from "../common/discover/utils.js";
|
|
1
|
+
import { defaultFetchFn, defaultResolveSiteUrlFn, defaultResolveUrlFn } from "../common/discover/defaults.js";
|
|
3
2
|
import { discover } from "../common/discover/index.js";
|
|
4
3
|
import { defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions } from "./defaults.js";
|
|
5
|
-
import {
|
|
4
|
+
import { defaultExtractFn } from "./extractors.js";
|
|
6
5
|
//#region src/blogrolls/index.ts
|
|
7
6
|
const discoverBlogrolls = (input, options = {}) => {
|
|
8
7
|
return discover(input, {
|
|
@@ -13,8 +12,8 @@ const discoverBlogrolls = (input, options = {}) => {
|
|
|
13
12
|
"guess"
|
|
14
13
|
],
|
|
15
14
|
fetchFn: options.fetchFn ?? defaultFetchFn,
|
|
16
|
-
extractFn: options.extractFn ??
|
|
17
|
-
resolveUrlFn: options.resolveUrlFn ??
|
|
15
|
+
extractFn: options.extractFn ?? defaultExtractFn,
|
|
16
|
+
resolveUrlFn: options.resolveUrlFn ?? defaultResolveUrlFn,
|
|
18
17
|
resolveSiteUrlFn: options.resolveSiteUrlFn ?? defaultResolveSiteUrlFn
|
|
19
18
|
}, {
|
|
20
19
|
html: defaultHtmlOptions,
|
package/dist/blogrolls.cjs
CHANGED
|
@@ -2,12 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_defaults = require("./blogrolls/defaults.cjs");
|
|
3
3
|
const require_extractors = require("./blogrolls/extractors.cjs");
|
|
4
4
|
exports.anchorLabels = require_defaults.anchorLabels;
|
|
5
|
-
exports.
|
|
5
|
+
exports.defaultExtractFn = require_extractors.defaultExtractFn;
|
|
6
6
|
exports.defaultGuessOptions = require_defaults.defaultGuessOptions;
|
|
7
7
|
exports.defaultHeadersOptions = require_defaults.defaultHeadersOptions;
|
|
8
8
|
exports.defaultHtmlOptions = require_defaults.defaultHtmlOptions;
|
|
9
9
|
exports.linkSelectors = require_defaults.linkSelectors;
|
|
10
|
-
exports.mimeTypes = require_defaults.mimeTypes;
|
|
11
10
|
exports.urisBalanced = require_defaults.urisBalanced;
|
|
12
11
|
exports.urisComprehensive = require_defaults.urisComprehensive;
|
|
13
12
|
exports.urisMinimal = require_defaults.urisMinimal;
|
package/dist/blogrolls.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors,
|
|
1
|
+
import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal } from "./blogrolls/defaults.cjs";
|
|
2
2
|
import { BlogrollResult } from "./blogrolls/types.cjs";
|
|
3
|
-
import {
|
|
4
|
-
export { BlogrollResult, anchorLabels,
|
|
3
|
+
import { defaultExtractFn } from "./blogrolls/extractors.cjs";
|
|
4
|
+
export { BlogrollResult, anchorLabels, defaultExtractFn, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal };
|
package/dist/blogrolls.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors,
|
|
1
|
+
import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal } from "./blogrolls/defaults.js";
|
|
2
2
|
import { BlogrollResult } from "./blogrolls/types.js";
|
|
3
|
-
import {
|
|
4
|
-
export { BlogrollResult, anchorLabels,
|
|
3
|
+
import { defaultExtractFn } from "./blogrolls/extractors.js";
|
|
4
|
+
export { BlogrollResult, anchorLabels, defaultExtractFn, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal };
|
package/dist/blogrolls.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors,
|
|
2
|
-
import {
|
|
3
|
-
export { anchorLabels,
|
|
1
|
+
import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal } from "./blogrolls/defaults.js";
|
|
2
|
+
import { defaultExtractFn } from "./blogrolls/extractors.js";
|
|
3
|
+
export { anchorLabels, defaultExtractFn, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, urisBalanced, urisComprehensive, urisMinimal };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const require_utils = require("./utils.cjs");
|
|
2
|
+
let feedsmith = require("feedsmith");
|
|
3
|
+
//#region src/common/discover/defaults.ts
|
|
4
|
+
const defaultFetchFn = async (url, options) => {
|
|
5
|
+
const response = await fetch(url, {
|
|
6
|
+
method: options?.method ?? "GET",
|
|
7
|
+
headers: options?.headers
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
headers: response.headers,
|
|
11
|
+
body: await response.text(),
|
|
12
|
+
url: response.url,
|
|
13
|
+
status: response.status,
|
|
14
|
+
statusText: response.statusText
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const defaultResolveUrlFn = (url, baseUrl) => {
|
|
18
|
+
try {
|
|
19
|
+
return new URL(url, baseUrl).href;
|
|
20
|
+
} catch {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const defaultResolveSiteUrlFn = (input, resolveUrlFn) => {
|
|
25
|
+
if (!input.content) return;
|
|
26
|
+
try {
|
|
27
|
+
let siteUrl = require_utils.getFeedSiteUrl((0, feedsmith.parseFeed)(input.content));
|
|
28
|
+
if (siteUrl) {
|
|
29
|
+
siteUrl = resolveUrlFn(siteUrl, input.url);
|
|
30
|
+
if (siteUrl) {
|
|
31
|
+
const parsed = new URL(siteUrl);
|
|
32
|
+
parsed.hash = "";
|
|
33
|
+
siteUrl = parsed.href;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!siteUrl || siteUrl === new URL(input.url).href) try {
|
|
37
|
+
siteUrl = new URL(input.url).origin;
|
|
38
|
+
} catch {}
|
|
39
|
+
if (siteUrl && new URL(siteUrl).href === new URL(input.url).href) return;
|
|
40
|
+
return siteUrl;
|
|
41
|
+
} catch {}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.defaultFetchFn = defaultFetchFn;
|
|
45
|
+
exports.defaultResolveSiteUrlFn = defaultResolveSiteUrlFn;
|
|
46
|
+
exports.defaultResolveUrlFn = defaultResolveUrlFn;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getFeedSiteUrl } from "./utils.js";
|
|
2
|
+
import { parseFeed } from "feedsmith";
|
|
3
|
+
//#region src/common/discover/defaults.ts
|
|
4
|
+
const defaultFetchFn = async (url, options) => {
|
|
5
|
+
const response = await fetch(url, {
|
|
6
|
+
method: options?.method ?? "GET",
|
|
7
|
+
headers: options?.headers
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
headers: response.headers,
|
|
11
|
+
body: await response.text(),
|
|
12
|
+
url: response.url,
|
|
13
|
+
status: response.status,
|
|
14
|
+
statusText: response.statusText
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const defaultResolveUrlFn = (url, baseUrl) => {
|
|
18
|
+
try {
|
|
19
|
+
return new URL(url, baseUrl).href;
|
|
20
|
+
} catch {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const defaultResolveSiteUrlFn = (input, resolveUrlFn) => {
|
|
25
|
+
if (!input.content) return;
|
|
26
|
+
try {
|
|
27
|
+
let siteUrl = getFeedSiteUrl(parseFeed(input.content));
|
|
28
|
+
if (siteUrl) {
|
|
29
|
+
siteUrl = resolveUrlFn(siteUrl, input.url);
|
|
30
|
+
if (siteUrl) {
|
|
31
|
+
const parsed = new URL(siteUrl);
|
|
32
|
+
parsed.hash = "";
|
|
33
|
+
siteUrl = parsed.href;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!siteUrl || siteUrl === new URL(input.url).href) try {
|
|
37
|
+
siteUrl = new URL(input.url).origin;
|
|
38
|
+
} catch {}
|
|
39
|
+
if (siteUrl && new URL(siteUrl).href === new URL(input.url).href) return;
|
|
40
|
+
return siteUrl;
|
|
41
|
+
} catch {}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { defaultFetchFn, defaultResolveSiteUrlFn, defaultResolveUrlFn };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
const require_utils = require("./utils.cjs");
|
|
1
2
|
const require_types = require("../types.cjs");
|
|
2
|
-
const require_utils = require("../utils.cjs");
|
|
3
|
+
const require_utils$1 = require("../utils.cjs");
|
|
3
4
|
const require_index = require("../uris/index.cjs");
|
|
4
|
-
const require_utils$1 = require("./utils.cjs");
|
|
5
5
|
//#region src/common/discover/index.ts
|
|
6
6
|
const discover = async (input, options, defaults) => {
|
|
7
7
|
const { methods, fetchFn, extractFn, resolveUrlFn, resolveSiteUrlFn, stopOnFirstMethod = false, stopOnFirstResult = false, concurrency = 3, includeInvalid = false, onProgress } = options;
|
|
8
|
-
const sourceInput = await require_utils
|
|
8
|
+
const sourceInput = await require_utils.normalizeInput(input, fetchFn);
|
|
9
9
|
if (sourceInput.content) {
|
|
10
10
|
const result = await extractFn({
|
|
11
11
|
url: sourceInput.url,
|
|
@@ -16,7 +16,7 @@ const discover = async (input, options, defaults) => {
|
|
|
16
16
|
}
|
|
17
17
|
let siteInput;
|
|
18
18
|
if (resolveSiteUrlFn) {
|
|
19
|
-
const siteUrl = resolveSiteUrlFn(sourceInput);
|
|
19
|
+
const siteUrl = resolveSiteUrlFn(sourceInput, resolveUrlFn);
|
|
20
20
|
if (siteUrl) try {
|
|
21
21
|
const response = await fetchFn(siteUrl);
|
|
22
22
|
siteInput = {
|
|
@@ -26,14 +26,14 @@ const discover = async (input, options, defaults) => {
|
|
|
26
26
|
};
|
|
27
27
|
} catch {}
|
|
28
28
|
}
|
|
29
|
-
const urisByMethod = await require_index.discoverUris(require_utils
|
|
29
|
+
const urisByMethod = await require_index.discoverUris(require_utils.normalizeMethodsConfig(sourceInput, siteInput, methods, defaults), fetchFn);
|
|
30
30
|
const seen = /* @__PURE__ */ new Set();
|
|
31
31
|
const methodGroups = [];
|
|
32
32
|
for (const method of require_types.discoverMethodOrder) {
|
|
33
33
|
const rawUris = urisByMethod[method];
|
|
34
34
|
if (!rawUris || rawUris.length === 0) continue;
|
|
35
35
|
const unique = rawUris.map((entry) => {
|
|
36
|
-
return require_utils
|
|
36
|
+
return require_utils.normalizeUriEntry(entry, resolveUrlFn, sourceInput.url);
|
|
37
37
|
}).filter((entry) => {
|
|
38
38
|
const key = typeof entry.uri === "string" ? entry.uri : entry.uri.join("\0");
|
|
39
39
|
if (seen.has(key)) return false;
|
|
@@ -91,7 +91,7 @@ const discover = async (input, options, defaults) => {
|
|
|
91
91
|
};
|
|
92
92
|
for (const { method, entries } of methodGroups) {
|
|
93
93
|
const foundBefore = found;
|
|
94
|
-
await require_utils.processConcurrently(entries, (entry) => processUri(entry, method), {
|
|
94
|
+
await require_utils$1.processConcurrently(entries, (entry) => processUri(entry, method), {
|
|
95
95
|
concurrency,
|
|
96
96
|
shouldStop: () => {
|
|
97
97
|
return stopOnFirstResult && found > 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { normalizeInput, normalizeMethodsConfig, normalizeUriEntry } from "./utils.js";
|
|
1
2
|
import { discoverMethodOrder } from "../types.js";
|
|
2
3
|
import { processConcurrently } from "../utils.js";
|
|
3
4
|
import { discoverUris } from "../uris/index.js";
|
|
4
|
-
import { normalizeInput, normalizeMethodsConfig, normalizeUriEntry } from "./utils.js";
|
|
5
5
|
//#region src/common/discover/index.ts
|
|
6
6
|
const discover = async (input, options, defaults) => {
|
|
7
7
|
const { methods, fetchFn, extractFn, resolveUrlFn, resolveSiteUrlFn, stopOnFirstMethod = false, stopOnFirstResult = false, concurrency = 3, includeInvalid = false, onProgress } = options;
|
|
@@ -16,7 +16,7 @@ const discover = async (input, options, defaults) => {
|
|
|
16
16
|
}
|
|
17
17
|
let siteInput;
|
|
18
18
|
if (resolveSiteUrlFn) {
|
|
19
|
-
const siteUrl = resolveSiteUrlFn(sourceInput);
|
|
19
|
+
const siteUrl = resolveSiteUrlFn(sourceInput, resolveUrlFn);
|
|
20
20
|
if (siteUrl) try {
|
|
21
21
|
const response = await fetchFn(siteUrl);
|
|
22
22
|
siteInput = {
|
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
const require_locales = require("../locales.cjs");
|
|
2
|
-
const require_utils = require("../utils.cjs");
|
|
3
|
-
let feedsmith = require("feedsmith");
|
|
4
2
|
//#region src/common/discover/utils.ts
|
|
5
|
-
const defaultFetchFn = async (url, options) => {
|
|
6
|
-
const response = await fetch(url, {
|
|
7
|
-
method: options?.method ?? "GET",
|
|
8
|
-
headers: options?.headers
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
headers: response.headers,
|
|
12
|
-
body: await response.text(),
|
|
13
|
-
url: response.url,
|
|
14
|
-
status: response.status,
|
|
15
|
-
statusText: response.statusText
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
3
|
const normalizeInput = async (input, fetchFn) => {
|
|
19
4
|
if (typeof input === "object") return input;
|
|
20
5
|
try {
|
|
@@ -36,18 +21,6 @@ const getFeedSiteUrl = (parsed) => {
|
|
|
36
21
|
if (format === "atom") return getLinkOfType(feed.links, "alternate")?.href;
|
|
37
22
|
if (format === "json") return feed.home_page_url;
|
|
38
23
|
};
|
|
39
|
-
const defaultResolveSiteUrlFn = (input) => {
|
|
40
|
-
if (!input.content) return;
|
|
41
|
-
try {
|
|
42
|
-
let siteUrl = getFeedSiteUrl((0, feedsmith.parseFeed)(input.content));
|
|
43
|
-
if (!siteUrl) try {
|
|
44
|
-
siteUrl = new URL(input.url).origin;
|
|
45
|
-
} catch {}
|
|
46
|
-
else siteUrl = require_utils.resolveUrl(siteUrl, input.url);
|
|
47
|
-
if (siteUrl && new URL(siteUrl).href === new URL(input.url).href) return;
|
|
48
|
-
return siteUrl;
|
|
49
|
-
} catch {}
|
|
50
|
-
};
|
|
51
24
|
const normalizeUriEntry = (entry, resolveUrlFn, baseUrl) => {
|
|
52
25
|
if (typeof entry.uri === "string") return {
|
|
53
26
|
...entry,
|
|
@@ -122,8 +95,6 @@ const normalizeMethodsConfig = (sourceInput, siteInput, methods, defaults) => {
|
|
|
122
95
|
return methodsConfig;
|
|
123
96
|
};
|
|
124
97
|
//#endregion
|
|
125
|
-
exports.defaultFetchFn = defaultFetchFn;
|
|
126
|
-
exports.defaultResolveSiteUrlFn = defaultResolveSiteUrlFn;
|
|
127
98
|
exports.getFeedSiteUrl = getFeedSiteUrl;
|
|
128
99
|
exports.normalizeInput = normalizeInput;
|
|
129
100
|
exports.normalizeMethodsConfig = normalizeMethodsConfig;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { DiscoverResolveSiteUrlFn } from "../types.cjs";
|
|
2
1
|
import { parseFeed } from "feedsmith";
|
|
3
2
|
|
|
4
3
|
//#region src/common/discover/utils.d.ts
|
|
5
4
|
declare const getFeedSiteUrl: (parsed: ReturnType<typeof parseFeed>) => string | undefined;
|
|
6
|
-
declare const defaultResolveSiteUrlFn: DiscoverResolveSiteUrlFn;
|
|
7
5
|
//#endregion
|
|
8
|
-
export {
|
|
6
|
+
export { getFeedSiteUrl };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { DiscoverResolveSiteUrlFn } from "../types.js";
|
|
2
1
|
import { parseFeed } from "feedsmith";
|
|
3
2
|
|
|
4
3
|
//#region src/common/discover/utils.d.ts
|
|
5
4
|
declare const getFeedSiteUrl: (parsed: ReturnType<typeof parseFeed>) => string | undefined;
|
|
6
|
-
declare const defaultResolveSiteUrlFn: DiscoverResolveSiteUrlFn;
|
|
7
5
|
//#endregion
|
|
8
|
-
export {
|
|
6
|
+
export { getFeedSiteUrl };
|
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
import { errors } from "../locales.js";
|
|
2
|
-
import { resolveUrl } from "../utils.js";
|
|
3
|
-
import { parseFeed } from "feedsmith";
|
|
4
2
|
//#region src/common/discover/utils.ts
|
|
5
|
-
const defaultFetchFn = async (url, options) => {
|
|
6
|
-
const response = await fetch(url, {
|
|
7
|
-
method: options?.method ?? "GET",
|
|
8
|
-
headers: options?.headers
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
headers: response.headers,
|
|
12
|
-
body: await response.text(),
|
|
13
|
-
url: response.url,
|
|
14
|
-
status: response.status,
|
|
15
|
-
statusText: response.statusText
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
3
|
const normalizeInput = async (input, fetchFn) => {
|
|
19
4
|
if (typeof input === "object") return input;
|
|
20
5
|
try {
|
|
@@ -36,18 +21,6 @@ const getFeedSiteUrl = (parsed) => {
|
|
|
36
21
|
if (format === "atom") return getLinkOfType(feed.links, "alternate")?.href;
|
|
37
22
|
if (format === "json") return feed.home_page_url;
|
|
38
23
|
};
|
|
39
|
-
const defaultResolveSiteUrlFn = (input) => {
|
|
40
|
-
if (!input.content) return;
|
|
41
|
-
try {
|
|
42
|
-
let siteUrl = getFeedSiteUrl(parseFeed(input.content));
|
|
43
|
-
if (!siteUrl) try {
|
|
44
|
-
siteUrl = new URL(input.url).origin;
|
|
45
|
-
} catch {}
|
|
46
|
-
else siteUrl = resolveUrl(siteUrl, input.url);
|
|
47
|
-
if (siteUrl && new URL(siteUrl).href === new URL(input.url).href) return;
|
|
48
|
-
return siteUrl;
|
|
49
|
-
} catch {}
|
|
50
|
-
};
|
|
51
24
|
const normalizeUriEntry = (entry, resolveUrlFn, baseUrl) => {
|
|
52
25
|
if (typeof entry.uri === "string") return {
|
|
53
26
|
...entry,
|
|
@@ -122,4 +95,4 @@ const normalizeMethodsConfig = (sourceInput, siteInput, methods, defaults) => {
|
|
|
122
95
|
return methodsConfig;
|
|
123
96
|
};
|
|
124
97
|
//#endregion
|
|
125
|
-
export {
|
|
98
|
+
export { getFeedSiteUrl, normalizeInput, normalizeMethodsConfig, normalizeUriEntry };
|