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.
Files changed (131) hide show
  1. package/dist/blogrolls/extractors.cjs +2 -2
  2. package/dist/blogrolls/extractors.d.cts +2 -2
  3. package/dist/blogrolls/extractors.d.ts +2 -2
  4. package/dist/blogrolls/extractors.js +2 -2
  5. package/dist/blogrolls/index.cjs +9 -10
  6. package/dist/blogrolls/index.js +4 -5
  7. package/dist/blogrolls.cjs +1 -1
  8. package/dist/blogrolls.d.cts +2 -2
  9. package/dist/blogrolls.d.ts +2 -2
  10. package/dist/blogrolls.js +2 -2
  11. package/dist/common/discover/defaults.cjs +46 -0
  12. package/dist/common/discover/defaults.d.cts +6 -0
  13. package/dist/common/discover/defaults.d.ts +6 -0
  14. package/dist/common/discover/defaults.js +44 -0
  15. package/dist/common/discover/index.cjs +7 -7
  16. package/dist/common/discover/index.js +2 -2
  17. package/dist/common/discover/utils.cjs +9 -35
  18. package/dist/common/discover/utils.d.cts +1 -3
  19. package/dist/common/discover/utils.d.ts +1 -3
  20. package/dist/common/discover/utils.js +10 -34
  21. package/dist/common/locales.cjs +11 -4
  22. package/dist/common/locales.js +11 -4
  23. package/dist/common/types.d.cts +5 -4
  24. package/dist/common/types.d.ts +5 -4
  25. package/dist/common/uris/headers/index.cjs +1 -1
  26. package/dist/common/uris/headers/index.js +1 -1
  27. package/dist/common/uris/platform/types.d.cts +2 -2
  28. package/dist/common/uris/platform/types.d.ts +2 -2
  29. package/dist/common/utils.cjs +0 -8
  30. package/dist/common/utils.js +1 -8
  31. package/dist/favicons/defaults.cjs +6 -1
  32. package/dist/favicons/defaults.js +6 -1
  33. package/dist/favicons/extractors.cjs +2 -2
  34. package/dist/favicons/extractors.d.cts +2 -2
  35. package/dist/favicons/extractors.d.ts +2 -2
  36. package/dist/favicons/extractors.js +2 -2
  37. package/dist/favicons/index.cjs +11 -12
  38. package/dist/favicons/index.js +4 -5
  39. package/dist/favicons/platform/handlers/bluesky.cjs +1 -1
  40. package/dist/favicons/platform/handlers/bluesky.js +1 -1
  41. package/dist/favicons/platform/handlers/codeberg.cjs +4 -3
  42. package/dist/favicons/platform/handlers/codeberg.js +4 -3
  43. package/dist/favicons/platform/handlers/devto.cjs +31 -0
  44. package/dist/favicons/platform/handlers/devto.js +31 -0
  45. package/dist/favicons/platform/handlers/github.cjs +4 -3
  46. package/dist/favicons/platform/handlers/github.js +4 -3
  47. package/dist/favicons/platform/handlers/githubGist.cjs +4 -3
  48. package/dist/favicons/platform/handlers/githubGist.js +4 -3
  49. package/dist/favicons/platform/handlers/gitlab.cjs +38 -0
  50. package/dist/favicons/platform/handlers/gitlab.js +38 -0
  51. package/dist/favicons/platform/handlers/lobsters.cjs +3 -3
  52. package/dist/favicons/platform/handlers/lobsters.js +3 -3
  53. package/dist/favicons/platform/handlers/mastodon.cjs +5 -3
  54. package/dist/favicons/platform/handlers/mastodon.js +5 -3
  55. package/dist/favicons/platform/handlers/reddit.cjs +10 -8
  56. package/dist/favicons/platform/handlers/reddit.js +10 -8
  57. package/dist/favicons.cjs +1 -1
  58. package/dist/favicons.d.cts +2 -2
  59. package/dist/favicons.d.ts +2 -2
  60. package/dist/favicons.js +2 -2
  61. package/dist/feeds/defaults.cjs +4 -2
  62. package/dist/feeds/defaults.js +4 -2
  63. package/dist/feeds/extractors.cjs +6 -6
  64. package/dist/feeds/extractors.d.cts +2 -2
  65. package/dist/feeds/extractors.d.ts +2 -2
  66. package/dist/feeds/extractors.js +4 -4
  67. package/dist/feeds/index.cjs +9 -10
  68. package/dist/feeds/index.js +4 -5
  69. package/dist/feeds/platform/handlers/applePodcasts.cjs +26 -0
  70. package/dist/feeds/platform/handlers/applePodcasts.js +26 -0
  71. package/dist/feeds/platform/handlers/behance.cjs +2 -2
  72. package/dist/feeds/platform/handlers/behance.js +2 -2
  73. package/dist/feeds/platform/handlers/dailymotion.cjs +4 -4
  74. package/dist/feeds/platform/handlers/dailymotion.js +4 -4
  75. package/dist/feeds/platform/handlers/devto.cjs +6 -4
  76. package/dist/feeds/platform/handlers/devto.js +5 -5
  77. package/dist/feeds/platform/handlers/gitlab.cjs +4 -0
  78. package/dist/feeds/platform/handlers/gitlab.js +1 -1
  79. package/dist/feeds/platform/handlers/hatenablog.cjs +4 -4
  80. package/dist/feeds/platform/handlers/hatenablog.js +4 -4
  81. package/dist/feeds/platform/handlers/itchio.cjs +10 -10
  82. package/dist/feeds/platform/handlers/itchio.js +10 -10
  83. package/dist/feeds/platform/handlers/lobsters.cjs +8 -8
  84. package/dist/feeds/platform/handlers/lobsters.js +8 -8
  85. package/dist/feeds/platform/handlers/mastodon.cjs +4 -4
  86. package/dist/feeds/platform/handlers/mastodon.js +4 -4
  87. package/dist/feeds/platform/handlers/medium.cjs +10 -10
  88. package/dist/feeds/platform/handlers/medium.js +10 -10
  89. package/dist/feeds/platform/handlers/paragraph.cjs +2 -2
  90. package/dist/feeds/platform/handlers/paragraph.js +2 -2
  91. package/dist/feeds/platform/handlers/producthunt.cjs +4 -4
  92. package/dist/feeds/platform/handlers/producthunt.js +4 -4
  93. package/dist/feeds/platform/handlers/reddit.cjs +10 -10
  94. package/dist/feeds/platform/handlers/reddit.js +10 -10
  95. package/dist/feeds/platform/handlers/stackExchange.cjs +6 -6
  96. package/dist/feeds/platform/handlers/stackExchange.js +6 -6
  97. package/dist/feeds/platform/handlers/steam.cjs +4 -4
  98. package/dist/feeds/platform/handlers/steam.js +4 -4
  99. package/dist/feeds/platform/handlers/substack.cjs +10 -3
  100. package/dist/feeds/platform/handlers/substack.js +11 -4
  101. package/dist/feeds/platform/handlers/tumblr.cjs +2 -2
  102. package/dist/feeds/platform/handlers/tumblr.js +2 -2
  103. package/dist/feeds/platform/handlers/v2ex.cjs +4 -4
  104. package/dist/feeds/platform/handlers/v2ex.js +4 -4
  105. package/dist/feeds/platform/handlers/vimeo.cjs +2 -2
  106. package/dist/feeds/platform/handlers/vimeo.js +2 -2
  107. package/dist/feeds/platform/handlers/wordpress.cjs +6 -6
  108. package/dist/feeds/platform/handlers/wordpress.js +6 -6
  109. package/dist/feeds/platform/handlers/ximalaya.cjs +2 -2
  110. package/dist/feeds/platform/handlers/ximalaya.js +2 -2
  111. package/dist/feeds/platform/handlers/youtube.cjs +36 -21
  112. package/dist/feeds/platform/handlers/youtube.js +36 -21
  113. package/dist/feeds.cjs +1 -1
  114. package/dist/feeds.d.cts +2 -2
  115. package/dist/feeds.d.ts +2 -2
  116. package/dist/feeds.js +2 -2
  117. package/dist/hubs/discover/index.cjs +4 -5
  118. package/dist/hubs/discover/index.js +3 -4
  119. package/dist/hubs/feed/index.cjs +2 -2
  120. package/dist/hubs/feed/index.js +2 -2
  121. package/dist/hubs/headers/index.cjs +2 -2
  122. package/dist/hubs/headers/index.js +2 -2
  123. package/dist/hubs/html/index.cjs +2 -2
  124. package/dist/hubs/html/index.js +2 -2
  125. package/dist/index.cjs +2 -1
  126. package/dist/index.d.cts +2 -1
  127. package/dist/index.d.ts +2 -1
  128. package/dist/index.js +2 -1
  129. package/package.json +3 -2
  130. package/dist/hubs/discover/utils.cjs +0 -18
  131. package/dist/hubs/discover/utils.js +0 -18
