Update index.js

- added verbose mode
- renamed http to instance (to avoid conflict in variable names)
This commit is contained in:
freearhey 2019-08-08 15:56:23 +03:00
parent 11fb3cee97
commit 08a8c9526f

View File

@ -2,6 +2,7 @@ const util = require('../helpers/util')
const axios = require('axios')
const https = require('https')
const verbose = true
const errorLog = 'error.log'
const config = {
timeout: 60000,
@ -14,13 +15,13 @@ let stats = {
failures: 0
}
const http = axios.create({
const instance = axios.create({
timeout: config.timeout,
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
})
http.defaults.headers.common["User-Agent"] = "VLC/2.2.4 LibVLC/2.2.4"
instance.defaults.headers.common["User-Agent"] = "VLC/2.2.4 LibVLC/2.2.4"
async function test() {
@ -52,7 +53,11 @@ async function test() {
try {
await http.get(item.url)
if(verbose) {
console.log(`Checking '${item.url}'...`)
}
await instance.get(item.url)
continue