mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 11:18:28 +00:00
feat(linkedin): correctly normalize and parse linkedin post urls
This commit is contained in:
parent
47d15c2592
commit
7f5a33c675
@ -25,6 +25,7 @@ import twitch from "./services/twitch.js";
|
|||||||
import rutube from "./services/rutube.js";
|
import rutube from "./services/rutube.js";
|
||||||
import dailymotion from "./services/dailymotion.js";
|
import dailymotion from "./services/dailymotion.js";
|
||||||
import loom from "./services/loom.js";
|
import loom from "./services/loom.js";
|
||||||
|
import linkedin from "./services/linkedin.js";
|
||||||
|
|
||||||
let freebind;
|
let freebind;
|
||||||
|
|
||||||
@ -193,6 +194,12 @@ export default async function(host, patternMatch, lang, obj) {
|
|||||||
id: patternMatch.id
|
id: patternMatch.id
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "linkedin":
|
||||||
|
r = await linkedin({
|
||||||
|
postId: patternMatch.id,
|
||||||
|
quality: obj.vQuality
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return createResponse("error", {
|
return createResponse("error", {
|
||||||
t: loc(lang, 'ErrorUnsupported')
|
t: loc(lang, 'ErrorUnsupported')
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
"vk": {
|
"vk": {
|
||||||
"alias": "vk video & clips",
|
"alias": "vk video & clips",
|
||||||
"patterns": ["video:userId_:videoId", "clip:userId_:videoId", "clips:duplicate?z=clip:userId_:videoId"],
|
"patterns": ["video:userId_:videoId", "clip:userId_:videoId", "clips:duplicate?z=clip:userId_:videoId"],
|
||||||
"subdomains": ["m"],
|
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"ok": {
|
"ok": {
|
||||||
@ -118,6 +117,11 @@
|
|||||||
"alias": "loom videos",
|
"alias": "loom videos",
|
||||||
"patterns": ["share/:id"],
|
"patterns": ["share/:id"],
|
||||||
"enabled": true
|
"enabled": true
|
||||||
|
},
|
||||||
|
"linkedin": {
|
||||||
|
"alias": "linkedin videos",
|
||||||
|
"patterns": ["feed/update/urn\\:li\\:activity\\:(:id)"],
|
||||||
|
"enabled": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,9 @@ export const testers = {
|
|||||||
patternMatch.postId?.length <= 12
|
patternMatch.postId?.length <= 12
|
||||||
|| (patternMatch.username?.length <= 30 && patternMatch.storyId?.length <= 24),
|
|| (patternMatch.username?.length <= 30 && patternMatch.storyId?.length <= 24),
|
||||||
|
|
||||||
|
"linkedin": (patternMatch) =>
|
||||||
|
patternMatch.id?.length === 19,
|
||||||
|
|
||||||
"loom": (patternMatch) =>
|
"loom": (patternMatch) =>
|
||||||
patternMatch.id?.length <= 32,
|
patternMatch.id?.length <= 32,
|
||||||
|
|
||||||
|
@ -70,6 +70,12 @@ function aliasURL(url) {
|
|||||||
url.hostname = 'instagram.com';
|
url.hostname = 'instagram.com';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "linkedin":
|
||||||
|
if (parts[1] === "posts") {
|
||||||
|
const postId = parts.pop().split("-").at(-2)
|
||||||
|
url = new URL(`https://linkedin.com/feed/update/urn:li:activity:${postId}`)
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
Loading…
Reference in New Issue
Block a user