Update update.js

pull/6435/head
Aleksandr Statciuk 3 years ago
parent 95ba14bbdd
commit 25cfecbbf9

@ -133,20 +133,16 @@ function findOrigin(requests = [], origins = {}) {
} }
function parseStreams(streams) { function parseStreams(streams) {
const data = streams streams = streams.filter(s => s.codec_type === 'video')
.filter(s => s.codec_type === 'video') streams = _.orderBy(streams, ['height', 'bitrate'], ['desc', 'desc'])
.reduce(
(acc, curr) => { const data = _.head(streams)
if (curr.height > acc.height) { if (data) {
const bitrate = curr.tags.variant_bitrate ? parseInt(curr.tags.variant_bitrate) : 0 const bitrate = data.tags.variant_bitrate ? parseInt(data.tags.variant_bitrate) : 0
return { width: curr.width, height: curr.height, bitrate } return { width: data.width, height: data.height, bitrate }
} }
return acc
},
{ width: 0, height: 0, bitrate: 0 }
)
return data return {}
} }
function parseError(error) { function parseError(error) {

Loading…
Cancel
Save