From f4058b5a56a7c40530bcd22c710bd73aca1c9e9d Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:07:59 +0300 Subject: [PATCH 1/6] Update tests/__data__ --- .../__data__/expected/playlist_update/bz.m3u | 1 + tests/__data__/input/data/channels.json | 8 ++ tests/__data__/input/issues.js | 79 +++++++++++++++++++ tests/__data__/input/playlist_update/bz.m3u | 1 + .../input/playlist_validate/invalid_url.m3u | 3 + 5 files changed, 92 insertions(+) create mode 100644 tests/__data__/expected/playlist_update/bz.m3u create mode 100644 tests/__data__/input/playlist_update/bz.m3u create mode 100644 tests/__data__/input/playlist_validate/invalid_url.m3u diff --git a/tests/__data__/expected/playlist_update/bz.m3u b/tests/__data__/expected/playlist_update/bz.m3u new file mode 100644 index 0000000000..7452e53aad --- /dev/null +++ b/tests/__data__/expected/playlist_update/bz.m3u @@ -0,0 +1 @@ +#EXTM3U diff --git a/tests/__data__/input/data/channels.json b/tests/__data__/input/data/channels.json index 1a80abb8d1..faeb9f4d16 100644 --- a/tests/__data__/input/data/channels.json +++ b/tests/__data__/input/data/channels.json @@ -588,5 +588,13 @@ "country": "CA", "categories": [], "is_nsfw": false + }, + { + "id": "Channel7.bz", + "name": "Channel 7", + "network": null, + "country": "BZ", + "categories": [], + "is_nsfw": false } ] \ No newline at end of file diff --git a/tests/__data__/input/issues.js b/tests/__data__/input/issues.js index cbb6a79091..82d14a73fa 100644 --- a/tests/__data__/input/issues.js +++ b/tests/__data__/input/issues.js @@ -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 } ] diff --git a/tests/__data__/input/playlist_update/bz.m3u b/tests/__data__/input/playlist_update/bz.m3u new file mode 100644 index 0000000000..7452e53aad --- /dev/null +++ b/tests/__data__/input/playlist_update/bz.m3u @@ -0,0 +1 @@ +#EXTM3U diff --git a/tests/__data__/input/playlist_validate/invalid_url.m3u b/tests/__data__/input/playlist_validate/invalid_url.m3u new file mode 100644 index 0000000000..e593076c9e --- /dev/null +++ b/tests/__data__/input/playlist_validate/invalid_url.m3u @@ -0,0 +1,3 @@ +#EXTM3U +#EXTINF:-1 tvg-id="Channel7.bz@SD",Channel 7 +new: https://streamer2.nexgen.bz/07-CHANNEL7/index.m3u8 From 3d9641d9a6afee27de2b5ee3fb2be7d54bfdecc0 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:08:11 +0300 Subject: [PATCH 2/6] Update validate.test.ts --- tests/commands/playlist/validate.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/commands/playlist/validate.test.ts b/tests/commands/playlist/validate.test.ts index 597916c49a..e87ce1843b 100644 --- a/tests/commands/playlist/validate.test.ts +++ b/tests/commands/playlist/validate.test.ts @@ -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' }) From 850a6beeb8ab4a76cc37c9013ad9322de3364d6e Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:08:13 +0300 Subject: [PATCH 3/6] Update create.test.ts --- tests/commands/report/create.test.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/commands/report/create.test.ts b/tests/commands/report/create.test.ts index cb9fd3ab98..7dd3db603a 100644 --- a/tests/commands/report/create.test.ts +++ b/tests/commands/report/create.test.ts @@ -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) }) From e79445e28d4815ed62430efbf52f3c4a24c188bc Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:08:24 +0300 Subject: [PATCH 4/6] Update utils.ts --- scripts/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/utils.ts b/scripts/utils.ts index d58b80406d..ecce8da58b 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -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 } From 77e01b50eb2e02537440ac880c95270a27357622 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:08:31 +0300 Subject: [PATCH 5/6] Update validate.ts --- scripts/commands/playlist/validate.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/commands/playlist/validate.ts b/scripts/commands/playlist/validate.ts index c05964f562..f4292e62f2 100644 --- a/scripts/commands/playlist/validate.ts +++ b/scripts/commands/playlist/validate.ts @@ -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) From 0ab9e7aed63fda037b90dd2394845fe19ecf97eb Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:10:24 +0300 Subject: [PATCH 6/6] Fixed invalid URLs --- streams/mx.m3u | 2 +- streams/vn.m3u | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/streams/mx.m3u b/streams/mx.m3u index 85551f8059..1aca660e7d 100644 --- a/streams/mx.m3u +++ b/streams/mx.m3u @@ -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) diff --git a/streams/vn.m3u b/streams/vn.m3u index 5f30622902..b3d28a94d4 100644 --- a/streams/vn.m3u +++ b/streams/vn.m3u @@ -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]