From cccea39fb9797a5e592b543a1a6eb8585a7ee51c Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 11 Nov 2021 16:22:25 +0300 Subject: [PATCH 1/6] Update dsmart.com.tr_tr.channels.xml --- .../dsmart.com.tr_tr.channels.xml | 210 +++++++++--------- 1 file changed, 105 insertions(+), 105 deletions(-) diff --git a/sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml b/sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml index 0cb4c257..ad5ac74c 100644 --- a/sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml +++ b/sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml @@ -1,105 +1,105 @@ - - - - 24 Kitchen Türkiye - 24 TV - 360 - A Haber - A News - A Spor - ATV Türkiye - Baby TV Europe - BBC Earth Türkiye - BBC World News Europe - BBN Türk - Beyaz TV - Bloomberg HT - Boomerang Türkiye - Cartoon Network Türkiye - CNN International Europe - CNN Türk - Çocuk Smart - Da Vinci - Discovery Channel Türkiye - Discovery Science Türkiye - Disney Channel Türkiye - Disney Junior Türkiye & Polska - Diyanet TV - DiziSmart Max - DiziSmart Premium - DMAX Türkiye - DocuBox HD - Euro D - Eurosport 1 - Eurosport 2 - FashionTV HD Europe - Fast & FunBox HD - FB TV - FightBox HD - FilmBox Türkiye - Flash TV - Fox Crime Türkiye - Fox Türkiye - FX Türkiye - Haber Global - Habertürk - Insight HD - Kanal 7 - Kanal D - Love Nature - MovieSmart Classic - MovieSmart Premium - MovieSmart Premium 2 - MovieSmart Türk - National Geographic Türkiye - National Geographic Wild Türkiye - NBA TV - NTV - Number 1 Türk - Number 1 TV - Power TV - Show TV - Sinema 2 - Sinema 1001 - Sinema 1002 - Sinema Aile - Sinema Aile 2 - Sinema Aksiyon - Sinema Aksiyon 2 - Sinema Komedi - Sinema Komedi 2 - Sinema TV - Spor Smart - Spor Smart 2 - Sports TV - S Sport - S Sport 2 - Star TV - Stingray Naturescape - Tele 1 - Teve 2 - TGRT Haber - The History Channel Turkey - TLC Türkiye - Trace Urban - TRT 1 - TRT 2 - TRT 4K - TRT Avaz - TRT Belgesel - TRT Haber - TRT Kurdî - TRT Müzik - TRT Spor Yildiz - TRT Türk - TV 4 - TV 8 - TV 8.5 - TV 100 - TV Net - UçanKus TV - Ülke TV - Vav TV - Viasat History HD - - \ No newline at end of file + + + + 24 Kitchen Türkiye + 24 TV + 360 + A Haber + A News + A Spor + ATV Türkiye + Baby TV Europe + BBC Earth Türkiye + BBC World News Europe + BBN Türk + Beyaz TV + Bloomberg HT + Boomerang Türkiye + Cartoon Network Türkiye + CNN International Europe + CNN Türk + Çocuk Smart + Da Vinci + Discovery Channel Türkiye + Discovery Science Türkiye + Disney Channel Türkiye + Disney Junior Türkiye & Polska + Diyanet TV + DiziSmart Max + DiziSmart Premium + DMAX Türkiye + DocuBox HD + Euro D + Eurosport 1 + Eurosport 2 + FashionTV HD Europe + Fast & FunBox HD + FB TV + FightBox HD + FilmBox Türkiye + Flash TV + Fox Crime Türkiye + Fox Türkiye + FX Türkiye + Haber Global + Habertürk + Insight HD + Kanal 7 + Kanal D + Love Nature + MovieSmart Classic + MovieSmart Premium + MovieSmart Premium 2 + MovieSmart Türk + National Geographic Türkiye + National Geographic Wild Türkiye + NBA TV + NTV + Number 1 Türk + Number 1 TV + Power TV + Show TV + Sinema 2 + Sinema 1001 + Sinema 1002 + Sinema Aile + Sinema Aile 2 + Sinema Aksiyon + Sinema Aksiyon 2 + Sinema Komedi + Sinema Komedi 2 + Sinema TV + Spor Smart + Spor Smart 2 + Sports TV + S Sport + S Sport 2 + Star TV + Stingray Naturescape + Tele 1 + Teve 2 + TGRT Haber + The History Channel Turkey + TLC Türkiye + Trace Urban + TRT 1 + TRT 2 + TRT 4K + TRT Avaz + TRT Belgesel + TRT Haber + TRT Kurdî + TRT Müzik + TRT Spor Yildiz + TRT Türk + TV 4 + TV 8 + TV 8.5 + TV 100 + TV Net + UçanKus TV + Ülke TV + Vav TV + Viasat History HD + + From c94b6284d12d73644086a216520e9995854e2cf4 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 11 Nov 2021 16:22:28 +0300 Subject: [PATCH 2/6] Update .gitignore --- sites/tvtv.us/.gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sites/tvtv.us/.gitignore b/sites/tvtv.us/.gitignore index 047766eb..02900957 100644 --- a/sites/tvtv.us/.gitignore +++ b/sites/tvtv.us/.gitignore @@ -1,2 +1 @@ -*.crawler.js -*.update.js \ No newline at end of file +*.crawler.js \ No newline at end of file From cd12e3ad6b8e1dbc9d3555addff0321f88c129ca Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 11 Nov 2021 16:22:30 +0300 Subject: [PATCH 3/6] Create .gitignore --- scripts/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 scripts/.gitignore diff --git a/scripts/.gitignore b/scripts/.gitignore new file mode 100644 index 00000000..54295185 --- /dev/null +++ b/scripts/.gitignore @@ -0,0 +1 @@ +edit.js \ No newline at end of file From 231829172749f9af83e0d3ba9471409f41261da1 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 11 Nov 2021 16:37:38 +0300 Subject: [PATCH 4/6] Update dsmart.com.tr.test.js --- sites/dsmart.com.tr/dsmart.com.tr.test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sites/dsmart.com.tr/dsmart.com.tr.test.js b/sites/dsmart.com.tr/dsmart.com.tr.test.js index bcc31e8a..8e26ace5 100644 --- a/sites/dsmart.com.tr/dsmart.com.tr.test.js +++ b/sites/dsmart.com.tr/dsmart.com.tr.test.js @@ -9,21 +9,21 @@ dayjs.extend(utc) const date = dayjs.utc('2021-11-06', 'YYYY-MM-DD').startOf('d') const channel = { - site_id: '1', + site_id: '1#1', xmltv_id: 'MovieSmartPremium.tr' } const content = `{"meta": {"code": 200, "message": "OK"}, "data": {"total": 200, "channels": [{"rating": 3, "ch_id": 805, "logo": "59f97253cfef0b75f4723ded", "ch_no": 1, "is_hd": true, "genre": [1, 2], "packages": ["58cfc9c7e138237a591f9a61", "58cfc9c7e138237a591f9a62", "58cfc9c7e138237a591f9a5f", "58cfc9c7e138237a591f9a60"], "slug": "moviesmart-premium", "hd": true, "_id": "58d29bb0eefad3db9c606290", "order": 1, "channel_name": "MovieSmart Premium", "description": "", "schedule": [{"actor": "", "year": "2015", "id": "60488f69cfef0b15935d70d7", "subject": "Goosebumps: Canavarlar Firarda (Goosebumps) T\\u00fcr: Komedi - Macera Y\\u00f6netmen: Rob Letterman Oyuncular: Jack Black, Dylan Minnette, Odeya Rush", "audio_subtitles": 3, "start_date": "2021-11-03T21:15:00Z", "channel": "58d29bb0eefad3db9c606290", "description": "B\\u00fcy\\u00fck \\u015fehirden k\\u00fc\\u00e7\\u00fck bir kasabaya ta\\u015f\\u0131nd\\u0131\\u011f\\u0131 i\\u00e7in mutsuz olan Zach Cooper, ta\\u015f\\u0131nd\\u0131klar\\u0131 evin tam yan\\u0131ndaki evde ya\\u015fayan g\\u00fczel k\\u0131z Hannah ile kar\\u015f\\u0131la\\u015f\\u0131p, Champ ile de k\\u0131sa s\\u00fcrede arkada\\u015f olunca yeni bir hayat i\\u00e7in umutlan\\u0131r. Ancak Zach, Hannah'n\\u0131n gizemli babas\\u0131n\\u0131n Goosebumps kitaplar\\u0131n\\u0131n yazar\\u0131, R.L. Stine oldu\\u011funu \\u00f6\\u011frendi\\u011finde, olaylar\\u0131n normal gitmeyece\\u011fini anlar. (Dil:T\\u00fcrk\\u00e7e/Orijinal - Altyaz\\u0131:T\\u00fcrk\\u00e7e/\\u0130ngilizce)", "director": "", "end_date": "2021-11-03T23:55:00Z", "genre": "sinema/genel", "program_name": "Goosebumps: Canavarlar Firarda", "day": "2021-11-05T21:00:00Z", "episode": "", "screen_violence": 4, "_id": "6185a3f6cfef0b1593e44e63", "duration": "1:40:00"},{"actor": "", "year": "2015", "id": "60488f69cfef0b15935d70d7", "subject": "Goosebumps: Canavarlar Firarda (Goosebumps) T\\u00fcr: Komedi - Macera Y\\u00f6netmen: Rob Letterman Oyuncular: Jack Black, Dylan Minnette, Odeya Rush", "audio_subtitles": 3, "start_date": "2021-11-03T23:55:00Z", "channel": "58d29bb0eefad3db9c606290", "description": "B\\u00fcy\\u00fck \\u015fehirden k\\u00fc\\u00e7\\u00fck bir kasabaya ta\\u015f\\u0131nd\\u0131\\u011f\\u0131 i\\u00e7in mutsuz olan Zach Cooper, ta\\u015f\\u0131nd\\u0131klar\\u0131 evin tam yan\\u0131ndaki evde ya\\u015fayan g\\u00fczel k\\u0131z Hannah ile kar\\u015f\\u0131la\\u015f\\u0131p, Champ ile de k\\u0131sa s\\u00fcrede arkada\\u015f olunca yeni bir hayat i\\u00e7in umutlan\\u0131r. Ancak Zach, Hannah'n\\u0131n gizemli babas\\u0131n\\u0131n Goosebumps kitaplar\\u0131n\\u0131n yazar\\u0131, R.L. Stine oldu\\u011funu \\u00f6\\u011frendi\\u011finde, olaylar\\u0131n normal gitmeyece\\u011fini anlar. (Dil:T\\u00fcrk\\u00e7e/Orijinal - Altyaz\\u0131:T\\u00fcrk\\u00e7e/\\u0130ngilizce)", "director": "", "end_date": "2021-11-03T01:55:00Z", "genre": "sinema/genel", "program_name": "Goosebumps: Canavarlar Firarda", "day": "2021-11-05T21:00:00Z", "episode": "", "screen_violence": 4, "_id": "6185a3f6cfef0b1593e44e63", "duration": "1:40:00"}]}]}}` it('can generate valid url', () => { - const result = url({ date, channel }) - expect(result).toBe( + expect(url({ date, channel })).toBe( 'https://www.dsmart.com.tr/api/v1/public/epg/schedules?page=1&limit=1&day=2021-11-06' ) }) it('can get logo url', () => { - const result = logo({ content }) - expect(result).toBe('https://www.dsmart.com.tr/epg/images/0x50/59f97253cfef0b75f4723ded') + expect(logo({ content, channel })).toBe( + 'https://www.dsmart.com.tr/epg/images/0x50/59f97253cfef0b75f4723ded' + ) }) it('can parse response', () => { From 52094dae00586fbfc368191907a01b7d5ff566ef Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 11 Nov 2021 16:37:44 +0300 Subject: [PATCH 5/6] Update dsmart.com.tr.config.js --- sites/dsmart.com.tr/dsmart.com.tr.config.js | 33 +++++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/sites/dsmart.com.tr/dsmart.com.tr.config.js b/sites/dsmart.com.tr/dsmart.com.tr.config.js index 33405ba1..21145960 100644 --- a/sites/dsmart.com.tr/dsmart.com.tr.config.js +++ b/sites/dsmart.com.tr/dsmart.com.tr.config.js @@ -9,21 +9,21 @@ module.exports = { }, site: 'dsmart.com.tr', url({ date, channel }) { - return `https://www.dsmart.com.tr/api/v1/public/epg/schedules?page=${ - channel.site_id - }&limit=1&day=${date.format('YYYY-MM-DD')}` - }, - logo({ content }) { - const data = JSON.parse(content) - if (!data || !data.data.channels.length) return null - const logoId = data.data.channels[0].logo + const [page] = channel.site_id.split('#') - return logoId ? `https://www.dsmart.com.tr/epg/images/0x50/${logoId}` : null + return `https://www.dsmart.com.tr/api/v1/public/epg/schedules?page=${page}&limit=1&day=${date.format( + 'YYYY-MM-DD' + )}` + }, + logo({ content, channel }) { + const data = parseContent(content, channel) + + return data && data.logo ? `https://www.dsmart.com.tr/epg/images/0x50/${data.logo}` : null }, parser: function ({ content, channel, date }) { let offset = -1 let programs = [] - const items = parseItems(content) + const items = parseItems(content, channel) items.forEach(item => { let start = parseStart(item, date) if (offset === -1 && start.hour() > 18) start = start.subtract(1, 'd') @@ -52,9 +52,16 @@ function parseStop(item, date) { return dayjs.utc(item.end_date).set('date', date.get('date')) } -function parseItems(content) { +function parseContent(content, channel) { const data = JSON.parse(content) - if (!data || !data.data.channels.length) return [] + if (!data || !data.data || !Array.isArray(data.data.channels)) return null + const [_, channelId] = channel.site_id.split('#') - return data.data.channels[0].schedule + return data.data.channels.find(i => i.ch_no == channelId) +} + +function parseItems(content, channel) { + const data = parseContent(content, channel) + + return data ? data.schedule : [] } From 4bcc0f0786b5e426dda4c5dab6752813b783c975 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 11 Nov 2021 16:39:16 +0300 Subject: [PATCH 6/6] Update dsmart.com.tr_tr.channels.xml --- sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml b/sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml index ad5ac74c..e1d3b87f 100644 --- a/sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml +++ b/sites/dsmart.com.tr/dsmart.com.tr_tr.channels.xml @@ -5,7 +5,6 @@ 24 TV 360 A Haber - A News A Spor ATV Türkiye Baby TV Europe @@ -17,7 +16,6 @@ Boomerang Türkiye Cartoon Network Türkiye CNN International Europe - CNN Türk Çocuk Smart Da Vinci Discovery Channel Türkiye @@ -29,7 +27,6 @@ DiziSmart Premium DMAX Türkiye DocuBox HD - Euro D Eurosport 1 Eurosport 2 FashionTV HD Europe @@ -84,11 +81,9 @@ Trace Urban TRT 1 TRT 2 - TRT 4K TRT Avaz TRT Belgesel TRT Haber - TRT Kurdî TRT Müzik TRT Spor Yildiz TRT Türk