From 463a2e842898227866e365f15b2e3194db1370b9 Mon Sep 17 00:00:00 2001 From: yarafie <88841013+yarafie@users.noreply.github.com> Date: Tue, 11 Jan 2022 19:59:32 +0300 Subject: [PATCH 1/3] Update elcinema.com.config.js dateString needs to take into account single digit or double digit days to match format on website epg. --- sites/elcinema.com/elcinema.com.config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sites/elcinema.com/elcinema.com.config.js b/sites/elcinema.com/elcinema.com.config.js index efcfdc7c..1bad9068 100644 --- a/sites/elcinema.com/elcinema.com.config.js +++ b/sites/elcinema.com/elcinema.com.config.js @@ -105,7 +105,12 @@ function parseDescription(item) { function parseItems(content, channel, date) { const $ = cheerio.load(content) - const dateString = date.locale(channel.lang).format('dddd D MMMM') + +// const dateString = date.locale(channel.lang).format('dddd D MMMM') + const dayNum = date.locale(channel.lang).format('D') + if ( dayNum.length == 1 ) dateString = date.locale(channel.lang).format('dddd D MMMM') + if ( dayNum.length == 2 ) dateString = date.locale(channel.lang).format('dddd D MMMM') + const list = $('.dates') .filter((i, el) => { return $(el).text().trim() === dateString From 8ac8ba58afeccc5d363c7e8b6d420ecf7a64024b Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 12 Jan 2022 14:02:42 +0300 Subject: [PATCH 2/3] Update elcinema.com.test.js --- sites/elcinema.com/elcinema.com.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/elcinema.com/elcinema.com.test.js b/sites/elcinema.com/elcinema.com.test.js index 7fe1109c..848faf09 100644 --- a/sites/elcinema.com/elcinema.com.test.js +++ b/sites/elcinema.com/elcinema.com.test.js @@ -19,8 +19,8 @@ const channelEN = { site_id: '1127', xmltv_id: 'MBC.ae' } -const contentAR = `
الخميس 11 نوفمبر
  • 12:30 مساءً
  • [30 دقيقة]
  • يعيد برنامج (أحلى ما طاش) عرضا لمجموعة من أفضل الحلقات التي...اقرأ المزيد تم تقديمها من خلال المسلسل الكوميدي السعودي (طاش ما طاش)، والذي استمر عرضه على التليفزيون السعودي لمدة 18 موسمًا متواصلًا، والتي ناقش من خلالها (ناصر القصبي) و(عبدالله السدحان) مجموعة من القضايا الاجتماعية التي تشغل بال المجتمع السعودي بطريقة ساخرة.
الجمعة 12 نوفمبر
  • يوميات موسم الرياض 2021
  • 12:00 صباحًا [15 دقيقة]
` -const contentEN = `
Thursday 11 November
  • 10:00 AM
  • [120 minutes]
` +const contentAR = `
الخميس 11 نوفمبر
  • 12:30 مساءً
  • [30 دقيقة]
  • يعيد برنامج (أحلى ما طاش) عرضا لمجموعة من أفضل الحلقات التي...اقرأ المزيد تم تقديمها من خلال المسلسل الكوميدي السعودي (طاش ما طاش)، والذي استمر عرضه على التليفزيون السعودي لمدة 18 موسمًا متواصلًا، والتي ناقش من خلالها (ناصر القصبي) و(عبدالله السدحان) مجموعة من القضايا الاجتماعية التي تشغل بال المجتمع السعودي بطريقة ساخرة.
الجمعة 12 نوفمبر
  • يوميات موسم الرياض 2021
  • 12:00 صباحًا [15 دقيقة]
` +const contentEN = `
Thursday 11 November
  • 10:00 AM
  • [120 minutes]
` it('can generate valid url', () => { expect(url({ channel: channelEN })).toBe('https://elcinema.com/en/tvguide/1127/') From 8eea99a123b9564ec63997be0820f24be6b4e19f Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 12 Jan 2022 14:02:45 +0300 Subject: [PATCH 3/3] Update elcinema.com.config.js --- sites/elcinema.com/elcinema.com.config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sites/elcinema.com/elcinema.com.config.js b/sites/elcinema.com/elcinema.com.config.js index 1bad9068..eaef7489 100644 --- a/sites/elcinema.com/elcinema.com.config.js +++ b/sites/elcinema.com/elcinema.com.config.js @@ -106,14 +106,14 @@ function parseDescription(item) { function parseItems(content, channel, date) { const $ = cheerio.load(content) -// const dateString = date.locale(channel.lang).format('dddd D MMMM') - const dayNum = date.locale(channel.lang).format('D') - if ( dayNum.length == 1 ) dateString = date.locale(channel.lang).format('dddd D MMMM') - if ( dayNum.length == 2 ) dateString = date.locale(channel.lang).format('dddd D MMMM') + const dateString = date.locale(channel.lang).format('dddd D MMMM') const list = $('.dates') .filter((i, el) => { - return $(el).text().trim() === dateString + let parsedDateString = $(el).text().trim() + parsedDateString = parsedDateString.replace(/\s\s+/g, ' ') + + return parsedDateString === dateString }) .first() .parent()