diff --git a/sites/astro.com.my/__data__/program.json b/sites/astro.com.my/__data__/program.json index 3f080446..9729d343 100644 --- a/sites/astro.com.my/__data__/program.json +++ b/sites/astro.com.my/__data__/program.json @@ -7,7 +7,7 @@ "channelStbNumber": "305", "isHd": true, "imageUrl": "https://s3-ap-southeast-1.amazonaws.com/ams-astro/production/images/1035X328883.jpg", - "title": "Triumph in the Skies Ep06", + "title": "Triumph in the Skies S1 Ep06", "programmeId": "328827", "episodeId": "328883", "datetime": "2022-10-31 00:10:00.0", diff --git a/sites/astro.com.my/astro.com.my.config.js b/sites/astro.com.my/astro.com.my.config.js index a739f38b..628a4b47 100644 --- a/sites/astro.com.my/astro.com.my.config.js +++ b/sites/astro.com.my/astro.com.my.config.js @@ -21,7 +21,7 @@ module.exports = { const stop = start.add(duration, 's') const details = await loadProgramDetails(item) programs.push({ - title: item.title, + title: details.title, sub_title: item.subtitles, description: details.longSynopsis || details.shortSynopsis, actors: parseList(details.cast), @@ -30,6 +30,7 @@ module.exports = { rating: parseRating(details), categories: parseCategories(details), episode: parseEpisode(item), + season: parseSeason(details), start: start, stop: stop }) @@ -45,6 +46,12 @@ function parseEpisode(item) { return number ? parseInt(number) : null } +function parseSeason(details) { + const [_, season] = details.title ? details.title.match(/ S(\d+)/) || [null, null] : [null, null] + + return season ? parseInt(season) : null +} + function parseList(list) { return typeof list === 'string' ? list.split(',') : [] } diff --git a/sites/astro.com.my/astro.com.my.test.js b/sites/astro.com.my/astro.com.my.test.js index 4eb79a3f..88a58265 100644 --- a/sites/astro.com.my/astro.com.my.test.js +++ b/sites/astro.com.my/astro.com.my.test.js @@ -49,7 +49,7 @@ it('can parse response', async () => { expect(results[0]).toMatchObject({ start: '2022-10-30T16:10:00.000Z', stop: '2022-10-30T17:02:00.000Z', - title: 'Triumph in the Skies Ep06', + title: 'Triumph in the Skies S1 Ep06', description: 'This classic drama depicts the many aspects of two complicated relationships set against an airline company. Will those involved ever find true love?', actors: ['Francis Ng Chun Yu', 'Joe Ma Tak Chung', 'Flora Chan Wai San'], @@ -60,6 +60,7 @@ it('can parse response', async () => { value: 'U' }, episode: 6, + season: 1, categories: ['Drama'] }) })