mirror of https://github.com/iptv-org/iptv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
526 B
JavaScript
20 lines
526 B
JavaScript
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,
|
|
error: !result.status.ok ? result.status.reason : null,
|
|
streams: result.status.ok ? result.status.metadata.streams : [],
|
|
requests: result.status.ok ? result.status.metadata.requests : []
|
|
}
|
|
}
|
|
|
|
module.exports = checker
|