Update playlist/validate.js
This commit is contained in:
		
							
								
								
									
										5
									
								
								.github/workflows/auto-update.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/workflows/auto-update.yml
									
									
									
									
										vendored
									
									
								
							| @@ -16,12 +16,13 @@ jobs: | ||||
|       - name: Download data from API | ||||
|         run: | | ||||
|           mkdir -p scripts/data | ||||
|           curl -L -o scripts/data/channels.json https://iptv-org.github.io/api/channels.json | ||||
|           curl -L -o scripts/data/blocklist.json https://iptv-org.github.io/api/blocklist.json | ||||
|           curl -L -o scripts/data/categories.json https://iptv-org.github.io/api/categories.json | ||||
|           curl -L -o scripts/data/channels.json https://iptv-org.github.io/api/channels.json | ||||
|           curl -L -o scripts/data/countries.json https://iptv-org.github.io/api/countries.json | ||||
|           curl -L -o scripts/data/guides.json https://iptv-org.github.io/api/guides.json | ||||
|           curl -L -o scripts/data/languages.json https://iptv-org.github.io/api/languages.json | ||||
|           curl -L -o scripts/data/regions.json https://iptv-org.github.io/api/regions.json | ||||
|           curl -L -o scripts/data/guides.json https://iptv-org.github.io/api/guides.json | ||||
|       - uses: actions/upload-artifact@v2 | ||||
|         with: | ||||
|           name: data | ||||
|   | ||||
							
								
								
									
										5
									
								
								.github/workflows/check.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/workflows/check.yml
									
									
									
									
										vendored
									
									
								
							| @@ -13,6 +13,11 @@ jobs: | ||||
