mirror of
https://github.com/imputnet/cobalt.git
synced 2026-02-19 21:13:49 +00:00
api/twitter: strip "tag" param from video urls
This commit is contained in:
parent
1ad54bc13f
commit
b04e2bbde1
@ -37,9 +37,19 @@ function needsFixing(media) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bestQuality(arr) {
|
function bestQuality(arr) {
|
||||||
return arr.filter(v => v.content_type === "video/mp4")
|
return stripVideoURL(
|
||||||
|
arr.filter(v => v.content_type === "video/mp4")
|
||||||
.reduce((a, b) => Number(a?.bitrate) > Number(b?.bitrate) ? a : b)
|
.reduce((a, b) => Number(a?.bitrate) > Number(b?.bitrate) ? a : b)
|
||||||
.url
|
.url
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stripVideoURL(maybeUrl) {
|
||||||
|
if (maybeUrl) {
|
||||||
|
const url = new URL(maybeUrl);
|
||||||
|
url.searchParams.delete('tag');
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let _cachedToken;
|
let _cachedToken;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user