20 Commits

Author SHA1 Message Date
7f6f74f50b 1.5.4 2018-03-21 23:43:29 +01:00
c569c0beca 1.5.3 2017-10-08 23:21:55 +02:00
6a3d4820c1 Auto stash before merge of "dev" and "origin/dev" 2017-10-01 16:09:10 +02:00
Luca Jäntsch
3d5d5320bd 1.5.2 2017-10-01 16:09:10 +02:00
43fa503dcf Rebase 2017-10-01 16:08:04 +02:00
82d2cc5bd6 Update tampermonkey_plugin.js 2017-10-01 03:09:48 +02:00
1155acf718 Update router.js 2017-09-27 09:05:10 +02:00
d4041906be Update README.md 2017-09-24 21:03:53 +02:00
47be7ec8ca 1.5.1.2 rel 2017-09-23 19:46:51 +02:00
526d60720e 1.5.1.1 rel 2017-09-23 18:57:05 +02:00
b371613f55 Merge branch 'dev' 2017-09-23 18:39:13 +02:00
92511a8457 1.5.1.1 2017-09-23 18:15:08 +02:00
46435b7e52 1.5.1 2017-09-23 17:19:11 +02:00
bc7901a69f Merge branch 'dev' into 'master'
1.5.0

See merge request !1
2017-09-11 00:44:03 +02:00
a2848a9ee3 1.5 2017-09-11 00:42:29 +02:00
a317a880ae 1.5 d 2017-09-11 00:10:12 +02:00
50c8ccd6b7 1.5 c 2017-09-10 23:35:38 +02:00
42e12189a4 1.5 b 2017-09-10 21:37:02 +02:00
bb905111ec 1.4.1 Alpha 2017-09-08 00:06:24 +02:00
12db3c4599 1.4.0 Alpha 2017-08-28 23:44:48 +02:00
40 changed files with 28941 additions and 663 deletions

7
.gitignore vendored
View File

@@ -66,3 +66,10 @@ src/lib/youtube-dl*
node_modules node_modules
out out
*.exe *.exe
inst
*.mp4
*.mp3
*.part
*.ytdl
*.webm

View File

@@ -1,7 +1,29 @@
# electron-simple-youtube-downloader # Cyb3r Downloader
![./current-preview.PNG](./current-preview.PNG) ![./current-preview.PNG](./current-preview.PNG)
# Download 1.5.1 release
So I've changed a lot from 1.5.1, not program technically but for the install process and a bit the design
The starter is a batch file, you have to keep it open to run it :( but you can minimize it.
For the browser script located in "browser_out" or [Link](https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader/blob/master/browser_out/tampermonkey_plugin.js) in the repo you can use it with "tampermonkey". Create a new script and copy & paste the source code in. Now if you are on YT in the navbar is a new button.
[Download](https://cl.thee.moe/index.php/s/Z5YvrlHaPfvEdbu)
> 24.09.2017 Fixed Installer
## Install Process
Checks if node is installed, if not it downloads it for you and you have only to click throu the installer, after that it will continue with the normal process.
# Download 1.5
At the moment it have a few bugs. If you find some talk to me and I will list them here and fix it as soon as possible
or if you have an git account just add them in the issues tab. [Issues](https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader/issues)
[Download](https://cl.thee.moe/index.php/s/hd9ILsF2etPoa6r)
# v 1.4.0 Alpha # v 1.4.0 Alpha

View File

@@ -0,0 +1,61 @@
// ==UserScript==
// @name Cyber Downloader ADD
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @require http://code.jquery.com/jquery-latest.js
// @require https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js
// @match https://www.youtube.com/watch?v=*
// @grant none
// ==/UserScript==
var css = `
<style>.notifyjs-corner {
top: 57px !important;
z-index: 99999;
}</style>
<button id="cb3_send" style="
background-color: transparent;
color: #FFF;
border: none;
cursor: pointer;
"><yt-iconx style=" display: inline-flex;
-ms-flex-align: center;
transform: rotate(180deg);
-webkit-align-items: center;
align-items: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
position: relative;
vertical-align: middle;
fill: var(--iron-icon-fill-color, currentcolor);
stroke: none;
width: var(--iron-icon-width, 24px);
height: var(--iron-icon-height, 24px);
margin-right: var(--iron-icon_-_margin-right);
width: var(--iron-icon_-_width, var(--iron-icon-width, 24px));
height: var(--iron-icon_-_height, var(--iron-icon-height, 24px));
margin-bottom: var(--iron-icon_-_margin-bottom);" class="style-scope ytd-button-renderer"><svg viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet" class="style-scope yt-icon" style="pointer-events: none; display: block; width: 100%; height: 100%;"><g class="style-scope yt-icon">
<path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" class="style-scope yt-icon"></path>
</g></svg>
</yt-iconx> Send To Cyber</button>
`;
(function() {
'use strict';
var s = jQuery.noConflict();
console.log('loaded');
setTimeout(function(){
s('#end').prepend(css);
},1000);
// Your code here...
s('body').delegate('#cb3_send','click',function(){
var sy = window.location;
s.notify("Start Download", "info");
s.post( "http://127.0.0.1:54167/download?url="+encodeURI(sy),function() {
});
});
})();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 155 KiB

18358
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
{ {
"name": "cyb3r-youtube-downloader", "name": "cyb3r-downloader",
"productName": "cyb3r-youtube-downloader", "productName": "cyb3r-downloader",
"version": "1.0.0", "version": "1.5.0",
"description": "My Electron application description", "description": "Cyb3r_Downloader",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {
"start": "electron-forge start", "start": "electron-forge start",
@@ -12,7 +12,7 @@
}, },
"keywords": [], "keywords": [],
"author": "theen", "author": "theen",
"license": "MIT", "license": "GPL",
"config": { "config": {
"forge": { "forge": {
"make_targets": { "make_targets": {
@@ -28,10 +28,19 @@
] ]
}, },
"electronPackagerConfig": { "electronPackagerConfig": {
"packageManager": "npm" "packageManager": "npm",
"win32metadata": {
"ProductName": "Cyb3r_Downloader",
"CompanyName": "Thee.moe"
},
"version-string": {
"ProductName": "Cyb3r_Downloader",
"CompanyName": "Thee.moe"
}
}, },
"electronWinstallerConfig": { "electronWinstallerConfig": {
"name": "cyb3r_youtube_downloader", "name": "Cyb3r_Downloader",
"packageName": "Cyb3r_Downloader",
"icon": "app.ico" "icon": "app.ico"
}, },
"electronInstallerDebian": {}, "electronInstallerDebian": {},
@@ -41,30 +50,23 @@
"name": "https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader" "name": "https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader"
}, },
"windowsStoreConfig": { "windowsStoreConfig": {
"packageName": "", "packageName": "Cyb3r_Downloader",
"name": "cyb3ryoutubedownloader" "name": "Cyb3r_Downloader"
} }
} }
}, },
"dependencies": { "dependencies": {
"electron": "^1.6.11", "body-parser": "^1.17.2",
"electron-compile": "^6.4.1", "cors": "^2.8.4",
"fs": "0.0.1-security", "electron": "^1.7.6",
"mkdirp": "^0.5.1", "electron-config": "^1.0.0",
"path": "^0.12.7", "express": "^4.15.4",
"request": "^2.81.0", "fs": "0.0.1-security",
"unzip": "^0.1.11", "mkdirp": "^0.5.1",
"watchr": "^3.0.1" "node-id3": "0.0.10",
}, "path": "^0.12.7",
"devDependencies": { "request": "^2.81.0",
"babel-plugin-transform-async-to-generator": "^6.24.1", "unzip": "^0.1.11",
"babel-preset-env": "^1.6.0", "watchr": "^3.0.1"
"babel-preset-react": "^6.24.1", }
"electron-prebuilt-compile": "1.6.11",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.1.0"
}
} }