@@ -1,7 +1,7 @@
1
1
  import { composeHint, isHostOf } from "../../../common/utils.js";
2
2
  //#region src/feeds/platform/handlers/steam.ts
3
- const appPathRegex = /^\/(?:news\/)?app\/(\d+)/;
4
- const groupPathRegex = /^\/groups\/([^/]+)/;
3
+ const appRegex = /^\/(?:news\/)?app\/(\d+)/;
4
+ const groupRegex = /^\/groups\/([^/]+)/;
5
5
  const hosts = ["store.steampowered.com", "steamcommunity.com"];
6
6
  const steamHandler = {
7
7
  match: (url) => {
@@ -9,13 +9,13 @@ const steamHandler = {
9
9
  },
10
10
  resolve: (url) => {
11
11
  const { hostname, pathname } = new URL(url);
12
- const appMatch = pathname.match(appPathRegex);
12
+ const appMatch = pathname.match(appRegex);
13
13
  if (appMatch?.[1]) return [{
14
14
  uri: `https://store.steampowered.com/feeds/news/app/${appMatch[1]}/`,
15
15
  hint: composeHint("steam:news")
16
16
  }];
17
17
  if (hostname === "steamcommunity.com") {
18
- const groupMatch = pathname.match(groupPathRegex);
18
+ const groupMatch = pathname.match(groupRegex);
19
19
  if (groupMatch?.[1]) return [{
20
20
  uri: `https://steamcommunity.com/groups/${groupMatch[1]}/rss`,
21
21
  hint: composeHint("steam:group")
@@ -1,13 +1,20 @@
1
1
  const require_utils = require("../../../common/utils.cjs");
2
2
  //#region src/feeds/platform/handlers/substack.ts
3
+ const profileRegex = /^\/@([\w-]+)/;
3
4
  const substackHandler = {
4
5
  match: (url) => {
5
- return require_utils.isSubdomainOf(url, "substack.com");
6
+ if (require_utils.isSubdomainOf(url, "substack.com")) return true;
7
+ return require_utils.isHostOf(url, "substack.com") && profileRegex.test(new URL(url).pathname);
6
8
  },
7
9
  resolve: (url) => {
8
- const { origin } = new URL(url);
10
+ const parsed = new URL(url);
11
+ const profileMatch = parsed.pathname.match(profileRegex);
12
+ if (require_utils.isHostOf(url, "substack.com") && profileMatch?.[1]) return [{
13
+ uri: `https://${profileMatch[1]}.substack.com/feed`,
14
+ hint: require_utils.composeHint("substack:newsletter")
15
+ }];
9
16
  return [{
10
- uri: `${origin}/feed`,
17
+ uri: `${parsed.origin}/feed`,
11
18
  hint: require_utils.composeHint("substack:newsletter")
12
19
  }];
13
20
  }
@@ -1,13 +1,20 @@
1
- import { composeHint, isSubdomainOf } from "../../../common/utils.js";
1
+ import { composeHint, isHostOf, isSubdomainOf } from "../../../common/utils.js";
2
2
  //#region src/feeds/platform/handlers/substack.ts
3
+ const profileRegex = /^\/@([\w-]+)/;
3
4
  const substackHandler = {
4
5
  match: (url) => {
5
- return isSubdomainOf(url, "substack.com");
6
+ if (isSubdomainOf(url, "substack.com")) return true;
7
+ return isHostOf(url, "substack.com") && profileRegex.test(new URL(url).pathname);
6
8
  },
7
9
  resolve: (url) => {
8
- const { origin } = new URL(url);
10
+ const parsed = new URL(url);
11
+ const profileMatch = parsed.pathname.match(profileRegex);
12
+ if (isHostOf(url, "substack.com") && profileMatch?.[1]) return [{
13
+ uri: `https://${profileMatch[1]}.substack.com/feed`,
14
+ hint: composeHint("substack:newsletter")
15
+ }];
9
16
  return [{
10
- uri: `${origin}/feed`,
17
+ uri: `${parsed.origin}/feed`,
11
18
  hint: composeHint("substack:newsletter")
12
19
  }];
13
20
  }
@@ -1,14 +1,14 @@
1
1
  const require_utils = require("../../../common/utils.cjs");
2
2
  //#region src/feeds/platform/handlers/tumblr.ts
3
3
  const domains = ["tumblr.com"];
4
- const tagPathRegex = /^\/tagged\/([^/]+)/;
4
+ const tagRegex = /^\/tagged\/([^/]+)/;
5
5
  const tumblrHandler = {
6
6
  match: (url) => {
7
7
  return require_utils.isSubdomainOf(url, domains);
8
8
  },
9
9
  resolve: (url) => {
10
10
  const { origin, pathname } = new URL(url);
11
- const tagMatch = pathname.match(tagPathRegex);
11
+ const tagMatch = pathname.match(tagRegex);
12
12
  if (tagMatch?.[1]) return [{
13
13
  uri: `${origin}/tagged/${tagMatch[1]}/rss`,
14
14
  hint: require_utils.composeHint("tumblr:tag")
@@ -1,14 +1,14 @@
1
1
  import { composeHint, isSubdomainOf } from "../../../common/utils.js";
2
2
  //#region src/feeds/platform/handlers/tumblr.ts
3
3
  const domains = ["tumblr.com"];
4
- const tagPathRegex = /^\/tagged\/([^/]+)/;
4
+ const tagRegex = /^\/tagged\/([^/]+)/;
5
5
  const tumblrHandler = {
6
6
  match: (url) => {
7
7
  return isSubdomainOf(url, domains);
8
8
  },
9
9
  resolve: (url) => {
10
10
  const { origin, pathname } = new URL(url);
11
- const tagMatch = pathname.match(tagPathRegex);
11
+ const tagMatch = pathname.match(tagRegex);
12
12
  if (tagMatch?.[1]) return [{
13
13
  uri: `${origin}/tagged/${tagMatch[1]}/rss`,
14
14
  hint: composeHint("tumblr:tag")
@@ -1,7 +1,7 @@
1
1
  const require_utils = require("../../../common/utils.cjs");
2
2
  //#region src/feeds/platform/handlers/v2ex.ts
3
- const nodePathRegex = /^\/go\/([^/]+)/;
4
- const memberPathRegex = /^\/member\/([^/]+)/;
3
+ const nodeRegex = /^\/go\/([^/]+)/;
4
+ const memberRegex = /^\/member\/([^/]+)/;
5
5
  const hosts = ["www.v2ex.com", "v2ex.com"];
6
6
  const v2exHandler = {
7
7
  match: (url) => {
@@ -9,12 +9,12 @@ const v2exHandler = {
9
9
  },
10
10
  resolve: (url) => {
11
11
  const { pathname, searchParams } = new URL(url);
12
- const nodeMatch = pathname.match(nodePathRegex);
12
+ const nodeMatch = pathname.match(nodeRegex);
13
13
  if (nodeMatch?.[1]) return [{
14
14
  uri: `https://www.v2ex.com/feed/${nodeMatch[1]}.xml`,
15
15
  hint: require_utils.composeHint("v2ex:node")
16
16
  }];
17
- const memberMatch = pathname.match(memberPathRegex);
17
+ const memberMatch = pathname.match(memberRegex);
18
18
  if (memberMatch?.[1]) return [{
19
19
  uri: `https://www.v2ex.com/feed/member/${memberMatch[1]}.xml`,
20
20
  hint: require_utils.composeHint("v2ex:member")
@@ -1,7 +1,7 @@
1
1
  import { composeHint, isHostOf } from "../../../common/utils.js";
2
2
  //#region src/feeds/platform/handlers/v2ex.ts
3
- const nodePathRegex = /^\/go\/([^/]+)/;
4
- const memberPathRegex = /^\/member\/([^/]+)/;
3
+ const nodeRegex = /^\/go\/([^/]+)/;
4
+ const memberRegex = /^\/member\/([^/]+)/;
5
5
  const hosts = ["www.v2ex.com", "v2ex.com"];
6
6
  const v2exHandler = {
7
7
  match: (url) => {
@@ -9,12 +9,12 @@ const v2exHandler = {
9
9
  },
10
10
  resolve: (url) => {
11
11
  const { pathname, searchParams } = new URL(url);
12
- const nodeMatch = pathname.match(nodePathRegex);
12
+ const nodeMatch = pathname.match(nodeRegex);
13
13
  if (nodeMatch?.[1]) return [{
14
14
  uri: `https://www.v2ex.com/feed/${nodeMatch[1]}.xml`,
15
15
  hint: composeHint("v2ex:node")
16
16
  }];
17
- const memberMatch = pathname.match(memberPathRegex);
17
+ const memberMatch = pathname.match(memberRegex);
18
18
  if (memberMatch?.[1]) return [{
19
19
  uri: `https://www.v2ex.com/feed/member/${memberMatch[1]}.xml`,
20
20
  hint: composeHint("v2ex:member")
@@ -1,6 +1,6 @@
1
1
  const require_utils = require("../../../common/utils.cjs");
2
2
  //#region src/feeds/platform/handlers/vimeo.ts
3
- const numericPathRegex = /^\d+$/;
3
+ const numericRegex = /^\d+$/;
4
4
  const hosts = ["vimeo.com", "www.vimeo.com"];
5
5
  const excludedPaths = [
6
6
  "about",
@@ -50,7 +50,7 @@ const vimeoHandler = {
50
50
  }];
51
51
  if (pathSegments.length > 0) {
52
52
  const user = pathSegments[0];
53
- if (!require_utils.isAnyOf(user, excludedPaths) && !numericPathRegex.test(user)) {
53
+ if (!require_utils.isAnyOf(user, excludedPaths) && !numericRegex.test(user)) {
54
54
  const feeds = [{
55
55
  uri: `${origin}/${user}/videos/rss`,
56
56
  hint: require_utils.composeHint("vimeo:videos")
@@ -1,6 +1,6 @@
1
1
  import { composeHint, isAnyOf, isHostOf } from "../../../common/utils.js";
2
2
  //#region src/feeds/platform/handlers/vimeo.ts
3
- const numericPathRegex = /^\d+$/;
3
+ const numericRegex = /^\d+$/;
4
4
  const hosts = ["vimeo.com", "www.vimeo.com"];
5
5
  const excludedPaths = [
6
6
  "about",
@@ -50,7 +50,7 @@ const vimeoHandler = {
50
50
  }];
51
51
  if (pathSegments.length > 0) {
52
52
  const user = pathSegments[0];
53
- if (!isAnyOf(user, excludedPaths) && !numericPathRegex.test(user)) {
53
+ if (!isAnyOf(user, excludedPaths) && !numericRegex.test(user)) {
54
54
  const feeds = [{
55
55
  uri: `${origin}/${user}/videos/rss`,
56
56
  hint: composeHint("vimeo:videos")
@@ -1,8 +1,8 @@
1
1
  const require_utils = require("../../../common/utils.cjs");
2
2
  //#region src/feeds/platform/handlers/wordpress.ts
3
- const categoryPathRegex = /^\/category\/([^/]+)/;
4
- const tagPathRegex = /^\/tag\/([^/]+)/;
5
- const authorPathRegex = /^\/author\/([^/]+)/;
3
+ const categoryRegex = /^\/category\/([^/]+)/;
4
+ const tagRegex = /^\/tag\/([^/]+)/;
5
+ const authorRegex = /^\/author\/([^/]+)/;
6
6
  const wordpressHandler = {
7
7
  match: (url) => {
8
8
  return require_utils.isSubdomainOf(url, "wordpress.com");
@@ -10,17 +10,17 @@ const wordpressHandler = {
10
10
  resolve: (url) => {
11
11
  const { origin, pathname } = new URL(url);
12
12
  const uris = [];
13
- const categoryMatch = pathname.match(categoryPathRegex);
13
+ const categoryMatch = pathname.match(categoryRegex);
14
14
  if (categoryMatch?.[1]) uris.push({
15
15
  uri: [`${origin}/category/${categoryMatch[1]}/feed/`, `${origin}/category/${categoryMatch[1]}/?feed=rss`],
16
16
  hint: require_utils.composeHint("wordpress:category")
17
17
  });
18
- const tagMatch = pathname.match(tagPathRegex);
18
+ const tagMatch = pathname.match(tagRegex);
19
19
  if (tagMatch?.[1]) uris.push({
20
20
  uri: [`${origin}/tag/${tagMatch[1]}/feed/`, `${origin}/tag/${tagMatch[1]}/?feed=rss`],
21
21
  hint: require_utils.composeHint("wordpress:tag")
22
22
  });
23
- const authorMatch = pathname.match(authorPathRegex);
23
+ const authorMatch = pathname.match(authorRegex);
24
24
  if (authorMatch?.[1]) uris.push({
25
25
  uri: [`${origin}/author/${authorMatch[1]}/feed/`, `${origin}/author/${authorMatch[1]}/?feed=rss`],
26
26
  hint: require_utils.composeHint("wordpress:author")
@@ -1,8 +1,8 @@
1
1
  import { composeHint, isSubdomainOf } from "../../../common/utils.js";
2
2
  //#region src/feeds/platform/handlers/wordpress.ts
3
- const categoryPathRegex = /^\/category\/([^/]+)/;
4
- const tagPathRegex = /^\/tag\/([^/]+)/;
5
- const authorPathRegex = /^\/author\/([^/]+)/;
3
+ const categoryRegex = /^\/category\/([^/]+)/;
4
+ const tagRegex = /^\/tag\/([^/]+)/;
5
+ const authorRegex = /^\/author\/([^/]+)/;
6
6
  const wordpressHandler = {
7
7
  match: (url) => {
8
8
  return isSubdomainOf(url, "wordpress.com");
@@ -10,17 +10,17 @@ const wordpressHandler = {
10
10
  resolve: (url) => {
11
11
  const { origin, pathname } = new URL(url);
12
12
  const uris = [];
13
- const categoryMatch = pathname.match(categoryPathRegex);
13
+ const categoryMatch = pathname.match(categoryRegex);
14
14
  if (categoryMatch?.[1]) uris.push({
15
15
  uri: [`${origin}/category/${categoryMatch[1]}/feed/`, `${origin}/category/${categoryMatch[1]}/?feed=rss`],
16
16
  hint: composeHint("wordpress:category")
17
17
  });
18
- const tagMatch = pathname.match(tagPathRegex);
18
+ const tagMatch = pathname.match(tagRegex);
19
19
  if (tagMatch?.[1]) uris.push({
20
20
  uri: [`${origin}/tag/${tagMatch[1]}/feed/`, `${origin}/tag/${tagMatch[1]}/?feed=rss`],
21
21
  hint: composeHint("wordpress:tag")
22
22
  });
23
- const authorMatch = pathname.match(authorPathRegex);
23
+ const authorMatch = pathname.match(authorRegex);
24
24
  if (authorMatch?.[1]) uris.push({
25
25
  uri: [`${origin}/author/${authorMatch[1]}/feed/`, `${origin}/author/${authorMatch[1]}/?feed=rss`],
26
26
  hint: composeHint("wordpress:author")
@@ -1,6 +1,6 @@
1
1
  const require_utils = require("../../../common/utils.cjs");
2
2
  //#region src/feeds/platform/handlers/ximalaya.ts
3
- const albumPathRegex = /^\/album\/(\d+)/;
3
+ const albumRegex = /^\/album\/(\d+)/;
4
4
  const hosts = ["www.ximalaya.com", "ximalaya.com"];
5
5
  const ximalayaHandler = {
6
6
  match: (url) => {
@@ -8,7 +8,7 @@ const ximalayaHandler = {
8
8
  },
9
9
  resolve: (url) => {
10
10
  const { pathname } = new URL(url);
11
- const id = pathname.match(albumPathRegex)?.[1];
11
+ const id = pathname.match(albumRegex)?.[1];
12
12
  if (!id) return [];
13
13
  return [{
14
14
  uri: `https://www.ximalaya.com/album/${id}.xml`,
@@ -1,6 +1,6 @@
1
1
  import { composeHint, isHostOf } from "../../../common/utils.js";
2
2
  //#region src/feeds/platform/handlers/ximalaya.ts
3
- const albumPathRegex = /^\/album\/(\d+)/;
3
+ const albumRegex = /^\/album\/(\d+)/;
4
4
  const hosts = ["www.ximalaya.com", "ximalaya.com"];
5
5
  const ximalayaHandler = {
6
6
  match: (url) => {
@@ -8,7 +8,7 @@ const ximalayaHandler = {
8
8
  },
9
9
  resolve: (url) => {
10
10
  const { pathname } = new URL(url);
11
- const id = pathname.match(albumPathRegex)?.[1];
11
+ const id = pathname.match(albumRegex)?.[1];
12
12
  if (!id) return [];
13
13
  return [{
14
14
  uri: `https://www.ximalaya.com/album/${id}.xml`,
@@ -1,10 +1,10 @@
1
1
  const require_utils = require("../../../common/utils.cjs");
2
2
  //#region src/feeds/platform/handlers/youtube.ts
3
3
  const channelIdRegex = /"(?:channelId|externalId)":"(UC[a-zA-Z0-9_-]+)"/;
4
- const channelPathRegex = /^\/channel\/(UC[a-zA-Z0-9_-]+)/;
5
- const handlePathRegex = /^\/@([^/]+)/;
6
- const userPathRegex = /^\/user\/([^/]+)/;
7
- const customPathRegex = /^\/c\/([^/]+)/;
4
+ const channelRegex = /^\/channel\/(UC[a-zA-Z0-9_-]+)/;
5
+ const handleRegex = /^\/@([^/]+)/;
6
+ const userRegex = /^\/user\/([^/]+)/;
7
+ const customRegex = /^\/c\/([^/]+)/;
8
8
  const channelPrefixRegex = /^UC/;
9
9
  const hosts = [
10
10
  "youtube.com",
@@ -16,38 +16,53 @@ const hosts = [
16
16
  const extractChannelIdFromContent = (content) => {
17
17
  return content.match(channelIdRegex)?.[1];
18
18
  };
19
- const getAllUploadsPlaylistId = (channelId) => {
20
- return channelId.replace(channelPrefixRegex, "UU");
21
- };
22
- const getVideosOnlyPlaylistId = (channelId) => {
23
- return channelId.replace(channelPrefixRegex, "UULF");
24
- };
25
- const getShortsOnlyPlaylistId = (channelId) => {
26
- return channelId.replace(channelPrefixRegex, "UUSH");
27
- };
28
- const getLiveStreamsOnlyPlaylistId = (channelId) => {
29
- return channelId.replace(channelPrefixRegex, "UULV");
19
+ const playlistPrefix = (prefix, channelId) => {
20
+ return channelId.replace(channelPrefixRegex, prefix);
30
21
  };
31
22
  const feedUrl = (param, value) => {
32
23
  return `https://www.youtube.com/feeds/videos.xml?${param}=${value}`;
33
24
  };
34
25
  const pushChannelUris = (uris, channelId) => {
35
26
  uris.push({
36
- uri: [feedUrl("channel_id", channelId), feedUrl("playlist_id", getAllUploadsPlaylistId(channelId))],
27
+ uri: [feedUrl("channel_id", channelId), feedUrl("playlist_id", playlistPrefix("UU", channelId))],
37
28
  hint: require_utils.composeHint("youtube:all")
38
29
  });
39
30
  uris.push({
40
- uri: feedUrl("playlist_id", getVideosOnlyPlaylistId(channelId)),
31
+ uri: feedUrl("playlist_id", playlistPrefix("UULF", channelId)),
41
32
  hint: require_utils.composeHint("youtube:videos")
42
33
  });
43
34
  uris.push({
44
- uri: feedUrl("playlist_id", getShortsOnlyPlaylistId(channelId)),
35
+ uri: feedUrl("playlist_id", playlistPrefix("UUSH", channelId)),
45
36
  hint: require_utils.composeHint("youtube:shorts")
46
37
  });
47
38
  uris.push({
48
- uri: feedUrl("playlist_id", getLiveStreamsOnlyPlaylistId(channelId)),
39
+ uri: feedUrl("playlist_id", playlistPrefix("UULV", channelId)),
49
40
  hint: require_utils.composeHint("youtube:live")
50
41
  });
42
+ uris.push({
43
+ uri: feedUrl("playlist_id", playlistPrefix("UULP", channelId)),
44
+ hint: require_utils.composeHint("youtube:popular-videos")
45
+ });
46
+ uris.push({
47
+ uri: feedUrl("playlist_id", playlistPrefix("UUPS", channelId)),
48
+ hint: require_utils.composeHint("youtube:popular-shorts")
49
+ });
50
+ uris.push({
51
+ uri: feedUrl("playlist_id", playlistPrefix("UUPV", channelId)),
52
+ hint: require_utils.composeHint("youtube:popular-live")
53
+ });
54
+ uris.push({
55
+ uri: feedUrl("playlist_id", playlistPrefix("UUMO", channelId)),
56
+ hint: require_utils.composeHint("youtube:member-videos")
57
+ });
58
+ uris.push({
59
+ uri: feedUrl("playlist_id", playlistPrefix("UUMS", channelId)),
60
+ hint: require_utils.composeHint("youtube:member-shorts")
61
+ });
62
+ uris.push({
63
+ uri: feedUrl("playlist_id", playlistPrefix("UUMV", channelId)),
64
+ hint: require_utils.composeHint("youtube:member-live")
65
+ });
51
66
  };
52
67
  const youtubeHandler = {
53
68
  match: (url) => {
@@ -56,7 +71,7 @@ const youtubeHandler = {
56
71
  resolve: (url, content) => {
57
72
  const parsedUrl = new URL(url);
58
73
  const uris = [];
59
- const channelMatch = parsedUrl.pathname.match(channelPathRegex);
74
+ const channelMatch = parsedUrl.pathname.match(channelRegex);
60
75
  if (channelMatch?.[1]) {
61
76
  const channelId = channelMatch[1];
62
77
  pushChannelUris(uris, channelId);
@@ -67,7 +82,7 @@ const youtubeHandler = {
67
82
  hint: require_utils.composeHint("youtube:playlist")
68
83
  });
69
84
  if (uris.length === 0 && content) {
70
- if (parsedUrl.searchParams.has("v") || parsedUrl.hostname.includes("youtu.be") && parsedUrl.pathname.length > 1 || parsedUrl.pathname.match(handlePathRegex) || parsedUrl.pathname.match(userPathRegex) || parsedUrl.pathname.match(customPathRegex)) {
85
+ if (parsedUrl.searchParams.has("v") || parsedUrl.hostname.includes("youtu.be") && parsedUrl.pathname.length > 1 || parsedUrl.pathname.match(handleRegex) || parsedUrl.pathname.match(userRegex) || parsedUrl.pathname.match(customRegex)) {
71
86
  const channelId = extractChannelIdFromContent(content);
72
87
  if (channelId) pushChannelUris(uris, channelId);
73
88
  }
@@ -1,10 +1,10 @@
1
1
  import { composeHint, isHostOf } from "../../../common/utils.js";
2
2
  //#region src/feeds/platform/handlers/youtube.ts
3
3
  const channelIdRegex = /"(?:channelId|externalId)":"(UC[a-zA-Z0-9_-]+)"/;
4
- const channelPathRegex = /^\/channel\/(UC[a-zA-Z0-9_-]+)/;
5
- const handlePathRegex = /^\/@([^/]+)/;
6
- const userPathRegex = /^\/user\/([^/]+)/;
7
- const customPathRegex = /^\/c\/([^/]+)/;
4
+ const channelRegex = /^\/channel\/(UC[a-zA-Z0-9_-]+)/;
5
+ const handleRegex = /^\/@([^/]+)/;
6
+ const userRegex = /^\/user\/([^/]+)/;
7
+ const customRegex = /^\/c\/([^/]+)/;
8
8
  const channelPrefixRegex = /^UC/;
9
9
  const hosts = [
10
10
  "youtube.com",
@@ -16,38 +16,53 @@ const hosts = [
16
16
  const extractChannelIdFromContent = (content) => {
17
17
  return content.match(channelIdRegex)?.[1];
18
18
  };
19
- const getAllUploadsPlaylistId = (channelId) => {
20
- return channelId.replace(channelPrefixRegex, "UU");
21
- };
22
- const getVideosOnlyPlaylistId = (channelId) => {
23
- return channelId.replace(channelPrefixRegex, "UULF");
24
- };
25
- const getShortsOnlyPlaylistId = (channelId) => {
26
- return channelId.replace(channelPrefixRegex, "UUSH");
27
- };
28
- const getLiveStreamsOnlyPlaylistId = (channelId) => {
29
- return channelId.replace(channelPrefixRegex, "UULV");
19
+ const playlistPrefix = (prefix, channelId) => {
20
+ return channelId.replace(channelPrefixRegex, prefix);
30
21
  };
31
22
  const feedUrl = (param, value) => {
32
23
  return `https://www.youtube.com/feeds/videos.xml?${param}=${value}`;
33
24
  };
34
25
  const pushChannelUris = (uris, channelId) => {
35
26
  uris.push({
36
- uri: [feedUrl("channel_id", channelId), feedUrl("playlist_id", getAllUploadsPlaylistId(channelId))],
27
+ uri: [feedUrl("channel_id", channelId), feedUrl("playlist_id", playlistPrefix("UU", channelId))],
37
28
  hint: composeHint("youtube:all")
38
29
  });
39
30
  uris.push({
40
- uri: feedUrl("playlist_id", getVideosOnlyPlaylistId(channelId)),
31
+ uri: feedUrl("playlist_id", playlistPrefix("UULF", channelId)),
41
32
  hint: composeHint("youtube:videos")
42
33
  });
43
34
  uris.push({
44
- uri: feedUrl("playlist_id", getShortsOnlyPlaylistId(channelId)),
35
+ uri: feedUrl("playlist_id", playlistPrefix("UUSH", channelId)),
45
36
  hint: composeHint("youtube:shorts")
46
37
  });
47
38
  uris.push({
48
- uri: feedUrl("playlist_id", getLiveStreamsOnlyPlaylistId(channelId)),
39
+ uri: feedUrl("playlist_id", playlistPrefix("UULV", channelId)),
49
40
  hint: composeHint("youtube:live")
50
41
  });
42
+ uris.push({
43
+ uri: feedUrl("playlist_id", playlistPrefix("UULP", channelId)),
44
+ hint: composeHint("youtube:popular-videos")
45
+ });
46
+ uris.push({
47
+ uri: feedUrl("playlist_id", playlistPrefix("UUPS", channelId)),
48
+ hint: composeHint("youtube:popular-shorts")
49
+ });
50
+ uris.push({
51
+ uri: feedUrl("playlist_id", playlistPrefix("UUPV", channelId)),
52
+ hint: composeHint("youtube:popular-live")
53
+ });
54
+ uris.push({
55
+ uri: feedUrl("playlist_id", playlistPrefix("UUMO", channelId)),
56
+ hint: composeHint("youtube:member-videos")
57
+ });
58
+ uris.push({
59
+ uri: feedUrl("playlist_id", playlistPrefix("UUMS", channelId)),
60
+ hint: composeHint("youtube:member-shorts")
61
+ });
62
+ uris.push({
63
+ uri: feedUrl("playlist_id", playlistPrefix("UUMV", channelId)),
64
+ hint: composeHint("youtube:member-live")
65
+ });
51
66
  };
52
67
  const youtubeHandler = {
53
68
  match: (url) => {
@@ -56,7 +71,7 @@ const youtubeHandler = {
56
71
  resolve: (url, content) => {
57
72
  const parsedUrl = new URL(url);
58
73
  const uris = [];
59
- const channelMatch = parsedUrl.pathname.match(channelPathRegex);
74
+ const channelMatch = parsedUrl.pathname.match(channelRegex);
60
75
  if (channelMatch?.[1]) {
61
76
  const channelId = channelMatch[1];
62
77
  pushChannelUris(uris, channelId);
@@ -67,7 +82,7 @@ const youtubeHandler = {
67
82
  hint: composeHint("youtube:playlist")
68
83
  });
69
84
  if (uris.length === 0 && content) {
70
- if (parsedUrl.searchParams.has("v") || parsedUrl.hostname.includes("youtu.be") && parsedUrl.pathname.length > 1 || parsedUrl.pathname.match(handlePathRegex) || parsedUrl.pathname.match(userPathRegex) || parsedUrl.pathname.match(customPathRegex)) {
85
+ if (parsedUrl.searchParams.has("v") || parsedUrl.hostname.includes("youtu.be") && parsedUrl.pathname.length > 1 || parsedUrl.pathname.match(handleRegex) || parsedUrl.pathname.match(userRegex) || parsedUrl.pathname.match(customRegex)) {
71
86
  const channelId = extractChannelIdFromContent(content);
72
87
  if (channelId) pushChannelUris(uris, channelId);
73
88
  }
package/dist/feeds.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_defaults = require("./feeds/defaults.cjs");
3
3
  const require_extractors = require("./feeds/extractors.cjs");
4
4
  exports.anchorLabels = require_defaults.anchorLabels;
5
- exports.defaultExtractor = require_extractors.defaultExtractor;
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;
package/dist/feeds.d.cts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal } from "./feeds/defaults.cjs";
2
2
  import { FeedResult } from "./feeds/types.cjs";
3
- import { defaultExtractor } from "./feeds/extractors.cjs";
4
- export { FeedResult, anchorLabels, defaultExtractor, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
3
+ import { defaultExtractFn } from "./feeds/extractors.cjs";
4
+ export { FeedResult, anchorLabels, defaultExtractFn, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
package/dist/feeds.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal } from "./feeds/defaults.js";
2
2
  import { FeedResult } from "./feeds/types.js";
3
- import { defaultExtractor } from "./feeds/extractors.js";
4
- export { FeedResult, anchorLabels, defaultExtractor, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
3
+ import { defaultExtractFn } from "./feeds/extractors.js";
4
+ export { FeedResult, anchorLabels, defaultExtractFn, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
package/dist/feeds.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { anchorLabels, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal } from "./feeds/defaults.js";
2
- import { defaultExtractor } from "./feeds/extractors.js";
3
- export { anchorLabels, defaultExtractor, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
2
+ import { defaultExtractFn } from "./feeds/extractors.js";
3
+ export { anchorLabels, defaultExtractFn, defaultGuessOptions, defaultHeadersOptions, defaultHtmlOptions, defaultPlatformOptions, ignoredUris, linkSelectors, mimeTypes, urisBalanced, urisComprehensive, urisMinimal };
@@ -1,17 +1,16 @@
1
- const require_utils = require("../../common/utils.cjs");
2
- const require_utils$1 = require("../../common/discover/utils.cjs");
1
+ const require_utils = require("../../common/discover/utils.cjs");
2
+ const require_defaults = require("../../common/discover/defaults.cjs");
3
3
  const require_index = require("../feed/index.cjs");
4
4
  const require_index$1 = require("../headers/index.cjs");
5
5
  const require_index$2 = require("../html/index.cjs");
6
- const require_utils$2 = require("./utils.cjs");
7
6
  //#region src/hubs/discover/index.ts
8
7
  const discoverHubs = async (input, options = {}) => {
9
8
  const { methods = [
10
9
  "headers",
11
10
  "feed",
12
11
  "html"
13
- ], fetchFn = require_utils$1.defaultFetchFn, resolveUrlFn = require_utils.resolveUrl } = options;
14
- const normalizedInput = await require_utils$2.normalizeInput(input, fetchFn);
12
+ ], fetchFn = require_defaults.defaultFetchFn, resolveUrlFn = require_defaults.defaultResolveUrlFn } = options;
13
+ const normalizedInput = await require_utils.normalizeInput(input, fetchFn);
15
14
  const results = [];
16
15
  if (methods.includes("headers") && normalizedInput.headers) {
17
16
  const headerHubs = require_index$1.discoverHubsFromHeaders(normalizedInput.headers, normalizedInput.url, resolveUrlFn);
@@ -1,16 +1,15 @@
1
- import { resolveUrl } from "../../common/utils.js";
2
- import { defaultFetchFn } from "../../common/discover/utils.js";
1
+ import { normalizeInput } from "../../common/discover/utils.js";
2
+ import { defaultFetchFn, defaultResolveUrlFn } from "../../common/discover/defaults.js";
3
3
  import { discoverHubsFromFeed } from "../feed/index.js";
4
4
  import { discoverHubsFromHeaders } from "../headers/index.js";
5
5
  import { discoverHubsFromHtml } from "../html/index.js";
6
- import { normalizeInput } from "./utils.js";
7
6
  //#region src/hubs/discover/index.ts
8
7
  const discoverHubs = async (input, options = {}) => {
9
8
  const { methods = [
10
9
  "headers",
11
10
  "feed",
12
11
  "html"
13
- ], fetchFn = defaultFetchFn, resolveUrlFn = resolveUrl } = options;
12
+ ], fetchFn = defaultFetchFn, resolveUrlFn = defaultResolveUrlFn } = options;
14
13
  const normalizedInput = await normalizeInput(input, fetchFn);
15
14
  const results = [];
16
15
  if (methods.includes("headers") && normalizedInput.headers) {
@@ -1,10 +1,10 @@
1
- const require_utils = require("../../common/utils.cjs");
1
+ const require_defaults = require("../../common/discover/defaults.cjs");
2
2
  let feedsmith = require("feedsmith");
3
3
  //#region src/hubs/feed/index.ts
4
4
  const getLinksWithRel = (links, rel) => {
5
5
  return links?.filter((link) => link.rel === rel && link.href).map((link) => link.href) ?? [];
6
6
  };
7
- const discoverHubsFromFeed = (content, baseUrl, resolveUrlFn = require_utils.resolveUrl) => {
7
+ const discoverHubsFromFeed = (content, baseUrl, resolveUrlFn = require_defaults.defaultResolveUrlFn) => {
8
8
  try {
9
9
  const { format, feed } = (0, feedsmith.parseFeed)(content);
10
10
  if (format === "json") {
@@ -1,10 +1,10 @@
1
- import { resolveUrl } from "../../common/utils.js";
1
+ import { defaultResolveUrlFn } from "../../common/discover/defaults.js";
2
2
  import { parseFeed } from "feedsmith";
3
3
  //#region src/hubs/feed/index.ts
4
4
  const getLinksWithRel = (links, rel) => {
5
5
  return links?.filter((link) => link.rel === rel && link.href).map((link) => link.href) ?? [];
6
6
  };
7
- const discoverHubsFromFeed = (content, baseUrl, resolveUrlFn = resolveUrl) => {
7
+ const discoverHubsFromFeed = (content, baseUrl, resolveUrlFn = defaultResolveUrlFn) => {
8
8
  try {
9
9
  const { format, feed } = parseFeed(content);
10
10
  if (format === "json") {
@@ -1,9 +1,9 @@
1
- const require_utils = require("../../common/utils.cjs");
1
+ const require_defaults = require("../../common/discover/defaults.cjs");
2
2
  const require_index = require("../../common/uris/headers/index.cjs");
3
3
  //#region src/hubs/headers/index.ts
4
4
  const hubSelector = [{ rel: "hub" }];
5
5
  const selfSelector = [{ rel: "self" }];
6
- const discoverHubsFromHeaders = (headers, baseUrl, resolveUrlFn = require_utils.resolveUrl) => {
6
+ const discoverHubsFromHeaders = (headers, baseUrl, resolveUrlFn = require_defaults.defaultResolveUrlFn) => {
7
7
  const hubUris = require_index.discoverUrisFromHeaders(headers, { linkSelectors: hubSelector });
8
8
  if (hubUris.length === 0) return [];
9
9
  const selfUris = require_index.discoverUrisFromHeaders(headers, { linkSelectors: selfSelector });
@@ -1,9 +1,9 @@
1
- import { resolveUrl } from "../../common/utils.js";
1
+ import { defaultResolveUrlFn } from "../../common/discover/defaults.js";
2
2
  import { discoverUrisFromHeaders } from "../../common/uris/headers/index.js";
3
3
  //#region src/hubs/headers/index.ts
4
4
  const hubSelector = [{ rel: "hub" }];
5
5
  const selfSelector = [{ rel: "self" }];
6
- const discoverHubsFromHeaders = (headers, baseUrl, resolveUrlFn = resolveUrl) => {
6
+ const discoverHubsFromHeaders = (headers, baseUrl, resolveUrlFn = defaultResolveUrlFn) => {
7
7
  const hubUris = discoverUrisFromHeaders(headers, { linkSelectors: hubSelector });
8
8
  if (hubUris.length === 0) return [];
9
9
  const selfUris = discoverUrisFromHeaders(headers, { linkSelectors: selfSelector });