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

View File

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