feedscout 1.7.1 → 1.8.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/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 -1
- package/dist/blogrolls.d.cts +2 -2
- package/dist/blogrolls.d.ts +2 -2
- package/dist/blogrolls.js +2 -2
- 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 +9 -35
- package/dist/common/discover/utils.d.cts +1 -3
- package/dist/common/discover/utils.d.ts +1 -3
- package/dist/common/discover/utils.js +10 -34
- package/dist/common/locales.cjs +11 -4
- package/dist/common/locales.js +11 -4
- package/dist/common/types.d.cts +5 -4
- package/dist/common/types.d.ts +5 -4
- package/dist/common/uris/headers/index.cjs +1 -1
- package/dist/common/uris/headers/index.js +1 -1
- package/dist/common/uris/platform/types.d.cts +2 -2
- package/dist/common/uris/platform/types.d.ts +2 -2
- package/dist/common/utils.cjs +0 -8
- package/dist/common/utils.js +1 -8
- package/dist/favicons/defaults.cjs +6 -1
- package/dist/favicons/defaults.js +6 -1
- 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/platform/handlers/bluesky.cjs +1 -1
- package/dist/favicons/platform/handlers/bluesky.js +1 -1
- package/dist/favicons/platform/handlers/codeberg.cjs +4 -3
- package/dist/favicons/platform/handlers/codeberg.js +4 -3
- package/dist/favicons/platform/handlers/devto.cjs +31 -0
- package/dist/favicons/platform/handlers/devto.js +31 -0
- package/dist/favicons/platform/handlers/github.cjs +4 -3
- package/dist/favicons/platform/handlers/github.js +4 -3
- package/dist/favicons/platform/handlers/githubGist.cjs +4 -3
- package/dist/favicons/platform/handlers/githubGist.js +4 -3
- package/dist/favicons/platform/handlers/gitlab.cjs +38 -0
- package/dist/favicons/platform/handlers/gitlab.js +38 -0
- package/dist/favicons/platform/handlers/lobsters.cjs +3 -3
- package/dist/favicons/platform/handlers/lobsters.js +3 -3
- package/dist/favicons/platform/handlers/mastodon.cjs +5 -3
- package/dist/favicons/platform/handlers/mastodon.js +5 -3
- package/dist/favicons/platform/handlers/reddit.cjs +10 -8
- package/dist/favicons/platform/handlers/reddit.js +10 -8
- 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 +4 -2
- package/dist/feeds/defaults.js +4 -2
- 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/applePodcasts.cjs +26 -0
- package/dist/feeds/platform/handlers/applePodcasts.js +26 -0
- package/dist/feeds/platform/handlers/behance.cjs +2 -2
- package/dist/feeds/platform/handlers/behance.js +2 -2
- package/dist/feeds/platform/handlers/dailymotion.cjs +4 -4
- package/dist/feeds/platform/handlers/dailymotion.js +4 -4
- package/dist/feeds/platform/handlers/devto.cjs +6 -4
- package/dist/feeds/platform/handlers/devto.js +5 -5
- package/dist/feeds/platform/handlers/gitlab.cjs +4 -0
- package/dist/feeds/platform/handlers/gitlab.js +1 -1
- package/dist/feeds/platform/handlers/hatenablog.cjs +4 -4
- package/dist/feeds/platform/handlers/hatenablog.js +4 -4
- package/dist/feeds/platform/handlers/itchio.cjs +10 -10
- package/dist/feeds/platform/handlers/itchio.js +10 -10
- package/dist/feeds/platform/handlers/lobsters.cjs +8 -8
- package/dist/feeds/platform/handlers/lobsters.js +8 -8
- package/dist/feeds/platform/handlers/mastodon.cjs +4 -4
- package/dist/feeds/platform/handlers/mastodon.js +4 -4
- package/dist/feeds/platform/handlers/medium.cjs +10 -10
- package/dist/feeds/platform/handlers/medium.js +10 -10
- package/dist/feeds/platform/handlers/paragraph.cjs +2 -2
- package/dist/feeds/platform/handlers/paragraph.js +2 -2
- package/dist/feeds/platform/handlers/producthunt.cjs +4 -4
- package/dist/feeds/platform/handlers/producthunt.js +4 -4
- package/dist/feeds/platform/handlers/reddit.cjs +10 -10
- package/dist/feeds/platform/handlers/reddit.js +10 -10
- package/dist/feeds/platform/handlers/stackExchange.cjs +6 -6
- package/dist/feeds/platform/handlers/stackExchange.js +6 -6
- package/dist/feeds/platform/handlers/steam.cjs +4 -4
- package/dist/feeds/platform/handlers/steam.js +4 -4
- package/dist/feeds/platform/handlers/substack.cjs +10 -3
- package/dist/feeds/platform/handlers/substack.js +11 -4
- package/dist/feeds/platform/handlers/tumblr.cjs +2 -2
- package/dist/feeds/platform/handlers/tumblr.js +2 -2
- package/dist/feeds/platform/handlers/v2ex.cjs +4 -4
- package/dist/feeds/platform/handlers/v2ex.js +4 -4
- package/dist/feeds/platform/handlers/vimeo.cjs +2 -2
- package/dist/feeds/platform/handlers/vimeo.js +2 -2
- package/dist/feeds/platform/handlers/wordpress.cjs +6 -6
- package/dist/feeds/platform/handlers/wordpress.js +6 -6
- package/dist/feeds/platform/handlers/ximalaya.cjs +2 -2
- package/dist/feeds/platform/handlers/ximalaya.js +2 -2
- package/dist/feeds/platform/handlers/youtube.cjs +36 -21
- package/dist/feeds/platform/handlers/youtube.js +36 -21
- package/dist/feeds.cjs +1 -1
- package/dist/feeds.d.cts +2 -2
- package/dist/feeds.d.ts +2 -2
- package/dist/feeds.js +2 -2
- package/dist/hubs/discover/index.cjs +4 -5
- package/dist/hubs/discover/index.js +3 -4
- 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/package.json +3 -2
- package/dist/hubs/discover/utils.cjs +0 -18
- package/dist/hubs/discover/utils.js +0 -18
|
@@ -2,13 +2,13 @@ const require_utils = require("../../../common/utils.cjs");
|
|
|
2
2
|
const require_utils$1 = require("../../utils.cjs");
|
|
3
3
|
const require_reddit = require("../../../feeds/platform/handlers/reddit.cjs");
|
|
4
4
|
//#region src/favicons/platform/handlers/reddit.ts
|
|
5
|
+
const subredditRegex = /^\/r\/([^/.]+)/;
|
|
6
|
+
const userRegex = /^\/(u|user)\/([^/.]+)/;
|
|
5
7
|
const isSubredditPath = (pathname) => {
|
|
6
|
-
|
|
7
|
-
return segments.length >= 2 && segments[0] === "r";
|
|
8
|
+
return subredditRegex.test(pathname);
|
|
8
9
|
};
|
|
9
10
|
const isUserPath = (pathname) => {
|
|
10
|
-
|
|
11
|
-
return segments.length >= 2 && (segments[0] === "u" || segments[0] === "user");
|
|
11
|
+
return userRegex.test(pathname);
|
|
12
12
|
};
|
|
13
13
|
const redditHandler = {
|
|
14
14
|
match: (url) => {
|
|
@@ -22,13 +22,15 @@ const redditHandler = {
|
|
|
22
22
|
if (!fetchFn) return [];
|
|
23
23
|
try {
|
|
24
24
|
const { pathname } = new URL(url);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const subredditMatch = pathname.match(subredditRegex);
|
|
26
|
+
if (subredditMatch?.[1]) {
|
|
27
|
+
const data = require_utils$1.parseBodyJson((await fetchFn(`https://www.reddit.com/r/${subredditMatch[1]}/about.json`)).body);
|
|
27
28
|
const icon = data?.data?.community_icon?.split("?")[0] || data?.data?.icon_img;
|
|
28
29
|
if (require_utils$1.isNonEmptyString(icon)) return [{ uri: icon }];
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const userMatch = pathname.match(userRegex);
|
|
32
|
+
if (userMatch?.[2]) {
|
|
33
|
+
const data = require_utils$1.parseBodyJson((await fetchFn(`https://www.reddit.com/user/${userMatch[2]}/about.json`)).body);
|
|
32
34
|
const icon = data?.data?.icon_img || data?.data?.snoovatar_img;
|
|
33
35
|
if (require_utils$1.isNonEmptyString(icon)) return [{ uri: icon }];
|
|
34
36
|
}
|
|
@@ -2,13 +2,13 @@ import { isHostOf } from "../../../common/utils.js";
|
|
|
2
2
|
import { isNonEmptyString, parseBodyJson } from "../../utils.js";
|
|
3
3
|
import { hosts } from "../../../feeds/platform/handlers/reddit.js";
|
|
4
4
|
//#region src/favicons/platform/handlers/reddit.ts
|
|
5
|
+
const subredditRegex = /^\/r\/([^/.]+)/;
|
|
6
|
+
const userRegex = /^\/(u|user)\/([^/.]+)/;
|
|
5
7
|
const isSubredditPath = (pathname) => {
|
|
6
|
-
|
|
7
|
-
return segments.length >= 2 && segments[0] === "r";
|
|
8
|
+
return subredditRegex.test(pathname);
|
|
8
9
|
};
|
|
9
10
|
const isUserPath = (pathname) => {
|
|
10
|
-
|
|
11
|
-
return segments.length >= 2 && (segments[0] === "u" || segments[0] === "user");
|
|
11
|
+
return userRegex.test(pathname);
|
|
12
12
|
};
|
|
13
13
|
const redditHandler = {
|
|
14
14
|
match: (url) => {
|
|
@@ -22,13 +22,15 @@ const redditHandler = {
|
|
|
22
22
|
if (!fetchFn) return [];
|
|
23
23
|
try {
|
|
24
24
|
const { pathname } = new URL(url);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const subredditMatch = pathname.match(subredditRegex);
|
|
26
|
+
if (subredditMatch?.[1]) {
|
|
27
|
+
const data = parseBodyJson((await fetchFn(`https://www.reddit.com/r/${subredditMatch[1]}/about.json`)).body);
|
|
27
28
|
const icon = data?.data?.community_icon?.split("?")[0] || data?.data?.icon_img;
|
|
28
29
|
if (isNonEmptyString(icon)) return [{ uri: icon }];
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const userMatch = pathname.match(userRegex);
|
|
32
|
+
if (userMatch?.[2]) {
|
|
33
|
+
const data = parseBodyJson((await fetchFn(`https://www.reddit.com/user/${userMatch[2]}/about.json`)).body);
|
|
32
34
|
const icon = data?.data?.icon_img || data?.data?.snoovatar_img;
|
|
33
35
|
if (isNonEmptyString(icon)) return [{ uri: icon }];
|
|
34
36
|
}
|
package/dist/favicons.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_defaults = require("./favicons/defaults.cjs");
|
|
3
3
|
const require_extractors = require("./favicons/extractors.cjs");
|
|
4
|
-
exports.
|
|
4
|
+
exports.defaultExtractFn = require_extractors.defaultExtractFn;
|
|
5
5
|
exports.defaultFeedOptions = require_defaults.defaultFeedOptions;
|
|
6
6
|
exports.defaultGuessOptions = require_defaults.defaultGuessOptions;
|
|
7
7
|
exports.defaultGuessPaths = require_defaults.defaultGuessPaths;
|
package/dist/favicons.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { defaultFeedOptions, defaultGuessOptions, defaultGuessPaths, defaultHeadersOptions, defaultHtmlOptions, defaultIconRels, defaultPlatformOptions, linkSelectors } from "./favicons/defaults.cjs";
|
|
2
2
|
import { FaviconResult } from "./favicons/types.cjs";
|
|
3
|
-
import {
|
|
4
|
-
export { FaviconResult,
|
|
3
|
+
import { defaultExtractFn } from "./favicons/extractors.cjs";
|
|
4
|
+
export { FaviconResult, defaultExtractFn, defaultFeedOptions, defaultGuessOptions, defaultGuessPaths, defaultHeadersOptions, defaultHtmlOptions, defaultIconRels, defaultPlatformOptions, linkSelectors };
|
package/dist/favicons.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { defaultFeedOptions, defaultGuessOptions, defaultGuessPaths, defaultHeadersOptions, defaultHtmlOptions, defaultIconRels, defaultPlatformOptions, linkSelectors } from "./favicons/defaults.js";
|
|
2
2
|
import { FaviconResult } from "./favicons/types.js";
|
|
3
|
-
import {
|
|
4
|
-
export { FaviconResult,
|
|
3
|
+
import { defaultExtractFn } from "./favicons/extractors.js";
|
|
4
|
+
export { FaviconResult, defaultExtractFn, defaultFeedOptions, defaultGuessOptions, defaultGuessPaths, defaultHeadersOptions, defaultHtmlOptions, defaultIconRels, defaultPlatformOptions, linkSelectors };
|
package/dist/favicons.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { defaultFeedOptions, defaultGuessOptions, defaultGuessPaths, defaultHeadersOptions, defaultHtmlOptions, defaultIconRels, defaultPlatformOptions, linkSelectors } from "./favicons/defaults.js";
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { defaultExtractFn } from "./favicons/extractors.js";
|
|
3
|
+
export { defaultExtractFn, defaultFeedOptions, defaultGuessOptions, defaultGuessPaths, defaultHeadersOptions, defaultHtmlOptions, defaultIconRels, defaultPlatformOptions, linkSelectors };
|
package/dist/feeds/defaults.cjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
const require_codeberg = require("./platform/handlers/codeberg.cjs");
|
|
2
2
|
const require_deviantart = require("./platform/handlers/deviantart.cjs");
|
|
3
|
+
const require_devto = require("./platform/handlers/devto.cjs");
|
|
3
4
|
const require_github = require("./platform/handlers/github.cjs");
|
|
4
5
|
const require_githubGist = require("./platform/handlers/githubGist.cjs");
|
|
6
|
+
const require_gitlab = require("./platform/handlers/gitlab.cjs");
|
|
5
7
|
const require_lobsters = require("./platform/handlers/lobsters.cjs");
|
|
6
8
|
const require_reddit = require("./platform/handlers/reddit.cjs");
|
|
7
9
|
const require_sourceforge = require("./platform/handlers/sourceforge.cjs");
|
|
8
10
|
const require_tumblr = require("./platform/handlers/tumblr.cjs");
|
|
11
|
+
const require_applePodcasts = require("./platform/handlers/applePodcasts.cjs");
|
|
9
12
|
const require_behance = require("./platform/handlers/behance.cjs");
|
|
10
13
|
const require_blogspot = require("./platform/handlers/blogspot.cjs");
|
|
11
14
|
const require_bluesky = require("./platform/handlers/bluesky.cjs");
|
|
12
15
|
const require_csdn = require("./platform/handlers/csdn.cjs");
|
|
13
16
|
const require_dailymotion = require("./platform/handlers/dailymotion.cjs");
|
|
14
|
-
const require_devto = require("./platform/handlers/devto.cjs");
|
|
15
17
|
const require_douban = require("./platform/handlers/douban.cjs");
|
|
16
|
-
const require_gitlab = require("./platform/handlers/gitlab.cjs");
|
|
17
18
|
const require_goodreads = require("./platform/handlers/goodreads.cjs");
|
|
18
19
|
const require_hashnode = require("./platform/handlers/hashnode.cjs");
|
|
19
20
|
const require_hatenablog = require("./platform/handlers/hatenablog.cjs");
|
|
@@ -123,6 +124,7 @@ const defaultHtmlOptions = {
|
|
|
123
124
|
const defaultHeadersOptions = { linkSelectors };
|
|
124
125
|
const defaultGuessOptions = { uris: urisBalanced };
|
|
125
126
|
const defaultPlatformOptions = { handlers: [
|
|
127
|
+
require_applePodcasts.applePodcastsHandler,
|
|
126
128
|
require_behance.behanceHandler,
|
|
127
129
|
require_blogspot.blogspotHandler,
|
|
128
130
|
require_bluesky.blueskyHandler,
|
package/dist/feeds/defaults.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { codebergHandler } from "./platform/handlers/codeberg.js";
|
|
2
2
|
import { deviantartHandler } from "./platform/handlers/deviantart.js";
|
|
3
|
+
import { devtoHandler } from "./platform/handlers/devto.js";
|
|
3
4
|
import { githubHandler } from "./platform/handlers/github.js";
|
|
4
5
|
import { githubGistHandler } from "./platform/handlers/githubGist.js";
|
|
6
|
+
import { gitlabHandler } from "./platform/handlers/gitlab.js";
|
|
5
7
|
import { lobstersHandler } from "./platform/handlers/lobsters.js";
|
|
6
8
|
import { redditHandler } from "./platform/handlers/reddit.js";
|
|
7
9
|
import { sourceforgeHandler } from "./platform/handlers/sourceforge.js";
|
|
8
10
|
import { tumblrHandler } from "./platform/handlers/tumblr.js";
|
|
11
|
+
import { applePodcastsHandler } from "./platform/handlers/applePodcasts.js";
|
|
9
12
|
import { behanceHandler } from "./platform/handlers/behance.js";
|
|
10
13
|
import { blogspotHandler } from "./platform/handlers/blogspot.js";
|
|
11
14
|
import { blueskyHandler } from "./platform/handlers/bluesky.js";
|
|
12
15
|
import { csdnHandler } from "./platform/handlers/csdn.js";
|
|
13
16
|
import { dailymotionHandler } from "./platform/handlers/dailymotion.js";
|
|
14
|
-
import { devtoHandler } from "./platform/handlers/devto.js";
|
|
15
17
|
import { doubanHandler } from "./platform/handlers/douban.js";
|
|
16
|
-
import { gitlabHandler } from "./platform/handlers/gitlab.js";
|
|
17
18
|
import { goodreadsHandler } from "./platform/handlers/goodreads.js";
|
|
18
19
|
import { hashnodeHandler } from "./platform/handlers/hashnode.js";
|
|
19
20
|
import { hatenablogHandler } from "./platform/handlers/hatenablog.js";
|
|
@@ -123,6 +124,7 @@ const defaultHtmlOptions = {
|
|
|
123
124
|
const defaultHeadersOptions = { linkSelectors };
|
|
124
125
|
const defaultGuessOptions = { uris: urisBalanced };
|
|
125
126
|
const defaultPlatformOptions = { handlers: [
|
|
127
|
+
applePodcastsHandler,
|
|
126
128
|
behanceHandler,
|
|
127
129
|
blogspotHandler,
|
|
128
130
|
blueskyHandler,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_utils = require("../common/utils.cjs");
|
|
2
|
-
const
|
|
1
|
+
const require_utils = require("../common/discover/utils.cjs");
|
|
2
|
+
const require_defaults = require("../common/discover/defaults.cjs");
|
|
3
3
|
let feedsmith = require("feedsmith");
|
|
4
4
|
//#region src/feeds/extractors.ts
|
|
5
|
-
const
|
|
5
|
+
const defaultExtractFn = ({ content, url }) => {
|
|
6
6
|
if (!content) return {
|
|
7
7
|
url,
|
|
8
8
|
isValid: false
|
|
@@ -10,8 +10,8 @@ const defaultExtractor = ({ content, url }) => {
|
|
|
10
10
|
try {
|
|
11
11
|
const parsed = (0, feedsmith.parseFeed)(content);
|
|
12
12
|
const { format, feed } = parsed;
|
|
13
|
-
const rawSiteUrl = require_utils
|
|
14
|
-
const siteUrl = rawSiteUrl ?
|
|
13
|
+
const rawSiteUrl = require_utils.getFeedSiteUrl(parsed);
|
|
14
|
+
const siteUrl = rawSiteUrl ? require_defaults.defaultResolveUrlFn(rawSiteUrl, url) : void 0;
|
|
15
15
|
if (format === "rss" || format === "rdf") return {
|
|
16
16
|
url,
|
|
17
17
|
isValid: true,
|
|
@@ -43,4 +43,4 @@ const defaultExtractor = ({ content, url }) => {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
|
-
exports.
|
|
46
|
+
exports.defaultExtractFn = defaultExtractFn;
|
|
@@ -2,6 +2,6 @@ import { DiscoverExtractFn } from "../common/types.cjs";
|
|
|
2
2
|
import { FeedResult } from "./types.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/feeds/extractors.d.ts
|
|
5
|
-
declare const
|
|
5
|
+
declare const defaultExtractFn: DiscoverExtractFn<FeedResult>;
|
|
6
6
|
//#endregion
|
|
7
|
-
export {
|
|
7
|
+
export { defaultExtractFn };
|
|
@@ -2,6 +2,6 @@ import { DiscoverExtractFn } from "../common/types.js";
|
|
|
2
2
|
import { FeedResult } from "./types.js";
|
|
3
3
|
|
|
4
4
|
//#region src/feeds/extractors.d.ts
|
|
5
|
-
declare const
|
|
5
|
+
declare const defaultExtractFn: DiscoverExtractFn<FeedResult>;
|
|
6
6
|
//#endregion
|
|
7
|
-
export {
|
|
7
|
+
export { defaultExtractFn };
|
package/dist/feeds/extractors.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { resolveUrl } from "../common/utils.js";
|
|
2
1
|
import { getFeedSiteUrl } from "../common/discover/utils.js";
|
|
2
|
+
import { defaultResolveUrlFn } from "../common/discover/defaults.js";
|
|
3
3
|
import { parseFeed } from "feedsmith";
|
|
4
4
|
//#region src/feeds/extractors.ts
|
|
5
|
-
const
|
|
5
|
+
const defaultExtractFn = ({ content, url }) => {
|
|
6
6
|
if (!content) return {
|
|
7
7
|
url,
|
|
8
8
|
isValid: false
|
|
@@ -11,7 +11,7 @@ const defaultExtractor = ({ content, url }) => {
|
|
|
11
11
|
const parsed = parseFeed(content);
|
|
12
12
|
const { format, feed } = parsed;
|
|
13
13
|
const rawSiteUrl = getFeedSiteUrl(parsed);
|
|
14
|
-
const siteUrl = rawSiteUrl ?
|
|
14
|
+
const siteUrl = rawSiteUrl ? defaultResolveUrlFn(rawSiteUrl, url) : void 0;
|
|
15
15
|
if (format === "rss" || format === "rdf") return {
|
|
16
16
|
url,
|
|
17
17
|
isValid: true,
|
|
@@ -43,4 +43,4 @@ const defaultExtractor = ({ content, url }) => {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
|
-
export {
|
|
46
|
+
export { defaultExtractFn };
|
package/dist/feeds/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/feeds/index.ts
|
|
7
6
|
const discoverFeeds = (input, options = {}) => {
|
|
@@ -13,14 +12,14 @@ const discoverFeeds = (input, options = {}) => {
|
|
|
13
12
|
"headers",
|
|
14
13
|
"guess"
|
|
15
14
|
],
|
|
16
|
-
fetchFn: options.fetchFn ??
|
|
17
|
-
extractFn: options.extractFn ?? require_extractors.
|
|
18
|
-
resolveUrlFn: options.resolveUrlFn ??
|
|
15
|
+
fetchFn: options.fetchFn ?? require_defaults.defaultFetchFn,
|
|
16
|
+
extractFn: options.extractFn ?? require_extractors.defaultExtractFn,
|
|
17
|
+
resolveUrlFn: options.resolveUrlFn ?? require_defaults.defaultResolveUrlFn
|
|
19
18
|
}, {
|
|
20
|
-
platform: require_defaults.defaultPlatformOptions,
|
|
21
|
-
html: require_defaults.defaultHtmlOptions,
|
|
22
|
-
headers: require_defaults.defaultHeadersOptions,
|
|
23
|
-
guess: require_defaults.defaultGuessOptions
|
|
19
|
+
platform: require_defaults$1.defaultPlatformOptions,
|
|
20
|
+
html: require_defaults$1.defaultHtmlOptions,
|
|
21
|
+
headers: require_defaults$1.defaultHeadersOptions,
|
|
22
|
+
guess: require_defaults$1.defaultGuessOptions
|
|
24
23
|
});
|
|
25
24
|
};
|
|
26
25
|
//#endregion
|
package/dist/feeds/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defaultFetchFn } from "../common/discover/utils.js";
|
|
1
|
+
import { defaultFetchFn, defaultResolveUrlFn } from "../common/discover/defaults.js";
|
|
3
2
|
import { discover } from "../common/discover/index.js";
|
|
4
3
|
import { defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions } from "./defaults.js";
|
|
5
|
-
import {
|
|
4
|
+
import { defaultExtractFn } from "./extractors.js";
|
|
6
5
|
//#region src/feeds/index.ts
|
|
7
6
|
const discoverFeeds = (input, options = {}) => {
|
|
8
7
|
return discover(input, {
|
|
@@ -14,8 +13,8 @@ const discoverFeeds = (input, options = {}) => {
|
|
|
14
13
|
"guess"
|
|
15
14
|
],
|
|
16
15
|
fetchFn: options.fetchFn ?? defaultFetchFn,
|
|
17
|
-
extractFn: options.extractFn ??
|
|
18
|
-
resolveUrlFn: options.resolveUrlFn ??
|
|
16
|
+
extractFn: options.extractFn ?? defaultExtractFn,
|
|
17
|
+
resolveUrlFn: options.resolveUrlFn ?? defaultResolveUrlFn
|
|
19
18
|
}, {
|
|
20
19
|
platform: defaultPlatformOptions,
|
|
21
20
|
html: defaultHtmlOptions,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const require_utils = require("../../../common/utils.cjs");
|
|
2
|
+
//#region src/feeds/platform/handlers/applePodcasts.ts
|
|
3
|
+
const hosts = ["podcasts.apple.com"];
|
|
4
|
+
const podcastRegex = /^\/[a-z]{2}\/podcast\/[^/]+\/id\d+/;
|
|
5
|
+
const feedUrlRegex = /"feedUrl"\s*:\s*"([^"]+)"/;
|
|
6
|
+
const extractFeedUrlFromContent = (content) => {
|
|
7
|
+
return content.match(feedUrlRegex)?.[1];
|
|
8
|
+
};
|
|
9
|
+
const applePodcastsHandler = {
|
|
10
|
+
match: (url) => {
|
|
11
|
+
if (!require_utils.isHostOf(url, hosts)) return false;
|
|
12
|
+
const { pathname } = new URL(url);
|
|
13
|
+
return podcastRegex.test(pathname);
|
|
14
|
+
},
|
|
15
|
+
resolve: (_url, content) => {
|
|
16
|
+
if (!content) return [];
|
|
17
|
+
const feedUrl = extractFeedUrlFromContent(content);
|
|
18
|
+
if (!feedUrl) return [];
|
|
19
|
+
return [{
|
|
20
|
+
uri: feedUrl,
|
|
21
|
+
hint: require_utils.composeHint("apple-podcasts:podcast")
|
|
22
|
+
}];
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.applePodcastsHandler = applePodcastsHandler;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { composeHint, isHostOf } from "../../../common/utils.js";
|
|
2
|
+
//#region src/feeds/platform/handlers/applePodcasts.ts
|
|
3
|
+
const hosts = ["podcasts.apple.com"];
|
|
4
|
+
const podcastRegex = /^\/[a-z]{2}\/podcast\/[^/]+\/id\d+/;
|
|
5
|
+
const feedUrlRegex = /"feedUrl"\s*:\s*"([^"]+)"/;
|
|
6
|
+
const extractFeedUrlFromContent = (content) => {
|
|
7
|
+
return content.match(feedUrlRegex)?.[1];
|
|
8
|
+
};
|
|
9
|
+
const applePodcastsHandler = {
|
|
10
|
+
match: (url) => {
|
|
11
|
+
if (!isHostOf(url, hosts)) return false;
|
|
12
|
+
const { pathname } = new URL(url);
|
|
13
|
+
return podcastRegex.test(pathname);
|
|
14
|
+
},
|
|
15
|
+
resolve: (_url, content) => {
|
|
16
|
+
if (!content) return [];
|
|
17
|
+
const feedUrl = extractFeedUrlFromContent(content);
|
|
18
|
+
if (!feedUrl) return [];
|
|
19
|
+
return [{
|
|
20
|
+
uri: feedUrl,
|
|
21
|
+
hint: composeHint("apple-podcasts:podcast")
|
|
22
|
+
}];
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { applePodcastsHandler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_utils = require("../../../common/utils.cjs");
|
|
2
2
|
//#region src/feeds/platform/handlers/behance.ts
|
|
3
3
|
const hosts = ["behance.net", "www.behance.net"];
|
|
4
|
-
const
|
|
4
|
+
const userRegex = /^\/([a-zA-Z0-9_-]+)(?:\/(appreciated))?\/?$/;
|
|
5
5
|
const excludedPaths = [
|
|
6
6
|
"search",
|
|
7
7
|
"galleries",
|
|
@@ -27,7 +27,7 @@ const behanceHandler = {
|
|
|
27
27
|
},
|
|
28
28
|
resolve: (url) => {
|
|
29
29
|
const { pathname } = new URL(url);
|
|
30
|
-
const userMatch = pathname.match(
|
|
30
|
+
const userMatch = pathname.match(userRegex);
|
|
31
31
|
if (userMatch?.[1]) {
|
|
32
32
|
const username = userMatch[1];
|
|
33
33
|
const subpage = userMatch[2];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { composeHint, isAnyOf, isHostOf } from "../../../common/utils.js";
|
|
2
2
|
//#region src/feeds/platform/handlers/behance.ts
|
|
3
3
|
const hosts = ["behance.net", "www.behance.net"];
|
|
4
|
-
const
|
|
4
|
+
const userRegex = /^\/([a-zA-Z0-9_-]+)(?:\/(appreciated))?\/?$/;
|
|
5
5
|
const excludedPaths = [
|
|
6
6
|
"search",
|
|
7
7
|
"galleries",
|
|
@@ -27,7 +27,7 @@ const behanceHandler = {
|
|
|
27
27
|
},
|
|
28
28
|
resolve: (url) => {
|
|
29
29
|
const { pathname } = new URL(url);
|
|
30
|
-
const userMatch = pathname.match(
|
|
30
|
+
const userMatch = pathname.match(userRegex);
|
|
31
31
|
if (userMatch?.[1]) {
|
|
32
32
|
const username = userMatch[1];
|
|
33
33
|
const subpage = userMatch[2];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_utils = require("../../../common/utils.cjs");
|
|
2
2
|
//#region src/feeds/platform/handlers/dailymotion.ts
|
|
3
3
|
const hosts = ["dailymotion.com", "www.dailymotion.com"];
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const userRegex = /^\/([a-zA-Z0-9_-]+)$/;
|
|
5
|
+
const playlistRegex = /^\/playlist\/([a-zA-Z0-9_-]+)/;
|
|
6
6
|
const excludedPaths = [
|
|
7
7
|
"signin",
|
|
8
8
|
"signout",
|
|
@@ -50,12 +50,12 @@ const dailymotionHandler = {
|
|
|
50
50
|
},
|
|
51
51
|
resolve: (url) => {
|
|
52
52
|
const { pathname } = new URL(url);
|
|
53
|
-
const playlistMatch = pathname.match(
|
|
53
|
+
const playlistMatch = pathname.match(playlistRegex);
|
|
54
54
|
if (playlistMatch?.[1]) return [{
|
|
55
55
|
uri: `https://www.dailymotion.com/rss/playlist/${playlistMatch[1]}`,
|
|
56
56
|
hint: require_utils.composeHint("dailymotion:playlist")
|
|
57
57
|
}];
|
|
58
|
-
const userMatch = pathname.match(
|
|
58
|
+
const userMatch = pathname.match(userRegex);
|
|
59
59
|
if (userMatch?.[1]) {
|
|
60
60
|
const username = userMatch[1];
|
|
61
61
|
if (!require_utils.isAnyOf(username, excludedPaths)) return [{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { composeHint, isAnyOf, isHostOf } from "../../../common/utils.js";
|
|
2
2
|
//#region src/feeds/platform/handlers/dailymotion.ts
|
|
3
3
|
const hosts = ["dailymotion.com", "www.dailymotion.com"];
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const userRegex = /^\/([a-zA-Z0-9_-]+)$/;
|
|
5
|
+
const playlistRegex = /^\/playlist\/([a-zA-Z0-9_-]+)/;
|
|
6
6
|
const excludedPaths = [
|
|
7
7
|
"signin",
|
|
8
8
|
"signout",
|
|
@@ -50,12 +50,12 @@ const dailymotionHandler = {
|
|
|
50
50
|
},
|
|
51
51
|
resolve: (url) => {
|
|
52
52
|
const { pathname } = new URL(url);
|
|
53
|
-
const playlistMatch = pathname.match(
|
|
53
|
+
const playlistMatch = pathname.match(playlistRegex);
|
|
54
54
|
if (playlistMatch?.[1]) return [{
|
|
55
55
|
uri: `https://www.dailymotion.com/rss/playlist/${playlistMatch[1]}`,
|
|
56
56
|
hint: composeHint("dailymotion:playlist")
|
|
57
57
|
}];
|
|
58
|
-
const userMatch = pathname.match(
|
|
58
|
+
const userMatch = pathname.match(userRegex);
|
|
59
59
|
if (userMatch?.[1]) {
|
|
60
60
|
const username = userMatch[1];
|
|
61
61
|
if (!isAnyOf(username, excludedPaths)) return [{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_utils = require("../../../common/utils.cjs");
|
|
2
2
|
//#region src/feeds/platform/handlers/devto.ts
|
|
3
3
|
const hosts = ["dev.to", "www.dev.to"];
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const userRegex = /^\/([a-zA-Z0-9_]+)\/?$/;
|
|
5
|
+
const tagRegex = /^\/t\/([^/]+)/;
|
|
6
6
|
const excludedPaths = [
|
|
7
7
|
"tag",
|
|
8
8
|
"tags",
|
|
@@ -28,7 +28,7 @@ const devtoHandler = {
|
|
|
28
28
|
},
|
|
29
29
|
resolve: (url) => {
|
|
30
30
|
const { pathname } = new URL(url);
|
|
31
|
-
const userMatch = pathname.match(
|
|
31
|
+
const userMatch = pathname.match(userRegex);
|
|
32
32
|
if (userMatch?.[1]) {
|
|
33
33
|
const username = userMatch[1];
|
|
34
34
|
if (!require_utils.isAnyOf(username, excludedPaths)) return [{
|
|
@@ -36,7 +36,7 @@ const devtoHandler = {
|
|
|
36
36
|
hint: require_utils.composeHint("devto:posts")
|
|
37
37
|
}];
|
|
38
38
|
}
|
|
39
|
-
const tagMatch = pathname.match(
|
|
39
|
+
const tagMatch = pathname.match(tagRegex);
|
|
40
40
|
if (tagMatch?.[1]) return [{
|
|
41
41
|
uri: `https://dev.to/feed/tag/${tagMatch[1]}`,
|
|
42
42
|
hint: require_utils.composeHint("devto:tag")
|
|
@@ -46,3 +46,5 @@ const devtoHandler = {
|
|
|
46
46
|
};
|
|
47
47
|
//#endregion
|
|
48
48
|
exports.devtoHandler = devtoHandler;
|
|
49
|
+
exports.excludedPaths = excludedPaths;
|
|
50
|
+
exports.hosts = hosts;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { composeHint, isAnyOf, isHostOf } from "../../../common/utils.js";
|
|
2
2
|
//#region src/feeds/platform/handlers/devto.ts
|
|
3
3
|
const hosts = ["dev.to", "www.dev.to"];
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const userRegex = /^\/([a-zA-Z0-9_]+)\/?$/;
|
|
5
|
+
const tagRegex = /^\/t\/([^/]+)/;
|
|
6
6
|
const excludedPaths = [
|
|
7
7
|
"tag",
|
|
8
8
|
"tags",
|
|
@@ -28,7 +28,7 @@ const devtoHandler = {
|
|
|
28
28
|
},
|
|
29
29
|
resolve: (url) => {
|
|
30
30
|
const { pathname } = new URL(url);
|
|
31
|
-
const userMatch = pathname.match(
|
|
31
|
+
const userMatch = pathname.match(userRegex);
|
|
32
32
|
if (userMatch?.[1]) {
|
|
33
33
|
const username = userMatch[1];
|
|
34
34
|
if (!isAnyOf(username, excludedPaths)) return [{
|
|
@@ -36,7 +36,7 @@ const devtoHandler = {
|
|
|
36
36
|
hint: composeHint("devto:posts")
|
|
37
37
|
}];
|
|
38
38
|
}
|
|
39
|
-
const tagMatch = pathname.match(
|
|
39
|
+
const tagMatch = pathname.match(tagRegex);
|
|
40
40
|
if (tagMatch?.[1]) return [{
|
|
41
41
|
uri: `https://dev.to/feed/tag/${tagMatch[1]}`,
|
|
42
42
|
hint: composeHint("devto:tag")
|
|
@@ -45,4 +45,4 @@ const devtoHandler = {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
//#endregion
|
|
48
|
-
export { devtoHandler };
|
|
48
|
+
export { devtoHandler, excludedPaths, hosts };
|
|
@@ -5,8 +5,8 @@ const domains = [
|
|
|
5
5
|
"hatenablog.jp",
|
|
6
6
|
"hateblo.jp"
|
|
7
7
|
];
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const categoryRegex = /^\/archive\/category\/([^/]+)/;
|
|
9
|
+
const authorRegex = /^\/archive\/author\/([^/]+)/;
|
|
10
10
|
const hatenablogHandler = {
|
|
11
11
|
match: (url) => {
|
|
12
12
|
return require_utils.isSubdomainOf(url, domains);
|
|
@@ -14,7 +14,7 @@ const hatenablogHandler = {
|
|
|
14
14
|
resolve: (url) => {
|
|
15
15
|
const { origin, pathname } = new URL(url);
|
|
16
16
|
const uris = [];
|
|
17
|
-
const categoryMatch = pathname.match(
|
|
17
|
+
const categoryMatch = pathname.match(categoryRegex);
|
|
18
18
|
if (categoryMatch?.[1]) {
|
|
19
19
|
const category = categoryMatch[1];
|
|
20
20
|
uris.push({
|
|
@@ -26,7 +26,7 @@ const hatenablogHandler = {
|
|
|
26
26
|
hint: require_utils.composeHint("hatenablog:category-atom")
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
const authorMatch = pathname.match(
|
|
29
|
+
const authorMatch = pathname.match(authorRegex);
|
|
30
30
|
if (authorMatch?.[1]) {
|
|
31
31
|
const author = authorMatch[1];
|
|
32
32
|
uris.push({
|
|
@@ -5,8 +5,8 @@ const domains = [
|
|
|
5
5
|
"hatenablog.jp",
|
|
6
6
|
"hateblo.jp"
|
|
7
7
|
];
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const categoryRegex = /^\/archive\/category\/([^/]+)/;
|
|
9
|
+
const authorRegex = /^\/archive\/author\/([^/]+)/;
|
|
10
10
|
const hatenablogHandler = {
|
|
11
11
|
match: (url) => {
|
|
12
12
|
return isSubdomainOf(url, domains);
|
|
@@ -14,7 +14,7 @@ const hatenablogHandler = {
|
|
|
14
14
|
resolve: (url) => {
|
|
15
15
|
const { origin, pathname } = new URL(url);
|
|
16
16
|
const uris = [];
|
|
17
|
-
const categoryMatch = pathname.match(
|
|
17
|
+
const categoryMatch = pathname.match(categoryRegex);
|
|
18
18
|
if (categoryMatch?.[1]) {
|
|
19
19
|
const category = categoryMatch[1];
|
|
20
20
|
uris.push({
|
|
@@ -26,7 +26,7 @@ const hatenablogHandler = {
|
|
|
26
26
|
hint: composeHint("hatenablog:category-atom")
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
const authorMatch = pathname.match(
|
|
29
|
+
const authorMatch = pathname.match(authorRegex);
|
|
30
30
|
if (authorMatch?.[1]) {
|
|
31
31
|
const author = authorMatch[1];
|
|
32
32
|
uris.push({
|