Update index.js
- added verbose mode - renamed http to instance (to avoid conflict in variable names)
This commit is contained in:
parent
11fb3cee97
commit
08a8c9526f
@ -2,6 +2,7 @@ const util = require('../helpers/util')
|
|||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const https = require('https')
|
const https = require('https')
|
||||||
|
|
||||||
|
const verbose = true
|
||||||
const errorLog = 'error.log'
|
const errorLog = 'error.log'
|
||||||
const config = {
|
const config = {
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
@ -14,13 +15,13 @@ let stats = {
|
|||||||
failures: 0
|
failures: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const http = axios.create({
|
const instance = axios.create({
|
||||||
timeout: config.timeout,
|
timeout: config.timeout,
|
||||||
httpsAgent: new https.Agent({
|
httpsAgent: new https.Agent({
|
||||||
rejectUnauthorized: false
|
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() {
|
async function test() {
|
||||||
|
|
||||||
@ -52,7 +53,11 @@ async function test() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
await http.get(item.url)
|
if(verbose) {
|
||||||
|
console.log(`Checking '${item.url}'...`)
|
||||||
|
}
|
||||||
|
|
||||||
|
await instance.get(item.url)
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user