feedscout 1.8.0 → 2.0.0-beta.1
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/extractors.d.ts +2 -2
- package/dist/blogrolls/extractors.js +2 -2
- package/dist/blogrolls/index.js +4 -5
- package/dist/blogrolls.d.ts +2 -2
- package/dist/blogrolls.js +2 -2
- package/dist/common/discover/defaults.d.ts +6 -0
- package/dist/common/discover/defaults.js +44 -0
- package/dist/common/discover/index.js +2 -2
- package/dist/common/discover/utils.d.ts +3 -6
- package/dist/common/discover/utils.js +1 -28
- package/dist/common/locales.js +214 -10
- package/dist/common/types.d.ts +3 -2
- package/dist/common/uris/feed/types.d.ts +2 -2
- package/dist/common/uris/html/types.d.ts +4 -4
- package/dist/common/utils.d.ts +6 -4
- package/dist/common/utils.js +13 -11
- package/dist/favicons/extractors.d.ts +2 -2
- package/dist/favicons/extractors.js +2 -2
- package/dist/favicons/index.js +4 -5
- package/dist/favicons.d.ts +2 -2
- package/dist/favicons.js +2 -2
- package/dist/feeds/defaults.d.ts +2 -1
- package/dist/feeds/defaults.js +116 -9
- package/dist/feeds/extractors.d.ts +2 -2
- package/dist/feeds/extractors.js +6 -6
- package/dist/feeds/index.js +4 -5
- package/dist/feeds/platform/handlers/acast.js +26 -0
- package/dist/feeds/platform/handlers/ameblo.js +36 -0
- package/dist/feeds/platform/handlers/applePodcasts.js +1 -1
- package/dist/feeds/platform/handlers/arena.js +42 -0
- package/dist/feeds/platform/handlers/artstation.js +52 -0
- package/dist/feeds/platform/handlers/audioboom.js +23 -0
- package/dist/feeds/platform/handlers/bearblog.js +45 -0
- package/dist/feeds/platform/handlers/behance.js +7 -0
- package/dist/feeds/platform/handlers/blogspot.js +38 -2
- package/dist/feeds/platform/handlers/bookwyrm.js +48 -0
- package/dist/feeds/platform/handlers/buttondown.js +43 -0
- package/dist/feeds/platform/handlers/buzzsprout.js +22 -0
- package/dist/feeds/platform/handlers/codeberg.js +5 -5
- package/dist/feeds/platform/handlers/dailymotion.js +16 -0
- package/dist/feeds/platform/handlers/deviantart.js +25 -6
- package/dist/feeds/platform/handlers/devto.js +8 -0
- package/dist/feeds/platform/handlers/discourse.js +70 -0
- package/dist/feeds/platform/handlers/dreamwidth.js +48 -0
- package/dist/feeds/platform/handlers/exblog.js +35 -0
- package/dist/feeds/platform/handlers/fireside.js +24 -0
- package/dist/feeds/platform/handlers/friendica.js +44 -0
- package/dist/feeds/platform/handlers/ghost.js +30 -0
- package/dist/feeds/platform/handlers/github.js +6 -0
- package/dist/feeds/platform/handlers/githubGist.js +16 -5
- package/dist/feeds/platform/handlers/gitlab.js +31 -13
- package/dist/feeds/platform/handlers/goodreads.js +18 -8
- package/dist/feeds/platform/handlers/hackernews.js +21 -0
- package/dist/feeds/platform/handlers/hashnode.js +1 -1
- package/dist/feeds/platform/handlers/hatenablog.js +4 -1
- package/dist/feeds/platform/handlers/hearthis.js +32 -0
- package/dist/feeds/platform/handlers/heyWorld.js +18 -0
- package/dist/feeds/platform/handlers/insanejournal.js +69 -0
- package/dist/feeds/platform/handlers/itchio.js +24 -1
- package/dist/feeds/platform/handlers/lemmy.js +46 -4
- package/dist/feeds/platform/handlers/letterboxd.js +4 -0
- package/dist/feeds/platform/handlers/libsyn.js +25 -0
- package/dist/feeds/platform/handlers/listed.js +20 -0
- package/dist/feeds/platform/handlers/livejournal.js +68 -0
- package/dist/feeds/platform/handlers/mastodon.js +32 -0
- package/dist/feeds/platform/handlers/mataroa.js +16 -0
- package/dist/feeds/platform/handlers/medium.js +2 -2
- package/dist/feeds/platform/handlers/microblog.js +55 -0
- package/dist/feeds/platform/handlers/misskey.js +40 -0
- package/dist/feeds/platform/handlers/myanimelist.js +43 -0
- package/dist/feeds/platform/handlers/naverBlog.js +21 -0
- package/dist/feeds/platform/handlers/nebula.js +68 -0
- package/dist/feeds/platform/handlers/note.js +53 -0
- package/dist/feeds/platform/handlers/observable.js +34 -0
- package/dist/feeds/platform/handlers/odysee.js +20 -0
- package/dist/feeds/platform/handlers/pagecord.js +16 -0
- package/dist/feeds/platform/handlers/paragraph.js +1 -2
- package/dist/feeds/platform/handlers/pika.js +35 -0
- package/dist/feeds/platform/handlers/pinterest.js +13 -0
- package/dist/feeds/platform/handlers/pixelfed.js +46 -0
- package/dist/feeds/platform/handlers/pleroma.js +34 -0
- package/dist/feeds/platform/handlers/podbean.js +29 -0
- package/dist/feeds/platform/handlers/podigee.js +29 -0
- package/dist/feeds/platform/handlers/posthaven.js +24 -0
- package/dist/feeds/platform/handlers/prose.js +26 -0
- package/dist/feeds/platform/handlers/qiita.js +58 -0
- package/dist/feeds/platform/handlers/reddit.js +83 -9
- package/dist/feeds/platform/handlers/rssCom.js +20 -0
- package/dist/feeds/platform/handlers/seesaa.js +22 -0
- package/dist/feeds/platform/handlers/sourceforge.js +37 -4
- package/dist/feeds/platform/handlers/spreaker.js +21 -0
- package/dist/feeds/platform/handlers/stackExchange.js +26 -2
- package/dist/feeds/platform/handlers/steam.js +7 -0
- package/dist/feeds/platform/handlers/tildes.js +41 -0
- package/dist/feeds/platform/handlers/tistory.js +16 -0
- package/dist/feeds/platform/handlers/transistor.js +29 -0
- package/dist/feeds/platform/handlers/velog.js +24 -0
- package/dist/feeds/platform/handlers/vimeo.js +6 -0
- package/dist/feeds/platform/handlers/weblogLol.js +26 -0
- package/dist/feeds/platform/handlers/weebly.js +25 -0
- package/dist/feeds/platform/handlers/wordpress.js +173 -28
- package/dist/feeds/platform/handlers/writeas.js +51 -0
- package/dist/feeds/platform/handlers/ximalaya.js +1 -1
- package/dist/feeds/platform/handlers/youtube.js +4 -1
- package/dist/feeds/platform/handlers/zenn.js +54 -0
- package/dist/feeds.d.ts +3 -3
- package/dist/feeds.js +3 -3
- package/dist/hubs/discover/index.js +3 -3
- package/dist/hubs/feed/index.js +2 -2
- package/dist/hubs/headers/index.js +2 -2
- package/dist/hubs/html/index.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/utils.d.ts +2 -1
- package/package.json +24 -64
- package/dist/blogrolls/defaults.cjs +0 -51
- package/dist/blogrolls/defaults.d.cts +0 -17
- package/dist/blogrolls/extractors.cjs +0 -21
- package/dist/blogrolls/extractors.d.cts +0 -7
- package/dist/blogrolls/index.cjs +0 -26
- package/dist/blogrolls/index.d.cts +0 -7
- package/dist/blogrolls/types.d.cts +0 -6
- package/dist/blogrolls.cjs +0 -13
- package/dist/blogrolls.d.cts +0 -4
- package/dist/common/discover/index.cjs +0 -105
- package/dist/common/discover/utils.cjs +0 -130
- package/dist/common/discover/utils.d.cts +0 -8
- package/dist/common/locales.cjs +0 -144
- package/dist/common/types.cjs +0 -10
- package/dist/common/types.d.cts +0 -89
- package/dist/common/uris/feed/index.cjs +0 -12
- package/dist/common/uris/feed/index.d.cts +0 -6
- package/dist/common/uris/feed/types.d.cts +0 -9
- package/dist/common/uris/guess/index.cjs +0 -8
- package/dist/common/uris/guess/index.d.cts +0 -7
- package/dist/common/uris/guess/types.d.cts +0 -10
- package/dist/common/uris/guess/utils.cjs +0 -42
- package/dist/common/uris/guess/utils.d.cts +0 -8
- package/dist/common/uris/headers/index.cjs +0 -26
- package/dist/common/uris/headers/index.d.cts +0 -6
- package/dist/common/uris/headers/types.d.cts +0 -9
- package/dist/common/uris/html/handlers.cjs +0 -45
- package/dist/common/uris/html/index.cjs +0 -19
- package/dist/common/uris/html/index.d.cts +0 -6
- package/dist/common/uris/html/types.d.cts +0 -12
- package/dist/common/uris/index.cjs +0 -32
- package/dist/common/uris/platform/index.cjs +0 -10
- package/dist/common/uris/platform/index.d.cts +0 -7
- package/dist/common/uris/platform/types.d.cts +0 -13
- package/dist/common/utils.cjs +0 -97
- package/dist/common/utils.d.cts +0 -10
- package/dist/favicons/defaults.cjs +0 -65
- package/dist/favicons/defaults.d.cts +0 -18
- package/dist/favicons/extractors.cjs +0 -25
- package/dist/favicons/extractors.d.cts +0 -7
- package/dist/favicons/index.cjs +0 -30
- package/dist/favicons/index.d.cts +0 -7
- package/dist/favicons/platform/handlers/bluesky.cjs +0 -27
- package/dist/favicons/platform/handlers/codeberg.cjs +0 -19
- package/dist/favicons/platform/handlers/deviantart.cjs +0 -29
- package/dist/favicons/platform/handlers/devto.cjs +0 -31
- package/dist/favicons/platform/handlers/github.cjs +0 -19
- package/dist/favicons/platform/handlers/githubGist.cjs +0 -19
- package/dist/favicons/platform/handlers/gitlab.cjs +0 -38
- package/dist/favicons/platform/handlers/lobsters.cjs +0 -21
- package/dist/favicons/platform/handlers/mastodon.cjs +0 -40
- package/dist/favicons/platform/handlers/reddit.cjs +0 -42
- package/dist/favicons/platform/handlers/sourceforge.cjs +0 -21
- package/dist/favicons/platform/handlers/tumblr.cjs +0 -16
- package/dist/favicons/types.d.cts +0 -4
- package/dist/favicons/utils.cjs +0 -10
- package/dist/favicons.cjs +0 -12
- package/dist/favicons.d.cts +0 -4
- package/dist/feeds/defaults.cjs +0 -178
- package/dist/feeds/defaults.d.cts +0 -20
- package/dist/feeds/extractors.cjs +0 -46
- package/dist/feeds/extractors.d.cts +0 -7
- package/dist/feeds/index.cjs +0 -27
- package/dist/feeds/index.d.cts +0 -7
- package/dist/feeds/platform/handlers/applePodcasts.cjs +0 -26
- package/dist/feeds/platform/handlers/behance.cjs +0 -49
- package/dist/feeds/platform/handlers/blogspot.cjs +0 -36
- package/dist/feeds/platform/handlers/bluesky.cjs +0 -20
- package/dist/feeds/platform/handlers/codeberg.cjs +0 -69
- package/dist/feeds/platform/handlers/csdn.cjs +0 -20
- package/dist/feeds/platform/handlers/dailymotion.cjs +0 -70
- package/dist/feeds/platform/handlers/deviantart.cjs +0 -66
- package/dist/feeds/platform/handlers/devto.cjs +0 -50
- package/dist/feeds/platform/handlers/douban.cjs +0 -56
- package/dist/feeds/platform/handlers/github.cjs +0 -116
- package/dist/feeds/platform/handlers/githubGist.cjs +0 -45
- package/dist/feeds/platform/handlers/gitlab.cjs +0 -80
- package/dist/feeds/platform/handlers/goodreads.cjs +0 -39
- package/dist/feeds/platform/handlers/hashnode.cjs +0 -16
- package/dist/feeds/platform/handlers/hatenablog.cjs +0 -53
- package/dist/feeds/platform/handlers/itchio.cjs +0 -88
- package/dist/feeds/platform/handlers/kickstarter.cjs +0 -22
- package/dist/feeds/platform/handlers/lemmy.cjs +0 -46
- package/dist/feeds/platform/handlers/letterboxd.cjs +0 -42
- package/dist/feeds/platform/handlers/lobsters.cjs +0 -57
- package/dist/feeds/platform/handlers/mastodon.cjs +0 -42
- package/dist/feeds/platform/handlers/medium.cjs +0 -68
- package/dist/feeds/platform/handlers/paragraph.cjs +0 -21
- package/dist/feeds/platform/handlers/pinterest.cjs +0 -44
- package/dist/feeds/platform/handlers/producthunt.cjs +0 -29
- package/dist/feeds/platform/handlers/reddit.cjs +0 -75
- package/dist/feeds/platform/handlers/soundcloud.cjs +0 -39
- package/dist/feeds/platform/handlers/sourceforge.cjs +0 -20
- package/dist/feeds/platform/handlers/stackExchange.cjs +0 -40
- package/dist/feeds/platform/handlers/steam.cjs +0 -28
- package/dist/feeds/platform/handlers/substack.cjs +0 -23
- package/dist/feeds/platform/handlers/tumblr.cjs +0 -24
- package/dist/feeds/platform/handlers/v2ex.cjs +0 -35
- package/dist/feeds/platform/handlers/vimeo.cjs +0 -69
- package/dist/feeds/platform/handlers/wordpress.cjs +0 -64
- package/dist/feeds/platform/handlers/wpengine.cjs +0 -10
- package/dist/feeds/platform/handlers/ximalaya.cjs +0 -20
- package/dist/feeds/platform/handlers/youtube.cjs +0 -94
- package/dist/feeds/types.d.cts +0 -9
- package/dist/feeds.cjs +0 -15
- package/dist/feeds.d.cts +0 -4
- package/dist/hubs/discover/index.cjs +0 -30
- package/dist/hubs/discover/index.d.cts +0 -7
- package/dist/hubs/discover/types.d.cts +0 -15
- package/dist/hubs/feed/index.cjs +0 -32
- package/dist/hubs/headers/index.cjs +0 -17
- package/dist/hubs/html/index.cjs +0 -28
- package/dist/hubs.cjs +0 -0
- package/dist/hubs.d.cts +0 -2
- package/dist/index.cjs +0 -12
- package/dist/index.d.cts +0 -7
- package/dist/methods.cjs +0 -15
- package/dist/methods.d.cts +0 -7
- package/dist/utils.cjs +0 -9
- package/dist/utils.d.cts +0 -2
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
|
|
|
@@ -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.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.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, mimeTypes, 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, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
|
package/dist/blogrolls.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal } from "./blogrolls/defaults.js";
|
|
2
|
-
import {
|
|
3
|
-
export { anchorLabels,
|
|
2
|
+
import { defaultExtractFn } from "./blogrolls/extractors.js";
|
|
3
|
+
export { anchorLabels, defaultExtractFn, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
|
|
@@ -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,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,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { parseFeed } from "feedsmith";
|
|
3
|
-
|
|
1
|
+
import { FeedMethodData } from "../uris/feed/types.js";
|
|
4
2
|
//#region src/common/discover/utils.d.ts
|
|
5
|
-
declare const getFeedSiteUrl: (parsed:
|
|
6
|
-
declare const defaultResolveSiteUrlFn: DiscoverResolveSiteUrlFn;
|
|
3
|
+
declare const getFeedSiteUrl: (parsed: FeedMethodData) => string | undefined;
|
|
7
4
|
//#endregion
|
|
8
|
-
export {
|
|
5
|
+
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 };
|
package/dist/common/locales.js
CHANGED
|
@@ -24,50 +24,89 @@ var hints = {
|
|
|
24
24
|
"github:tags": "Tags",
|
|
25
25
|
"github:wiki": "Wiki",
|
|
26
26
|
"github:discussions": "Discussions",
|
|
27
|
+
"github:discussion-category": "Discussion category",
|
|
27
28
|
"github:branch-commits": "Branch commits",
|
|
28
29
|
"github:file-history": "File history",
|
|
29
30
|
"reddit:posts": "Posts",
|
|
30
31
|
"reddit:post-comments": "Post comments",
|
|
31
32
|
"reddit:comments": "Comments",
|
|
32
33
|
"reddit:multireddit": "Multireddit",
|
|
34
|
+
"reddit:user-submitted": "Submitted",
|
|
35
|
+
"reddit:user-comments": "Comments",
|
|
36
|
+
"reddit:search": "Search",
|
|
37
|
+
"reddit:wiki": "Wiki",
|
|
38
|
+
"reddit:subreddits": "Subreddits",
|
|
33
39
|
"gitlab:activity": "Activity",
|
|
34
40
|
"gitlab:releases": "Releases",
|
|
35
41
|
"gitlab:tags": "Tags",
|
|
42
|
+
"gitlab:issues": "Issues",
|
|
43
|
+
"gitlab:merge-requests": "Merge requests",
|
|
44
|
+
"gitlab:branch-commits": "Branch commits",
|
|
36
45
|
"codeberg:activity": "Activity",
|
|
37
46
|
"codeberg:releases": "Releases",
|
|
38
47
|
"codeberg:tags": "Tags",
|
|
39
48
|
"codeberg:branch-commits": "Branch commits",
|
|
40
49
|
"codeberg:file-history": "File history",
|
|
41
|
-
"wordpress:category": "Category",
|
|
42
|
-
"wordpress:
|
|
43
|
-
"wordpress:
|
|
44
|
-
"wordpress:
|
|
45
|
-
"wordpress:
|
|
50
|
+
"wordpress:category-rss": "Category (RSS)",
|
|
51
|
+
"wordpress:category-atom": "Category (Atom)",
|
|
52
|
+
"wordpress:category-rdf": "Category (RDF)",
|
|
53
|
+
"wordpress:tag-rss": "Tag (RSS)",
|
|
54
|
+
"wordpress:tag-atom": "Tag (Atom)",
|
|
55
|
+
"wordpress:tag-rdf": "Tag (RDF)",
|
|
56
|
+
"wordpress:author-rss": "Author (RSS)",
|
|
57
|
+
"wordpress:author-atom": "Author (Atom)",
|
|
58
|
+
"wordpress:author-rdf": "Author (RDF)",
|
|
59
|
+
"wordpress:date-archive-rss": "Date archive (RSS)",
|
|
60
|
+
"wordpress:date-archive-atom": "Date archive (Atom)",
|
|
61
|
+
"wordpress:date-archive-rdf": "Date archive (RDF)",
|
|
62
|
+
"wordpress:posts-rss": "Posts (RSS)",
|
|
46
63
|
"wordpress:posts-rdf": "Posts (RDF)",
|
|
47
64
|
"wordpress:posts-atom": "Posts (Atom)",
|
|
48
|
-
"wordpress:comments": "Comments",
|
|
49
|
-
"wordpress:comments-rss2": "Comments (RSS 2.0)",
|
|
65
|
+
"wordpress:comments-rss": "Comments (RSS)",
|
|
50
66
|
"wordpress:comments-rdf": "Comments (RDF)",
|
|
51
67
|
"wordpress:comments-atom": "Comments (Atom)",
|
|
52
|
-
"
|
|
68
|
+
"wordpress:post-comments-rss": "Post comments (RSS)",
|
|
69
|
+
"wordpress:post-comments-rdf": "Post comments (RDF)",
|
|
70
|
+
"wordpress:post-comments-atom": "Post comments (Atom)",
|
|
53
71
|
"blogspot:posts-atom": "Posts (Atom)",
|
|
54
72
|
"blogspot:posts-rss": "Posts (RSS)",
|
|
73
|
+
"blogspot:posts-summary-atom": "Posts summary (Atom)",
|
|
74
|
+
"blogspot:posts-summary-rss": "Posts summary (RSS)",
|
|
75
|
+
"blogspot:comments-atom": "Comments (Atom)",
|
|
76
|
+
"blogspot:comments-rss": "Comments (RSS)",
|
|
77
|
+
"blogspot:label-atom": "Label (Atom)",
|
|
78
|
+
"blogspot:label-rss": "Label (RSS)",
|
|
79
|
+
"blogspot:post-comments-atom": "Post comments (Atom)",
|
|
80
|
+
"blogspot:post-comments-rss": "Post comments (RSS)",
|
|
55
81
|
"behance:portfolio": "Portfolio",
|
|
56
82
|
"behance:appreciated": "Appreciated",
|
|
83
|
+
"behance:projects": "Featured projects",
|
|
84
|
+
"behance:featured": "Featured by Adobe",
|
|
57
85
|
"bluesky:posts": "Posts",
|
|
58
86
|
"dailymotion:videos": "Videos",
|
|
59
87
|
"dailymotion:playlist": "Playlist",
|
|
88
|
+
"dailymotion:channel": "Channel",
|
|
89
|
+
"dailymotion:trending": "Trending",
|
|
90
|
+
"dailymotion:search": "Search",
|
|
60
91
|
"deviantart:tag": "Tag",
|
|
61
92
|
"deviantart:favorites": "Favorites",
|
|
62
93
|
"deviantart:gallery": "Gallery",
|
|
63
94
|
"deviantart:deviations": "Deviations",
|
|
95
|
+
"deviantart:journal": "Journal",
|
|
96
|
+
"deviantart:daily-deviations": "Daily Deviations",
|
|
97
|
+
"deviantart:popular": "Popular",
|
|
64
98
|
"devto:posts": "Posts",
|
|
65
99
|
"devto:tag": "Tag",
|
|
100
|
+
"devto:community": "Community",
|
|
101
|
+
"devto:latest": "Latest",
|
|
66
102
|
"github-gist:gists": "Gists",
|
|
67
103
|
"github-gist:starred": "Starred",
|
|
104
|
+
"github-gist:forks": "Forks",
|
|
105
|
+
"github-gist:discover": "Discover",
|
|
68
106
|
"kickstarter:updates": "Updates",
|
|
69
107
|
"kickstarter:projects": "Projects",
|
|
70
108
|
"letterboxd:diary": "Diary",
|
|
109
|
+
"letterboxd:journal": "Journal",
|
|
71
110
|
"lobsters:tag": "Tag",
|
|
72
111
|
"lobsters:domain": "Domain",
|
|
73
112
|
"lobsters:stories": "Stories",
|
|
@@ -76,11 +115,15 @@ var hints = {
|
|
|
76
115
|
"lobsters:comments": "Comments",
|
|
77
116
|
"mastodon:posts": "Posts",
|
|
78
117
|
"mastodon:tag": "Tag",
|
|
118
|
+
"mastodon:tagged": "Tagged",
|
|
119
|
+
"mastodon:replies": "Posts with replies",
|
|
120
|
+
"mastodon:media": "Media",
|
|
79
121
|
"medium:posts": "Posts",
|
|
80
122
|
"medium:tag": "Tag",
|
|
81
123
|
"medium:tagged": "Tagged",
|
|
82
124
|
"medium:publication": "Publication",
|
|
83
125
|
"pinterest:pins": "Pins",
|
|
126
|
+
"pinterest:board": "Board",
|
|
84
127
|
"producthunt:topic": "Topic",
|
|
85
128
|
"producthunt:category": "Category",
|
|
86
129
|
"producthunt:products": "Products",
|
|
@@ -88,18 +131,33 @@ var hints = {
|
|
|
88
131
|
"stackexchange:tag": "Tag",
|
|
89
132
|
"stackexchange:question": "Question",
|
|
90
133
|
"stackexchange:user": "User",
|
|
134
|
+
"stackexchange:newest": "Newest questions",
|
|
135
|
+
"stackexchange:collective": "Collective",
|
|
91
136
|
"steam:news": "News",
|
|
137
|
+
"steam:news-global": "News (global)",
|
|
138
|
+
"steam:daily-deals": "Daily deals",
|
|
92
139
|
"steam:group": "Group",
|
|
93
140
|
"substack:newsletter": "Newsletter",
|
|
94
141
|
"tumblr:posts": "Posts",
|
|
95
142
|
"tumblr:tag": "Tag",
|
|
96
143
|
"goodreads:updates": "Updates",
|
|
97
144
|
"goodreads:reviews": "Reviews",
|
|
98
|
-
"
|
|
145
|
+
"goodreads:shelf": "Shelf",
|
|
146
|
+
"sourceforge:activity": "Recent activity",
|
|
147
|
+
"sourceforge:files": "File releases",
|
|
148
|
+
"sourceforge:news-rss": "News (RSS)",
|
|
149
|
+
"sourceforge:news-atom": "News (Atom)",
|
|
150
|
+
"sourceforge:discussion": "Discussion",
|
|
151
|
+
"sourceforge:discussion-atom": "Discussion (Atom)",
|
|
152
|
+
"sourceforge:project-feed": "Project feed",
|
|
153
|
+
"sourceforge:bugs": "Bugs",
|
|
154
|
+
"velog:posts": "Posts",
|
|
155
|
+
"velog:trending": "Trending",
|
|
99
156
|
"vimeo:videos": "Videos",
|
|
100
157
|
"vimeo:likes": "Likes",
|
|
101
158
|
"vimeo:channel": "Channel",
|
|
102
159
|
"vimeo:group": "Group",
|
|
160
|
+
"vimeo:album": "Album",
|
|
103
161
|
"hashnode:blog": "Blog",
|
|
104
162
|
"paragraph:blog": "Blog",
|
|
105
163
|
"hatenablog:posts-rss": "Posts (RSS)",
|
|
@@ -111,10 +169,14 @@ var hints = {
|
|
|
111
169
|
"itchio:devlog": "Devlog",
|
|
112
170
|
"itchio:games": "Games",
|
|
113
171
|
"itchio:tag": "Tag",
|
|
172
|
+
"itchio:platform": "Platform",
|
|
173
|
+
"itchio:genre": "Genre",
|
|
174
|
+
"itchio:made-with": "Made with",
|
|
114
175
|
"itchio:section": "Section",
|
|
115
176
|
"itchio:featured": "Featured",
|
|
116
177
|
"itchio:new": "New",
|
|
117
178
|
"itchio:sales": "Sales",
|
|
179
|
+
"itchio:blog": "Blog",
|
|
118
180
|
"csdn:blog": "Blog",
|
|
119
181
|
"douban:interests": "Interests",
|
|
120
182
|
"douban:reviews": "Reviews",
|
|
@@ -127,7 +189,149 @@ var hints = {
|
|
|
127
189
|
"ximalaya:album": "Album",
|
|
128
190
|
"lemmy:community": "Community",
|
|
129
191
|
"lemmy:user": "User",
|
|
130
|
-
"
|
|
192
|
+
"lemmy:all": "All",
|
|
193
|
+
"lemmy:local": "Local",
|
|
194
|
+
"apple-podcasts:podcast": "Podcast",
|
|
195
|
+
"writeas:blog": "Blog",
|
|
196
|
+
"writeas:tag": "Tag",
|
|
197
|
+
"prose:blog": "Blog",
|
|
198
|
+
"prose:tag": "Tag",
|
|
199
|
+
"prose:discovery": "Discovery",
|
|
200
|
+
"pagecord:blog": "Blog",
|
|
201
|
+
"listed:blog": "Blog",
|
|
202
|
+
"fireside:podcast-rss": "Podcast (RSS)",
|
|
203
|
+
"fireside:podcast-json": "Podcast (JSON)",
|
|
204
|
+
"exblog:posts-rss": "Posts (RSS)",
|
|
205
|
+
"exblog:posts-atom": "Posts (Atom)",
|
|
206
|
+
"exblog:category-rss": "Category (RSS)",
|
|
207
|
+
"exblog:category-atom": "Category (Atom)",
|
|
208
|
+
"dreamwidth:posts-rss": "Posts (RSS)",
|
|
209
|
+
"dreamwidth:posts-atom": "Posts (Atom)",
|
|
210
|
+
"dreamwidth:posts-tag-rss": "Tag (RSS)",
|
|
211
|
+
"dreamwidth:posts-tag-atom": "Tag (Atom)",
|
|
212
|
+
"dreamwidth:userpics-atom": "Userpics (Atom)",
|
|
213
|
+
"buttondown:newsletter": "Newsletter",
|
|
214
|
+
"bearblog:posts-atom": "Posts (Atom)",
|
|
215
|
+
"bearblog:posts-rss": "Posts (RSS)",
|
|
216
|
+
"bearblog:tag-atom": "Tag (Atom)",
|
|
217
|
+
"bearblog:tag-rss": "Tag (RSS)",
|
|
218
|
+
"bearblog:discover-atom": "Trending (Atom)",
|
|
219
|
+
"bearblog:discover-rss": "Trending (RSS)",
|
|
220
|
+
"transistor:podcast": "Podcast",
|
|
221
|
+
"odysee:videos": "Videos",
|
|
222
|
+
"myanimelist:anime": "Anime list",
|
|
223
|
+
"myanimelist:manga": "Manga list",
|
|
224
|
+
"myanimelist:recently-watched": "Recently watched",
|
|
225
|
+
"myanimelist:recently-read": "Recently read",
|
|
226
|
+
"myanimelist:news": "News",
|
|
227
|
+
"myanimelist:featured": "Featured",
|
|
228
|
+
"hackernews:front": "Front page",
|
|
229
|
+
"hackernews:show": "Show HN",
|
|
230
|
+
"tistory:blog": "Blog",
|
|
231
|
+
"note:blog": "Blog",
|
|
232
|
+
"note:hashtag": "Hashtag",
|
|
233
|
+
"note:magazine": "Magazine",
|
|
234
|
+
"note:featured": "Featured",
|
|
235
|
+
"artstation:portfolio": "Portfolio",
|
|
236
|
+
"artstation:artwork": "Artwork",
|
|
237
|
+
"artstation:artwork-trending": "Artwork (Trending)",
|
|
238
|
+
"nebula:videos": "Videos",
|
|
239
|
+
"nebula:videos-plus": "Videos (Plus)",
|
|
240
|
+
"nebula:videos-all": "All Videos",
|
|
241
|
+
"nebula:videos-all-plus": "All Videos (Plus)",
|
|
242
|
+
"nebula:category": "Category",
|
|
243
|
+
"nebula:category-plus": "Category (Plus)",
|
|
244
|
+
"nebula:channels": "Recently Added Channels",
|
|
245
|
+
"acast:podcast": "Podcast",
|
|
246
|
+
"ameblo:posts-rss": "Posts (RSS)",
|
|
247
|
+
"ameblo:posts-atom": "Posts (Atom)",
|
|
248
|
+
"ameblo:posts-rdf": "Posts (RDF)",
|
|
249
|
+
"arena:profile": "Profile",
|
|
250
|
+
"arena:channel": "Channel",
|
|
251
|
+
"arena:editorial": "Editorial",
|
|
252
|
+
"audioboom:podcast": "Podcast",
|
|
253
|
+
"bookwyrm:activity": "Activity",
|
|
254
|
+
"bookwyrm:reviews": "Reviews",
|
|
255
|
+
"bookwyrm:quotes": "Quotes",
|
|
256
|
+
"bookwyrm:comments": "Comments",
|
|
257
|
+
"bookwyrm:shelf": "Shelf",
|
|
258
|
+
"buzzsprout:podcast": "Podcast",
|
|
259
|
+
"discourse:latest": "Latest",
|
|
260
|
+
"discourse:posts": "Latest posts",
|
|
261
|
+
"discourse:top": "Top",
|
|
262
|
+
"discourse:category": "Category",
|
|
263
|
+
"discourse:topic": "Topic",
|
|
264
|
+
"discourse:activity": "Activity",
|
|
265
|
+
"friendica:posts": "Posts",
|
|
266
|
+
"friendica:comments": "Comments",
|
|
267
|
+
"friendica:replies": "Replies",
|
|
268
|
+
"friendica:activity": "Activity",
|
|
269
|
+
"ghost:blog": "Blog",
|
|
270
|
+
"ghost:tag": "Tag",
|
|
271
|
+
"ghost:author": "Author",
|
|
272
|
+
"hearthis:tracks": "Tracks",
|
|
273
|
+
"hey-world:blog": "Blog",
|
|
274
|
+
"insanejournal:posts-rss": "Posts (RSS)",
|
|
275
|
+
"insanejournal:posts-atom": "Posts (Atom)",
|
|
276
|
+
"insanejournal:posts-tag-rss": "Tag (RSS)",
|
|
277
|
+
"insanejournal:posts-tag-atom": "Tag (Atom)",
|
|
278
|
+
"insanejournal:userpics-atom": "Userpics (Atom)",
|
|
279
|
+
"libsyn:podcast": "Podcast",
|
|
280
|
+
"livejournal:posts-rss": "Posts (RSS)",
|
|
281
|
+
"livejournal:posts-atom": "Posts (Atom)",
|
|
282
|
+
"livejournal:posts-tag-rss": "Tag (RSS)",
|
|
283
|
+
"livejournal:posts-tag-atom": "Tag (Atom)",
|
|
284
|
+
"livejournal:userpics-atom": "Userpics (Atom)",
|
|
285
|
+
"mataroa:blog": "Blog",
|
|
286
|
+
"microblog:posts-rss": "Posts (RSS)",
|
|
287
|
+
"microblog:posts-json": "Posts (JSON)",
|
|
288
|
+
"microblog:podcast": "Podcast",
|
|
289
|
+
"microblog:podcast-json": "Podcast (JSON)",
|
|
290
|
+
"microblog:category-rss": "Category (RSS)",
|
|
291
|
+
"microblog:category-json": "Category (JSON)",
|
|
292
|
+
"microblog:archive": "Archive",
|
|
293
|
+
"microblog:photos": "Photos",
|
|
294
|
+
"microblog:replies": "Replies",
|
|
295
|
+
"misskey:posts-atom": "Posts (Atom)",
|
|
296
|
+
"misskey:posts-rss": "Posts (RSS)",
|
|
297
|
+
"misskey:posts-json": "Posts (JSON)",
|
|
298
|
+
"naver-blog:blog": "Blog",
|
|
299
|
+
"observable:notebooks": "Notebooks",
|
|
300
|
+
"observable:collection": "Collection",
|
|
301
|
+
"observable:recent": "Recent",
|
|
302
|
+
"observable:trending": "Trending",
|
|
303
|
+
"pika:posts-atom": "Posts (Atom)",
|
|
304
|
+
"pika:posts-rss": "Posts (RSS)",
|
|
305
|
+
"pika:tag-atom": "Tag (Atom)",
|
|
306
|
+
"pika:tag-rss": "Tag (RSS)",
|
|
307
|
+
"pixelfed:posts": "Posts",
|
|
308
|
+
"pleroma:posts": "Posts",
|
|
309
|
+
"pleroma:posts-rss": "Posts (RSS)",
|
|
310
|
+
"podbean:podcast": "Podcast",
|
|
311
|
+
"podigee:podcast": "Podcast",
|
|
312
|
+
"posthaven:posts": "Posts",
|
|
313
|
+
"posthaven:tag": "Tag",
|
|
314
|
+
"qiita:posts": "Posts",
|
|
315
|
+
"qiita:tag": "Tag",
|
|
316
|
+
"qiita:organization": "Organization",
|
|
317
|
+
"qiita:popular": "Popular items",
|
|
318
|
+
"qiita:zine": "Qiita Zine",
|
|
319
|
+
"rss-com:podcast": "Podcast",
|
|
320
|
+
"seesaa:posts-rss2": "Posts (RSS 2.0)",
|
|
321
|
+
"seesaa:posts-rdf": "Posts (RDF)",
|
|
322
|
+
"spreaker:podcast": "Podcast",
|
|
323
|
+
"tildes:topics-rss": "Topics (RSS)",
|
|
324
|
+
"tildes:topics-atom": "Topics (Atom)",
|
|
325
|
+
"tildes:group-rss": "Group (RSS)",
|
|
326
|
+
"tildes:group-atom": "Group (Atom)",
|
|
327
|
+
"weblog-lol:posts-rss": "Posts (RSS)",
|
|
328
|
+
"weblog-lol:posts-atom": "Posts (Atom)",
|
|
329
|
+
"weblog-lol:posts-json": "Posts (JSON)",
|
|
330
|
+
"weebly:blog": "Blog",
|
|
331
|
+
"zenn:posts": "Posts",
|
|
332
|
+
"zenn:topic": "Topic",
|
|
333
|
+
"zenn:publication": "Publication",
|
|
334
|
+
"zenn:trending": "Trending"
|
|
131
335
|
};
|
|
132
336
|
//#endregion
|
|
133
337
|
export { errors, hints };
|
package/dist/common/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { PlatformMethodOptions } from "./uris/platform/types.js";
|
|
|
6
6
|
|
|
7
7
|
//#region src/common/types.d.ts
|
|
8
8
|
type MaybePromise<T> = T | Promise<T>;
|
|
9
|
+
type Pattern = string | RegExp;
|
|
9
10
|
type UriEntry = string | Array<string>;
|
|
10
11
|
type DiscoverUriHint = {
|
|
11
12
|
key: string;
|
|
@@ -22,7 +23,7 @@ type LinkSelector = {
|
|
|
22
23
|
types?: Array<string>;
|
|
23
24
|
};
|
|
24
25
|
type DiscoverResolveUrlFn = (url: string, baseUrl: string | undefined) => string | undefined;
|
|
25
|
-
type DiscoverResolveSiteUrlFn = (input: DiscoverInputObject) => string | undefined;
|
|
26
|
+
type DiscoverResolveSiteUrlFn = (input: DiscoverInputObject, resolveUrlFn: DiscoverResolveUrlFn) => string | undefined;
|
|
26
27
|
type DiscoverFetchFnOptions = {
|
|
27
28
|
method?: 'GET' | 'HEAD';
|
|
28
29
|
headers?: Record<string, string>;
|
|
@@ -86,4 +87,4 @@ type DiscoverOptions<TValid, TMethods extends DiscoverMethod = DiscoverMethod> =
|
|
|
86
87
|
includeInvalid?: boolean;
|
|
87
88
|
};
|
|
88
89
|
//#endregion
|
|
89
|
-
export { DiscoverExtractFn, DiscoverFetchFn, DiscoverFetchFnOptions, DiscoverFetchFnResponse, DiscoverInput, DiscoverInputObject, DiscoverMethod, DiscoverMethodsConfig, DiscoverOnProgressFn, DiscoverOptions, DiscoverProgress, DiscoverResolveSiteUrlFn, DiscoverResolveUrlFn, DiscoverResult, DiscoverUriEntry, DiscoverUriHint, LinkSelector, MaybePromise, UriEntry };
|
|
90
|
+
export { DiscoverExtractFn, DiscoverFetchFn, DiscoverFetchFnOptions, DiscoverFetchFnResponse, DiscoverInput, DiscoverInputObject, DiscoverMethod, DiscoverMethodsConfig, DiscoverOnProgressFn, DiscoverOptions, DiscoverProgress, DiscoverResolveSiteUrlFn, DiscoverResolveUrlFn, DiscoverResult, DiscoverUriEntry, DiscoverUriHint, LinkSelector, MaybePromise, Pattern, UriEntry };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseFeed } from "feedsmith";
|
|
2
2
|
|
|
3
3
|
//#region src/common/uris/feed/types.d.ts
|
|
4
|
-
type FeedMethodData = ReturnType<typeof parseFeed
|
|
4
|
+
type FeedMethodData = ReturnType<typeof parseFeed<string>>;
|
|
5
5
|
type FeedMethodOptions = {
|
|
6
6
|
extractUrls: (params: FeedMethodData) => Array<string>;
|
|
7
7
|
};
|
|
8
8
|
//#endregion
|
|
9
|
-
export { FeedMethodOptions };
|
|
9
|
+
export { FeedMethodData, FeedMethodOptions };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { LinkSelector } from "../../types.js";
|
|
1
|
+
import { LinkSelector, Pattern } from "../../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/common/uris/html/types.d.ts
|
|
4
4
|
type HtmlMethodOptions = {
|
|
5
5
|
baseUrl?: string;
|
|
6
6
|
linkSelectors: Array<LinkSelector>;
|
|
7
|
-
anchorUris: Array<
|
|
8
|
-
anchorIgnoredUris: Array<
|
|
9
|
-
anchorLabels: Array<
|
|
7
|
+
anchorUris: Array<Pattern>;
|
|
8
|
+
anchorIgnoredUris: Array<Pattern>;
|
|
9
|
+
anchorLabels: Array<Pattern>;
|
|
10
10
|
};
|
|
11
11
|
//#endregion
|
|
12
12
|
export { HtmlMethodOptions };
|
package/dist/common/utils.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { Pattern } from "./types.js";
|
|
2
|
+
|
|
1
3
|
//#region src/common/utils.d.ts
|
|
2
4
|
declare const isSubdomainOf: (url: string, domains: string | Array<string>) => boolean;
|
|
3
5
|
declare const isHostOf: (url: string, hosts: string | Array<string>) => boolean;
|
|
4
|
-
declare const includesAnyOf: (value: string, patterns: Array<
|
|
5
|
-
declare const isAnyOf: (value: string, patterns: Array<
|
|
6
|
-
declare const anyWordMatchesAnyOf: (value: string, patterns: Array<
|
|
7
|
-
declare const endsWithAnyOf: (value: string, patterns: Array<
|
|
6
|
+
declare const includesAnyOf: (value: string, patterns: Array<Pattern>, parser?: (value: string) => string) => boolean;
|
|
7
|
+
declare const isAnyOf: (value: string, patterns: Array<Pattern>, parser?: (value: string) => string) => boolean;
|
|
8
|
+
declare const anyWordMatchesAnyOf: (value: string, patterns: Array<Pattern>) => boolean;
|
|
9
|
+
declare const endsWithAnyOf: (value: string, patterns: Array<Pattern>) => boolean;
|
|
8
10
|
declare const omitEmpty: <T>(array: Array<T | null | undefined>) => Array<T>;
|
|
9
11
|
//#endregion
|
|
10
12
|
export { anyWordMatchesAnyOf, endsWithAnyOf, includesAnyOf, isAnyOf, isHostOf, isSubdomainOf, omitEmpty };
|
package/dist/common/utils.js
CHANGED
|
@@ -24,18 +24,27 @@ const isHostOf = (url, hosts) => {
|
|
|
24
24
|
};
|
|
25
25
|
const includesAnyOf = (value, patterns, parser) => {
|
|
26
26
|
const parsedValue = parser ? parser(value) : value?.toLowerCase();
|
|
27
|
-
return patterns.some((pattern) =>
|
|
27
|
+
return patterns.some((pattern) => {
|
|
28
|
+
if (pattern instanceof RegExp) return pattern.test(parsedValue);
|
|
29
|
+
return pattern && parsedValue?.includes(pattern.toLowerCase());
|
|
30
|
+
});
|
|
28
31
|
};
|
|
29
32
|
const isAnyOf = (value, patterns, parser) => {
|
|
30
33
|
const parsedValue = parser ? parser(value) : value?.toLowerCase()?.trim();
|
|
31
|
-
return patterns.some((pattern) =>
|
|
34
|
+
return patterns.some((pattern) => {
|
|
35
|
+
if (pattern instanceof RegExp) return pattern.test(parsedValue);
|
|
36
|
+
return parsedValue === pattern.toLowerCase().trim();
|
|
37
|
+
});
|
|
32
38
|
};
|
|
33
39
|
const anyWordMatchesAnyOf = (value, patterns) => {
|
|
34
40
|
return value.toLowerCase().split(whitespaceRegex).some((word) => isAnyOf(word, patterns));
|
|
35
41
|
};
|
|
36
42
|
const endsWithAnyOf = (value, patterns) => {
|
|
37
43
|
const lowerValue = value.toLowerCase();
|
|
38
|
-
return patterns.some((pattern) =>
|
|
44
|
+
return patterns.some((pattern) => {
|
|
45
|
+
if (pattern instanceof RegExp) return pattern.test(lowerValue);
|
|
46
|
+
return pattern && lowerValue.endsWith(pattern.toLowerCase());
|
|
47
|
+
});
|
|
39
48
|
};
|
|
40
49
|
const isOfAllowedMimeType = (type, allowedTypes) => {
|
|
41
50
|
if (allowedTypes.length === 0) return true;
|
|
@@ -52,13 +61,6 @@ const omitEmpty = (array) => {
|
|
|
52
61
|
for (const item of array) if (item != null && item !== "") result.push(item);
|
|
53
62
|
return result;
|
|
54
63
|
};
|
|
55
|
-
const resolveUrl = (url, baseUrl) => {
|
|
56
|
-
try {
|
|
57
|
-
return new URL(url, baseUrl).href;
|
|
58
|
-
} catch {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
64
|
const matchesAnyOfLinkSelectors = (rel, type, selectors) => {
|
|
63
65
|
return selectors.some((selector) => {
|
|
64
66
|
if (!anyWordMatchesAnyOf(rel, [selector.rel])) return false;
|
|
@@ -83,4 +85,4 @@ const processConcurrently = async (items, processFn, options) => {
|
|
|
83
85
|
}
|
|
84
86
|
};
|
|
85
87
|
//#endregion
|
|
86
|
-
export { anyWordMatchesAnyOf, composeHint, endsWithAnyOf, hasMetaContent, includesAnyOf, isAnyOf, isHostOf, isSubdomainOf, matchesAnyOfLinkSelectors, omitEmpty, processConcurrently
|
|
88
|
+
export { anyWordMatchesAnyOf, composeHint, endsWithAnyOf, hasMetaContent, includesAnyOf, isAnyOf, isHostOf, isSubdomainOf, matchesAnyOfLinkSelectors, omitEmpty, processConcurrently };
|
|
@@ -2,6 +2,6 @@ import { DiscoverExtractFn } from "../common/types.js";
|
|
|
2
2
|
import { FaviconResult } from "./types.js";
|
|
3
3
|
|
|
4
4
|
//#region src/favicons/extractors.d.ts
|
|
5
|
-
declare const
|
|
5
|
+
declare const defaultExtractFn: DiscoverExtractFn<FaviconResult>;
|
|
6
6
|
//#endregion
|
|
7
|
-
export {
|
|
7
|
+
export { defaultExtractFn };
|