advanced settings for format

progress
supositware 3 years ago
parent da356b70ff
commit f1d7b8453f

@ -88,7 +88,6 @@ router.get('/status/:uuid', function (req, res ,next) {
router.get('/format', function (req, res ,next) { router.get('/format', function (req, res ,next) {
let url; let url;
let i = 0;
try { try {
url = new URL(req.query.url); url = new URL(req.query.url);
} catch (e) { } catch (e) {
@ -100,17 +99,22 @@ router.get('/format', function (req, res ,next) {
youtubedl.exec(url.href, ['--dump-json'], {}, function(err, output) { youtubedl.exec(url.href, ['--dump-json'], {}, function(err, output) {
if (err) throw err if (err) throw err
let json = JSON.parse(output); let json = JSON.parse(output);
console.log(req.query.advanced);
json.formats.forEach(format => { json.formats.forEach(format => {
if (format.vcodec === 'none' || format.acodec === 'none') if (req.query.advanced === 'false' && (format.vcodec === 'none' || format.acodec === 'none'))
return; return;
i++; let note = `${format.width}x${format.height}`;
formats.push({ext: format.ext, id: format.format_id, note: `${format.width}x${format.height}`});
if (req.query.advanced === 'true') {
note = format.format
}
formats.push({ext: format.ext, id: format.format_id, note: note});
}); });
return res.send(formats); return res.send(formats);
}); });
return;
}); });
router.post('/', async function(req, res, next) { router.post('/', async function(req, res, next) {

@ -65,16 +65,14 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
<option value="mp3">MP3</option> <option value="mp3">MP3</option>
<option value="flac">FLAC</option> <option value="flac">FLAC</option>
</select> </select>
</div>
</div>
<div class="field has-addon"> <label for="advanced" class="checkbox">
<div class="control"> <input class="checkbox" type="checkbox" name="advanced" id="advanced" title="Advanced" onclick="CheckFormat()">
</div> Advanced (Prone to errors!)
<div class="control"> </label>
</div> </div>
</div> </div>
<br>
<div class="field is-horizontal level"> <div class="field is-horizontal level">
<div class="field-body"> <div class="field-body">
<div class="field is-horizontal"> <div class="field is-horizontal">
@ -251,7 +249,7 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
console.log(encodeURI(url.href)); console.log(encodeURI(url.href));
let xhttp = new XMLHttpRequest(); let xhttp = new XMLHttpRequest();
xhttp.open("get", `/format?url=${url.href}`, true); xhttp.open("get", `/format?url=${url.href}&advanced=${document.getElementById("advanced").checked}`, true);
xhttp.send(); xhttp.send();
xhttp.addEventListener("load", function(event) { xhttp.addEventListener("load", function(event) {
console.log(event.target.responseText); console.log(event.target.responseText);

Loading…
Cancel
Save