Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
const dbUrl = `mongodb://${config.mongoUser}:${config.mongoPass}@${config.mongoUrl}/${config.mongoDb}`;
const db = await dbHelpers.initializeMongo(dbUrl);
const hook = new Webhook.Webhook(config.webhookUrl);
const sampleCategories = getRandomFromArray(categories, 100);
for (let index = 0; index < sampleCategories.length; index++) {
const category = sampleCategories[index];
try {
console.log('sample categories', index, category);
const products = await scrapeResults(category, numberOfPagesToSearch, wantSoldByAmazon, minimumAllowedNumberOfVendors, minimumPrice);
console.log('Products', products.length, category, sampleCategories.length, index);
// Insert to database
// Check if it already exists
if (products.length > 0) {
try {
for (let i = 0; i < products.length; i++) {
const product = products[i];
try {
const matches = await dbHelpers.getAllFromMongo(db, config.mongoCollection, { asin: product.asin });
let webhook = process.argv[2];
let branch = process.argv[3];
let commit = process.argv[4];
let commit_message = process.argv[5];
const whook = require("webhook-discord");
const hook = new whook.Webhook(webhook);
hook.err("Travis CI", "**Build failed tests on Windows**: " + branch + " " + commit + " " + "\"" + commit_message + "\"");
let webhook = process.argv[2];
let branch = process.argv[3];
let commit = process.argv[4];
let commit_message = process.argv[5];
const whook = require("webhook-discord");
const hook = new whook.Webhook(webhook);
hook.success("Travis CI", "**Build successfully passed tests on Linux**: " + branch + " " + commit + " " + "\"" + commit_message + "\"");
let webhook = process.argv[2];
let branch = process.argv[3];
let commit = process.argv[4];
let commit_message = process.argv[5];
const whook = require("webhook-discord");
const hook = new whook.Webhook(webhook);
hook.err("Travis CI", "**Build failed tests on Linux**: " + branch + " " + commit + " " + "\"" + commit_message + "\"");
let webhook = process.argv[2];
let branch = process.argv[3];
let commit = process.argv[4];
let commit_message = process.argv[5];
const whook = require("webhook-discord");
const hook = new whook.Webhook(webhook);
hook.success("Travis CI", "**Build successfully passed tests on Windows**: " + branch + " " + commit + " " + "\"" + commit_message + "\"");
let webhook = process.argv[2];
let branch = process.argv[3];
let commit = process.argv[4];
const whook = require("webhook-discord");
const hook = new whook.Webhook(webhook);
hook.info("Travis CI", "**Successful build**: " + branch + " " + commit + "\n \n Windows: https://gleb-krasilich.fra1.digitaloceanspaces.com/GmodDotNetBuilds/Windows/" + branch + "/" + branch + "-" + commit + ".zip"
+ "\n\n"
+ "Linux: " + "https://gleb-krasilich.fra1.digitaloceanspaces.com/GmodDotNetBuilds/Linux/" + branch + "/" + branch + "-" + commit + ".tar.gz"
+ "\n\n"
+ "Osx: " + "https://gleb-krasilich.fra1.digitaloceanspaces.com/GmodDotNetBuilds/Osx/" + branch + "/" + branch + "-" + commit + ".tar.gz"
+ "\n\n"
+ "Lua client: " + "https://gleb-krasilich.fra1.digitaloceanspaces.com/GmodDotNetBuilds/Lua/" + branch + "/" + commit + "/" + "gm_dotnet_client.lua"
+ "\n\n"
+ "Lua server: " + "https://gleb-krasilich.fra1.digitaloceanspaces.com/GmodDotNetBuilds/Lua/" + branch + "/" + commit + "/" + "gm_dotnet_server.lua");