feedkeeper 0.44.2 → 0.44.3
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/THIRD-PARTY-LICENSES.md +31 -0
- package/package.json +1 -1
- package/server/dist/feeds/content/embeds/social.js +12 -7
- package/server/dist/feeds/content/embeds/video.js +30 -24
- package/server/dist/feeds/content/patterns/oembed-providers.js +69 -0
- package/server/dist/feeds/content/patterns/providers.json +152 -0
- package/server/dist/feeds/content/patterns/social-platforms.js +35 -9
- package/server/package.json +1 -1
package/THIRD-PARTY-LICENSES.md
CHANGED
|
@@ -64,3 +64,34 @@ If the Work includes a "NOTICE" text file as part of its distribution, then any
|
|
|
64
64
|
|
|
65
65
|
END OF TERMS AND CONDITIONS
|
|
66
66
|
```
|
|
67
|
+
|
|
68
|
+
## oEmbed Providers
|
|
69
|
+
|
|
70
|
+
- **Source:** [iamcal/oembed](https://github.com/iamcal/oembed) (`https://oembed.com/providers.json`)
|
|
71
|
+
- **Copyright:** Copyright (c) 2016 Cal Henderson
|
|
72
|
+
- **License:** MIT License
|
|
73
|
+
- **Used in:** [`server/src/feeds/content/patterns/providers.json`](server/src/feeds/content/patterns/providers.json)
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
The MIT License (MIT)
|
|
77
|
+
|
|
78
|
+
Copyright (c) 2016 Cal Henderson
|
|
79
|
+
|
|
80
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
81
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
82
|
+
in the Software without restriction, including without limitation the rights
|
|
83
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
84
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
85
|
+
furnished to do so, subject to the following conditions:
|
|
86
|
+
|
|
87
|
+
The above copyright notice and this permission notice shall be included in all
|
|
88
|
+
copies or substantial portions of the Software.
|
|
89
|
+
|
|
90
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
91
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
92
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
93
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
94
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
95
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
96
|
+
SOFTWARE.
|
|
97
|
+
```
|
package/package.json
CHANGED
|
@@ -5,12 +5,14 @@ export function socialPost(source) {
|
|
|
5
5
|
const address = parseAddress(source.trim());
|
|
6
6
|
if (!address || !/^https?:$/.test(address.protocol))
|
|
7
7
|
return null;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
if (!platform || !platform.post.test(`${address.pathname}${address.search}`))
|
|
8
|
+
const platform = SOCIAL_PLATFORMS.find(candidate => candidate.host.test(address.hostname) && candidate.post.test(address.href));
|
|
9
|
+
if (!platform)
|
|
11
10
|
return null;
|
|
12
|
-
const keepsQuery = platform.name === "Facebook";
|
|
13
|
-
return {
|
|
11
|
+
const keepsQuery = platform.name === "Facebook" || platform.name === "YouTube";
|
|
12
|
+
return {
|
|
13
|
+
platform,
|
|
14
|
+
url: `${address.origin}${address.pathname.replace(/\/embed\/?$/, "/")}${keepsQuery ? address.search : ""}`,
|
|
15
|
+
};
|
|
14
16
|
}
|
|
15
17
|
/** The post behind an embed iframe, which usually names it in the path or in a parameter. */
|
|
16
18
|
export function socialFrameTarget(source) {
|
|
@@ -36,7 +38,10 @@ export function socialFrameTarget(source) {
|
|
|
36
38
|
return inner ? socialPost(inner) : null;
|
|
37
39
|
}
|
|
38
40
|
if (MASTODON_EMBED_PATH.test(address.pathname) && /^https?:$/.test(address.protocol)) {
|
|
39
|
-
return {
|
|
41
|
+
return {
|
|
42
|
+
platform: { name: "Mastodon", host: /.*/, post: MASTODON_EMBED_PATH, kind: "social" },
|
|
43
|
+
url: `${address.origin}${address.pathname.replace(/\/embed\/?$/, "")}`,
|
|
44
|
+
};
|
|
40
45
|
}
|
|
41
46
|
return socialPost(source);
|
|
42
47
|
}
|
|
@@ -90,7 +95,7 @@ function resolveSocialEmbeds(root, stats) {
|
|
|
90
95
|
/** Posts of social platforms and audio players become one link to the post. */
|
|
91
96
|
export const socialEmbeds = {
|
|
92
97
|
name: "social-embeds",
|
|
93
|
-
description: "
|
|
98
|
+
description: "Supported social posts and audio players become one marked link.",
|
|
94
99
|
apply(root, stats) {
|
|
95
100
|
const { changed, links } = resolveSocialEmbeds(root, stats);
|
|
96
101
|
links.forEach(({ link, kind, source }) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PLAY_LABEL, PLAYER_TITLES } from "../patterns/play-labels/index.js";
|
|
2
|
+
import { OEMBED_PROVIDER_PLATFORMS } from "../patterns/oembed-providers.js";
|
|
2
3
|
import { flat, linkParagraph, parseAddress, pruneEmpty } from "../shared.js";
|
|
3
4
|
const PLAY_SOURCE = /(?:^|[/_.-])play[-_]?(?:icon|button|btn)?\.(?:svg|png|webp|gif)(?:[?#]|$)/i;
|
|
4
5
|
const DURATION = /^\d{1,2}:\d{2}(:\d{2})?$/;
|
|
@@ -8,39 +9,44 @@ function isPlayOverlay(image) {
|
|
|
8
9
|
}
|
|
9
10
|
/** Direct video URL of the embeds that are common enough to be worth a link. Anything else is not turned into a link. */
|
|
10
11
|
export function embedTarget(source) {
|
|
11
|
-
const
|
|
12
|
-
|
|
12
|
+
const trimmed = source.trim();
|
|
13
|
+
const address = parseAddress(trimmed.startsWith("//") ? `https:${trimmed}` : trimmed);
|
|
14
|
+
if (!address || !/^https?:$/.test(address.protocol))
|
|
13
15
|
return null;
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return { url: `https://www.youtube.com/watch?v=${address.searchParams.get("v")}`, name: "YouTube" };
|
|
16
|
+
const host = address.hostname.replace(/^(?:www|m|mobile)\./, "");
|
|
17
|
+
const provider = OEMBED_PROVIDER_PLATFORMS.find(candidate => candidate.kind === "video" && candidate.post.test(address.href));
|
|
18
|
+
if (provider?.name === "YouTube") {
|
|
19
|
+
const id = address.searchParams.get("v") ?? address.pathname.split("/").filter(Boolean).at(-1);
|
|
20
|
+
if (id && /^[\w-]{6,}$/.test(id)) {
|
|
21
|
+
return { url: `https://www.youtube.com/watch?v=${id}`, name: provider.name };
|
|
22
|
+
}
|
|
22
23
|
}
|
|
23
|
-
if (
|
|
24
|
-
|
|
24
|
+
if (provider?.name === "Vimeo" && host === "player.vimeo.com") {
|
|
25
|
+
const id = address.pathname.match(/\/video\/(\d{5,})$/)?.[1];
|
|
26
|
+
if (id) {
|
|
27
|
+
return { url: `https://vimeo.com/${id}`, name: provider.name };
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
|
-
if (
|
|
27
|
-
|
|
30
|
+
if (provider?.name === "Dailymotion") {
|
|
31
|
+
const id = address.pathname.match(/^\/video\/([a-zA-Z0-9]+)/)?.[1];
|
|
32
|
+
if (id) {
|
|
33
|
+
return { url: `https://www.dailymotion.com/video/${id}`, name: provider.name };
|
|
34
|
+
}
|
|
28
35
|
}
|
|
29
|
-
if (host === "dailymotion.com"
|
|
30
|
-
|
|
36
|
+
if (host === "dailymotion.com") {
|
|
37
|
+
const id = address.pathname.match(/^\/embed\/video\/([\w]+)/)?.[1];
|
|
38
|
+
if (id) {
|
|
39
|
+
return { url: `https://www.dailymotion.com/video/${id}`, name: "Dailymotion" };
|
|
40
|
+
}
|
|
31
41
|
}
|
|
32
42
|
return null;
|
|
33
43
|
}
|
|
34
44
|
/** The name of the video site a watch-page address belongs to, for the labels of links that were saved without a title. */
|
|
35
45
|
function videoSiteName(source) {
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
return "Vimeo";
|
|
41
|
-
if (/^dailymotion\.com$/.test(host))
|
|
42
|
-
return "Dailymotion";
|
|
43
|
-
return null;
|
|
46
|
+
const address = parseAddress(source);
|
|
47
|
+
if (!address)
|
|
48
|
+
return null;
|
|
49
|
+
return OEMBED_PROVIDER_PLATFORMS.find(platform => platform.kind === "video" && platform.post.test(address.href))?.name ?? null;
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
46
52
|
* Players need the publisher's script: a reader without it shows their play-button picture as a broken image and
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import registry from "./providers.json" with { type: "json" };
|
|
2
|
+
export const OEMBED_PROVIDER_SNAPSHOT = registry.snapshot_date;
|
|
3
|
+
const VIDEO_PROVIDERS = new Set(["YouTube", "Vimeo", "Dailymotion"]);
|
|
4
|
+
const AUDIO_PROVIDERS = new Set(["SoundCloud", "Spotify"]);
|
|
5
|
+
function escapeRegex(value) {
|
|
6
|
+
return value.replace(/[.*+?^$()|[\]\\]/g, "\\$&");
|
|
7
|
+
}
|
|
8
|
+
function compileHost(rawHost) {
|
|
9
|
+
if (rawHost === "*.youtube.com") {
|
|
10
|
+
return `(?:[^.]+\\.)?youtube(?:-nocookie)?\\.com`;
|
|
11
|
+
}
|
|
12
|
+
if (rawHost.startsWith("*.")) {
|
|
13
|
+
return `(?:[^.]+\\.)?${escapeRegex(rawHost.slice(2)).replace(/\\\*/g, "[^.]+")}`;
|
|
14
|
+
}
|
|
15
|
+
const bare = rawHost.replace(/^www\./, "");
|
|
16
|
+
if (!bare.includes("*.") && bare.split(".").length === 2) {
|
|
17
|
+
return `(?:(?:www|m|mobile)\\.)?${escapeRegex(bare)}`;
|
|
18
|
+
}
|
|
19
|
+
return escapeRegex(rawHost).replace(/\\\*/g, "[^.]+");
|
|
20
|
+
}
|
|
21
|
+
function compileScheme(scheme) {
|
|
22
|
+
const match = /^(https?):\/\/([^/]+)(\/.*)$/.exec(scheme);
|
|
23
|
+
if (!match) {
|
|
24
|
+
throw new Error(`Invalid oEmbed scheme: ${scheme}`);
|
|
25
|
+
}
|
|
26
|
+
const host = compileHost(match[2]);
|
|
27
|
+
const path = escapeRegex(match[3]).replace(/\\\*/g, "[^#]*");
|
|
28
|
+
return new RegExp(`^${match[1]}://${host}${path}$`, "i");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Single-item URL matchers derived from the versioned oEmbed provider registry snapshot.
|
|
32
|
+
* Run `npm run update:oembed-providers` to refresh `providers.json`.
|
|
33
|
+
*/
|
|
34
|
+
export const OEMBED_PROVIDER_PLATFORMS = registry.providers.map(provider => {
|
|
35
|
+
const name = provider.provider_name === "Bluesky Social" ? "Bluesky" : provider.provider_name;
|
|
36
|
+
const schemes = provider.schemes.map(compileScheme);
|
|
37
|
+
const paths = provider.item_paths.map(pattern => new RegExp(pattern, "i"));
|
|
38
|
+
const hosts = provider.schemes.map(scheme => {
|
|
39
|
+
const match = /^(https?):\/\/([^/]+)/.exec(scheme);
|
|
40
|
+
if (!match) {
|
|
41
|
+
throw new Error(`Invalid oEmbed scheme: ${scheme}`);
|
|
42
|
+
}
|
|
43
|
+
return compileHost(match[2]);
|
|
44
|
+
});
|
|
45
|
+
const host = new RegExp(`^(?:${[...new Set(hosts)].join("|")})$`, "i");
|
|
46
|
+
const post = {
|
|
47
|
+
test(value) {
|
|
48
|
+
try {
|
|
49
|
+
const url = new URL(value);
|
|
50
|
+
if (!host.test(url.hostname) ||
|
|
51
|
+
!schemes.some(pattern => pattern.test(url.href)) ||
|
|
52
|
+
!paths.some(pattern => pattern.test(url.pathname))) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (name === "YouTube" && url.pathname === "/watch" && !url.searchParams.has("v"))
|
|
56
|
+
return false;
|
|
57
|
+
if (name === "YouTube" && url.pathname === "/playlist" && !url.searchParams.has("list"))
|
|
58
|
+
return false;
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
const kind = VIDEO_PROVIDERS.has(name) ? "video" : AUDIO_PROVIDERS.has(name) ? "audio" : "social";
|
|
67
|
+
return { name, host, post, kind };
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=oembed-providers.js.map
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "https://oembed.com/providers.json",
|
|
3
|
+
"snapshot_date": "2026-11-23",
|
|
4
|
+
"providers": [
|
|
5
|
+
{
|
|
6
|
+
"provider_name": "Bluesky Social",
|
|
7
|
+
"schemes": [
|
|
8
|
+
"https://bsky.app/profile/*/post/*"
|
|
9
|
+
],
|
|
10
|
+
"item_paths": [
|
|
11
|
+
"^/profile/[^/]+/post/[^/]+/?$"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"provider_name": "Dailymotion",
|
|
16
|
+
"schemes": [
|
|
17
|
+
"https://www.dailymotion.com/video/*",
|
|
18
|
+
"https://geo.dailymotion.com/player.html?video=*"
|
|
19
|
+
],
|
|
20
|
+
"item_paths": [
|
|
21
|
+
"^/video/[A-Za-z0-9]+/?$"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"provider_name": "Flickr",
|
|
26
|
+
"schemes": [
|
|
27
|
+
"https://*.flickr.com/photos/*",
|
|
28
|
+
"https://flic.kr/p/*",
|
|
29
|
+
"https://flic.kr/s/*",
|
|
30
|
+
"https://*.*.flickr.com/*/*"
|
|
31
|
+
],
|
|
32
|
+
"item_paths": [
|
|
33
|
+
"^/photos/[^/]+/\\d+/?$",
|
|
34
|
+
"^/p/[^/]+/?$"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"provider_name": "Instagram",
|
|
39
|
+
"schemes": [
|
|
40
|
+
"https://instagram.com/*/p/*",
|
|
41
|
+
"https://www.instagram.com/*/p/*",
|
|
42
|
+
"https://instagram.com/p/*",
|
|
43
|
+
"https://instagr.am/p/*",
|
|
44
|
+
"https://www.instagram.com/p/*",
|
|
45
|
+
"https://www.instagr.am/p/*",
|
|
46
|
+
"https://instagram.com/tv/*",
|
|
47
|
+
"https://instagr.am/tv/*",
|
|
48
|
+
"https://www.instagram.com/tv/*",
|
|
49
|
+
"https://www.instagr.am/tv/*",
|
|
50
|
+
"https://www.instagram.com/reel/*",
|
|
51
|
+
"https://instagram.com/reel/*",
|
|
52
|
+
"https://instagr.am/reel/*",
|
|
53
|
+
"https://www.instagram.com/*/reel/*",
|
|
54
|
+
"https://instagram.com/*/reel/*"
|
|
55
|
+
],
|
|
56
|
+
"item_paths": [
|
|
57
|
+
"^/(?:[\\w.]+/)?(?:p|tv|reel|reels)/[\\w-]+/?$"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"provider_name": "Reddit",
|
|
62
|
+
"schemes": [
|
|
63
|
+
"https://reddit.com/r/*/comments/*/*",
|
|
64
|
+
"https://www.reddit.com/r/*/comments/*/*"
|
|
65
|
+
],
|
|
66
|
+
"item_paths": [
|
|
67
|
+
"^/r/[^/]+/comments/[^/]+"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"provider_name": "SoundCloud",
|
|
72
|
+
"schemes": [
|
|
73
|
+
"https://soundcloud.com/*",
|
|
74
|
+
"https://on.soundcloud.com/*",
|
|
75
|
+
"https://soundcloud.app.goog.gl/*"
|
|
76
|
+
],
|
|
77
|
+
"item_paths": [
|
|
78
|
+
"^/[^/]+/[^/]+/?$"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"provider_name": "Spotify",
|
|
83
|
+
"schemes": [
|
|
84
|
+
"https://open.spotify.com/*",
|
|
85
|
+
"https://spotify.link/*"
|
|
86
|
+
],
|
|
87
|
+
"item_paths": [
|
|
88
|
+
"^/(?:track|album|playlist|episode|show|artist)/[A-Za-z0-9]+/?$"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"provider_name": "TikTok",
|
|
93
|
+
"schemes": [
|
|
94
|
+
"https://www.tiktok.com/*",
|
|
95
|
+
"https://www.tiktok.com/*/video/*"
|
|
96
|
+
],
|
|
97
|
+
"item_paths": [
|
|
98
|
+
"^/@[^/]+/(?:video|photo)/\\d+/?$",
|
|
99
|
+
"^/(?:video|photo)/\\d+/?$"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"provider_name": "Vimeo",
|
|
104
|
+
"schemes": [
|
|
105
|
+
"https://vimeo.com/*",
|
|
106
|
+
"https://vimeo.com/album/*/video/*",
|
|
107
|
+
"https://vimeo.com/channels/*/*",
|
|
108
|
+
"https://vimeo.com/groups/*/videos/*",
|
|
109
|
+
"https://vimeo.com/ondemand/*/*",
|
|
110
|
+
"https://player.vimeo.com/video/*",
|
|
111
|
+
"https://vimeo.com/event/*/*"
|
|
112
|
+
],
|
|
113
|
+
"item_paths": [
|
|
114
|
+
"^/\\d{5,}/?$",
|
|
115
|
+
"^/channels/[^/]+/\\d{5,}/?$",
|
|
116
|
+
"^/video/\\d{5,}/?$"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"provider_name": "X",
|
|
121
|
+
"schemes": [
|
|
122
|
+
"https://x.com/*",
|
|
123
|
+
"https://x.com/*/status/*",
|
|
124
|
+
"https://*.x.com/*/status/*"
|
|
125
|
+
],
|
|
126
|
+
"item_paths": [
|
|
127
|
+
"^/(?:i/|[^/]+/)(?:web/)?status/\\d+/?$"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"provider_name": "YouTube",
|
|
132
|
+
"schemes": [
|
|
133
|
+
"https://*.youtube.com/watch*",
|
|
134
|
+
"https://*.youtube.com/v/*",
|
|
135
|
+
"https://youtu.be/*",
|
|
136
|
+
"https://*.youtube.com/playlist?list=*",
|
|
137
|
+
"https://youtube.com/playlist?list=*",
|
|
138
|
+
"https://*.youtube.com/shorts*",
|
|
139
|
+
"https://youtube.com/shorts*",
|
|
140
|
+
"https://*.youtube.com/embed/*",
|
|
141
|
+
"https://*.youtube.com/live*",
|
|
142
|
+
"https://youtube.com/live*"
|
|
143
|
+
],
|
|
144
|
+
"item_paths": [
|
|
145
|
+
"^/watch$",
|
|
146
|
+
"^/playlist$",
|
|
147
|
+
"^/(?:shorts|live|embed|v)/[\\w-]{6,}/?$",
|
|
148
|
+
"^/[\\w-]{6,}/?$"
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
@@ -1,13 +1,39 @@
|
|
|
1
|
+
import { OEMBED_PROVIDER_PLATFORMS } from "./oembed-providers.js";
|
|
2
|
+
/**
|
|
3
|
+
* Platforms without suitable single-post schemes in the oEmbed provider registry.
|
|
4
|
+
* Mastodon is handled separately because every instance has its own hostname.
|
|
5
|
+
*/
|
|
6
|
+
const CUSTOM_SOCIAL_PLATFORMS = [
|
|
7
|
+
{
|
|
8
|
+
name: "Threads",
|
|
9
|
+
host: /^(?:(?:www|m|mobile)\.)?threads\.(?:net|com)$/i,
|
|
10
|
+
post: /^https?:\/\/(?:(?:www|m|mobile)\.)?threads\.(?:net|com)\/@[\w.]+\/post\/[\w-]+(?:[/?#]|$)/i,
|
|
11
|
+
kind: "social",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "Facebook",
|
|
15
|
+
host: /^(?:(?:www|m|mobile)\.)?facebook\.com$/i,
|
|
16
|
+
post: {
|
|
17
|
+
test: value => /^https?:\/\/(?:(?:www|m|mobile)\.)?facebook\.com\/(?:[^/?#]+\/)?(?:posts|activity|photos|videos|permalink|watch|reel|share)\b/i.test(value) ||
|
|
18
|
+
/^https?:\/\/(?:(?:www|m|mobile)\.)?facebook\.com\/(?:photo|permalink|story)\.php\?(?:[^#]*&)?(?:fbid|story_fbid|v)=/i.test(value) ||
|
|
19
|
+
/^https?:\/\/(?:(?:www|m|mobile)\.)?facebook\.com\/[^#]*[?&](?:story_fbid|v)=/i.test(value),
|
|
20
|
+
},
|
|
21
|
+
kind: "social",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "X",
|
|
25
|
+
host: /^(?:(?:www|m|mobile)\.)?twitter\.com$/i,
|
|
26
|
+
post: /^https?:\/\/(?:(?:www|m|mobile)\.)?twitter\.com\/(?:i\/|[\w]+\/)(?:web\/)?status\/\d+/i,
|
|
27
|
+
kind: "social",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* The platforms whose posts become a marked link (`data-media` + `data-source`).
|
|
32
|
+
* A fixture in `test/fixtures/content/social-embeds` shows the expected result.
|
|
33
|
+
*/
|
|
1
34
|
export const SOCIAL_PLATFORMS = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
{ name: "TikTok", host: /^tiktok\.com$/, post: /\/(?:video|photo)\/\d+/, kind: "social" },
|
|
5
|
-
{ name: "Bluesky", host: /^bsky\.app$/, post: /^\/profile\/[^/]+\/post\/[\w]+/, kind: "social" },
|
|
6
|
-
{ name: "Threads", host: /^threads\.(?:net|com)$/, post: /^\/@[\w.]+\/post\/[\w-]+/, kind: "social" },
|
|
7
|
-
{ name: "Reddit", host: /^reddit\.com$/, post: /^\/r\/\w+\/comments\//, kind: "social" },
|
|
8
|
-
{ name: "Facebook", host: /^facebook\.com$/, post: /\/(?:posts|videos|photos|permalink|watch|reel|share)\b|[?&](?:story_fbid|v)=/, kind: "social" },
|
|
9
|
-
{ name: "Spotify", host: /^open\.spotify\.com$/, post: /^\/(?:track|album|playlist|episode|show|artist)\/\w+/, kind: "audio" },
|
|
10
|
-
{ name: "SoundCloud", host: /^soundcloud\.com$/, post: /^\/[^/]+\/[^/]+/, kind: "audio" },
|
|
35
|
+
...OEMBED_PROVIDER_PLATFORMS,
|
|
36
|
+
...CUSTOM_SOCIAL_PLATFORMS,
|
|
11
37
|
];
|
|
12
38
|
/** Classes of the blockquote placeholders that the platforms' scripts turn into the real post. */
|
|
13
39
|
export const SOCIAL_QUOTE = "blockquote.instagram-media, blockquote.twitter-tweet, blockquote.tiktok-embed, blockquote.bluesky-embed, " +
|