BIN
src/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -1,29 +1,51 @@
const shared = require(global.__dirname + '/../js/shared');
$(function() { $(function() {
const Config = require('electron-config');
const config = new Config();
const sys = require('sys');
const exec = require('child_process').exec;
var download_progress = $('#download-progress'); var download_progress = $('#download-progress');
var format = null; var format = "mp3";
if (typeof config.get('format') !== 'undefined') {
format = config.get('format');
}
var path = "";
if (typeof config.get('path') !== 'undefined') {
path = config.get('path');
}
var out = $('#output'); var out = $('#output');
var video = document.getElementById('video'); var video = document.getElementById('video');
const ipcRenderer = require('electron').ipcRenderer; const ipcRenderer = require('electron').ipcRenderer;
const request = require('request'); const request = require('request');
const helper = require('./../../helper/string'); const helper = require('./../../helper/string');
const helperx = require('./../../controller/webLoader/router');
var shell = require('electron').shell;
//open links externally by default
$(document).on('click', 'a[href^="http"]', function(event) {
event.preventDefault();
shell.openExternal(this.href);
});
const { const {
dialog dialog
} = require('electron').remote; } = require('electron').remote;
var cache = {}; var cache = {};
var path = "";
var pot = false; var pot = false;
ipcRenderer.send('watchr_event', {}); ipcRenderer.send('watchr_event', {});
ipcRenderer.on('play-in-Window',function(event,arg){ ipcRenderer.on('play-in-Window', function(event, arg) {
pot = arg.do; pot = arg.do;
}) })
ipcRenderer.on('watchr_file', function(event, arg) { ipcRenderer.on('watchr_file', function(event, arg) {
arg.file = encodeURI(arg.file) arg.file = encodeURI(arg.file)
if (arg.type === "add") { if (arg.type === "add") {
$('#watchr_files').append('<div class="row-flex file" data-file="' + arg.file + '"><div class="flex-btn"><button class="play-file btn btn-success" data-file="' + 'file://' + arg.file + '"><i class="fa fa-play-circle-o" aria-hidden="true"></i></button></div><div class="cont">' + arg.file + '</div></tr>') $('#watchr_files').append('<div class="row-flex file" data-file="' + arg.file + '"><div class="flex-btn"><button class="play-file btn btn-success" data-file="' + 'file://' + arg.file + '"><i class="fa fa-play-circle-o" aria-hidden="true"></i></button></div><div class="cont">' + decodeURI(arg.file) + '</div></tr>')
} else if (arg.type === "remove") { } else if (arg.type === "remove") {
$('.file[data-file="' + arg.file + '"]').remove(); $('.file[data-file="' + arg.file + '"]').remove();
} }
@@ -43,7 +65,7 @@ $(function() {
console.log('DOWNLOADED') console.log('DOWNLOADED')
console.log(arg); // prints "pong" console.log(arg); // prints "pong"
$('.media-out-' + arg.id).html('<button class="play-file" data-file="' + 'file://' + path + '/' + encodeURI(cache[arg.id]) + '.' + format + '">Play</button>'); $('.media-out-' + arg.id).html('<button style="color: #FFF !important;text-shadow: #000000 0px 0px 9px;cursor: pointer;" class="btn btn-link play-file" data-file="' + 'file://' + path + '/' + encodeURI(helper.replace(cache[arg.id])) + '.' + format + '"><i class="fa fa-2x fa-play-circle-o" aria-hidden="true"></i></button>');
//var video = document.getElementById('video'); //var video = document.getElementById('video');
//$('#body-' + arg.id).append('<audio src="file://' + path + '/' + cache[arg.id] + '.'+format+'" controls="true"/>'); //$('#body-' + arg.id).append('<audio src="file://' + path + '/' + cache[arg.id] + '.'+format+'" controls="true"/>');
}); });
@@ -51,25 +73,34 @@ $(function() {
path = dialog.showOpenDialog({ path = dialog.showOpenDialog({
properties: ['openDirectory'] properties: ['openDirectory']
})[0]; })[0];
config.set('path', path);
console.log(path) console.log(path)
ipcRenderer.send('setPath', { ipcRenderer.send('setPath', {
path: path path: path
}); });
}) })
$('#pot').click(function(){ $('#pot').click(function() {
ipcRenderer.send('open-pot', { ipcRenderer.send('open-pot', {});
});
}); });
$('body').delegate('.play-file', 'click', function(e) { $('body').delegate('.play-file', 'click', function(e) {
if(pot === false){
//exec(getCommandLine() + ' "' + decodeURI(e.currentTarget.dataset.file.split('file://')[1])+'"');
if (pot === false) {
video.setAttribute("src", e.currentTarget.dataset.file); video.setAttribute("src", e.currentTarget.dataset.file);
video.play(); video.play();
}else{ } else {
ipcRenderer.send('pot_run', {file:e.currentTarget.dataset.file}); ipcRenderer.send('pot_run', {
file: e.currentTarget.dataset.file
});
} }
}) })
$('body').delegate('#navigota li', 'click', function() {
console.log('TEST')
$('#togmenu').click();
})
$('body').delegate('.format', 'click', function(e) { $('body').delegate('.format', 'click', function(e) {
format = e.currentTarget.dataset.format; format = e.currentTarget.dataset.format;
config.set('format', format);
ipcRenderer.send('set-format', { ipcRenderer.send('set-format', {
format: e.currentTarget.dataset.format format: e.currentTarget.dataset.format
}); });
@@ -80,7 +111,20 @@ $(function() {
if (url.match('crunchyroll')) { if (url.match('crunchyroll')) {
var video_id = Math.floor(Date.now() / 1000); var video_id = Math.floor(Date.now() / 1000);
$('<div class="media" ><div class="media-left"><a href="#"><img id="img-' + video_id + '" width="128" class="media-object" src="' + '" alt="..."></a></div><div class="media-body" id="body-' + video_id + '"><h4 class="media-heading">' + url + '</h4> Author: ' + '<div class="progress"><div class="progress-bar" id="download-progress-' + video_id + '" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">0%</div></div><div class="media-out-' + video_id + '"></div></div></div>').prependTo('#output'); $(`
<div class="media">
<img id="img-` + video_id + `" class="d-flex align-self-start mr-3" src="..." alt="Generic placeholder image">
<div class="media-body" id="body-` + video_id + `">
<h5 class="mt-0">` + url + `</h5>
Author: ` + `
<div class="progress">
<div class="progress-bar"id="download-progress-` + video_id + `" role="progressbar" style="width: 0%; height: 20px;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="media-out-` + video_id + `" style=" color: #FFF !important;
text-shadow: #454545 1px 1px 1px;
margin: auto;"></div>
</div>
</div>`).prependTo('#output');
ipcRenderer.send('start-download', { ipcRenderer.send('start-download', {
url: $('#url').val(), url: $('#url').val(),
id: video_id id: video_id
@@ -102,7 +146,28 @@ $(function() {
request request
.get('https://www.youtube.com/oembed?url=https://www.youtube.com/playlist?list=' + playlist_id + '&format=json', function(err, httpResponse, body) { .get('https://www.youtube.com/oembed?url=https://www.youtube.com/playlist?list=' + playlist_id + '&format=json', function(err, httpResponse, body) {
var YT = JSON.parse(body); var YT = JSON.parse(body);
$('<div class="media" ><div class="media-left"><a href="#"><img id="img-' + video_id + '" width="128" class="media-object" src="' + YT.thumbnail_url + '" alt="..."></a></div><div class="media-body" id="body-' + video_id + '"><h4 class="media-heading">' + YT.title + '</h4> Playlistauthor: ' + YT.author_name + '<div class="progress"><div class="progress-bar" id="download-progress-' + video_id + '" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">0%</div></div><div class="media-out-' + video_id + '"></div></div></div>').prependTo('#output'); $(
`<div class="media">
<div class="d-flex alogn-self-start mr-3" style="
background:url(` + YT.thumbnail_url + `);
width: 189px;
height: 104px;
background-size: 189px;
background-position: 0px -18px;
">
<div class="media-out-` + video_id + `" style=" color: #FFF !important;
text-shadow: #454545 1px 1px 1px;
margin: auto;"></div>
</div>
<div class="media-body" id="body-` + video_id + `">
<h5 class="mt-0">` + YT.title + `</h5>
Author: ` + YT.author_name + `
<div class="progress">
<div class="progress-bar"id="download-progress-` + video_id + `" role="progressbar" style="width: 0%; height: 20px;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="media-out-` + video_id + `"></div>
</div>
</div>`).prependTo('#output');
cache[video_id] = YT.title; cache[video_id] = YT.title;
ipcRenderer.send('start-download-pl', { ipcRenderer.send('start-download-pl', {
url: $('#url').val(), url: $('#url').val(),
@@ -114,11 +179,35 @@ $(function() {
request request
.get('https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=' + video_id + '&format=json', function(err, httpResponse, body) { .get('https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=' + video_id + '&format=json', function(err, httpResponse, body) {
var YT = JSON.parse(body); var YT = JSON.parse(body);
$('<div class="media" ><div class="media-left"><a href="#"><img id="img-' + video_id + '" width="128" class="media-object" src="' + YT.thumbnail_url + '" alt="..."></a></div><div class="media-body" id="body-' + video_id + '"><h4 class="media-heading">' + YT.title + '</h4> Author: ' + YT.author_name + '<div class="progress"><div class="progress-bar" id="download-progress-' + video_id + '" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">0%</div></div><div class="media-out-' + video_id + '"></div></div></div>').prependTo('#output'); $(
`<div class="media">
<div class="d-flex alogn-self-start mr-3" style="
background:url(` + YT.thumbnail_url + `);
width: 189px;
height: 104px;
background-size: 189px;
background-position: 0px -18px;
">
<div class="media-out-` + video_id + `" style=" color: #FFF !important;
text-shadow: #454545 1px 1px 1px;
margin: auto;"></div>
</div>
<div class="media-body" id="body-` + video_id + `">
<h5 class="mt-0">` + YT.title + `</h5>
Author: ` + YT.author_name + `
<div class="progress">
<div class="progress-bar"id="download-progress-` + video_id + `" role="progressbar" style="width: 0%; height: 20px;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>`
).prependTo('#output');
cache[video_id] = YT.title; cache[video_id] = YT.title;
ipcRenderer.send('start-download', { ipcRenderer.send('start-download', {
url: $('#url').val(), url: $('#url').val(),
id: video_id id: video_id,
title: helper.replace(YT.title)
}); });
}) })
} }
@@ -127,4 +216,24 @@ $(function() {
} }
}) })
$('#close').click(function() {
console.log('TEST')
ipcRenderer.send('winHide', {
});
})
function getCommandLine() {
switch (process.platform) {
case 'darwin':
return 'open';
case 'win32':
return 'start';
case 'win64':
return 'start';
default:
return 'xdg-open';
}
}
}) })

View File

@@ -1,3 +1,4 @@
const shared = require(global.__dirname+'/../js/shared');
$(function() { $(function() {
const ipcRenderer = require('electron').ipcRenderer; const ipcRenderer = require('electron').ipcRenderer;
ipcRenderer.send('pot_real_open', {x:"xx"}); ipcRenderer.send('pot_real_open', {x:"xx"});
@@ -20,6 +21,4 @@ $(function() {
$('body').on( "mouseenter",function () { $('body').on( "mouseenter",function () {
$('.navbar').css('opacity',"1") $('.navbar').css('opacity',"1")
}); });
}) })

13
src/app/js/shared.js Normal file
View File

@@ -0,0 +1,13 @@
var shared = {};
var test = "";
shared.setLog = (text)=>{
test = text;
}
shared.log = ()=>{
console.log(test);
}
module.exports = shared;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

5
src/app/libs/popper.min.js vendored Normal file

File diff suppressed because one or more lines are too long

9150
src/app/style/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
#time span, #volume span {
background-color: #ffffff;
position: absolute;
top: 0;
left: 0;
height: 10px;
width: 0px;
}
#time {
cursor: pointer;
height: 10px;
margin-bottom: 10px;
outline: thin solid #ffffff;
overflow: hidden;
position: relative;
width: 100%;
vertical-align: -webkit-baseline-middle;
line-height: 1.42857143;
height: 9px;
display: inline-block;
top: 13px;
}
#volume {
cursor: pointer;
height: 10px;
margin-bottom: 10px;
outline: thin solid #ffffff;
overflow: hidden;
position: relative;
width: 200px;
vertical-align: -webkit-baseline-middle;
line-height: 1.42857143;
height: 9px;
display: inline-block;
top: 13px;
}
.btn-success {
color: #fff;
background-color: #f8f8f8;
border-color: #111;
transition: all .3s;
}

View File

@@ -2,7 +2,7 @@
cursor: pointer; cursor: pointer;
height: 10px; height: 10px;
margin-bottom: 10px; margin-bottom: 10px;
outline: thin solid #FFF; outline: thin solid #1D1D1D;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
width: 100%; width: 100%;
@@ -17,7 +17,7 @@
cursor: pointer; cursor: pointer;
height: 10px; height: 10px;
margin-bottom: 10px; margin-bottom: 10px;
outline: thin solid #FFF; outline: thin solid #1D1D1D;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
width: 200px; width: 200px;
@@ -29,7 +29,7 @@
} }
#time span, #volume span { #time span, #volume span {
background-color: #FFF; background-color: #1D1D1D;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;

View File

@@ -1 +1 @@
body{margin:0;margin-top:50px;background:#111;color:#f8f8f8}.btn-success{color:#f8f8f8;background-color:#111;border-color:#f8f8f8;transition:all .3s}.btn-success.active,.btn-success:active,.btn-success:focus,.btn-success:hover,.dropdown-toggle:active,.dropdown-toggle:focus,.open>.dropdown-toggle.btn-success{color:#111!important;background-color:#f8f8f8!important;border-color:#f8f8f8!important;transition:all .3s}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{text-decoration:none;color:#f8f8f8;background-color:#111}.dropdown-menu{background-color:#111}span.input-group-btn.open>ul>li>a{background-image:none}.progress{background-image:none;background-color:#111;box-shadow:inset 0 0 3px 0 #f8f8f8}.progress-bar{background-image:none;background-color:#111;box-shadow:inset 0 0 12px 0 #f8f8f8;transition:.3s all}.media:first-child{margin-top:15px}.media{box-shadow:0 0 6px 1px #f8f8f8}.sidebar-nav{padding:10px}.nav.nav-list a{padding:5px 10px}.nav-header{font-weight:700}.scroll{overflow-y:scroll;height:calc(100vh - 96px)}.left-playlist{box-shadow:0 0 6px 1px #f8f8f8;height:calc(100vh - 20vw - 30px)}.row-flex{word-break:break-all;width:100%;display:flex}.row-flex .flex-btn{width:50px}.row-flex .cont{width:100%} body{margin:0;margin-top:46px}.navbar{background:#111!important;color:#f8f8f8}.btn-success{color:#111;background-color:#f8f8f8;border-color:#111;transition:all .3s}.btn-success.active,.btn-success:active,.btn-success:focus,.btn-success:hover,.dropdown-toggle:active,.dropdown-toggle:focus,.open>.dropdown-toggle.btn-success{color:#f8f8f8!important;background-color:#111!important;border-color:#111!important;transition:all .3s}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{text-decoration:none;color:#111;background-color:#f8f8f8}.dropdown-menu{background-color:#f8f8f8}span.input-group-btn.open>ul>li>a{background-image:none}.media:first-child{margin-top:15px}.media{box-shadow:0 0 12px 1px rgba(105,105,105,.28);margin-top:14px}.sidebar-nav{padding:10px}.nav.nav-list a{padding:5px 10px}.nav-header{font-weight:700}.scroll{overflow-y:scroll;height:calc(100vh - 160px);margin-top:15px;box-shadow:inset 0 0 3px 2px rgba(69,69,69,.3)}.left-playlist{box-shadow:0 0 6px 1px #111;height:calc(100vh - 20vw - 30px)}.row-flex{word-break:break-all;width:100%;display:flex}.row-flex .flex-btn{width:50px}.row-flex .cont{width:100%}*{border-radius:0!important}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3);background-color:#f5f5f5}::-webkit-scrollbar{width:6px;background-color:#f5f5f5}::-webkit-scrollbar-thumb{background-color:#000}

View File

@@ -5,15 +5,19 @@
*/ */
@main-front-color : #f8f8f8; @main-front-color : #111111;
@background-color : #111111; @background-color : #F8F8F8;
@background-2ndcolor: #232323; @background-2ndcolor: #F8F8F8;
body { body {
margin: 0; margin: 0;
margin-top: 50px; margin-top: 46px;
background: @background-color; /*background: @background-color;
color:@main-front-color; color:@main-front-color;*/
}
.navbar{
background: @main-front-color !important;
color:@background-color;
} }
.btn-success { .btn-success {
color: @main-front-color; color: @main-front-color;
@@ -38,6 +42,7 @@ body {
span.input-group-btn.open > ul > li> a{ span.input-group-btn.open > ul > li> a{
background-image:none; background-image:none;
} }
/*
.progress{ .progress{
background-image:none; background-image:none;
background-color: @background-color; background-color: @background-color;
@@ -48,12 +53,13 @@ span.input-group-btn.open > ul > li> a{
background-color: @background-color; background-color: @background-color;
box-shadow: inset 0px 0px 12px 0px @main-front-color; box-shadow: inset 0px 0px 12px 0px @main-front-color;
transition: .3s all; transition: .3s all;
} }*/
.media:first-child { .media:first-child {
margin-top: 15px; margin-top: 15px;
} }
.media { .media {
box-shadow: 0px 0px 6px 1px @main-front-color; box-shadow: 0 0 12px 1px rgba(105, 105, 105, 0.28);
margin-top: 14px;
} }
.sidebar-nav { .sidebar-nav {
padding: 10px; padding: 10px;
@@ -63,14 +69,14 @@ span.input-group-btn.open > ul > li> a{
} }
.nav-header { .nav-header {
font-weight: bold; font-weight: bold;
} }
.scroll{ .scroll {
overflow-y: scroll; overflow-y: scroll;
height: ~"calc( 100vh - 96px)"; height: ~"calc(100vh - 160px)";
margin-top: 15px;
box-shadow: inset 0px 0px 3px 2px rgba(69, 69, 69, 0.3);
} }
.left-playlist{ .left-playlist{
box-shadow: 0px 0px 6px 1px @main-front-color; box-shadow: 0px 0px 6px 1px @main-front-color;
height: ~"calc(100vh - 20vw - 30px )"; height: ~"calc(100vh - 20vw - 30px )";
@@ -86,3 +92,22 @@ span.input-group-btn.open > ul > li> a{
width:100%; width:100%;
} }
} }
*{
border-radius: 0px !important;
}
*::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
*::-webkit-scrollbar
{
width: 6px;
background-color: #F5F5F5;
}
*::-webkit-scrollbar-thumb
{
background-color: #000000;
}

View File

@@ -14,192 +14,194 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title></title> <title></title>
<style> <style>
body { body {
margin: 0; margin: 0;
background: #333; background: #333;
} }
@keyframes arrow-spin { @keyframes arrow-spin {
100% { 100% {
transform: rotate(179deg); transform: rotate(179deg);
} }
} }
@-webkit-keyframes arrow-spin { @-webkit-keyframes arrow-spin {
100% { 100% {
-webkit-transform: rotate(179deg); -webkit-transform: rotate(179deg);
} }
} }
.psoload, .psoload,
.psoload *, .psoload *,
.psoload *:before, .psoload *:before,
.psoload *:after { .psoload *:after {
box-sizing: border-box; box-sizing: border-box;
transition: all 0.3s; transition: all 0.3s;
-webkit-transition: all 0.3s; -webkit-transition: all 0.3s;
} }
.psoload { .psoload {
position: relative; position: relative;
margin: 30px auto; margin: 30px auto;
height: 150px; height: 150px;
width: 150px; width: 150px;
} }
.psoload .straight, .psoload .straight,
.psoload .curve { .psoload .curve {
position: absolute; position: absolute;
top: 17.5%; top: 17.5%;
left: 17.5%; left: 17.5%;
width: 65%; width: 65%;
height: 65%; height: 65%;
border-radius: 100%; border-radius: 100%;
animation: arrow-spin 0.85s cubic-bezier(0.2, 0.8, 0.9, 0.1) infinite; animation: arrow-spin 0.85s cubic-bezier(0.2, 0.8, 0.9, 0.1) infinite;
-webkit-animation: arrow-spin 0.85s cubic-bezier(0.2, 0.8, 0.9, 0.1) infinite; -webkit-animation: arrow-spin 0.85s cubic-bezier(0.2, 0.8, 0.9, 0.1) infinite;
} }
.psoload .straight:before, .psoload .straight:before,
.psoload .straight:after { .psoload .straight:after {
content: ''; content: '';
position: absolute; position: absolute;
width: 15%; width: 15%;
border-bottom: 3px solid #eee; border-bottom: 3px solid #eee;
transform: rotate(45deg); transform: rotate(45deg);
-webkit-transform: rotate(45deg); -webkit-transform: rotate(45deg);
} }
.psoload .straight:before { .psoload .straight:before {
top: 5px; top: 5px;
left: 5px; left: 5px;
} }
.psoload .straight:after { .psoload .straight:after {
bottom: 5px; bottom: 5px;
right: 5px; right: 5px;
} }
.psoload .curve:before, .psoload .curve:before,
.psoload .curve:after { .psoload .curve:after {
content: ''; content: '';
position: absolute; position: absolute;
width: 45px; width: 45px;
height: 10px; height: 10px;
border: solid 3px transparent; border: solid 3px transparent;
border-top-color: #eee; border-top-color: #eee;
border-radius: 50%/10px 10px 0 0; border-radius: 50%/10px 10px 0 0;
z-index: 90001; z-index: 90001;
} }
.psoload .curve:before { .psoload .curve:before {
transform: rotate(-63deg) translateX(-27px) translateY(-4px); transform: rotate(-63deg) translateX(-27px) translateY(-4px);
-webkit-transform: rotate(-63deg) translateX(-27px) translateY(-4px); -webkit-transform: rotate(-63deg) translateX(-27px) translateY(-4px);
} }
.psoload .curve:after { .psoload .curve:after {
bottom: 5px; bottom: 5px;
right: 5px; right: 5px;
transform: rotate(115deg) translateX(-26px) translateY(-12px); transform: rotate(115deg) translateX(-26px) translateY(-12px);
-webkit-transform: rotate(115deg) translateX(-26px) translateY(-12px); -webkit-transform: rotate(115deg) translateX(-26px) translateY(-12px);
} }
.psoload .center { .psoload .center {
position: absolute; position: absolute;
top: 20%; top: 20%;
left: 20%; left: 20%;
width: 60%; width: 60%;
height: 60%; height: 60%;
border-radius: 100%; border-radius: 100%;
border: 3px solid #eee; border: 3px solid #eee;
} }
.psoload .inner { .psoload .inner {
position: absolute; position: absolute;
top: 25%; top: 25%;
left: 25%; left: 25%;
width: 50%; width: 50%;
height: 50%; height: 50%;
border-radius: 100%; border-radius: 100%;
animation: arrow-spin 0.85s cubic-bezier(0.2, 0.8, 0.9, 0.1) infinite reverse; animation: arrow-spin 0.85s cubic-bezier(0.2, 0.8, 0.9, 0.1) infinite reverse;
-webkit-animation: arrow-spin 0.85s cubic-bezier(0.2, 0.8, 0.9, 0.1) infinite reverse; -webkit-animation: arrow-spin 0.85s cubic-bezier(0.2, 0.8, 0.9, 0.1) infinite reverse;
} }
.psoload .inner:before, .psoload .inner:before,
.psoload .inner:after { .psoload .inner:after {
content: ''; content: '';
position: absolute; position: absolute;
width: 0; width: 0;
height: 0; height: 0;
border: 6px solid transparent; border: 6px solid transparent;
border-bottom-width: 11px; border-bottom-width: 11px;
border-bottom-color: #eee; border-bottom-color: #eee;
} }
.psoload .inner:before { .psoload .inner:before {
top: 12px; top: 12px;
left: 12px; left: 12px;
transform: rotate(128deg); transform: rotate(128deg);
-webkit-transform: rotate(128deg); -webkit-transform: rotate(128deg);
} }
.psoload .inner:after { .psoload .inner:after {
bottom: 12px; bottom: 12px;
right: 12px; right: 12px;
transform: rotate(-48deg); transform: rotate(-48deg);
-webkit-transform: rotate(-48deg); -webkit-transform: rotate(-48deg);
} }
.progress{
height:10px;
}
.progress .progress-bar{
height:5px;
width:30px;
background-color:#FFF;
content:"";
} .progress {
height: 10px;
}
.progress .progress-bar {
height: 5px;
width: 30px;
background-color: #FFF;
content: "";
}
</style> </style>
</head> </head>
<body> <body>
<div class="psoload"> <div class="psoload">
<div class="straight"></div> <div class="straight"></div>
<div class="curve"></div> <div class="curve"></div>
<div class="center"></div> <div class="center"></div>
<div class="inner"></div> <div class="inner"></div>
</div> </div>
<iframe id="coub" src="https://coub.com/embed/ulak9?muted=false&autostart=true&originalSize=false&startWithHD=false" allowfullscreen="true" frameborder="0" width="320" height="180"></iframe><script async src="https://c-cdn.coub.com/embed-runner.js"></script> <iframe id="coub" src="https://coub.com/embed/ulak9?muted=false&autostart=true&originalSize=false&startWithHD=false" allowfullscreen="true" frameborder="0" width="320" height="180"></iframe>
<script async src="https://c-cdn.coub.com/embed-runner.js"></script>
<hr/> <hr/>
<div class="progress"> <div class="progress">
<div class="progress-bar" id="main"></div> <div class="progress-bar" id="main"></div>
<div class="progress-bar" id="single"></div> <div class="progress-bar" id="single"></div>
</div> </div>
<script> <script>
$(function(){ $(function() {
var start = [ var start = [
"whbex", "whbex",
"wf0jb", "wf0jb",
"ulak9", "ulak9",
"wcmxa", "wc5e2",
"wc5e2" "xza2z"
]; ];
var x = Math.floor(Math.random()*start.length) var x = Math.floor(Math.random() * start.length)
$('#coub').attr('src','https://coub.com/embed/'+start[x]+'?muted=false&autostart=true&originalSize=false&startWithHD=false') $('#coub').attr('src', 'https://coub.com/embed/' + start[x] + '?muted=false&autostart=true&originalSize=false&startWithHD=false')
const ipcRenderer = require('electron').ipcRenderer; const ipcRenderer = require('electron').ipcRenderer;
ipcRenderer.send('download-lib', {}); ipcRenderer.send('download-lib', {});
ipcRenderer.on('progress', function(event, arg) { ipcRenderer.on('progress', function(event, arg) {
console.log(arg); // prints "pong" console.log(arg); // prints "pong"
$('#single').css("width",arg.percent+"%"); $('#single').css("width", arg.percent + "%");
}).on('fin-loading',function(event,arg){ }).on('fin-loading', function(event, arg) {
$('#main').css("width","100%"); $('#main').css("width", "100%");
setTimeout(function(){ setTimeout(function() {
ipcRenderer.send('start-full', {}); ipcRenderer.send('start-full', {});
},1000) }, 1000)
}) })
}) })
</script> </script>
</body> </body>
</html> </html>

View File

@@ -2,103 +2,219 @@
<html> <html>
<head> <head>
<script> <script>
if (typeof module === 'object') { if (typeof module === 'object') {
window.module = module; window.module = module;
module = undefined; module = undefined;
} }
</script> </script>
<script src="./../libs/jquery/jquery-3.2.1.min.js"></script> <script src="./../libs/jquery/jquery-3.2.1.min.js"></script>
<script src="./../libs/bootstrap/js/bootstrap.js"></script> <script src="./../libs/popper.min.js"></script>
<script src="./../js/player.js"></script> <script src="./../libs/bootstrap/bootstrap.min.js"></script>
<meta charset="utf-8"> <script src="./../js/player.js"></script>
<title>Cyb3r Downloader</title> <meta charset="utf-8">
<link rel="stylesheet" href="./../libs/bootstrap/css/bootstrap.css" /> <title>Cyb3r Downloader</title>
<link rel="stylesheet" href="./../libs/bootstrap/css/bootstrap-theme.css" /> <link rel="stylesheet" href="./../libs/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="./../libs/font-awesome/css/font-awesome.min.css" /> <link rel="stylesheet" href="./../libs/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="./../style/progress.css" /> <link rel="stylesheet" href="./../style/bootstrap.min.css" />
<link rel="stylesheet" href="./../style/style.css" /> <link rel="stylesheet" href="./../style/style.css" />
<link rel="stylesheet" href="./../style/player.css" /> <link rel="stylesheet" href="./../style/player.css" />
</head> </head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="collapse" id="navigota" style=" position: fixed; top: 56px; left: 0px;z-index: 999999;">
<div class="col-md-2"> <div class="bg-dark p-4">
<div class="sidebar-nav"> <div class="list-group" role="tablist" id="">
<ul class="nav nav-tabs nav-pills nav-stacked" role="tablist"> <li role="presentation" class="list-group-item list-group-item-action"><a href="#download" aria-controls="download" role="tab" data-toggle="tab">Download</a></li>
<li role="presentation" class="active"><a href="#download" aria-controls="download" role="tab" data-toggle="tab">Download</a></li> <li role="presentation" class="list-group-item list-group-item-action"><a href="#player" aria-controls="player" role="tab" data-toggle="tab">Player</a></li>
<li role="presentation"><a href="#player" aria-controls="player" role="tab" data-toggle="tab">Player</a></li> <li role="presentation" class="list-group-item list-group-item-action"><a href="#wt" aria-controls="wt" role="tab" data-toggle="tab">Watch Together</a></li>
</ul> <li role="presentation" class="list-group-item list-group-item-action"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">Info</a></li>
</div>
</div>
</div>
</div>
<nav class="navbar fixed-top navbar-dark bg-dark justify-content-between" style="-webkit-app-region: drag">
<button id="togmenu" style="-webkit-app-region: no-drag;" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navigota" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand">Cyb3r Downloader</a>
<form class="form-inline">
<button class="btn btn-outline-success my-2 my-sm-0" id="close" style="-webkit-app-region: no-drag;">X</button>
</form>
</nav>
<div class="row">
<div class="col-md-2" style="display:none">
<div class="list-group" role="tablist">
<li role="presentation" class="list-group-item list-group-item-action"><a href="#download" aria-controls="download" role="tab" data-toggle="tab">Download</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#player" aria-controls="player" role="tab" data-toggle="tab">Player</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#wt" aria-controls="wt" role="tab" data-toggle="tab">Watch Together</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">Info</a></li>
</div>
</div>
<div class="col-md-12">
<div style="max-width:380px;margin:auto;margin-bottom:25px;">
<div style=" margin: 0;
padding: 0;
height: 35px;
display: flex;
position: fixed;
bottom: 0;
width: 100%;
left: 0;
background-color: #f1f1f1;
box-shadow: 0px -1px 8px 4px rgba(69, 69, 69, 0.18);
z-index:99999999;
">
<button class="btn nabbar-btn btn-link" style="margin:0;" id="play"><i class="fa fa-pause-circle-o" aria-hidden="true"></i></button>
<div id="time">
<span></span>
</div> </div>
<div class="col-md-6"> <button class="btn nabbar-btn btn-link" style="margin:0;"><i class="fa fa-volume-up" aria-hidden="true"></i></button>
<div class="tab-content"> <div id="volume">
<div role="tabpanel" class="tab-pane fade in active" id="download"> <span></span>
<input id="business" type="file" style="display: none" />
<div class="row">
<div class="col-md-12">
<div class="input-group input-group-lg">
<span class="input-group-btn">
<button id="party" class="very-sweet-looking btn btn-success btn-sm">Select Folder</button>
</span>
<input type="text" class="form-control input-sm" maxlength="128" id="url" placeholder="YT-Url" />
<span class="input-group-btn">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Format <span class="caret"></span>
</button>
<ul class="dropdown-menu" id="format">
<li><a href="#" class="format" data-format="mp3">MP3</a></li>
<li role="separator" class="divider"></li>
<li><a href="#" class="format" data-format="mp4">MP4</a></li>
</ul>
</span>
<span class="input-group-btn">
<button type="button" id="start-download" class="btn btn-success btn-sm">Download</button>
</span>
</div>
</div>
</div>
<div class="row scroll">
<div class="col-md-12" id="output">
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="player">
<div class="row">
<div class="col-md-12">
<div id="watchr_files">
</div>
</div>
</div>
</div>
</div>
</div> </div>
<div class="col-md-4"> <button class="btn nabbar-btn btn-link" id="pot" style="margin:0;"><i class="fa fa-window-restore" aria-hidden="true"></i></button>
</div>
</div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="download">
<input id="business" type="file" style="display: none" />
<div class="row">
<div class="col-md-12">
<div class="input-group">
<span class="input-group-btn">
<button id="party" class="btn btn-secondary" type="button">Select Folder</button>
</span>
<input type="text" class="form-control" id="url" placeholder="YT-Url" aria-label="Product name">
<span class="input-group-btn">
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Format
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item format" href="#" data-format="mp3">MP3</a>
<a class="dropdown-item format" href="#" data-format="vorbis">OGG</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item format" href="#" data-format="mp4">MP4</a>
</div>
</div>
</span>
<span class="input-group-btn">
<button class="btn btn-secondary" type="button" id="start-download">Download</button>
</span>
</div>
</div>
</div>
<div class="row scroll">
<div class="col-md-12" id="output">
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="player">
<div class="row">
<div class="col-md-12">
<div class="embed-responsive embed-responsive-16by9"> <div class="embed-responsive embed-responsive-16by9">
<video id="video"></video> <video id="video"></video>
</div> </div>
<div style=" margin: 0; padding: 0; height: 35px; display:flex;"> <div id="watchr_files">
<button class="btn nabbar-btn btn-success" style="margin:0;" id="play"><i class="fa fa-pause-circle-o" aria-hidden="true"></i></button>
<div id="time">
<span></span>
</div>
<button class="btn nabbar-btn btn-success" style="margin:0;"><i class="fa fa-volume-up" aria-hidden="true"></i></button>
<div id="volume">
<span></span>
</div>
<button class="btn navbar-btn btn-success" id="pot" style="margin:0;"><i class="fa fa-window-restore" aria-hidden="true"></i></button>
</div> </div>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="wt">
<div class="row">
<div class="col-md-12">
<div class="input-group">
<input type="text" class="form-control" id="webview-url" placeholder="www..." aria-label="Product name">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button" id="webviewload">-></button>
<button class="btn btn-secondary" type="button" id="webviewdownload">Cyb3r Download</button>
</span>
</div>
<webview id="foo" src="https://youtube.com/" style="display:inline-flex; width:100%; height:calc(100vh - 144px)"></webview>
</div>
<script>
$(function(){
require('remote').getCurrentWindow().toggleDevTools();
const webview = document.querySelector('webview')
const indicator = document.querySelector('.indicator')
const loadstart = () => {
}
const loadstop = () => {
$('#webview-url').val(webview.getURL());
}
$('#webviewload').click(()=>{
var url = $('#webview-url').val();
webview.loadURL(url)
})
$('#webviewdownload').click(()=>{
var url = $('#webview-url').val();
$.post( "http://127.0.0.1:54167/download?url="+encodeURI(url),function() {
});
})
webview.addEventListener('did-start-loading', loadstart)
webview.addEventListener('did-stop-loading', loadstop)
});
</script>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="info">
<div class="row">
<div class="col-md-12">
<h1>Info</h1>
<a href="https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader" target="_blank">Git</a>
<div id="rss">
</div>
<script>
/*
$(()=>{
$.get( "https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader/commits/master?format=atom", function( data ) {
$xml = $( data ),
$title = $xml.find( "title" );
console.log($xml)
$('#rss').html(data.toString());
alert( "Load was performed." );
});
})
*/
</script>
</div>
</div>
</div>
</div>
</div>
<!--<div class="col-md-4">
<div class="left-playlist"> <div class="left-playlist">
</div> </div>
</div> </div>-->
</div>
</div> </div>
<script src="./../js/app.js"></script> </div>
<script src="./../js/app.js"></script>
<script>
document.addEventListener("keydown", function(e) {
if (e.which === 123) {
} else if (e.which === 116) {
location.reload();
}
});
</script>
</body> </body>
</html> </html>

View File

@@ -20,6 +20,7 @@
<link rel="stylesheet" href="./../style/progress.css" /> <link rel="stylesheet" href="./../style/progress.css" />
<link rel="stylesheet" href="./../style/style.css" /> <link rel="stylesheet" href="./../style/style.css" />
<link rel="stylesheet" href="./../style/player.css" /> <link rel="stylesheet" href="./../style/player.css" />
<link rel="stylesheet" href="./../style/player-controls.css" />
<style> <style>
video { video {
max-width: 100%; max-width: 100%;

View File

@@ -0,0 +1,109 @@
const request = require('request');
// https://vivo.sx/46b5f0d914
var vivo = (url,cb)=>{
request('https://vivo.sx/76aa530aac', function(error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
//console.log('body:', body); // Print the HTML for the Google homepage.
var html = body;
var bse64 = html.split('Core.InitializeStream (\'')[1].split('\');')[0];
console.log(bse64)
var arr = eval(Base64.decode(bse64));
console.log(arr[0])
cb(arr[0]);
});
}
module.exports = vivo;
var Base64 = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function(e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
i = e.charCodeAt(f++);
s = n >> 2;
o = (n & 3) << 4 | r >> 4;
u = (r & 15) << 2 | i >> 6;
a = i & 63;
if (isNaN(r)) {
u = a = 64
} else if (isNaN(i)) {
a = 64
}
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a)
}
return t
},
decode: function(e) {
var t = "";
var n, r, i;
var s, o, u, a;
var f = 0;
e = e.replace(/[^A-Za-z0-9+/=]/g, "");
while (f < e.length) {
s = this._keyStr.indexOf(e.charAt(f++));
o = this._keyStr.indexOf(e.charAt(f++));
u = this._keyStr.indexOf(e.charAt(f++));
a = this._keyStr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r)
}
if (a != 64) {
t = t + String.fromCharCode(i)
}
}
t = Base64._utf8_decode(t);
return t
},
_utf8_encode: function(e) {
e = e.replace(/rn/g, "n");
var t = "";
for (var n = 0; n < e.length; n++) {
var r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r)
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128)
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128)
}
}
return t
},
_utf8_decode: function(e) {
var t = "";
var n = 0;
var r = c1 = c2 = 0;
while (n < e.length) {
r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
n++
} else if (r > 191 && r < 224) {
c2 = e.charCodeAt(n + 1);
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
n += 2
} else {
c2 = e.charCodeAt(n + 1);
c3 = e.charCodeAt(n + 2);
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
n += 3
}
}
return t
}
}

View File

@@ -7,20 +7,20 @@ const fs = require('fs');
var crunch = {}; var crunch = {};
crunch.session_save = (session)=>{ crunch.session_save = (session) => {
var net = `# Netscape HTTP Cookie File\n var net = `# Netscape HTTP Cookie File\n
# http://curl.haxx.se/rfc/cookie_spec.html\n # http://curl.haxx.se/rfc/cookie_spec.html\n
# This is a generated file! Do not edit.\n\n`; # This is a generated file! Do not edit.\n\n`;
var old_exp = 0; var old_exp = 0;
for(var i = 0;i<session.length;i++){ for (var i = 0; i < session.length; i++) {
if(typeof session[i].expirationDate == 'undefined'){ if (typeof session[i].expirationDate == 'undefined') {
session[i].expirationDate = old_exp; session[i].expirationDate = old_exp;
} }
if(session[i].expirationDate>old_exp){ if (session[i].expirationDate > old_exp) {
old_exp = session[i].expirationDate; old_exp = session[i].expirationDate;
} }
net += session[i].domain+' '+session[i].httpOnly.toString().toUpperCase()+' '+session[i].path+' '+session[i].secure.toString().toUpperCase()+' '+Math.ceil(session[i].expirationDate)+' '+session[i].name+' '+session[i].value+'\n'; net += session[i].domain + ' ' + session[i].httpOnly.toString().toUpperCase() + ' ' + session[i].path + ' ' + session[i].secure.toString().toUpperCase() + ' ' + Math.ceil(session[i].expirationDate) + ' ' + session[i].name + ' ' + session[i].value + '\n';
} }
//console.log(net); //console.log(net);
/*fs.writeFile(global.dir+"/tmp/c", net, function(err) { /*fs.writeFile(global.dir+"/tmp/c", net, function(err) {

View File

@@ -1,138 +1,188 @@
const request = require('request'); const request = require('request');
const fs = require('fs') const fs = require('fs')
const ipcMain = require('electron').ipcMain; const ipcMain = require('electron').ipcMain;
const unzip = require('unzip') const unzip = require('unzip');
const {
spawn
} = require('child_process');
var libsx = { var libsx = {
"ffmpeg":"ffmpeg", "ffmpeg": "ffmpeg",
"ffplay":"ffplay", "ffplay": "ffplay",
"ffprobe":"ffprobe", "ffprobe": "ffprobe",
"youtube-dl":"youtube-dl" "youtube-dl": "youtube-dl"
} }
var libs = {}; var libs = {};
libs.listen = null; libs.listen = null;
libs.libs = null; libs.libs = null;
ipcMain ipcMain
.on('download-lib', (event, arg)=>{ .on('download-lib', (event, arg) => {
console.log('TEST') console.log('TEST')
libs.listen = event; libs.listen = event;
console.log(`This platform is ${process.platform}`); console.log(`This platform is ${process.platform}`);
switch (process.platform) { switch (process.platform) {
case "win32": case "win32":
for (var lib in libsx) { for (var lib in libsx) {
libsx[lib] = libsx[lib]+'.exe'; libsx[lib] = libsx[lib] + '.exe';
}
break;
default:
}
for (var lib in libsx) {
if (fs.existsSync(global.dir+"/lib/"+libsx[lib])) {
}else{
libsx[lib] = null;
}
}
libs.libs = libsx;
if(libsx['ffmpeg'] === null || libsx['ffplay'] === null || libsx['ffprobe'] === null ){
var z = 0;
var url = libs.ff(process.platform);
if(url === ''){
libs.checkNext('youtube-dl');
}else{
libs.download(url,"ffmpeg",function(data,file){
fs.createReadStream(file)
.pipe(unzip.Parse())
.on('entry', function (entry) {
var fileName = entry.path;
var type = entry.type; // 'Directory' or 'File'
var size = entry.size;
console.log(fileName)
if (fileName === "ffmpeg-latest-win32-static/bin/ffmpeg.exe" || fileName === "ffmpeg-latest-win32-static/bin/ffprobe.exe" || fileName === "ffmpeg-latest-win32-static/bin/ffplay.exe") {
entry.pipe(fs.createWriteStream(global.dir+'/lib/'+fileName.split('/')[2]));
console.log('TEST')
z++;
if(z == 3){
libs.checkNext('youtube-dl');
} }
} else { break;
entry.autodrain(); default:
} }
});
}); for (var lib in libsx) {
} if (fs.existsSync(global.dir + "/lib/" + libsx[lib])) {
}else{
libs.checkNext('youtube-dl'); } else {
} libsx[lib] = null;
console.dir(libsx); }
}) }
libs.checkNext = (nxt)=>{ libs.libs = libsx;
if( libs.libs['youtube-dl'] === null ){ if (libsx['ffmpeg'] === null || libsx['ffplay'] === null || libsx['ffprobe'] === null) {
libs.yt_dl(process.platform,function(){ var z = 0;
var url = libs.ff(process.platform);
if (url === '') {
libs.checkNext('youtube-dl');
} else {
switch (process.platform) {
case "win32":
libs.download(url, "ffmpeg", function(data, file) {
fs.createReadStream(file)
.pipe(unzip.Parse())
.on('entry', function(entry) {
var fileName = entry.path;
var type = entry.type; // 'Directory' or 'File'
var size = entry.size;
console.log(fileName)
if (fileName === "ffmpeg-latest-win32-static/bin/ffmpeg.exe" || fileName === "ffmpeg-latest-win32-static/bin/ffprobe.exe" || fileName === "ffmpeg-latest-win32-static/bin/ffplay.exe") {
entry.pipe(fs.createWriteStream(global.dir + '/lib/' + fileName.split('/')[2]));
console.log('TEST')
z++;
if (z == 3) {
libs.checkNext('youtube-dl');
}
} else {
entry.autodrain();
}
});
});
break;
case "linux":
libs.download(url, "ffmpeg", function(data, file) {
const ls = spawn('tar', ['xvf', './src/tmp/ffmpeg.x-xz', '-C', './src/tmp']);
ls.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
ls.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
ls.on('close', (code) => {
var folder = "";
console.log(`child process exited with code ${code}`);
const ls = spawn('rm', ['./src/tmp/ffmpeg.x-xz']).on('close', () => {
const ls = spawn('ls', ['./src/tmp/']).stdout.on(data, (data) => {
console.log(data)
if (data.match('ffmpeg-') && data.match('-static')) {
folder = data;
}
}).on('close', () => {
const ls = spawn('cp', ['./src/tmp/' + folder + '/ffmpeg', './src/lib/ffmpeg']).on('close', () => {
const ls = spawn('cp', ['./src/tmp/' + folder + '/ffprobe', './src/lib/ffprobe']).on('close', () => {
libs.checkNext('youtube-dl');
});
});
});
});
});
})
break;
default:
}
}
} else {
libs.checkNext('youtube-dl');
}
console.dir(libsx);
})
libs.checkNext = (nxt) => {
if (libs.libs['youtube-dl'] === null) {
libs.yt_dl(process.platform, function() {
libs.startFull(); libs.startFull();
}); });
}else{ } else {
libs.startFull(); libs.startFull();
} }
} }
libs.startFull = ()=>{ libs.startFull = () => {
libs.listen.sender.send('fin-loading',{}); libs.listen.sender.send('fin-loading', {});
} }
libs.ff = (os)=>{ libs.ff = (os) => {
var url = ""; var url = "";
switch (os) { switch (os) {
case "win32": case "win32":
url = 'http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.zip'; url = 'http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.zip';
break; break;
case "linux": case "linux":
url = '' url = 'https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz'
default: default:
} }
return url; return url;
} }
libs.yt_dl = (os,cb)=>{ libs.yt_dl = (os, cb) => {
var url = ""; var url = "";
switch (os) { switch (os) {
case "win32": case "win32":
url = 'https://yt-dl.org/downloads/2017.08.13/youtube-dl.exe'; url = 'https://yt-dl.org/downloads/2017.08.13/youtube-dl.exe';
libs.download(url,"youtube-dl",function(data,file){ libs.download(url, "youtube-dl", function(data, file) {
fs.renameSync(file,global.dir+'/lib/youtube-dl.exe'); fs.renameSync(file, global.dir + '/lib/youtube-dl.exe');
cb(); cb();
}) })
break; break;
case "linux": case "linux":
url = '' url = 'https://yt-dl.org/downloads/latest/youtube-dl'
cb(); libs.download(url, "youtube-dl", function(data, file) {
fs.renameSync(file, global.dir + '/lib/youtube-dl');
cb();
})
default: default:
} }
} }
libs.download = (url,data,cb)=>{ libs.download = (url, data, cb) => {
var r = request(url); var r = request(url);
var actual = 1; var actual = 1;
var full = 100; var full = 100;
var perc = 0; var perc = 0;
r.on('data', function (chunk) { r.on('data', function(chunk) {
actual += chunk.length; actual += chunk.length;
perc = actual / full * 100; perc = actual / full * 100;
console.log(perc); console.log(perc);
libs.listen.sender.send('progress',{percent :Math.floor(perc)}); libs.listen.sender.send('progress', {
percent: Math.floor(perc)
});
}); });
r.on('response', function (res) { r.on('response', function(res) {
res.pipe(fs.createWriteStream(global.dir+'/tmp/' + data + '.' + res.headers['content-type'].split('/')[1])); res.pipe(fs.createWriteStream(global.dir + '/tmp/' + data + '.' + res.headers['content-type'].split('/')[1]));
full = res.headers[ 'content-length' ] ; full = res.headers['content-length'];
res.on('end', function () { res.on('end', function() {
cb(data,global.dir+'/tmp/' + data + '.' + res.headers['content-type'].split('/')[1]); cb(data, global.dir + '/tmp/' + data + '.' + res.headers['content-type'].split('/')[1]);
}) })
}); });
} }
function win_ffmpeg() {
}
module.exports = libs; module.exports = libs;

View File

@@ -1,4 +1,6 @@
const { exec } = require('child_process'); const {
exec
} = require('child_process');
var install = {}; var install = {};
@@ -6,48 +8,50 @@ var install = {};
install.init = (cb)=>{ install.init = (cb) => {
var url = [ var url = [
['ffmpeg','https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz'], ['ffmpeg', 'https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz'],
['youtube-dl' ,'https://yt-dl.org/downloads/latest/youtube-dl'] ['youtube-dl', 'https://yt-dl.org/downloads/latest/youtube-dl']
] ]
var download = (i)=>{ var download = (i) => {
install.download(url[i],function(path){ install.download(url[i], function(path) {
switch (i) { switch (i) {
case 0: case 0:
shell. shell.
break; break;
default: default:
} }
if(i<url.length-1){ if (i < url.length - 1) {
download(i++); download(i++);
}else{ } else {
cb(); cb();
} }
}) })
}; };
download(0) download(0)
} }
install.download = (url,cb) =>{ install.download = (url, cb) => {
var r = request(url); var r = request(url);
var actual = 1; var actual = 1;
var full = 100; var full = 100;
var perc = 0; var perc = 0;
r.on('data', function (chunk) { r.on('data', function(chunk) {
actual += chunk.length; actual += chunk.length;
perc = actual / full * 100; perc = actual / full * 100;
console.log(perc); console.log(perc);
libs.listen.sender.send('progress',{percent :Math.floor(perc)}); libs.listen.sender.send('progress', {
}); percent: Math.floor(perc)
r.on('response', function (res) { });
var path = global.dir+'/tmp/'+url.split('/')[url.split('/').length-1]; });
res.pipe(fs.createWriteStream( path )); r.on('response', function(res) {
full = res.headers[ 'content-length' ] ; var path = global.dir + '/tmp/' + url.split('/')[url.split('/').length - 1];
res.on('end', function () { res.pipe(fs.createWriteStream(path));
cb(path); full = res.headers['content-length'];
}) res.on('end', function() {
}); cb(path);
})
});
} }

View File

@@ -12,38 +12,43 @@ var win = null;
var pot = {}; var pot = {};
var s = null; var s = null;
var pot_open_ev = null;
ipcMain ipcMain
.on('close_pot',(event,arg)=>{ .on('close_pot', (event, arg) => {
console.log('CLOSE') console.log('CLOSE')
pot.close(event); pot.close(event);
}) })
.on('pot_run',(event,arg)=>{ .on('pot_run', (event, arg) => {
pot_open_ev.sender.send('pot_play',arg); pot_open_ev.sender.send('pot_play', arg);
}) })
.on('pot_real_open',(event,arg)=>{ .on('pot_real_open', (event, arg) => {
console.log('POT EVENT SET') console.log('POT EVENT SET')
pot_open_ev = event; pot_open_ev = event;
}) })
.on('open-pot',(event,arg)=>{ .on('open-pot', (event, arg) => {
pot.open(event); pot.open(event);
}) })
pot.isOpen = false; pot.isOpen = false;
pot.open = (e) => { pot.open = (e) => {
s = e; s = e;
if (win !== null) { if (win !== null) {
e.sender.send('play-in-Window',{do :false}); e.sender.send('play-in-Window', {
do: false
});
win.close(); win.close();
} }
var x = new playerOnTop(e); var x = new playerOnTop(e);
} }
pot.close = ()=>{ pot.close = () => {
console.log('CLOSE') console.log('CLOSE')
s.sender.send('play-in-Window',{do :false}); s.sender.send('play-in-Window', {
do: false
});
win.close(); win.close();
} }
@@ -59,21 +64,25 @@ class playerOnTop {
alwaysOnTop: true, alwaysOnTop: true,
icon: global.dir + '/app.ico' icon: global.dir + '/app.ico'
}) })
e.sender.send('play-in-Window',{do :true}); e.sender.send('play-in-Window', {
do: true
});
win = this.win; win = this.win;
win.loadURL(`file://${global.dir}/app/view/pot.html`) win.loadURL(`file://${global.dir}/app/view/pot.html`)
win.once('ready-to-show', () => { win.once('ready-to-show', () => {
win.show(); win.show();
}) })
win.on('resize', function () { win.on('resize', function() {
setTimeout(function () { setTimeout(function() {
var size = win.getSize(); var size = win.getSize();
win.setSize(size[0], parseInt(size[0] * 9 / 16)); win.setSize(size[0], parseInt(size[0] * 9 / 16));
}, 0); }, 0);
}); });
win.on('closed', () => { win.on('closed', () => {
pot.isOpen = false; pot.isOpen = false;
e.sender.send('play-in-Window',{do :false}); e.sender.send('play-in-Window', {
do: false
});
win = null; win = null;
}); });
} }

47
src/controller/tray.js Normal file
View File

@@ -0,0 +1,47 @@
const {
app,
Menu,
Tray
} = require('electron')
const main_window = require('./windows.js/main.js')
const path = require('path')
module.exports = () => {
switch (process.platform) {
case 'win32':
break;
case 'linux':
break;
}
let tray = new Tray(path.join(global.dir + '/app.png'))
const contextMenu = Menu.buildFromTemplate([{
label: 'Open',
click() {
main_window.open()
}
},
/*{label: 'About',click() { console.log('item 1 clicked') }},
{label: 'Item1', type: 'radio'},
{type: 'separator'},
{label: 'Item2', type: 'radio'},
{label: 'Item3', type: 'radio', checked: true},*/
{
label: 'Beenden',
click() {
main_window.close();
}
},
])
tray.setToolTip('Cyb3r Downloader.')
tray.setContextMenu(contextMenu)
main_window.createWindow();
main_window.open();
return tray;
}

View File

@@ -1,14 +1,14 @@
const watchr = require('watchr'); const watchr = require('watchr');
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const ipcMain = require('electron').ipcMain; const ipcMain = require('electron').ipcMain;
var watch_event = null; var watch_event = null;
ipcMain ipcMain
.on('watchr_event', (event, arg)=>{ .on('watchr_event', (event, arg) => {
watch_event = event watch_event = event
}) })
class folderWatchr { class folderWatchr {
constructor(folder) { constructor(folder) {
@@ -20,9 +20,12 @@ class folderWatchr {
files.push(folder + '/' + file); files.push(folder + '/' + file);
}); });
for(var i = 0;i<files.length;i++){ for (var i = 0; i < files.length; i++) {
files[i]=files[i].replace(/\\/g, "/"); files[i] = files[i].replace(/\\/g, "/");
watch_event.sender.send('watchr_file',{type:"add",file:files[i]}); watch_event.sender.send('watchr_file', {
type: "add",
file: files[i]
});
} }
function listener(changeType, fullPath, currentStat, previousStat) { function listener(changeType, fullPath, currentStat, previousStat) {
@@ -36,10 +39,16 @@ class folderWatchr {
console.log('the file', fullPath, 'was created', currentStat) console.log('the file', fullPath, 'was created', currentStat)
files.push(fullPath); files.push(fullPath);
watch_event.sender.send('watchr_file',{type:"add",file:fullPath}); watch_event.sender.send('watchr_file', {
type: "add",
file: fullPath
});
break; break;
case 'delete': case 'delete':
watch_event.sender.send('watchr_file',{type:"remove",file:fullPath}); watch_event.sender.send('watchr_file', {
type: "remove",
file: fullPath
});
files.splice(files.indexOf(fullPath), 1); files.splice(files.indexOf(fullPath), 1);
break; break;
} }
@@ -51,9 +60,9 @@ class folderWatchr {
} }
// Watch the path with the change listener and completion callback // Watch the path with the change listener and completion callback
this.stalker = watchr.open(this.folder , listener, next); this.stalker = watchr.open(this.folder, listener, next);
} }
destroy(){ destroy() {
this.stalker.close() this.stalker.close()
} }
} }

View File

@@ -0,0 +1,25 @@
const app = require('express')();
var cors = require('cors')
app.use(cors())
const bodyParser = require('body-parser');
app.use(bodyParser.json()); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));
app.post('/download', function(req, res) {
var log = req.query.url;
console.log(log)
// ...
$('#url').val(log);
$('#start-download').click();
res.send();
});
app.listen(54167, "127.0.0.1");
module.exports = app;

View File

@@ -1,14 +1,12 @@
const { const {
BrowserWindow, BrowserWindow,
session session
} = require('electron'); } = require('electron');
const crunch = require('./../crunchyroll') const crunch = require('./../crunchyroll')
class browser { class browser {
constructor(url){ constructor(url) {
console.log("TEST") console.log("TEST")
this.window = new BrowserWindow({ this.window = new BrowserWindow({
width: 500, width: 500,
@@ -17,12 +15,14 @@ class browser {
frame: true, frame: true,
icon: global.dir + '/app.ico' icon: global.dir + '/app.ico'
}) })
setInterval(function(){ setInterval(function() {
session.defaultSession.cookies.get({url:'http://crunchyroll.com'}, (error, cookies) => { session.defaultSession.cookies.get({
//console.log(error, cookies) url: 'http://crunchyroll.com'
crunch.session_save(cookies); }, (error, cookies) => {
//console.log(error, cookies)
crunch.session_save(cookies);
}) })
},3000) }, 3000)
var window = this.window var window = this.window
window.loadURL(url) window.loadURL(url)
window.once('ready-to-show', () => { window.once('ready-to-show', () => {
@@ -30,7 +30,7 @@ class browser {
}) })
this.window.on('closed', () => { this.window.on('closed', () => {
window = null; window = null;
}); });
} }
} }

View File

@@ -0,0 +1,47 @@
const {
app,
BrowserWindow,
Menu,
dialog,
ipcMain
} = require('electron');
var win = {};
win.win = null;
ipcMain
.on('winHide', (event, arg) => {
console.log('minimize')
win.win.minimize()
//win.win.hide()
})
win.createWindow = () => {
win.win = new BrowserWindow({
width: 1010,
height: 800,
minWidth: 1010,
minHeight: 565,
show: true,
frame: false,
icon: global.dir + '/app.ico'
})
win.win.loadURL(`file://${global.dir}/app/view/layout.html`);
win.win.show();
win.win.on('closed', () => {
//win.win = null;
});
win.win.on('close', function(event) {
});
}
win.open = () => {
win.win.restore();
}
win.close = () => {
win.win.close();
}
module.exports = win;

View File

@@ -1,8 +1,16 @@
const { spawn } = require('child_process'); const {
const ipcMain = require('electron').ipcMain; spawn
} = require('child_process');
const {
Notification,
ipcMain
} = require('electron');
const dl_routine = require('./youtube-dl.routine') const dl_routine = require('./youtube-dl.routine')
const nodeID3 = require('node-id3');
const pot = require('./player_onTop') //const web = require('./webLoader/router');
const pot = require('./player_onTop');
const folderWatchr = require('./watchr') const folderWatchr = require('./watchr')
console.log(global.dir); console.log(global.dir);
@@ -12,115 +20,189 @@ var format = "mp3";
var fol = null; var fol = null;
var pot_open_ev = null; var pot_open_ev = null;
ipcMain var request = require('request').defaults({
.on('start-download', (event, arg)=>{ encoding: null
path = orig_path
var download = new yt_dl(arg.url,arg.id);
download.addListen(event)
download.download();
})
.on('set-format',(event,arg)=>{
format = arg.format;
})
.on('start-download-pl', (event, arg)=>{
var mkdirp = require('mkdirp');
if(orig_path === ""){
path = '.'
}else{
path = orig_path
}
mkdirp(path+'/'+arg.folder, function(err) {
path = path+'/'+arg.folder;
// path exists unless there was an error
var download = new yt_dl(arg.url,arg.id);
download.addListen(event)
download.download();
});
})
.on('setPath', function(event, arg) {
path = arg.path;
orig_path = arg.path;
if(fol !== null){
fol.destroy()
}
fol = new folderWatchr(path);
console.log('SET Path: '+path)
}); });
var yt_dl = class{ var list = [];
constructor(url,id){
this.url = url ; ipcMain
.on('start-download', (event, arg) => {
path = orig_path;
if(list.length != 0){
list.push([arg,event]);
}else{
list.push([arg,event]);
var download = new yt_dl(arg.url, arg.id, arg.title);
download.addListen(event)
download.download();
}
})
.on('set-format', (event, arg) => {
format = arg.format;
})
.on('start-download-pl', (event, arg) => {
var mkdirp = require('mkdirp');
if (orig_path === "") {
path = '.'
} else {
path = orig_path
}
mkdirp(path + '/' + arg.folder, function(err) {
path = path + '/' + arg.folder;
// path exists unless there was an error
var download = new yt_dl(arg.url, arg.id);
download.addListen(event)
download.download();
});
})
.on('setPath', function(event, arg) {
path = arg.path;
orig_path = arg.path;
if (fol !== null) {
fol.destroy()
}
fol = new folderWatchr(path);
console.log('SET Path: ' + path)
});
var yt_dl = class {
constructor(url, id, title) {
this.url = url;
this.percent = 0; this.percent = 0;
this.lwrite = null; this.lwrite = null;
this.id = id; this.id = id;
this.title = title
} }
addListen(e){ addListen(e) {
this.lwrite = e this.lwrite = e
} }
status(stat){ status(stat) {
this.lwrite('download-progress', stat); this.lwrite('download-progress', stat);
} }
download(){ download() {
var log = []; var log = [];
var me = this; var me = this;
var ls; var ls;
var m = dl_routine(path,this.url,format); var m = dl_routine(path, this.url, format, this.title);
ls = spawn(m[0],m[1]); console.log('CMD: '+m[0]+' '+ m[1]);
if(path == ''){ ls = spawn(m[0], m[1]);
if (path == '') {
//ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url]); //ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url]);
}else{ } else {
//ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url,'-o',path+'/%(title)s.%(ext)s']); //ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url,'-o',path+'/%(title)s.%(ext)s']);
} }
ls.stdout.on('data', (data) => { ls.stdout.on('data', (data) => {
data = data.toString('utf8'); data = data.toString('utf8');
log.push(data); log.push(data);
//console.log(data); //console.log(data);
try{ try {
var z = data.replace(/(\r\n|\n|\r)/gm,"").split(' '); var z = data.replace(/(\r\n|\n|\r)/gm, "").split(' ');
console.log(z) console.log(z)
switch (z[0]) { switch (z[0]) {
case '[download]': case '[download]':
var percent = data.split(']')[1].split('of')[0]; var percent = data.split(']')[1].split('of')[0];
//console.log(z) //console.log(z)
me.percent = percent.trim(); me.percent = percent.trim();
me.lwrite.sender.send('download-progress',{percent :me.percent,id:me.id}); me.lwrite.sender.send('download-progress', {
break; percent: me.percent,
default: id: me.id
} });
var m = z.length; break;
for(var i = 0;i<m;i++){ default:
if(z[i] === '[ffmpeg]'){ }
if(z[i+1] === 'Merging'){ var m = z.length;
var file = ""; for (var i = 0; i < m; i++) {
for(var x = i+4;x<m;x++){ if (z[i] === '[ffmpeg]') {
console.log(z[x]) if (z[i + 1] === 'Merging') {
if(z[x] === 'has' && z[x+1] === "already" && z[x+2] === "been" && z[x+3] === 'downloaded'){ var file = "";
break; for (var x = i + 4; x < m; x++) {
} console.log(z[x])
file = z[x]; if (z[x] === 'has' && z[x + 1] === "already" && z[x + 2] === "been" && z[x + 3] === 'downloaded') {
} break;
me.lwrite.sender.send('file',{id:me.id,file:file}); }
break; file = z[x];
} }
} me.lwrite.sender.send('file', {
} id: me.id,
}catch(e){ file: file
console.log(e); });
}finally{ break;
}
}
}
} catch (e) {
console.log(e);
} finally {
} }
}); });
ls.stderr.on('data', (data) => { ls.stderr.on('data', (data) => {
console.log(`stderr: ${data}`); console.log(`stderr: ${data}`);
}); });
ls.on('close', (code) => { ls.on('close', (code) => {
console.log(`child process exited with code ${code}`); console.log(`child process exited with code ${code}`);
me.lwrite.sender.send('file',{id:me.id,file:log[log.length-2].split('[ffmpeg] Destination: ')[1]}); me.lwrite.sender.send('file', {
me.lwrite.sender.send('process-fin',{percent :me.percent,id:me.id}); id: me.id,
file: log[log.length - 2].split('[ffmpeg] Destination: ')[1]
});
me.lwrite.sender.send('process-fin', {
percent: me.percent,
id: me.id
});
list.splice(0,1);
if(list.length>0){
dl(list[0][0],list[0][1]);
}
var title = this.title;
if (this.url.match('youtube') && format === 'mp3') {
var url = this.url;
var video_id = this.url.split('v=')[1];
var ampersandPosition = video_id.indexOf('&');
if (ampersandPosition != -1) {
video_id = video_id.substring(0, ampersandPosition);
}
var fornoti = title;
if (title === "") {
fornoti = url;
}
var x = new Notification({
title: "Cyb3r Downloader",
body: "finished download for " + title,
//icon : body
})
x.show()
request.get('https://i.ytimg.com/vi/' + video_id + '/hqdefault.jpg', function(err, res, body) {
//log[log.length-2].split('[ffmpeg] Destination: ')[1]
var tags = {
image: body
}
var success = nodeID3.write(tags, path + '/' + title + '.' + format);
console.log(success);
});
}
}); });
} }
} }
function dl(arg,event){
var download = new yt_dl(arg.url, arg.id, arg.title);
download.addListen(event)
download.download();
}
module.exports = yt_dl; module.exports = yt_dl;

View File

@@ -1,30 +1,29 @@
module.exports = (path, url, format, title = "%(title)s") => {
var command = global.dir + '/lib/youtube-dl';
var param = [];
module.exports = (path,url,format)=>{
var command = global.dir+'/lib/youtube-dl';
var param = [];
console.log(url); console.log(url);
if(url.match('youtube')){ if (url.match('youtube')) {
console.log('youtube') console.log('youtube')
switch (format) { switch (format) {
case "vorbis":
param = ['-x', '-f', 'bestaudio[acodec^=opus]', '--audio-format', 'vorbis', '-i', url, '-o', path + '/'+title+'.%(ext)s'];
break;
case "mp3": case "mp3":
param = ['-x','--audio-format','mp3','-i',url,'-o',path+'/%(title)s.%(ext)s']; param = ['--audio-quality', '0','-f','bestaudio[ext=m4a]','--audio-format','mp3', url, '-o', path + '/'+title+'.%(ext)s'];
break; break;
case "mp4": case "mp4":
param = ['-w','-f','bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4',url,'-o',path+'/%(title)s.%(ext)s']; param = ['-w', '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4', url, '-o', path + '/'+title+'.%(ext)s'];
break; break;
default: default:
} }
} } else if (url.match('crunchyroll')) {
else if(url.match('crunchyroll')){
console.log('crunchyroll') console.log('crunchyroll')
param = ['--cookie', global.dir+'/tmp/c', '--all-subs', '--sub-format', 'srt', '--write-sub', '--embed-subs',url,'-o',path+'/%(title)s.%(ext)s']; param = ['--cookie', global.dir + '/tmp/c', '--all-subs', '--sub-format', 'srt', '--write-sub', '--embed-subs', url, '-o', path + '/%(title)s.%(ext)s'];
} }
return [command,param]; return [command, param];

View File

@@ -6,8 +6,10 @@ var st = {};
st.replace = (str)=>{ st.replace = (str)=>{
return sub return str
.replace(/\|/g, "_"); .replace(/\|/g, "_")
.replace(/__/g, "_");
;
} }

View File

@@ -11,53 +11,19 @@ const fs = require('fs');
const yt_dl = require('./controller/youtube-dl') const yt_dl = require('./controller/youtube-dl')
const dl = require('./controller/download'); const dl = require('./controller/download');
const browser = require('./controller/windows.js/browser'); const browser = require('./controller/windows.js/browser');
const tray = require('./controller/tray')
//const main_window = require('./controller/windows.js/main.js')
let tray_win = null;
if (!fs.existsSync(global.dir+'/tmp/inst')) { if (!fs.existsSync(global.dir+'/tmp/inst')) {
fs.writeFileSync(global.dir+'/tmp/inst',"out"); fs.writeFileSync(global.dir+'/tmp/inst',"out");
var win; app.quit();
const createWindow = () =>{
win = new BrowserWindow({
width: 320,
height: 500,
show: false,
frame: false,
icon: __dirname + '/app.ico'
})
win.once('ready-to-show', () => {
})
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
}else{ }else{
var win ; var win ;
app.getPath('documents') app.getPath('documents')
const createWindow = () =>{ const createWindow = () =>{
//dl.download(dl.ff(process.platform));
/*
win = new BrowserWindow({
width: 1010,
height: 800,
minWidth: 1010,
minHeight: 565,
show: false,
frame: true
})
*/
win = new BrowserWindow({ win = new BrowserWindow({
width: 320, width: 320,
height: 500, height: 500,
@@ -67,46 +33,27 @@ if (!fs.existsSync(global.dir+'/tmp/inst')) {
}) })
ipcMain ipcMain
.on('start-full', (event, arg)=>{ .on('start-full', (event, arg)=>{
//main_window.createWindow();
//main_window.open();
tray_win = tray();
win.close();
var win2 = new BrowserWindow({
width: 1010,
height: 800,
minWidth: 1010,
minHeight: 565,
show: true,
frame: true,
icon: __dirname + '/app.ico'
})
win.close();
//var z = new browser('http://www.crunchyroll.com/');
win2.loadURL(`file://${__dirname}/app/view/layout.html`)
win = win2;
}); });
win.loadURL(`file://${__dirname}/app/view/init.html`) win.loadURL(`file://${__dirname}/app/view/init.html`)
win.once('ready-to-show', () => { win.once('ready-to-show', () => {
win.show() win.show()
//var x = new yt_dl("https://www.youtube.com/watch?v=UbQgXeY_zi4")
//x.download();
}) })
win.on('closed', () => { win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null; win = null;
}); });
} }
app.on('ready', createWindow); app.on('ready', createWindow);
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit(); app.quit();
} }
}); });
app.on('activate', () => { app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) { if (mainWindow === null) {
createWindow(); createWindow();
} }

View File

@@ -4,28 +4,29 @@ var handleStartupEvent = function() {
console.log(process.platform); console.log(process.platform);
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
break; break;
case 'linux': case 'linux':
break; break;
default: default:
} }
if (process.platform !== 'win32') { if (process.platform !== 'win32') {
return false; return false;
} }
const exeName = path.basename(process.execPath);
var squirrelCommand = process.argv[1]; var squirrelCommand = process.argv[1];
console.log(squirrelCommand); console.log(squirrelCommand);
switch (squirrelCommand) { switch (squirrelCommand) {
case '--squirrel-updated':
case '--squirrel-install': case '--squirrel-install':
target = path.basename(process.execPath); target = path.basename(process.execPath);
updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe'); updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe');
var createShortcut = updateDotExe + ' --createShortcut=' + target + ' --shortcut-locations=Desktop,StartMenu' ; var createShortcut = updateDotExe + ' --createShortcut=' + target + ' --shortcut-locations=Desktop,StartMenu' ;
console.log (createShortcut); console.log (createShortcut);
exec(createShortcut); exec(createShortcut);
// Always quit when done spawnUpdate(['--createShortcut', exeName]);
app.quit(); app.quit();
return true; return true;
@@ -37,6 +38,7 @@ var handleStartupEvent = function() {
var createShortcut = updateDotExe + ' --removeShortcut=' + target ; var createShortcut = updateDotExe + ' --removeShortcut=' + target ;
console.log (createShortcut); console.log (createShortcut);
exec(createShortcut); exec(createShortcut);
spawnUpdate(['--removeShortcut', exeName]);
// Always quit when done // Always quit when done
app.quit(); app.quit();
return true; return true;

View File

@@ -5,15 +5,19 @@
*/ */
@main-front-color : #f8f8f8; @main-front-color : #111111;
@background-color : #111111; @background-color : #F8F8F8;
@background-2ndcolor: #232323; @background-2ndcolor: #F8F8F8;
body { body {
margin: 0; margin: 0;
margin-top: 50px; margin-top: 46px;
background: @background-color; /*background: @background-color;
color:@main-front-color; color:@main-front-color;*/
}
.navbar{
background: @main-front-color !important;
color:@background-color;
} }
.btn-success { .btn-success {
color: @main-front-color; color: @main-front-color;
@@ -38,6 +42,7 @@ body {
span.input-group-btn.open > ul > li> a{ span.input-group-btn.open > ul > li> a{
background-image:none; background-image:none;
} }
/*
.progress{ .progress{
background-image:none; background-image:none;
background-color: @background-color; background-color: @background-color;
@@ -48,12 +53,13 @@ span.input-group-btn.open > ul > li> a{
background-color: @background-color; background-color: @background-color;
box-shadow: inset 0px 0px 12px 0px @main-front-color; box-shadow: inset 0px 0px 12px 0px @main-front-color;
transition: .3s all; transition: .3s all;
} }*/
.media:first-child { .media:first-child {
margin-top: 15px; margin-top: 15px;
} }
.media { .media {
box-shadow: 0px 0px 6px 1px @main-front-color; box-shadow: 0 0 12px 1px rgba(105, 105, 105, 0.28);
margin-top: 14px;
} }
.sidebar-nav { .sidebar-nav {
padding: 10px; padding: 10px;
@@ -63,14 +69,14 @@ span.input-group-btn.open > ul > li> a{
} }
.nav-header { .nav-header {
font-weight: bold; font-weight: bold;
} }
.scroll{ .scroll {
overflow-y: scroll; overflow-y: scroll;
height: ~"calc( 100vh - 96px)"; height: ~"calc(100vh - 160px)";
margin-top: 15px;
box-shadow: inset 0px 0px 3px 2px rgba(69, 69, 69, 0.3);
} }
.left-playlist{ .left-playlist{
box-shadow: 0px 0px 6px 1px @main-front-color; box-shadow: 0px 0px 6px 1px @main-front-color;
height: ~"calc(100vh - 20vw - 30px )"; height: ~"calc(100vh - 20vw - 30px )";
@@ -86,3 +92,22 @@ span.input-group-btn.open > ul > li> a{
width:100%; width:100%;
} }
} }
*{
border-radius: 0px !important;
}
*::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
*::-webkit-scrollbar
{
width: 6px;
background-color: #F5F5F5;
}
*::-webkit-scrollbar-thumb
{
background-color: #000000;
}

View File

@@ -1,15 +0,0 @@
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file! Do not edit.
.crunchyroll.com TRUE / FALSE 1534887951 __cfduid db1426254a0b86e7ca8b70551a18644361503351951
.crunchyroll.com TRUE / FALSE 1537220753 __qca P0-1835482882-1503351953593
.crunchyroll.com TRUE / FALSE 1566942248 _ga GA1.2.1843711990.1503351953
.crunchyroll.com TRUE / FALSE 1503956648 _gid GA1.2.1726060626.1503868189
.crunchyroll.com TRUE / FALSE 1504561873 c_d p%3D1
.crunchyroll.com TRUE / FALSE 1504561873 c_userid 64927993
.crunchyroll.com TRUE / FALSE 1504561873 c_userkey 2%3AZxOX%2BsILKGFm2Nmfc6%2FX12lxWjo%3D
.crunchyroll.com TRUE / FALSE 1518903952 c_visitor 95852853-d74d-4e9c-b5ad-182b74e6f44f
.crunchyroll.com TRUE / FALSE 1503960371 cf_clearance fb4b8c534496cdfec5683c51ec28dc2e4c70e5ce-1503351970-604800
.crunchyroll.com TRUE / FALSE 1537220753 sess_id jjdcwcg0amrsbt44eviz34disrmrqd2m
.crunchyroll.com TRUE / FALSE 1537220753 session_id 2074779edf6db7782876092c0d2f03db

7
tests/player.js Normal file
View File

@@ -0,0 +1,7 @@
var MPlayer = require('mplayer');
var player = new MPlayer();
var song = 'D:/theen/git/cyb3r-youtube-downloader/___.mp3';
player.openFile(song);