mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-15 03:20:05 -04:00
Update format.js
This commit is contained in:
parent
407b7204bd
commit
84f3470bb3
1 changed files with 9 additions and 9 deletions
|
@ -20,7 +20,7 @@ const config = program.opts()
|
||||||
|
|
||||||
const instance = axios.create({
|
const instance = axios.create({
|
||||||
timeout: config.timeout,
|
timeout: config.timeout,
|
||||||
maxContentLength: 5000,
|
maxContentLength: 20000,
|
||||||
httpsAgent: new https.Agent({
|
httpsAgent: new https.Agent({
|
||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
})
|
})
|
||||||
|
@ -120,12 +120,16 @@ async function detectResolution(playlist) {
|
||||||
.get(url)
|
.get(url)
|
||||||
.then(sleep(config.delay))
|
.then(sleep(config.delay))
|
||||||
.catch(err => {})
|
.catch(err => {})
|
||||||
if (isValid(response)) {
|
if (response) {
|
||||||
|
if (response.status === 200) {
|
||||||
|
if (/^#EXTM3U/.test(response.data)) {
|
||||||
const resolution = parseResolution(response.data)
|
const resolution = parseResolution(response.data)
|
||||||
if (resolution) {
|
if (resolution) {
|
||||||
item.resolution = resolution
|
item.resolution = resolution
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
results.push(item)
|
results.push(item)
|
||||||
}
|
}
|
||||||
|
@ -200,10 +204,6 @@ function sleep(ms) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isValid(response) {
|
|
||||||
return response && response.status === 200 && /^#EXTM3U/.test(response.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updatePlaylist(playlist) {
|
async function updatePlaylist(playlist) {
|
||||||
const original = helper.readFile(playlist.url)
|
const original = helper.readFile(playlist.url)
|
||||||
let output = playlist.getHeader()
|
let output = playlist.getHeader()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue