mirror of
https://github.com/iptv-org/iptv
synced 2026-04-09 04:23:22 -04:00
Merge pull request #34330 from iptv-org/patch-2026.03.3
Patch 2026.03.3
This commit is contained in:
@@ -3,6 +3,7 @@ import { Storage } from '@freearhey/storage-js'
|
||||
import { PlaylistParser } from '../../core'
|
||||
import { data, loadData } from '../../api'
|
||||
import { ROOT_DIR } from '../../constants'
|
||||
import { isURI } from '../../utils.js'
|
||||
import { Stream } from '../../models'
|
||||
import * as sdk from '@iptv-org/sdk'
|
||||
import { program } from 'commander'
|
||||
@@ -63,6 +64,14 @@ async function main() {
|
||||
buffer.set(stream.url, true)
|
||||
}
|
||||
|
||||
if (!isURI(stream.url)) {
|
||||
log.add({
|
||||
type: 'error',
|
||||
line: stream.getLine(),
|
||||
message: `"${stream.url}" is not a valid URL`
|
||||
})
|
||||
}
|
||||
|
||||
if (stream.channel) {
|
||||
const blocklistRecords = new Collection(
|
||||
data.blocklistRecordsGroupedByChannel.get(stream.channel)
|
||||
|
||||
@@ -2,8 +2,8 @@ import normalizeUrl from 'normalize-url'
|
||||
|
||||
export function isURI(string: string): boolean {
|
||||
try {
|
||||
new URL(string)
|
||||
return true
|
||||
const url = new URL(string)
|
||||
return /^(http:|https:|mmsh:|rtsp:|rtmp:)/.test(url.protocol)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ https://ccstreaming.packet.mx/WebRTCAppEE/streams/45.1_kd5oiNTTWO0gEOFc431277834
|
||||
#EXTINF:-1 tvg-id="CanalParlamentodelCongresodeJalisco.mx@SD",Canal Parlamento del Congreso de Jalisco (720p) [Not 24/7]
|
||||
https://60417ddeaf0d9.streamlock.net/srtc/smil:srtc.smil/playlist.m3u8
|
||||
#EXTINF:-1 tvg-id="Capital21.mx@SD",Capital 21 (1080p) [Not 24/7]
|
||||
hhttps://video.cdmx.gob.mx/redes/stream.m3u8
|
||||
https://video.cdmx.gob.mx/redes/stream.m3u8
|
||||
#EXTINF:-1 tvg-id="ConectaTV.mx@SD",Conecta TV (720p)
|
||||
https://stream8.mexiserver.com:19360/conectatvx/conectatvx.m3u8
|
||||
#EXTINF:-1 tvg-id="CreaLaTV.mx@SD",CreaLaTV (1080p)
|
||||
|
||||
@@ -84,7 +84,7 @@ https://live.mediatech.vn/live/285aaa79b4b265a457d81bb72bc32e2c114/chunklist.m3u
|
||||
#EXTINF:-1 tvg-id="SCTV1.vn@SD",SCTV1 (720p)
|
||||
https://liveh12.vtvprime.vn/hls/SCTV1/index.m3u8
|
||||
#EXTINF:-1 tvg-id="SCTV2.vn@SD",SCTV2 (720p)
|
||||
ttps://liveh12.vtvprime.vn/hls/SCTV2/index.m3u8
|
||||
https://liveh12.vtvprime.vn/hls/SCTV2/index.m3u8
|
||||
#EXTINF:-1 tvg-id="SCTV4.vn@SD",SCTV4 (720p)
|
||||
https://liveh12.vtvprime.vn/hls/SCTV4/index.m3u8
|
||||
#EXTINF:-1 tvg-id="SCTV6.vn@SD",SCTV6 (1080p) [Geo-blocked]
|
||||
|
||||
1
tests/__data__/expected/playlist_update/bz.m3u
Normal file
1
tests/__data__/expected/playlist_update/bz.m3u
Normal file
@@ -0,0 +1 @@
|
||||
#EXTM3U
|
||||
@@ -588,5 +588,13 @@
|
||||
"country": "CA",
|
||||
"categories": [],
|
||||
"is_nsfw": false
|
||||
},
|
||||
{
|
||||
"id": "Channel7.bz",
|
||||
"name": "Channel 7",
|
||||
"network": null,
|
||||
"country": "BZ",
|
||||
"categories": [],
|
||||
"is_nsfw": false
|
||||
}
|
||||
]
|
||||
@@ -2393,5 +2393,84 @@ module.exports = [
|
||||
timeline_url: 'https://api.github.com/repos/iptv-org/iptv/issues/25157/timeline',
|
||||
performed_via_github_app: null,
|
||||
state_reason: null
|
||||
},
|
||||
{
|
||||
url: 'https://api.github.com/repos/iptv-org/iptv/issues/15175',
|
||||
repository_url: 'https://api.github.com/repos/iptv-org/iptv',
|
||||
labels_url: 'https://api.github.com/repos/iptv-org/iptv/issues/15175/labels{/name}',
|
||||
comments_url: 'https://api.github.com/repos/iptv-org/iptv/issues/15175/comments',
|
||||
events_url: 'https://api.github.com/repos/iptv-org/iptv/issues/15175/events',
|
||||
html_url: 'https://github.com/iptv-org/iptv/issues/15175',
|
||||
id: 1884859888,
|
||||
node_id: 'I_kwDOCWUK8M5wWK2C',
|
||||
number: 15175,
|
||||
title: 'Add: TFX',
|
||||
user: {
|
||||
login: 'freearhey',
|
||||
id: 7253922,
|
||||
node_id: 'MDQ6VXNlcjcyNTM5MjI=',
|
||||
avatar_url: 'https://avatars.githubusercontent.com/u/7253922?v=4',
|
||||
gravatar_id: '',
|
||||
url: 'https://api.github.com/users/freearhey',
|
||||
html_url: 'https://github.com/freearhey',
|
||||
followers_url: 'https://api.github.com/users/freearhey/followers',
|
||||
following_url: 'https://api.github.com/users/freearhey/following{/other_user}',
|
||||
gists_url: 'https://api.github.com/users/freearhey/gists{/gist_id}',
|
||||
starred_url: 'https://api.github.com/users/freearhey/starred{/owner}{/repo}',
|
||||
subscriptions_url: 'https://api.github.com/users/freearhey/subscriptions',
|
||||
organizations_url: 'https://api.github.com/users/freearhey/orgs',
|
||||
repos_url: 'https://api.github.com/users/freearhey/repos',
|
||||
events_url: 'https://api.github.com/users/freearhey/events{/privacy}',
|
||||
received_events_url: 'https://api.github.com/users/freearhey/received_events',
|
||||
type: 'User',
|
||||
site_admin: false
|
||||
},
|
||||
labels: [
|
||||
{
|
||||
id: 5923498886,
|
||||
node_id: 'LA_kwDOCWUK8M8AAAABYRFrhg',
|
||||
url: 'https://api.github.com/repos/iptv-org/iptv/labels/approved',
|
||||
name: 'approved',
|
||||
color: '85ddde',
|
||||
default: false,
|
||||
description: ''
|
||||
},
|
||||
{
|
||||
id: 5923508587,
|
||||
node_id: 'LA_kwDOCWUK8M8AAAABYRGRaw',
|
||||
url: 'https://api.github.com/repos/iptv-org/iptv/labels/streams:add',
|
||||
name: 'streams:add',
|
||||
color: '017ff9',
|
||||
default: false,
|
||||
description: 'Request to add a new link to a playlist'
|
||||
}
|
||||
],
|
||||
state: 'open',
|
||||
locked: false,
|
||||
assignee: null,
|
||||
assignees: [],
|
||||
milestone: null,
|
||||
comments: 1,
|
||||
created_at: '2023-09-06T22:54:25Z',
|
||||
updated_at: '2023-09-07T00:57:11Z',
|
||||
closed_at: null,
|
||||
author_association: 'COLLABORATOR',
|
||||
active_lock_reason: null,
|
||||
body: '### Stream ID\n\nChannel7.bz@SD\n\n### Stream URL\n\nnew: https://streamer2.nexgen.bz/07-CHANNEL7/index.m3u8\n\n### Label\n\nNone\n\n### HTTP User Agent\n\n_No response_\n\n### HTTP Referrer\n\n_No response_\n\n### Notes (optional)\n\n_No response_\n\n### Contributing Guide\n\n- [X] I have read [Contributing Guide](https://github.com/iptv-org/iptv/blob/master/CONTRIBUTING.md)',
|
||||
reactions: {
|
||||
url: 'https://api.github.com/repos/iptv-org/iptv/issues/15175/reactions',
|
||||
total_count: 0,
|
||||
'+1': 0,
|
||||
'-1': 0,
|
||||
laugh: 0,
|
||||
hooray: 0,
|
||||
confused: 0,
|
||||
heart: 0,
|
||||
rocket: 0,
|
||||
eyes: 0
|
||||
},
|
||||
timeline_url: 'https://api.github.com/repos/iptv-org/iptv/issues/15175/timeline',
|
||||
performed_via_github_app: null,
|
||||
state_reason: null
|
||||
}
|
||||
]
|
||||
|
||||
1
tests/__data__/input/playlist_update/bz.m3u
Normal file
1
tests/__data__/input/playlist_update/bz.m3u
Normal file
@@ -0,0 +1 @@
|
||||
#EXTM3U
|
||||
3
tests/__data__/input/playlist_validate/invalid_url.m3u
Normal file
3
tests/__data__/input/playlist_validate/invalid_url.m3u
Normal file
@@ -0,0 +1,3 @@
|
||||
#EXTM3U
|
||||
#EXTINF:-1 tvg-id="Channel7.bz@SD",Channel 7
|
||||
new: https://streamer2.nexgen.bz/07-CHANNEL7/index.m3u8
|
||||
@@ -38,6 +38,20 @@ describe('playlist:validate', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('show a error if stream has an invalid url', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- invalid_url.m3u`
|
||||
try {
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
} catch (error) {
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, error)
|
||||
expect((error as ExecError).stdout).toContain('invalid_url.m3u')
|
||||
expect((error as ExecError).stdout).toContain(
|
||||
'2 error "new: https://streamer2.nexgen.bz/07-CHANNEL7/index.m3u8" is not a valid URL'
|
||||
)
|
||||
expect((error as ExecError).stdout).toContain('1 problems (1 errors, 0 warnings)')
|
||||
}
|
||||
})
|
||||
|
||||
it('skip the file if it does not exist', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- missing.m3u`
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
|
||||
@@ -19,11 +19,12 @@ describe('report:create', () => {
|
||||
│ 2 │ 14177 │ 'streams:add' │ 'TUTV.us' │ 'https://livestream.telvue.com/templeuni1/f7b44cfafd5c52223d5498196c8a2e7b.sdp/playlist.m3u8' │ 'duplicate_link' │
|
||||
│ 3 │ 14178 │ 'streams:add' │ 'TV3.my' │ 'https://live-streams-ssai-01.tonton.com.my/live/2dd2b7cd-1b34-4871-b669-57b5c9beca23/live.isml/.m...' │ 'channel_blocked' │
|
||||
│ 4 │ 14179 │ 'streams:add' │ 'ManoramaNews.in' │ '(https://mitelefe.com/Api/Videos/GetSourceUrl/694564/0/HLS / https://ssl.cloud.telefe.com/Api/Vid...' │ 'invalid_stream_url' │
|
||||
│ 5 │ 16120 │ 'streams:remove' │ undefined │ 'http://190.61.102.67:2000/play/a038/index.m3u8' │ 'nonexistent_link' │
|
||||
│ 6 │ 19956 │ 'channel search' │ 'CNBCe.tr' │ undefined │ 'invalid_channel_id' │
|
||||
│ 7 │ 19957 │ 'channel search' │ '13thStreet.au' │ undefined │ 'channel_closed' │
|
||||
│ 8 │ 20956 │ 'channel search' │ 'IONTV.us' │ undefined │ 'fulfilled' │
|
||||
│ 9 │ 25157 │ 'streams:add' │ 'OnTimeSports.eg@SD' │ 'OnTime Sports SD.mu38' │ 'invalid_stream_url' │
|
||||
│ 5 │ 15175 │ 'streams:add' │ 'Channel7.bz@SD' │ 'new: https://streamer2.nexgen.bz/07-CHANNEL7/index.m3u8' │ 'invalid_stream_url' │
|
||||
│ 6 │ 16120 │ 'streams:remove' │ undefined │ 'http://190.61.102.67:2000/play/a038/index.m3u8' │ 'nonexistent_link' │
|
||||
│ 7 │ 19956 │ 'channel search' │ 'CNBCe.tr' │ undefined │ 'invalid_channel_id' │
|
||||
│ 8 │ 19957 │ 'channel search' │ '13thStreet.au' │ undefined │ 'channel_closed' │
|
||||
│ 9 │ 20956 │ 'channel search' │ 'IONTV.us' │ undefined │ 'fulfilled' │
|
||||
│ 10 │ 25157 │ 'streams:add' │ 'OnTimeSports.eg@SD' │ 'OnTime Sports SD.mu38' │ 'invalid_stream_url' │
|
||||
└─────────┴─────────────┴──────────────────┴─────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────┘`)
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user