From 16e0b45fc1dd2531bffcf6188e1ee5898c5c1ac6 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 7 Jun 2021 13:32:53 +0300 Subject: [PATCH 1/3] Update clean.yml --- .github/workflows/clean.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml index 30ca9f286..9649364bc 100644 --- a/.github/workflows/clean.yml +++ b/.github/workflows/clean.yml @@ -10,7 +10,8 @@ jobs: strategy: fail-fast: false matrix: - country: [ + country: + [ ad, ae, af, @@ -166,8 +167,8 @@ jobs: vn, xk, ye, - zm - # unsorted + zm, + unsorted ] steps: - name: Checkout From c03b55812f7aeb45eb61981a4f3eedec08756c66 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 7 Jun 2021 14:54:42 +0300 Subject: [PATCH 2/3] Update clean.js --- scripts/clean.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/clean.js b/scripts/clean.js index 2288af620..32f79cee9 100644 --- a/scripts/clean.js +++ b/scripts/clean.js @@ -24,7 +24,7 @@ const instance = axios.create({ rejectUnauthorized: false }), validateStatus: function (status) { - return status !== 404 + return status !== 404 && status < 500 } }) @@ -101,8 +101,7 @@ async function checkStatus(playlist) { .then(utils.sleep(config.delay)) .catch(err => { clearTimeout(timeout) - if (err.response && err.response.status === 404) { - //console.error(err) + if (err.response && (err.response.status === 404 || err.response.status >= 500)) { if (config.debug) { console.info(` ${counter} ${chalk.red('offline')} ${chalk.white(channel.url)}`) stats.broken++ From c45edae2d8b986e2ff18898c04d6161fdeff280c Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 7 Jun 2021 21:25:10 +0300 Subject: [PATCH 3/3] Update clean.js --- scripts/clean.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/clean.js b/scripts/clean.js index 32f79cee9..9b4bd2095 100644 --- a/scripts/clean.js +++ b/scripts/clean.js @@ -17,6 +17,7 @@ program const config = program.opts() +const offlineStatusCodes = [404, 410, 500, 501] const instance = axios.create({ timeout: config.timeout, maxContentLength: 200000, @@ -24,7 +25,7 @@ const instance = axios.create({ rejectUnauthorized: false }), validateStatus: function (status) { - return status !== 404 && status < 500 + return !offlineStatusCodes.includes(status) } }) @@ -34,7 +35,7 @@ const stats = { broken: 0 } async function main() { console.info(`\nStarting...`) - console.time('Process completed in') + console.time('Done in') if (config.debug) { console.info(chalk.yellow(`INFO: Debug mode enabled\n`)) } @@ -101,11 +102,11 @@ async function checkStatus(playlist) { .then(utils.sleep(config.delay)) .catch(err => { clearTimeout(timeout) - if (err.response && (err.response.status === 404 || err.response.status >= 500)) { + if (err.response && offlineStatusCodes.includes(err.response.status)) { if (config.debug) { console.info(` ${counter} ${chalk.red('offline')} ${chalk.white(channel.url)}`) - stats.broken++ } + stats.broken++ } else { results.push(channel) if (config.debug) { @@ -130,7 +131,7 @@ async function savePlaylist(playlist) { return false } else { utils.createFile(playlist.url, output) - console.info(`Playlist has been updated. Removed ${stats.broken} broken links.`) + console.info(`Playlist has been updated. Removed ${stats.broken} links.`) } return true @@ -141,7 +142,7 @@ async function done() { } function finish() { - console.timeEnd('Process completed in') + console.timeEnd('Done in') } main()