diff --git a/sites/tv.dir.bg/tv.dir.bg.config.js b/sites/tv.dir.bg/tv.dir.bg.config.js index e62e97e137..9e6fe53833 100644 --- a/sites/tv.dir.bg/tv.dir.bg.config.js +++ b/sites/tv.dir.bg/tv.dir.bg.config.js @@ -204,6 +204,15 @@ function parseItems(content) { } const $ = cheerio.load(json.html) + // Now the site gives 3 columns (prev day, current day, next day) + // Before it was 2 columns (current day, next day) + const broadcasts = $('.day-broadcast-list') + + // Remove prev day column + if (broadcasts.length >= 3) { + broadcasts.first().remove() + } + const items = $('.broadcast-item').toArray() return items @@ -213,4 +222,4 @@ function parseItems(content) { console.error('Error stack:', error.stack) return [] } -} \ No newline at end of file +} diff --git a/sites/tv.dir.bg/tv.dir.bg.test.js b/sites/tv.dir.bg/tv.dir.bg.test.js index eac5d01d1a..38b8688358 100644 --- a/sites/tv.dir.bg/tv.dir.bg.test.js +++ b/sites/tv.dir.bg/tv.dir.bg.test.js @@ -25,15 +25,15 @@ it('can parse response', () => { return p }) - expect(results.length).toBe(63) + expect(results.length).toBe(46) expect(results[0]).toMatchObject({ - start: '2025-06-30T03:00:00.000Z', - stop: '2025-06-30T03:30:00.000Z', - title: 'Светът на здравето' + start: '2025-06-30T03:15:00.000Z', + stop: '2025-06-30T03:57:00.000Z', + title: 'Лице в лице' }) - expect(results[62]).toMatchObject({ + expect(results[45]).toMatchObject({ start: '2025-07-01T02:00:00.000Z', stop: '2025-07-01T02:30:00.000Z', title: 'Убийства в Рая , сезон 1 , епизод 7'