Update test.js

- exclude 403 error from log (Usually occurs only if the link is geo-blocked)
- skip link with rtmp protocol (Not supported by axios client)
This commit is contained in:
freearhey 2021-04-10 23:17:05 +03:00
parent 86e061f084
commit 214108eb0a
1 changed files with 7 additions and 1 deletions

View File

@ -21,7 +21,10 @@ const instance = axios.create({
maxContentLength: 20000, maxContentLength: 20000,
httpsAgent: new https.Agent({ httpsAgent: new https.Agent({
rejectUnauthorized: false rejectUnauthorized: false
}) }),
validateStatus: function (status) {
return (status >= 200 && status < 300) || status === 403
}
}) })
let stats = { let stats = {
@ -45,6 +48,9 @@ async function test() {
for (let channel of playlist.channels) { for (let channel of playlist.channels) {
bar.tick() bar.tick()
stats.channels++ stats.channels++
if (channel.url.startsWith('rtmp://')) continue
await instance await instance
.get(channel.url) .get(channel.url)
.then(utils.sleep(config.delay)) .then(utils.sleep(config.delay))