fix format filtering (removed dash formats)
This commit is contained in:
parent
1358afe467
commit
85263995ae
|
@ -111,7 +111,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const formats = JSON.parse(document.getElementById('yt_formats').innerText)
|
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) => {
|
.sort((a, b) => {
|
||||||
if (a.vcodec === 'none' && b.vcodec !== 'none') {
|
if (a.vcodec === 'none' && b.vcodec !== 'none') {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -129,6 +129,8 @@ window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
console.log(formats);
|
console.log(formats);
|
||||||
const videoFormat = formats.find((fmt) => fmt.vcodec !== 'none');
|
const videoFormat = formats.find((fmt) => fmt.vcodec !== 'none');
|
||||||
const audioFormat = videoFormat.acodec === 'none' ? formats.find((fmt) => fmt.acodec !== 'none') : null;
|
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;
|
video.src = videoFormat.url;
|
||||||
if (audioFormat) {
|
if (audioFormat) {
|
||||||
|
|
Loading…
Reference in a new issue