Last active
November 5, 2019 04:26
-
-
Save joshbtn/dbd043c7634c7812ce526bf37b1c1938 to your computer and use it in GitHub Desktop.
quick check of yt compatible formats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//type and url dictionary | |
ytplayer.config.args.adaptive_fmts | |
.split(',') | |
.map((format) => format.split('&')) | |
.reduce((a, cv) => { | |
a[decodeURIComponent(cv[0].split("=")[1])] = decodeURIComponent(cv[1].split("=")[1]); | |
return a; | |
}, {}) | |
// All props as arrays | |
ytplayer.config.args.adaptive_fmts | |
.split(',') | |
.map((format) => format | |
.split('&') | |
.map((prop) => prop.split("=")) | |
.reduce((agr, cv) => { | |
cv.every((e, i, a) => { | |
agr[decodeURIComponent(e)] = decodeURIComponent(a[1]) | |
}); | |
return agr; | |
}, {})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment