From e6a9cad632847b236e75c7210af2c925388811a3 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 5 Jun 2021 17:12:43 +0300 Subject: [PATCH 1/4] Update parser.js --- scripts/parser.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/parser.js b/scripts/parser.js index 007d76dc13..2348c91455 100644 --- a/scripts/parser.js +++ b/scripts/parser.js @@ -4,6 +4,7 @@ const categories = require('./categories') const path = require('path') const sfwCategories = categories.filter(c => !c.nsfw).map(c => c.name) +const nsfwCategories = categories.filter(c => c.nsfw).map(c => c.name) const parser = {} @@ -234,6 +235,10 @@ class Channel { isSFW() { return sfwCategories.includes(this.category) } + + isNSFW() { + return nsfwCategories.includes(this.category) + } } module.exports = parser From 6cea832af4d5c6e25a05fdbffc395ef81b4efd58 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 5 Jun 2021 17:13:09 +0300 Subject: [PATCH 2/4] Update generate.js --- scripts/generate.js | 52 +++++++++++++-------------------------------- 1 file changed, 15 insertions(+), 37 deletions(-) diff --git a/scripts/generate.js b/scripts/generate.js index ceb566ef39..f561c9e237 100644 --- a/scripts/generate.js +++ b/scripts/generate.js @@ -34,15 +34,15 @@ function generateIndex() { const filename = `${ROOT_DIR}/index.m3u` utils.createFile(filename, '#EXTM3U\n') - const sfwFilename = `${ROOT_DIR}/index.sfw.m3u` - utils.createFile(sfwFilename, '#EXTM3U\n') + const nsfwFilename = `${ROOT_DIR}/index.nsfw.m3u` + utils.createFile(nsfwFilename, '#EXTM3U\n') const channels = db.channels.sortBy(['name', 'url']).removeDuplicates().get() for (const channel of channels) { - utils.appendToFile(filename, channel.toString()) - if (channel.isSFW()) { - utils.appendToFile(sfwFilename, channel.toString()) + if (!channel.isNSFW()) { + utils.appendToFile(filename, channel.toString()) } + utils.appendToFile(nsfwFilename, channel.toString()) } } @@ -51,15 +51,9 @@ function generateCategoryIndex() { const filename = `${ROOT_DIR}/index.category.m3u` utils.createFile(filename, '#EXTM3U\n') - const sfwFilename = `${ROOT_DIR}/index.category.sfw.m3u` - utils.createFile(sfwFilename, '#EXTM3U\n') - const channels = db.channels.sortBy(['category', 'name', 'url']).removeDuplicates().get() for (const channel of channels) { utils.appendToFile(filename, channel.toString()) - if (channel.isSFW()) { - utils.appendToFile(sfwFilename, channel.toString()) - } } } @@ -68,9 +62,6 @@ function generateCountryIndex() { const filename = `${ROOT_DIR}/index.country.m3u` utils.createFile(filename, '#EXTM3U\n') - const sfwFilename = `${ROOT_DIR}/index.country.sfw.m3u` - utils.createFile(sfwFilename, '#EXTM3U\n') - for (const country of [{ code: 'undefined' }, ...db.countries.sortBy(['name']).all()]) { const channels = db.channels .sortBy(['name', 'url']) @@ -79,11 +70,10 @@ function generateCountryIndex() { .get() for (const channel of channels) { const category = channel.category - const sfw = channel.isSFW() + const nsfw = channel.isNSFW() channel.category = country.name || '' - utils.appendToFile(filename, channel.toString()) - if (sfw) { - utils.appendToFile(sfwFilename, channel.toString()) + if (!nsfw) { + utils.appendToFile(filename, channel.toString()) } channel.category = category } @@ -95,9 +85,6 @@ function generateLanguageIndex() { const filename = `${ROOT_DIR}/index.language.m3u` utils.createFile(filename, '#EXTM3U\n') - const sfwFilename = `${ROOT_DIR}/index.language.sfw.m3u` - utils.createFile(sfwFilename, '#EXTM3U\n') - for (const language of [{ code: 'undefined' }, ...db.languages.sortBy(['name']).all()]) { const channels = db.channels .sortBy(['name', 'url']) @@ -106,11 +93,10 @@ function generateLanguageIndex() { .get() for (const channel of channels) { const category = channel.category - const sfw = channel.isSFW() + const nsfw = channel.isNSFW() channel.category = language.name || '' - utils.appendToFile(filename, channel.toString()) - if (sfw) { - utils.appendToFile(sfwFilename, channel.toString()) + if (!nsfw) { + utils.appendToFile(filename, channel.toString()) } channel.category = category } @@ -146,18 +132,14 @@ function generateCountries() { const filename = `${outputDir}/${country.code}.m3u` utils.createFile(filename, '#EXTM3U\n') - const sfwFilename = `${outputDir}/${country.code}.sfw.m3u` - utils.createFile(sfwFilename, '#EXTM3U\n') - const channels = db.channels .sortBy(['name', 'url']) .forCountry(country) .removeDuplicates() .get() for (const channel of channels) { - utils.appendToFile(filename, channel.toString()) - if (channel.isSFW()) { - utils.appendToFile(sfwFilename, channel.toString()) + if (!channel.isNSFW()) { + utils.appendToFile(filename, channel.toString()) } } } @@ -172,18 +154,14 @@ function generateLanguages() { const filename = `${outputDir}/${language.code}.m3u` utils.createFile(filename, '#EXTM3U\n') - const sfwFilename = `${outputDir}/${language.code}.sfw.m3u` - utils.createFile(sfwFilename, '#EXTM3U\n') - const channels = db.channels .sortBy(['name', 'url']) .forLanguage(language) .removeDuplicates() .get() for (const channel of channels) { - utils.appendToFile(filename, channel.toString()) - if (channel.isSFW()) { - utils.appendToFile(sfwFilename, channel.toString()) + if (!channel.isNSFW()) { + utils.appendToFile(filename, channel.toString()) } } } From 8cd5b1f6ec2c29b3b45639f35cea594440c71045 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 5 Jun 2021 17:24:38 +0300 Subject: [PATCH 3/4] Update template.md --- .readme/template.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/.readme/template.md b/.readme/template.md index 9cfec9a7e3..968037ec95 100644 --- a/.readme/template.md +++ b/.readme/template.md @@ -54,8 +54,6 @@ Or select one of the playlists from the list below. -**NOTE:** Add `.sfw` to the end of the filename for the lists without any adult channels (For example: `https://iptv-org.github.io/iptv/countries/fr.sfw.m3u`). - ## For Developers In addition to the above methods, you can also get a list of all available channels in JSON format. From 9a71630762ae7ae6ccc1fb215815a9dafffa830a Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 5 Jun 2021 17:52:38 +0300 Subject: [PATCH 4/4] Update template.md --- .readme/template.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.readme/template.md b/.readme/template.md index 968037ec95..0b0df4af70 100644 --- a/.readme/template.md +++ b/.readme/template.md @@ -18,6 +18,7 @@ Also you can instead use one of these playlists: - `https://iptv-org.github.io/iptv/index.country.m3u` (grouped by country) - `https://iptv-org.github.io/iptv/index.category.m3u` (grouped by category) - `https://iptv-org.github.io/iptv/index.language.m3u` (grouped by language) +- `https://iptv-org.github.io/iptv/index.nsfw.m3u` (includes adult channels) Or select one of the playlists from the list below.