fix format filtering (removed dash formats)
parent
1358afe467
commit
85263995ae
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue