Merge branch 'master' into patch-2026.09.1

This commit is contained in:
Aleksandr Statciuk
2026-09-04 11:25:51 +03:00
committed by GitHub
20 changed files with 420 additions and 121 deletions
@@ -9,6 +9,16 @@
"quality": null,
"labels": []
},
{
"channel": null,
"feed": null,
"title": "Example (720|)",
"url": "https://example.com/live.m3u8",
"referrer": null,
"user_agent": null,
"quality": null,
"labels": []
},
{
"channel": null,
"feed": null,
@@ -79,4 +89,4 @@
"quality": "720p",
"labels": []
}
]
]
+3
View File
@@ -0,0 +1,3 @@
const dns = require('node:dns')
dns.lookup = (_hostname, callback) => callback(new Error('offline'))
@@ -1,9 +1,11 @@
#EXTM3U
#EXTINF:-1 tvg-id="LDPRTV.ru",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/blocked.m3u8
#EXTINF:-1 tvg-id="VisitXTV.nl",Visit-X TV
https://stream.visit-x.tv/vxtv/ngrp:live_all/30fps.m3u8
#EXTINF:-1 tvg-id="" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",Andorra TV (720p) [Not 24/7]
#EXTINF:-1 tvg-id="VisitXTV.nl",Visit-X TV
https://stream.visit-x.tv/vxtv/ngrp:live_all/30fps.m3u8
#EXTINF:-1 tvg-id="",Example (720|)
https://example.com/live.m3u8
#EXTINF:-1 tvg-id="" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",Andorra TV (720p) [Not 24/7]
#EXTVLCOPT:http-referrer=http://imn.iq
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index2.m3u8
+1
View File
@@ -19,6 +19,7 @@ describe('playlist:export', () => {
content('tests/__data__/expected/playlist_export/.api/streams.json')
)
})
})
function content(filepath: string) {
+17 -1
View File
@@ -1,4 +1,5 @@
import child_process from 'node:child_process'
import child_process, { execSync } from 'node:child_process'
import path from 'node:path'
import { pathToFileURL } from 'node:url'
import { promisify } from 'node:util'
import * as fs from 'fs-extra'
@@ -9,6 +10,7 @@ const exec = promisify(child_process.exec)
type ExecError = {
status: number
stdout: string
stderr: string
}
const ENV_VAR = 'cross-env DATA_DIR=tests/__data__/input/data ROOT_DIR=tests/__data__/output'
@@ -55,6 +57,20 @@ describe('playlist:test', () => {
})
}
})
it('fails when the network is unavailable', () => {
const preload = path.resolve('tests/__data__/input/offline_dns.cjs').replaceAll('\\', '/')
const cmd =
`cross-env NODE_OPTIONS="--require=${preload}" npm run playlist:test -- streams/af.m3u`
try {
execSync(cmd, { encoding: 'utf8' })
throw new Error('Expected playlist:test to fail offline')
} catch (error) {
const output = `${(error as ExecError).stdout || ''}${(error as ExecError).stderr || ''}`
expect(output).toContain('Internet connection is required for the script to work')
}
})
})
function content(filepath: string) {