fix format filtering (removed dash formats)

merge-requests/5/head
Lauren Liberda 2021-03-17 22:08:39 +01:00
parent 1358afe467
commit 85263995ae
1 changed files with 3 additions and 1 deletions

View File

@ -111,7 +111,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
}
const formats = JSON.parse(document.getElementById('yt_formats').innerText)
.filter((fmt) => !['m3u8'].includes(fmt.protocol))
.filter((fmt) => ['http', 'https'].includes(fmt.protocol))
.sort((a, b) => {
if (a.vcodec === 'none' && b.vcodec !== 'none') {
return -1;
@ -129,6 +129,8 @@ window.addEventListener('DOMContentLoaded', (event) => {
console.log(formats);
const videoFormat = formats.find((fmt) => fmt.vcodec !== 'none');
const audioFormat = videoFormat.acodec === 'none' ? formats.find((fmt) => fmt.acodec !== 'none') : null;
console.log('selected video format', videoFormat);
console.log('selected audio format', audioFormat);
video.src = videoFormat.url;
if (audioFormat) {