Installed iptv-checker-module package

This commit is contained in:
freearhey 2020-05-26 15:23:22 +03:00
parent 526f7d6212
commit de7a9c2a4a
3 changed files with 58 additions and 63 deletions

71
package-lock.json generated
View File

@ -3,12 +3,6 @@
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"async": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz",
"integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==",
"dev": true
},
"axios": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
@ -19,6 +13,18 @@
"is-buffer": "^2.0.2"
}
},
"colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
"dev": true
},
"command-exists": {
"version": "1.2.9",
"resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz",
"integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==",
"dev": true
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
@ -43,16 +49,6 @@
"integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==",
"dev": true
},
"fluent-ffmpeg": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz",
"integrity": "sha1-yVLeIkD4EuvaCqgAbXd27irPfXQ=",
"dev": true,
"requires": {
"async": ">=0.2.9",
"which": "^1.1.1"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
@ -62,6 +58,30 @@
"debug": "=3.1.0"
}
},
"iptv-checker-module": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/iptv-checker-module/-/iptv-checker-module-1.4.0.tgz",
"integrity": "sha512-K0dRPYl8yuI7tGNaG9Fs8Z8aswn0SihIXR8aIRWRgJK1EoZIv6SdUxytchyOvuoc69dZ8V/M7xMlHZnNNk/qZw==",
"dev": true,
"requires": {
"axios": "^0.19.2",
"colors": "^1.4.0",
"command-exists": "^1.2.9",
"iptv-playlist-parser": "^0.4.2",
"valid-url": "^1.0.9"
},
"dependencies": {
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"dev": true,
"requires": {
"follow-redirects": "1.5.10"
}
}
}
},
"iptv-playlist-parser": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/iptv-playlist-parser/-/iptv-playlist-parser-0.4.2.tgz",
@ -74,12 +94,6 @@
"integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==",
"dev": true
},
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
},
"iso-639-3": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/iso-639-3/-/iso-639-3-2.0.0.tgz",
@ -113,14 +127,11 @@
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
}
"valid-url": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/valid-url/-/valid-url-1.0.9.tgz",
"integrity": "sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA=",
"dev": true
},
"xml-js": {
"version": "1.6.11",

View File

@ -14,7 +14,7 @@
"axios": ">=0.18.1",
"epg-parser": "^0.1.1",
"escape-string-regexp": "^2.0.0",
"fluent-ffmpeg": "^2.1.2",
"iptv-checker-module": "^1.4.0",
"iptv-playlist-parser": "^0.4.2",
"iso-639-3": "^2.0.0",
"markdown-include": "^0.4.3"

View File

@ -1,13 +1,13 @@
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0
const helper = require('./helper')
const ffmpeg = require('fluent-ffmpeg')
const iptvChecker = require('iptv-checker-module')
const config = {
debug: process.env.npm_config_debug || false,
country: process.env.npm_config_country,
exclude: process.env.npm_config_exclude,
timeout: 10
timeout: 10000
}
let stats = {
@ -26,40 +26,24 @@ async function test() {
console.log(`Processing '${country.url}'...`)
const playlist = helper.parsePlaylist(country.url)
for (let item of playlist.items) {
stats.channels++
if (config.debug) {
console.log(`Checking '${item.url}'...`)
}
await new Promise(resolve => {
const timeout = setTimeout(() => {
resolve()
}, config.timeout * 1000)
ffmpeg(item.url, { timeout: 60 }).ffprobe(
['-user_agent', `"Mozilla/5.0 (Windows NT 10.0; Win64; x64)"`],
err => {
if (err) {
const message = helper.parseMessage(err, item.url)
const options = {
timeout: config.timeout,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)',
debug: config.debug,
omitMetadata: true,
parallel: 1,
itemCallback: item => {
if (!item.status.ok) {
stats.failures++
helper.writeToLog(country.url, message, item.url)
helper.writeToLog(country.url, item.status.reason, item.url)
console.log(`${message} '${item.url}'`)
console.log(`${item.status.reason} '${item.url}'`)
}
}
}
clearTimeout(timeout)
resolve()
}
)
})
}
await iptvChecker(country.url, options)
}
if (stats.failures === 0) {