Compare commits

..

5 commits

Author SHA1 Message Date
6c37eb6742 version bump 2021-06-13 16:03:02 +02:00
05617a73cd remove user route 2021-06-13 16:02:55 +02:00
f1d7b8453f advanced settings for format 2021-06-13 16:02:46 +02:00
da356b70ff actual error page 2021-06-13 16:02:27 +02:00
f97314ab02 removed useless user route 2021-06-13 16:01:59 +02:00
6 changed files with 52 additions and 28 deletions

1
app.js
View file

@ -5,7 +5,6 @@ var cookieParser = require('cookie-parser');
var logger = require('morgan'); var logger = require('morgan');
var indexRouter = require('./routes/index'); var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var app = express(); var app = express();

View file

@ -1,6 +1,6 @@
{ {
"name": "jeff-downloader2", "name": "jeff-downloader2",
"version": "0.3.1", "version": "0.3.2",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "node ./bin/www" "start": "node ./bin/www"

View file

@ -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) {

View file

@ -1,9 +0,0 @@
var express = require('express');
var router = express.Router();
/* GET users listing. */
router.get('/', function(req, res, next) {
res.send('respond with a resource');
});
module.exports = router;

View file

@ -1,3 +1,35 @@
<h1><%= message %></h1> <!DOCTYPE html>
<h2><%= error.status %></h2> <html class="has-background-grey-dark" lang="en">
<pre><%= error.stack %></pre> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta property="og:type" content="website">
<meta property="og:title" content="<%= error.status%>" />
<meta property="og:description" content="A simple video downloader without any ad or tracking." />
<meta property="og:url" content="https://namejeff.xyz/" />
<meta property="og:image" content="https://namejeff.xyz/asset/jeff.png" />
<meta name="theme-color" content="#3b2ccf" />
<link rel="icon" href="/asset/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="asset/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="stylesheets/index.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
<title><%= error.status%></title>
</head>
<body class="has-text-light gradientBG">
<section class="section has-text-centered">
<div class="container">
<img src="https://http.cat/<%= error.status %>">
</div>
</div>
</section>
<footer class="footer has-background-grey-dark has-text-light has-text-centered">
<p>Uses SponsorBlock API from <a href="https://sponsor.ajay.app/">https://sponsor.ajay.app/</a></p>
<p>I don't take any accountability for downloads made using this website.</p>
<p>Credit to <a href="https://github.com/rg3/youtube-dl/">youtube-dl</a> - My other projects <a href="https://discordapp.com/oauth2/authorize?client_id=377563711927484418&scope=bot&permissions=0">Haha yes</a> & <a href="https://twitter.com/YTPB5k">YTP twitter bot</a> - Contact <a href="https://discord.gg/cNRh5JQ">Supositware#1616</a> on Discord if you have any issues</p>
<p>You can also support me either on <a href="https://www.paypal.me/supositware">Paypal</a> Or by tipping <a href="https://basicattentiontoken.org/">BAT</a> on this website!</p>
<p><a href="https://git.namejeff.xyz/Supositware/jeff-downloader">Source code</a></p>
</footer>
</body>
</html>

View file

@ -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>
<label for="advanced" class="checkbox">
<input class="checkbox" type="checkbox" name="advanced" id="advanced" title="Advanced" onclick="CheckFormat()">
Advanced (Prone to errors!)
</label>
</div> </div>
</div> </div>
<br>
<div class="field has-addon">
<div class="control">
</div>
<div class="control">
</div>
</div>
<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);