|         with: | ||||
|           node-version: '14' | ||||
|           cache: 'npm' | ||||
|       - name: Download data from API | ||||
|         run: | | ||||
|           mkdir -p scripts/data | ||||
|           curl -L -o scripts/data/blocklist.json https://iptv-org.github.io/api/blocklist.json | ||||
|           curl -L -o scripts/data/channels.json https://iptv-org.github.io/api/channels.json | ||||
|       - run: npm install | ||||
|       - run: npm run lint | ||||
|       - run: npm run validate | ||||
|   | ||||
| @@ -1,37 +1,57 @@ | ||||
| const { file, logger, api, parser, blocklist } = require('../../core') | ||||
| const { file, logger, api, parser, id } = require('../../core') | ||||
| const { program } = require('commander') | ||||
| const chalk = require('chalk') | ||||
| const _ = require('lodash') | ||||
|  | ||||
| program.argument('<filepath>', 'Path to file to validate').parse(process.argv) | ||||
| program.argument('[filepath]', 'Path to file to validate').parse(process.argv) | ||||
|  | ||||
| async function main() { | ||||
|   const files = program.args.length ? program.args : await file.list('channels/*.m3u') | ||||
|  | ||||
|   logger.info(`loading blocklist...`) | ||||
|   await api.channels.load() | ||||
|   await api.blocklist.load() | ||||
|  | ||||
|   let blocklist = await api.blocklist.all() | ||||
|   blocklist = blocklist | ||||
|     .map(blocked => { | ||||
|       const channel = api.channels.find({ id: blocked.channel }) | ||||
|       if (!channel) return null | ||||
|       return { ...blocked, name: channel.name } | ||||
|     }) | ||||
|     .filter(i => i) | ||||
|   logger.info(`found ${blocklist.length} records`) | ||||
|  | ||||
|   let errors = [] | ||||
|   let warnings = [] | ||||
|   for (const filepath of program.args) { | ||||
|   for (const filepath of files) { | ||||
|     if (!filepath.endsWith('.m3u')) continue | ||||
|  | ||||
|     const basename = file.basename(filepath) | ||||
|     const [_, countryCode] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null] | ||||
|     const [__, country] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null] | ||||
|  | ||||
|     const fileLog = [] | ||||
|     const streams = await parser.parsePlaylist(filepath) | ||||
|     for (const stream of streams) { | ||||
|       const found = blocklist.find(stream.name, countryCode.toUpperCase()) | ||||
|       if (found) { | ||||
|     const items = await parser.parsePlaylist(filepath) | ||||
|     for (const item of items) { | ||||
|       if (item.tvg.id && !api.channels.find({ id: item.tvg.id })) { | ||||
|         fileLog.push({ | ||||
|           type: 'error', | ||||
|           line: stream.line, | ||||
|           message: `"${found.name}" is on the blocklist due to claims of copyright holders (${found.reference})` | ||||
|           type: 'warning', | ||||
|           line: item.line, | ||||
|           message: `"${item.tvg.id}" is not in the database` | ||||
|         }) | ||||
|       } | ||||
|  | ||||
|       if (stream.tvg.id && !api.channels.find({ id: stream.tvg.id })) { | ||||
|       const channel_id = id.generate(item.name, country) | ||||
|       const found = blocklist.find( | ||||
|         blocked => | ||||
|           item.tvg.id.toLowerCase() === blocked.channel.toLowerCase() || | ||||
|           channel_id.toLowerCase() === blocked.channel.toLowerCase() | ||||
|       ) | ||||
|       if (found) { | ||||
|         fileLog.push({ | ||||
|           type: 'warning', | ||||
|           line: stream.line, | ||||
|           message: `"${stream.tvg.id}" is not in the database` | ||||
|           type: 'error', | ||||
|           line: item.line, | ||||
|           message: `"${found.name}" is on the blocklist due to claims of copyright holders (${found.ref})` | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   | ||||
| @@ -1,18 +0,0 @@ | ||||
| const list = require('../data/blocklist') | ||||
| const parser = require('./parser') | ||||
|  | ||||
| const blocklist = {} | ||||
|  | ||||
| blocklist.find = function (title, country) { | ||||
|   const name = parser.parseChannelName(title) | ||||
|  | ||||
|   return list.find(item => { | ||||
|     const regexp = new RegExp(item.regex, 'i') | ||||
|     const hasSameName = regexp.test(name) | ||||
|     const fromSameCountry = country === item.country | ||||
|  | ||||
|     return hasSameName && fromSameCountry | ||||
|   }) | ||||
| } | ||||
|  | ||||
| module.exports = blocklist | ||||
| @@ -1,23 +1,19 @@ | ||||
| const file = require('./file') | ||||
| const parser = require('./parser') | ||||
| const transliteration = require('transliteration') | ||||
| const { transliterate } = require('transliteration') | ||||
|  | ||||
| const id = {} | ||||
|  | ||||
| id.generate = function (title, filepath) { | ||||
|   const name = parser.parseChannelName(title) | ||||
|   const code = parser.parseCountryCode(filepath) | ||||
| id.generate = function (name, code) { | ||||
|   if (!name || !code) return null | ||||
|  | ||||
|   if (name && code) { | ||||
|     const slug = transliteration | ||||
|       .transliterate(name) | ||||
|       .replace(/\+/gi, 'Plus') | ||||
|       .replace(/[^a-z\d]+/gi, '') | ||||
|   name = name.replace(/ *\([^)]*\) */g, '') | ||||
|   name = name.replace(/ *\[[^)]*\] */g, '') | ||||
|   name = name.replace(/\+/gi, 'Plus') | ||||
|   name = name.replace(/[^a-z\d]+/gi, '') | ||||
|   name = name.trim() | ||||
|   name = transliterate(name) | ||||
|   code = code.toLowerCase() | ||||
|  | ||||
|     return `${slug}.${code.toLowerCase()}` | ||||
|   } | ||||
|  | ||||
|   return null | ||||
|   return `${name}.${code}` | ||||
| } | ||||
|  | ||||
| module.exports = id | ||||
|   | ||||
| @@ -10,4 +10,3 @@ exports.store = require('./store') | ||||
| exports.markdown = require('./markdown') | ||||
| exports.api = require('./api') | ||||
| exports.id = require('./id') | ||||
| exports.blocklist = require('./blocklist') | ||||
|   | ||||
| @@ -28,23 +28,4 @@ parser.parseNumber = function (string) { | ||||
|   return parsed | ||||
| } | ||||
|  | ||||
| parser.parseChannelName = function (string) { | ||||
|   return string | ||||
|     .trim() | ||||
|     .split(' ') | ||||
|     .map(s => s.trim()) | ||||
|     .filter(s => { | ||||
|       return !/\[|\]/i.test(s) && !/\((\d+)P\)/i.test(s) | ||||
|     }) | ||||
|     .join(' ') | ||||
| } | ||||
|  | ||||
| parser.parseCountryCode = function (filepath) { | ||||
|   if (!filepath) return null | ||||
|   const basename = file.basename(filepath) | ||||
|   const [_, code] = basename.match(/^([a-z]{2})(_|\.)/) || [null, null] | ||||
|  | ||||
|   return code | ||||
| } | ||||
|  | ||||
| module.exports = parser | ||||
|   | ||||
							
								
								
									
										1
									
								
								scripts/data/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								scripts/data/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,3 +1,2 @@ | ||||
| * | ||||
| !.gitignore | ||||
| !blocklist.json | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -1,3 +1,7 @@ | ||||
| #EXTM3U | ||||
| #EXTINF:-1 tvg-id="" tvg-country="TH" tvg-language="Thai" tvg-logo="" group-title="Sports",Fox Sports 2 Asia (Thai) (720p) | ||||
| #EXTINF:-1 tvg-id="",Fox Sports 2 Asia (Thai) (720p) | ||||
| https://example.com/playlist.m3u8 | ||||
| #EXTINF:-1 tvg-id="",TVN | ||||
| https://example.com/playlist2.m3u8 | ||||
| #EXTINF:-1 tvg-id="EverydayHeroes.us",Everyday Heroes (720p) | ||||
| https://a.jsrdn.com/broadcast/7b1451fa52/+0000/c.m3u8 | ||||
|   | ||||
| @@ -1,644 +1 @@ | ||||
| [ | ||||
|   { | ||||
|     "name": "Animal Planet", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Animal Planet\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Arena 4", | ||||
|     "country": "HU", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Arena( |)4\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Asian Food Network", | ||||
|     "country": "SG", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Asian Food Network\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Astro SuperSport", | ||||
|     "country": "MY", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Astro SuperSport\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Azteca 7", | ||||
|     "country": "MX", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Azteca 7\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "beIN Sports", | ||||
|     "country": "QA", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^beIN Sports\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Canal+ Sport", | ||||
|     "country": "FR", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Canal( |)+ Sport\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Cooking Channel", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Cooking Channel\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "DAZN", | ||||
|     "country": "UK", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^DAZN($| [1-4] .*)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Diema Sport", | ||||
|     "country": "BG", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Diema Sport\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Digi Sport", | ||||
|     "country": "RO", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Digi Sport\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Asia", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Asia\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Channel", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Channel\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Civiliztion", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Civiliztion\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery en Espanol", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery en Espanol\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Family", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Family\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Historia", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Historia\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery History", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery History\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Home and Health", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Home and Health\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Life", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Life\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Science", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Science\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Shed", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Shed\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Theater", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Theater\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Travel and Living", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Travel and Living\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery Turbo Xtra", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery Turbo Xtra\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery World", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery World\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Discovery", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Discovery\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "DIY Network", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^DIY Network\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "DKiss", | ||||
|     "country": "ES", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^DKiss\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "DMax", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^DMax\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Eleven Sports", | ||||
|     "country": "UK", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Eleven Sports($| [1-6] .*)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "ESPN", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^ESPN($|[1-3]| .*)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Eurosport", | ||||
|     "country": "FR", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Eurosport($| [1-2])\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "eve", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^eve\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Familia Discovery", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Familia Discovery\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Fatafeat", | ||||
|     "country": "EG", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Fatafeat\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "FEM", | ||||
|     "country": "NO", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^FEM\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Fine Living", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Fine Living\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Flow Sports", | ||||
|     "country": "UK", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Flow Sports\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Food Network", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Food Network\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "food tv", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^food( |)tv\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Fox Sports", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Fox Sports\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Frisbee", | ||||
|     "country": "IT", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Frisbee\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Futbol", | ||||
|     "country": "TJ", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^(Futbol|Football TV|ТВ Футбол|Футбол)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "GTV Sports", | ||||
|     "country": "GH", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^GTV Sports\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Giallo", | ||||
|     "country": "IT", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Giallo\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "GolfTV", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Golf( |)TV\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "HGTV", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^HGTV\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Investigation Discovery", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^(Investigation Discovery|ID Investigation Discovery|ID Investigation|ID)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "K2", | ||||
|     "country": "IT", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^K2\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Living Channel", | ||||
|     "country": "NZ", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Living Channel\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Local Now", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.zendesk.com/attachments/token/qCOIlhjNbuhARY64ffpnzv9Ef/?name=2022-01-06-localnow.rtf", | ||||
|     "regex": "^Local( |)Now" | ||||
|   }, | ||||
|   { | ||||
|     "name": "LookSport", | ||||
|     "country": "RO", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Look( |)Sport\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Magnolia Network", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/5994", | ||||
|     "regex": "^Magnolia( |)Network\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Mango", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Mango\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Match!", | ||||
|     "country": "RU", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^(Match|Матч)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Motortrend", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Motortrend\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Mola TV", | ||||
|     "country": "ID", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Mola TV($| .*)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Movistar Liga de Campeones", | ||||
|     "country": "ES", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Movistar Liga de Campeones [1-8]\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Nova Sport", | ||||
|     "country": "CZ", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Nova Sport [1-3]\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Nova Sports", | ||||
|     "country": "GR", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Nova Sports [1-6]\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Nove", | ||||
|     "country": "IT", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Nove($| .*)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "PPTV HD 36", | ||||
|     "country": "TH", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^PPTV($| HD)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "One", | ||||
|     "country": "IL", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^One\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "OWN", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^(OWN|Oprah)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Quest Red", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Quest Red\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Quest", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Quest\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Real Time", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Real Time\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "SABC Sport ", | ||||
|     "country": "ZA", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^SABC Sport\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Setanta Sports", | ||||
|     "country": "IE", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Setanta Sports($| .*)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Sky Sports", | ||||
|     "country": "UK", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Sky Sports\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Sky Sport Bundesliga", | ||||
|     "country": "DE", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Sky Sport Bundesliga [0-9]+\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Sky TG24", | ||||
|     "country": "IT", | ||||
|     "reference": "https://github.com/iptv-org/iptv/pull/2294", | ||||
|     "regex": "^Sky TG24\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Sony Ten", | ||||
|     "country": "IN", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Sony Ten [1-4]\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Spíler TV", | ||||
|     "country": "HU", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Spíler( |[1-2] )TV\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Šport TV", | ||||
|     "country": "SI", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^(Šport|Sport) TV\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Sport Klub", | ||||
|     "country": "HU", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^(Sport Klub|SK[1-9])\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "SportsNet", | ||||
|     "country": "CA", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^SportsNet\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "StarHub TV", | ||||
|     "country": "SG", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^StarHub TV\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "StarSat", | ||||
|     "country": "ZA", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^StarSat\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "StarTimes TV", | ||||
|     "country": "MZ", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^StarTimes TV\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "SuperSport", | ||||
|     "country": "AL", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^SuperSport [1-7]\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Tivibu Spor", | ||||
|     "country": "TR", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Tivibu Spor\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TLC", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TLC\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Trvl Channel", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Trvl Channel\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TSN", | ||||
|     "country": "MT", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^TSN\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TTV", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TTV\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TV Norge", | ||||
|     "country": "NO", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TV Norge\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TV Varzish", | ||||
|     "country": "TJ", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^(TV Varzish|Varzish TV|Варзиш ТВ)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TV3 Sport", | ||||
|     "country": "DK", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^TV( |)3 Sport\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "tvN Asia", | ||||
|     "country": "KR", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^tvN($| Asia)\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Tvn 24 Bis", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Tvn(| )24 Bis\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TVN 24", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TVN 24\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Tvn 7", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Tvn 7\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TVN Extra", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TVN Extra\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TVN Fabula", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TVN Fabula\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TVN Meteo", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TVN Meteo\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TVN Style", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TVN Style\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TVN Turbo", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TVN Turbo\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TVN Warszawa", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TVN Warszawa\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "TVN", | ||||
|     "country": "PL", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^TVN\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "V Sport", | ||||
|     "country": "NO", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^V Sport\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Vox", | ||||
|     "country": "NO", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^Vox\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "VTV Cab", | ||||
|     "country": "KR", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^VTV( |)Cab\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "World Discovery", | ||||
|     "country": "US", | ||||
|     "reference": "https://github.com/iptv-org/iptv/issues/1831", | ||||
|     "regex": "^World Discovery\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "Xee", | ||||
|     "country": "DK", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^Xee\\b" | ||||
|   }, | ||||
|   { | ||||
|     "name": "XtvN", | ||||
|     "country": "KR", | ||||
|     "reference": "https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md", | ||||
|     "regex": "^X( |)tvN\\b" | ||||
|   } | ||||
| ] | ||||
| [{"channel":"FoxSports1.us","ref":"https://github.com/iptv-org/iptv/issues/0000"},{"channel":"FoxSports2Asia.us","ref":"https://github.com/iptv-org/iptv/issues/0000"},{"channel":"TVN.pl","ref":"https://github.com/iptv-org/iptv/issues/0000"},{"channel":"Eve.us","ref":"https://github.com/iptv-org/iptv/issues/0000"}] | ||||
| @@ -36,6 +36,74 @@ | ||||
|     "is_nsfw": false, | ||||
|     "logo": "https://raw.githubusercontent.com/Tapiosinn/tv-logos/master/countries/united-kingdom/bbc-news-uk.png" | ||||
|   }, | ||||
|   { | ||||
|     "id": "Eve.us", | ||||
|     "name": "Eve", | ||||
|     "network": null, | ||||
|     "country": "US", | ||||
|     "subdivision": null, | ||||
|     "city": null, | ||||
|     "broadcast_area": [ | ||||
|       "c/US" | ||||
|     ], | ||||
|     "languages": [ | ||||
|       "eng" | ||||
|     ], | ||||
|     "categories": [], | ||||
|     "is_nsfw": false, | ||||
|     "logo": "https://www.lyngsat.com/logo/tv/ee/eve_us.png" | ||||
|   }, | ||||
|   { | ||||
|     "id": "EverydayHeroes.us", | ||||
|     "name": "Everyday Heroes", | ||||
|     "network": null, | ||||
|     "country": "US", | ||||
|     "subdivision": null, | ||||
|     "city": null, | ||||
|     "broadcast_area": [ | ||||
|       "c/US" | ||||
|     ], | ||||
|     "languages": [ | ||||
|       "eng" | ||||
|     ], | ||||
|     "categories": [], | ||||
|     "is_nsfw": false, | ||||
|     "logo": "https://i.imgur.com/Iam3ol3.png" | ||||
|   }, | ||||
|   { | ||||
|     "id": "FoxSports1.us", | ||||
|     "name": "Fox Sports 1", | ||||
|     "network": null, | ||||
|     "country": "US", | ||||
|     "subdivision": null, | ||||
|     "city": null, | ||||
|     "broadcast_area": [ | ||||
|       "c/US" | ||||
|     ], | ||||
|     "languages": [ | ||||
|       "eng" | ||||
|     ], | ||||
|     "categories": [], | ||||
|     "is_nsfw": false, | ||||
|     "logo": "https://cdn.tvpassport.com/image/station/100x100/fs1.png" | ||||
|   }, | ||||
|   { | ||||
|     "id": "FoxSports2Asia.us", | ||||
|     "name": "Fox Sports 2 Asia", | ||||
|     "network": null, | ||||
|     "country": "US", | ||||
|     "subdivision": null, | ||||
|     "city": null, | ||||
|     "broadcast_area": [ | ||||
|       "c/US" | ||||
|     ], | ||||
|     "languages": [ | ||||
|       "eng" | ||||
|     ], | ||||
|     "categories": [], | ||||
|     "is_nsfw": false, | ||||
|     "logo": null | ||||
|   }, | ||||
|   { | ||||
|     "id": "LDPRTV.ru", | ||||
|     "name": "LDPR TV", | ||||
| @@ -74,6 +142,23 @@ | ||||
|     "is_nsfw": false, | ||||
|     "logo": "https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" | ||||
|   }, | ||||
|   { | ||||
|     "id": "TVN.pl", | ||||
|     "name": "TVN", | ||||
|     "network": null, | ||||
|     "country": "PL", | ||||
|     "subdivision": null, | ||||
|     "city": null, | ||||
|     "broadcast_area": [ | ||||
|       "c/PL" | ||||
|     ], | ||||
|     "languages": [ | ||||
|       "pol" | ||||
|     ], | ||||
|     "categories": [], | ||||
|     "is_nsfw": false, | ||||
|     "logo": "https://www.sms.cz/kategorie/televize/bmp/loga/velka/TVN.png" | ||||
|   }, | ||||
|   { | ||||
|     "id": "VisitXTV.nl", | ||||
|     "name": "Visit-X TV", | ||||
|   | ||||
| @@ -1,22 +1,24 @@ | ||||
| const { execSync } = require('child_process') | ||||
|  | ||||
| it('show error if channel name in the blocklist', () => { | ||||
| it('show an error if channel name in the blocklist', () => { | ||||
|   try { | ||||
|     execSync( | ||||
|     const stdout = execSync( | ||||
|       'DATA_DIR=tests/__data__/input/data npm run playlist:validate -- tests/__data__/input/channels/us_blocked.m3u', | ||||
|       { | ||||
|         encoding: 'utf8' | ||||
|       } | ||||
|     ) | ||||
|     console.log(stdout) | ||||
|     process.exit(1) | ||||
|   } catch (err) { | ||||
|     expect(err.status).toBe(1) | ||||
|     expect(err.stdout).toBe( | ||||
|       `\n> playlist:validate\n> node scripts/commands/playlist/validate.js "tests/__data__/input/channels/us_blocked.m3u"\n\n\ntests/__data__/input/channels/us_blocked.m3u\n 2     error    "Fox Sports" is on the blocklist due to claims of copyright holders (https://github.com/github/dmca/blob/master/2020/09/2020-09-16-dfl.md)\n\n1 problems (1 errors, 0 warnings)\n` | ||||
|       `\n> playlist:validate\n> node scripts/commands/playlist/validate.js "tests/__data__/input/channels/us_blocked.m3u"\n\nloading blocklist...\nfound 4 records\n\ntests/__data__/input/channels/us_blocked.m3u\n 2     error    "Fox Sports 2 Asia" is on the blocklist due to claims of copyright holders (https://github.com/iptv-org/iptv/issues/0000)\n\n1 problems (1 errors, 0 warnings)\n` | ||||
|     ) | ||||
|   } | ||||
| }) | ||||
|  | ||||
| it('show warning if channel has wrong id', () => { | ||||
| it('show a warning if channel has wrong id', () => { | ||||
|   const stdout = execSync( | ||||
|     'DATA_DIR=tests/__data__/input/data npm run playlist:validate -- tests/__data__/input/channels/wrong_id.m3u', | ||||
|     { | ||||
| @@ -25,6 +27,6 @@ it('show warning if channel has wrong id', () => { | ||||
|   ) | ||||
|  | ||||
|   expect(stdout).toBe( | ||||
|     `\n> playlist:validate\n> node scripts/commands/playlist/validate.js "tests/__data__/input/channels/wrong_id.m3u"\n\n\ntests/__data__/input/channels/wrong_id.m3u\n 2     warning  "qib22lAq1L.us" is not in the database\n\n1 problems (0 errors, 1 warnings)\n` | ||||
|     `\n> playlist:validate\n> node scripts/commands/playlist/validate.js "tests/__data__/input/channels/wrong_id.m3u"\n\nloading blocklist...\nfound 4 records\n\ntests/__data__/input/channels/wrong_id.m3u\n 2     warning  "qib22lAq1L.us" is not in the database\n\n1 problems (0 errors, 1 warnings)\n` | ||||
|   ) | ||||
| }) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user