mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 10:00:05 -04:00
Create scripts/core
This commit is contained in:
parent
213da67762
commit
c6c3154522
11 changed files with 517 additions and 0 deletions
19
scripts/core/checker.js
Normal file
19
scripts/core/checker.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue