From 7231180cf02d12386fc8afcc95a75d77360fa194 Mon Sep 17 00:00:00 2001 From: GenericMale Date: Tue, 21 Nov 2023 18:30:09 +0100 Subject: [PATCH] adapt tvprofil.com checksum impl --- sites/tvprofil.com/tvprofil.com.config.js | 11 ++++++----- sites/tvprofil.com/tvprofil.com.test.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sites/tvprofil.com/tvprofil.com.config.js b/sites/tvprofil.com/tvprofil.com.config.js index ac568528..ea7d3d11 100644 --- a/sites/tvprofil.com/tvprofil.com.config.js +++ b/sites/tvprofil.com/tvprofil.com.config.js @@ -77,19 +77,20 @@ function buildQuery(site_id, date) { callback: 'cb' } - const a = query.datum + query.kanal + let c = 3 + const a = query.datum + query.kanal + c const ua = query.kanal + query.datum let i = a.length, - b = 2, - c = 2 + b = 2 - for (var j = 0; j < ua.length; j++) c += ua.charCodeAt(j) + for (let j = 0; j < ua.length; j++) c += ua.charCodeAt(j) while (i--) { b += (a.charCodeAt(i) + c * 2) * i } - const key = 'b' + b.toString().charCodeAt(2) + b = b.toString() + const key = 'b' + b.charCodeAt(b.length-1) query[key] = b diff --git a/sites/tvprofil.com/tvprofil.com.test.js b/sites/tvprofil.com/tvprofil.com.test.js index 3019ab32..ea92d4a4 100644 --- a/sites/tvprofil.com/tvprofil.com.test.js +++ b/sites/tvprofil.com/tvprofil.com.test.js @@ -17,7 +17,7 @@ const channel = { it('can generate valid url', () => { expect(url({ channel, date })).toBe( - 'https://tvprofil.com/bg/tv-programa/program/?datum=2023-01-12&kanal=24kitchen-bg&callback=cb&b55=747917' + 'https://tvprofil.com/bg/tv-programa/program/?datum=2023-01-12&kanal=24kitchen-bg&callback=cb&b51=818933' ) })