mirror of
https://github.com/imputnet/cobalt.git
synced 2025-12-23 08:28:52 +00:00
api/twitter: strip "tag" param from video urls
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user