mirror of
https://github.com/imputnet/cobalt.git
synced 2025-01-22 14:31:41 +00:00
api/xiaohongshu: deduplicate h264 stream extraction
reduce() isn't called on 1 item arrays, so this is just fine Co-authored-by: jj <log@riseup.net>
This commit is contained in:
parent
4963c9f128
commit
e39b0ae7b3
|
@ -75,12 +75,9 @@ export default async function ({ id, token, shareId, h265, isAudioOnly, dispatch
|
||||||
|
|
||||||
if (!videoURL) {
|
if (!videoURL) {
|
||||||
const h264Streams = video.media?.stream?.h264;
|
const h264Streams = video.media?.stream?.h264;
|
||||||
if (!h264Streams) return { error: "fetch.empty" };
|
|
||||||
|
|
||||||
if (h264Streams.length > 1) {
|
if (h264Streams?.length) {
|
||||||
videoURL = h264Streams.reduce((a, b) => Number(a?.videoBitrate) > Number(b?.videoBitrate) ? a : b).masterUrl;
|
videoURL = h264Streams.reduce((a, b) => Number(a?.videoBitrate) > Number(b?.videoBitrate) ? a : b).masterUrl;
|
||||||
} else {
|
|
||||||
videoURL = h264Streams[0].masterUrl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue