mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-22 10:46:19 +01: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
1 changed files with 1 additions and 4 deletions
|
@ -75,12 +75,9 @@ export default async function ({ id, token, shareId, h265, isAudioOnly, dispatch
|
|||
|
||||
if (!videoURL) {
|
||||
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;
|
||||
} else {
|
||||
videoURL = h264Streams[0].masterUrl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue