Fix: Revert back to Heroku calls for youtube-dl because of Windows

This commit is contained in:
Preston 2018-03-19 19:41:21 -04:00
parent c624b7f02c
commit 1c471b5bad
2 changed files with 14 additions and 8 deletions

View File

@ -36,7 +36,7 @@
},
"electronPackagerConfig": {
"packageManager": "yarn",
"icon": "./src/icon.icns"
"icon": "./src/icons/icon.icns"
},
"electronWinstallerConfig": {
"name": "freetube",
@ -65,7 +65,6 @@
"jquery": "^3.3.1",
"mustache": "^2.3.0",
"nedb": "^1.8.0",
"opml-to-json": "0.0.3",
"youtube-dl": "^1.12.2"
"opml-to-json": "0.0.3"
}
}

View File

@ -9,7 +9,6 @@
*/
function youtubeAPI(resource, params, success) {
params.key = apiKey;
console.log(resource, params, success)
$.getJSON(
'https://www.googleapis.com/youtube/v3/' + resource,
params,
@ -17,6 +16,8 @@ function youtubeAPI(resource, params, success) {
).fail((xhr, textStatus, error) => {
showToast('There was an error calling the YouTube API.');
console.log(error);
console.log(xhr);
console.log(textStatus);
stopLoadingAnimation();
});
}
@ -30,10 +31,16 @@ function youtubeAPI(resource, params, success) {
* @return {Void}
*/
function youtubedlGetInfo(videoId, callback) {
let url = 'https://youtube.com/watch?v=' + videoId;
let options = ['--all-subs', '--geo-bypass'];
let url = 'https://stormy-inlet-41826.herokuapp.com/api/info?url=https://www.youtube.com/watch?v=' + videoId + 'flatten=True&writesubtitles=True&geo_bypass=True';
$.getJSON(url, (response) => {
callback(response.info);
});
youtubedl.getInfo(url, options, {maxBuffer: Infinity}, function(err, info) {
/*let url = 'https://youtube.com/watch?v=' + videoId;
let options = ['--all-subs'];
youtubedl.getInfo(url, options, function(err, info) {
if (err){
showToast('There was an issue calling youtube-dl.');
stopLoadingAnimation();
@ -43,5 +50,5 @@ function youtubedlGetInfo(videoId, callback) {
console.log('Success');
callback(info);
});
});*/
}