1.5.4
This commit is contained in:
parent
c569c0beca
commit
7f6f74f50b
2
.gitignore
vendored
2
.gitignore
vendored
@ -71,3 +71,5 @@ out
|
|||||||
*.mp3
|
*.mp3
|
||||||
*.part
|
*.part
|
||||||
*.ytdl
|
*.ytdl
|
||||||
|
|
||||||
|
*.webm
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
|
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
<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="mp3">MP3</a>
|
||||||
|
<a class="dropdown-item format" href="#" data-format="vorbis">OGG</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item format" href="#" data-format="mp4">MP4</a>
|
<a class="dropdown-item format" href="#" data-format="mp4">MP4</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,16 +1,21 @@
|
|||||||
const request = require('request');
|
const request = require('request');
|
||||||
|
// https://vivo.sx/46b5f0d914
|
||||||
|
|
||||||
request('https://vivo.sx/76aa530aac', function(error, response, body) {
|
var vivo = (url,cb)=>{
|
||||||
console.log('error:', error); // Print the error if one occurred
|
request('https://vivo.sx/76aa530aac', function(error, response, body) {
|
||||||
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
|
console.log('error:', error); // Print the error if one occurred
|
||||||
//console.log('body:', body); // Print the HTML for the Google homepage.
|
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
|
||||||
var html = body;
|
//console.log('body:', body); // Print the HTML for the Google homepage.
|
||||||
var bse64 = html.split('Core.InitializeStream (\'')[1].split('\');')[0];
|
var html = body;
|
||||||
console.log(bse64)
|
var bse64 = html.split('Core.InitializeStream (\'')[1].split('\');')[0];
|
||||||
var arr = eval(Base64.decode(bse64));
|
console.log(bse64)
|
||||||
console.log(arr[0])
|
var arr = eval(Base64.decode(bse64));
|
||||||
});
|
console.log(arr[0])
|
||||||
|
cb(arr[0]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = vivo;
|
||||||
|
|
||||||
var Base64 = {
|
var Base64 = {
|
||||||
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||||
|
@ -24,12 +24,20 @@ var request = require('request').defaults({
|
|||||||
encoding: null
|
encoding: null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var list = [];
|
||||||
|
|
||||||
ipcMain
|
ipcMain
|
||||||
.on('start-download', (event, arg) => {
|
.on('start-download', (event, arg) => {
|
||||||
path = orig_path
|
path = orig_path;
|
||||||
var download = new yt_dl(arg.url, arg.id, arg.title);
|
if(list.length != 0){
|
||||||
download.addListen(event)
|
list.push([arg,event]);
|
||||||
download.download();
|
}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) => {
|
.on('set-format', (event, arg) => {
|
||||||
format = arg.format;
|
format = arg.format;
|
||||||
@ -79,6 +87,7 @@ var yt_dl = class {
|
|||||||
var ls;
|
var ls;
|
||||||
|
|
||||||
var m = dl_routine(path, this.url, format, this.title);
|
var m = dl_routine(path, this.url, format, this.title);
|
||||||
|
console.log('CMD: '+m[0]+' '+ m[1]);
|
||||||
ls = spawn(m[0], m[1]);
|
ls = spawn(m[0], m[1]);
|
||||||
|
|
||||||
|
|
||||||
@ -151,10 +160,13 @@ var yt_dl = class {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
list.splice(0,1);
|
||||||
|
if(list.length>0){
|
||||||
|
dl(list[0][0],list[0][1]);
|
||||||
|
}
|
||||||
var title = this.title;
|
var title = this.title;
|
||||||
if (this.url.match('youtube')) {
|
|
||||||
|
if (this.url.match('youtube') && format === 'mp3') {
|
||||||
var url = this.url;
|
var url = this.url;
|
||||||
var video_id = this.url.split('v=')[1];
|
var video_id = this.url.split('v=')[1];
|
||||||
var ampersandPosition = video_id.indexOf('&');
|
var ampersandPosition = video_id.indexOf('&');
|
||||||
@ -187,4 +199,10 @@ var yt_dl = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
@ -5,8 +5,11 @@ module.exports = (path, url, format, title = "%(title)s") => {
|
|||||||
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+'.%(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+'.%(ext)s'];
|
param = ['-w', '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4', url, '-o', path + '/'+title+'.%(ext)s'];
|
||||||
|
Loading…
Reference in New Issue
Block a user