Compare commits

..

No commits in common. "6c37eb674290e9806d776b548018698066591df7" and "538e606cf5aa4b491888be2b96229747f47b4d27" have entirely different histories.

6 changed files with 28 additions and 52 deletions

1
app.js
View file

@ -5,6 +5,7 @@ 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.2", "version": "0.3.1",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "node ./bin/www" "start": "node ./bin/www"

View file

@ -88,6 +88,7 @@ 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) {
@ -99,22 +100,17 @@ 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 (req.query.advanced === 'false' && (format.vcodec === 'none' || format.acodec === 'none')) if (format.vcodec === 'none' || format.acodec === 'none')
return; return;
let note = `${format.width}x${format.height}`; i++;
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) {

9
routes/users.js Normal file
View file

@ -0,0 +1,9 @@
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,35 +1,3 @@
<!DOCTYPE html> <h1><%= message %></h1>
<html class="has-background-grey-dark" lang="en"> <h2><%= error.status %></h2>
<head> <pre><%= error.stack %></pre>
<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,14 +65,16 @@ 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>
<label for="advanced" class="checkbox"> <div class="field has-addon">
<input class="checkbox" type="checkbox" name="advanced" id="advanced" title="Advanced" onclick="CheckFormat()"> <div class="control">
Advanced (Prone to errors!) </div>
</label> <div class="control">
</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">
@ -249,7 +251,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}&advanced=${document.getElementById("advanced").checked}`, true); xhttp.open("get", `/format?url=${url.href}`, 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);