feedscout 1.2.0 → 1.4.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/dist/blogrolls.cjs +1 -0
- package/dist/common/discover/index.cjs +2 -2
- package/dist/common/discover/index.js +2 -2
- package/dist/common/types.d.cts +3 -2
- package/dist/common/types.d.ts +3 -2
- package/dist/common/uris/index.cjs +13 -4
- package/dist/common/uris/index.js +13 -4
- package/dist/feeds/defaults.cjs +21 -8
- package/dist/feeds/defaults.js +21 -8
- package/dist/feeds/platform/handlers/youtube.cjs +1 -1
- package/dist/feeds/platform/handlers/youtube.js +1 -1
- package/dist/feeds.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/methods.cjs +1 -0
- package/dist/utils.cjs +1 -0
- package/package.json +4 -4
package/dist/blogrolls.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const require_utils$1 = require('./utils.cjs');
|
|
|
4
4
|
|
|
5
5
|
//#region src/common/discover/index.ts
|
|
6
6
|
const discover = async (input, options, defaults) => {
|
|
7
|
-
const { methods, fetchFn, extractFn, normalizeUrlFn,
|
|
7
|
+
const { methods, fetchFn, extractFn, normalizeUrlFn, stopOnFirstMethod = false, stopOnFirstResult = false, concurrency = 3, includeInvalid = false, onProgress } = options;
|
|
8
8
|
const normalizedInput = await require_utils$1.normalizeInput(input, fetchFn);
|
|
9
9
|
if (normalizedInput.content) {
|
|
10
10
|
const result = await extractFn({
|
|
@@ -13,7 +13,7 @@ const discover = async (input, options, defaults) => {
|
|
|
13
13
|
});
|
|
14
14
|
if (result.isValid) return [result];
|
|
15
15
|
}
|
|
16
|
-
const rawUris = require_index.discoverUris(require_utils$1.normalizeMethodsConfig(normalizedInput, methods, defaults));
|
|
16
|
+
const rawUris = require_index.discoverUris(require_utils$1.normalizeMethodsConfig(normalizedInput, methods, defaults), stopOnFirstMethod);
|
|
17
17
|
const uris = [...new Set(rawUris.map((uri) => normalizeUrlFn(uri, normalizedInput.url)))];
|
|
18
18
|
const results = [];
|
|
19
19
|
let tested = 0;
|
|
@@ -4,7 +4,7 @@ import { normalizeInput, normalizeMethodsConfig } from "./utils.js";
|
|
|
4
4
|
|
|
5
5
|
//#region src/common/discover/index.ts
|
|
6
6
|
const discover = async (input, options, defaults) => {
|
|
7
|
-
const { methods, fetchFn, extractFn, normalizeUrlFn,
|
|
7
|
+
const { methods, fetchFn, extractFn, normalizeUrlFn, stopOnFirstMethod = false, stopOnFirstResult = false, concurrency = 3, includeInvalid = false, onProgress } = options;
|
|
8
8
|
const normalizedInput = await normalizeInput(input, fetchFn);
|
|
9
9
|
if (normalizedInput.content) {
|
|
10
10
|
const result = await extractFn({
|
|
@@ -13,7 +13,7 @@ const discover = async (input, options, defaults) => {
|
|
|
13
13
|
});
|
|
14
14
|
if (result.isValid) return [result];
|
|
15
15
|
}
|
|
16
|
-
const rawUris = discoverUris(normalizeMethodsConfig(normalizedInput, methods, defaults));
|
|
16
|
+
const rawUris = discoverUris(normalizeMethodsConfig(normalizedInput, methods, defaults), stopOnFirstMethod);
|
|
17
17
|
const uris = [...new Set(rawUris.map((uri) => normalizeUrlFn(uri, normalizedInput.url)))];
|
|
18
18
|
const results = [];
|
|
19
19
|
let tested = 0;
|
package/dist/common/types.d.cts
CHANGED
|
@@ -58,10 +58,11 @@ type DiscoverOptions<TValid> = {
|
|
|
58
58
|
fetchFn?: DiscoverFetchFn;
|
|
59
59
|
extractFn?: DiscoverExtractFn<TValid>;
|
|
60
60
|
normalizeUrlFn?: DiscoverNormalizeUrlFn;
|
|
61
|
-
|
|
61
|
+
stopOnFirstMethod?: boolean;
|
|
62
62
|
stopOnFirstResult?: boolean;
|
|
63
|
-
|
|
63
|
+
concurrency?: number;
|
|
64
64
|
onProgress?: DiscoverOnProgressFn;
|
|
65
|
+
includeInvalid?: boolean;
|
|
65
66
|
};
|
|
66
67
|
//#endregion
|
|
67
68
|
export { DiscoverExtractFn, DiscoverFetchFn, DiscoverFetchFnOptions, DiscoverFetchFnResponse, DiscoverInput, DiscoverInputObject, DiscoverMethodsConfig, DiscoverNormalizeUrlFn, DiscoverOnProgressFn, DiscoverOptions, DiscoverProgress, DiscoverResult, LinkSelector };
|
package/dist/common/types.d.ts
CHANGED
|
@@ -58,10 +58,11 @@ type DiscoverOptions<TValid> = {
|
|
|
58
58
|
fetchFn?: DiscoverFetchFn;
|
|
59
59
|
extractFn?: DiscoverExtractFn<TValid>;
|
|
60
60
|
normalizeUrlFn?: DiscoverNormalizeUrlFn;
|
|
61
|
-
|
|
61
|
+
stopOnFirstMethod?: boolean;
|
|
62
62
|
stopOnFirstResult?: boolean;
|
|
63
|
-
|
|
63
|
+
concurrency?: number;
|
|
64
64
|
onProgress?: DiscoverOnProgressFn;
|
|
65
|
+
includeInvalid?: boolean;
|
|
65
66
|
};
|
|
66
67
|
//#endregion
|
|
67
68
|
export { DiscoverExtractFn, DiscoverFetchFn, DiscoverFetchFnOptions, DiscoverFetchFnResponse, DiscoverInput, DiscoverInputObject, DiscoverMethodsConfig, DiscoverNormalizeUrlFn, DiscoverOnProgressFn, DiscoverOptions, DiscoverProgress, DiscoverResult, LinkSelector };
|
|
@@ -4,11 +4,20 @@ const require_index$2 = require('./html/index.cjs');
|
|
|
4
4
|
const require_index$3 = require('./platform/index.cjs');
|
|
5
5
|
|
|
6
6
|
//#region src/common/uris/index.ts
|
|
7
|
-
const discoverUris = (config) => {
|
|
7
|
+
const discoverUris = (config, stopOnFirstMethod = false) => {
|
|
8
8
|
const uris = /* @__PURE__ */ new Set();
|
|
9
|
-
if (config.platform)
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
if (config.platform) {
|
|
10
|
+
for (const uri of require_index$3.discoverUrisFromPlatform(config.platform.html, config.platform.options)) uris.add(uri);
|
|
11
|
+
if (stopOnFirstMethod && uris.size > 0) return Array.from(uris);
|
|
12
|
+
}
|
|
13
|
+
if (config.html) {
|
|
14
|
+
for (const uri of require_index$2.discoverUrisFromHtml(config.html.html, config.html.options)) uris.add(uri);
|
|
15
|
+
if (stopOnFirstMethod && uris.size > 0) return Array.from(uris);
|
|
16
|
+
}
|
|
17
|
+
if (config.headers) {
|
|
18
|
+
for (const uri of require_index$1.discoverUrisFromHeaders(config.headers.headers, config.headers.options)) uris.add(uri);
|
|
19
|
+
if (stopOnFirstMethod && uris.size > 0) return Array.from(uris);
|
|
20
|
+
}
|
|
12
21
|
if (config.guess) for (const uri of require_index.discoverUrisFromGuess(config.guess.options)) uris.add(uri);
|
|
13
22
|
return Array.from(uris);
|
|
14
23
|
};
|
|
@@ -4,11 +4,20 @@ import { discoverUrisFromHtml } from "./html/index.js";
|
|
|
4
4
|
import { discoverUrisFromPlatform } from "./platform/index.js";
|
|
5
5
|
|
|
6
6
|
//#region src/common/uris/index.ts
|
|
7
|
-
const discoverUris = (config) => {
|
|
7
|
+
const discoverUris = (config, stopOnFirstMethod = false) => {
|
|
8
8
|
const uris = /* @__PURE__ */ new Set();
|
|
9
|
-
if (config.platform)
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
if (config.platform) {
|
|
10
|
+
for (const uri of discoverUrisFromPlatform(config.platform.html, config.platform.options)) uris.add(uri);
|
|
11
|
+
if (stopOnFirstMethod && uris.size > 0) return Array.from(uris);
|
|
12
|
+
}
|
|
13
|
+
if (config.html) {
|
|
14
|
+
for (const uri of discoverUrisFromHtml(config.html.html, config.html.options)) uris.add(uri);
|
|
15
|
+
if (stopOnFirstMethod && uris.size > 0) return Array.from(uris);
|
|
16
|
+
}
|
|
17
|
+
if (config.headers) {
|
|
18
|
+
for (const uri of discoverUrisFromHeaders(config.headers.headers, config.headers.options)) uris.add(uri);
|
|
19
|
+
if (stopOnFirstMethod && uris.size > 0) return Array.from(uris);
|
|
20
|
+
}
|
|
12
21
|
if (config.guess) for (const uri of discoverUrisFromGuess(config.guess.options)) uris.add(uri);
|
|
13
22
|
return Array.from(uris);
|
|
14
23
|
};
|
package/dist/feeds/defaults.cjs
CHANGED
|
@@ -53,26 +53,38 @@ const urisBalanced = [
|
|
|
53
53
|
const urisComprehensive = [
|
|
54
54
|
...urisBalanced,
|
|
55
55
|
"/atom",
|
|
56
|
+
"/rss/",
|
|
57
|
+
"/rss2.xml",
|
|
56
58
|
"/feed.rss",
|
|
57
59
|
"/feed.atom",
|
|
58
60
|
"/feed.rss.xml",
|
|
59
61
|
"/feed.atom.xml",
|
|
62
|
+
"/feed/atom/",
|
|
63
|
+
"/feed/rss/",
|
|
64
|
+
"/feed/rss2/",
|
|
65
|
+
"/feed/rdf",
|
|
66
|
+
"/feed/rdf/",
|
|
60
67
|
"/index.rss.xml",
|
|
61
68
|
"/index.atom.xml",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
+
"?feed=rss",
|
|
70
|
+
"?feed=rss2",
|
|
71
|
+
"?feed=atom",
|
|
72
|
+
"?feed=rdf",
|
|
73
|
+
"?feed=comments-rss2",
|
|
74
|
+
"?feed=comments-atom",
|
|
75
|
+
"?format=rss",
|
|
76
|
+
"?format=atom",
|
|
77
|
+
"?rss=1",
|
|
78
|
+
"?atom=1",
|
|
69
79
|
"/.rss",
|
|
70
80
|
"/f.json",
|
|
71
81
|
"/f.rss",
|
|
72
82
|
"/json",
|
|
73
83
|
"/.feed",
|
|
74
84
|
"/comments/feed",
|
|
75
|
-
"/feeds/posts/default"
|
|
85
|
+
"/feeds/posts/default",
|
|
86
|
+
"/feeds/posts/default?alt=rss",
|
|
87
|
+
"/feeds/comments/default"
|
|
76
88
|
];
|
|
77
89
|
const ignoredUris = ["wp-json/oembed/", "wp-json/wp/"];
|
|
78
90
|
const anchorLabels = [
|
|
@@ -81,6 +93,7 @@ const anchorLabels = [
|
|
|
81
93
|
"atom",
|
|
82
94
|
"subscribe",
|
|
83
95
|
"syndicate",
|
|
96
|
+
"syndication",
|
|
84
97
|
"json feed"
|
|
85
98
|
];
|
|
86
99
|
const linkSelectors = [{
|
package/dist/feeds/defaults.js
CHANGED
|
@@ -53,26 +53,38 @@ const urisBalanced = [
|
|
|
53
53
|
const urisComprehensive = [
|
|
54
54
|
...urisBalanced,
|
|
55
55
|
"/atom",
|
|
56
|
+
"/rss/",
|
|
57
|
+
"/rss2.xml",
|
|
56
58
|
"/feed.rss",
|
|
57
59
|
"/feed.atom",
|
|
58
60
|
"/feed.rss.xml",
|
|
59
61
|
"/feed.atom.xml",
|
|
62
|
+
"/feed/atom/",
|
|
63
|
+
"/feed/rss/",
|
|
64
|
+
"/feed/rss2/",
|
|
65
|
+
"/feed/rdf",
|
|
66
|
+
"/feed/rdf/",
|
|
60
67
|
"/index.rss.xml",
|
|
61
68
|
"/index.atom.xml",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
+
"?feed=rss",
|
|
70
|
+
"?feed=rss2",
|
|
71
|
+
"?feed=atom",
|
|
72
|
+
"?feed=rdf",
|
|
73
|
+
"?feed=comments-rss2",
|
|
74
|
+
"?feed=comments-atom",
|
|
75
|
+
"?format=rss",
|
|
76
|
+
"?format=atom",
|
|
77
|
+
"?rss=1",
|
|
78
|
+
"?atom=1",
|
|
69
79
|
"/.rss",
|
|
70
80
|
"/f.json",
|
|
71
81
|
"/f.rss",
|
|
72
82
|
"/json",
|
|
73
83
|
"/.feed",
|
|
74
84
|
"/comments/feed",
|
|
75
|
-
"/feeds/posts/default"
|
|
85
|
+
"/feeds/posts/default",
|
|
86
|
+
"/feeds/posts/default?alt=rss",
|
|
87
|
+
"/feeds/comments/default"
|
|
76
88
|
];
|
|
77
89
|
const ignoredUris = ["wp-json/oembed/", "wp-json/wp/"];
|
|
78
90
|
const anchorLabels = [
|
|
@@ -81,6 +93,7 @@ const anchorLabels = [
|
|
|
81
93
|
"atom",
|
|
82
94
|
"subscribe",
|
|
83
95
|
"syndicate",
|
|
96
|
+
"syndication",
|
|
84
97
|
"json feed"
|
|
85
98
|
];
|
|
86
99
|
const linkSelectors = [{
|
|
@@ -8,7 +8,7 @@ const hosts = [
|
|
|
8
8
|
"youtu.be",
|
|
9
9
|
"www.youtu.be"
|
|
10
10
|
];
|
|
11
|
-
const channelIdRegex = /"channelId":"(UC[a-zA-Z0-9_-]+)"/;
|
|
11
|
+
const channelIdRegex = /"(?:channelId|externalId)":"(UC[a-zA-Z0-9_-]+)"/;
|
|
12
12
|
const channelPathRegex = /^\/channel\/(UC[a-zA-Z0-9_-]+)/;
|
|
13
13
|
const handlePathRegex = /^\/@([^/]+)/;
|
|
14
14
|
const userPathRegex = /^\/user\/([^/]+)/;
|
|
@@ -8,7 +8,7 @@ const hosts = [
|
|
|
8
8
|
"youtu.be",
|
|
9
9
|
"www.youtu.be"
|
|
10
10
|
];
|
|
11
|
-
const channelIdRegex = /"channelId":"(UC[a-zA-Z0-9_-]+)"/;
|
|
11
|
+
const channelIdRegex = /"(?:channelId|externalId)":"(UC[a-zA-Z0-9_-]+)"/;
|
|
12
12
|
const channelPathRegex = /^\/channel\/(UC[a-zA-Z0-9_-]+)/;
|
|
13
13
|
const handlePathRegex = /^\/@([^/]+)/;
|
|
14
14
|
const userPathRegex = /^\/user\/([^/]+)/;
|
package/dist/feeds.cjs
CHANGED
package/dist/index.cjs
CHANGED
package/dist/methods.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
const require_utils = require('./common/uris/guess/utils.cjs');
|
|
2
3
|
const require_index = require('./common/uris/guess/index.cjs');
|
|
3
4
|
const require_index$1 = require('./common/uris/headers/index.cjs');
|
package/dist/utils.cjs
CHANGED
package/package.json
CHANGED
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"htmlparser2": "^10.1.0"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@types/bun": "^1.3.
|
|
105
|
-
"kvalita": "1.
|
|
106
|
-
"tsdown": "^0.20.
|
|
104
|
+
"@types/bun": "^1.3.8",
|
|
105
|
+
"kvalita": "1.10.0",
|
|
106
|
+
"tsdown": "^0.20.3",
|
|
107
107
|
"vitepress": "^1.6.4"
|
|
108
108
|
},
|
|
109
|
-
"version": "1.
|
|
109
|
+
"version": "1.4.0"
|
|
110
110
|
}
|