Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.on("end", function() {
// Embed metadata
if(settings.get('embedMetadata') && spotifyMetadata !== null) {
const rainbow = require('./rainbowWrapper');
rainbow.embedMetadata(fileName, spotifyMetadata.spotifyId);
}
log.info('YTDownload', 'Download complete for ' + youtubeMetadata.link);
resolve({
code: 200,
message: 'Download complete'
});
})
.saveToFile(fileName);
constructor(path) {
this.path = path;
this.metadata = {};
// note that this instance of the bot is created ONLY for pulling its team
// string and metadata. this instance is not actually used in battles.
Log.info('trying to require path:' + path);
const It = require(path);
this.bot = new It.default(); // eslint-disable-line
// metadata location
try {
const pkg = path + '/package.json';
this.metadata = require(pkg);
} catch (e) {
// nested try-catch, u mad brah?
try {
this.metadata = this.bot.meta;
} catch (x) {
Log.error('No metadata found! Expected to find the file in node_path '
+ path);
}
}
let searchVideosByQuery = (query) => {
log.info('YTSearch', 'Recieved search parameters - ' + query);
var apiParams = {
part: 'snippet',
maxResults: 10,
q: query,
key: 'AIzaSyBVqWn_4aUZnAtJXSTyg-WRevZrRK3ctPE',
type: 'video',
topicId: '/m/04rlf'
}
return new Promise(function(resolve, reject) {
axios.get('https://www.googleapis.com/youtube/v3/search?' + querystring.stringify(apiParams)).then(response => {
try {
var result = response.data;
// crunch the results into a meaningfull JSON object
.then(server => {
const port = server.address().port;
console.log(log);
log.info("Commuter server listening on port " + port);
})
.catch((e: Error) => {
.then(server => {
const port = server.address().port;
log.info("Commuter server listening on port " + port);
})
.catch((e: Error) => {