2021-12-12 05:10:18 +01:00
|
|
|
const IPTVChecker = require('iptv-checker')
|
|
|
|
|
|
|
|
const checker = {}
|
|
|
|
|
|
|
|
checker.check = async function (item, config) {
|
|
|
|
const ic = new IPTVChecker(config)
|
|
|
|
const result = await ic.checkStream({ url: item.url, http: item.http })
|
|
|
|
|
|
|
|
return {
|
|
|
|
_id: item._id,
|
|
|
|
url: item.url,
|
|
|
|
http: item.http,
|
2022-06-08 19:45:03 +02:00
|
|
|
error: !result.status.ok ? { code: result.status.code, message: result.status.message } : null,
|
2021-12-12 05:10:18 +01:00
|
|
|
streams: result.status.ok ? result.status.metadata.streams : [],
|
|
|
|
requests: result.status.ok ? result.status.metadata.requests : []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = checker
|