diff --git a/sites/programetv.ro/__data__/content.html b/sites/programetv.ro/__data__/content.html new file mode 100644 index 00000000..0eba125b --- /dev/null +++ b/sites/programetv.ro/__data__/content.html @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/sites/programetv.ro/__data__/no_content.html b/sites/programetv.ro/__data__/no_content.html new file mode 100644 index 00000000..4589c8b2 --- /dev/null +++ b/sites/programetv.ro/__data__/no_content.html @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/sites/programetv.ro/programetv.ro.config.js b/sites/programetv.ro/programetv.ro.config.js index 4a14f0e5..344e65b3 100644 --- a/sites/programetv.ro/programetv.ro.config.js +++ b/sites/programetv.ro/programetv.ro.config.js @@ -72,8 +72,8 @@ function parseStop(item) { } function parseContent(content) { - const [, data] = content.match(/var pageData = ({.+});\n/) || [null, null] - + const [, data] = content.match(/var pageData = ({.+?});/) || [null, null] + return data ? JSON.parse(data) : {} } diff --git a/sites/programetv.ro/programetv.ro.test.js b/sites/programetv.ro/programetv.ro.test.js index 03be7955..22731737 100644 --- a/sites/programetv.ro/programetv.ro.test.js +++ b/sites/programetv.ro/programetv.ro.test.js @@ -1,4 +1,6 @@ const { parser, url } = require('./programetv.ro.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -7,22 +9,6 @@ dayjs.extend(utc) const date = dayjs.utc('2021-10-24', 'YYYY-MM-DD').startOf('d') const channel = { site_id: 'pro-tv', xmltv_id: 'ProTV.ro' } -const content = ` - - - - - -` it('can generate valid url', () => { const result = url({ date, channel }) @@ -30,6 +16,7 @@ it('can generate valid url', () => { }) it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8') const result = parser({ date, channel, content }) expect(result).toMatchObject([ { @@ -48,21 +35,8 @@ it('can handle empty guide', () => { const result = parser({ date, channel, - content: ` - - - - - - -` + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8') + }) expect(result).toMatchObject([]) }) diff --git a/sites/programme-tv.vini.pf/__data__/content.json b/sites/programme-tv.vini.pf/__data__/content.json new file mode 100644 index 00000000..41e8bacc --- /dev/null +++ b/sites/programme-tv.vini.pf/__data__/content.json @@ -0,0 +1 @@ +{"programmes":[{"nid":"8857261","src":"https://programme-tv.vini.pf/sites/default/files/img-icones/192.png","alt":"","title":"","url":"/tf1","programmes":[{"nidP":"24162436","categorieP":"Magazine","categorieTIDP":"1033","episodeP":"-1","titreP":"Reportages découverte","heureP":"13:50","timestampDeb":1637452200,"timestampFin":1637457000,"altP":"","titleP":"","legendeP":"La coloc ne connaît pas la crise","desc":"Pour faire face à la crise du logement, aux loyers toujours plus élevés, à la solitude ou pour les gardes d'enfants, les colocations ont le vent en poupe, Pour mieux comprendre ce nouveau phénomène, une équipe a partagé le quotidien de quatre foyers : une retraitée qui héberge des étudiants, des mamans solos, enceintes, qui partagent un appartement associatif, trois générations de la même famille sur un domaine viticole et une étudiante qui intègre une colocation XXL.","srcP":"https://programme-tv.vini.pf/sites/default/files/img-icones/52ada51ed86b7e7bc11eaee83ff2192785989d77.jpg","urlP":"/reportages-decouverte-20112021-1350","width":58.333333333333,"active":false,"progression":0,"test":0,"nowphp":1637509179},{"nidP":"24162437","categorieP":"Magazine","categorieTIDP":"1033","episodeP":"-1","titreP":"Les docs du week-end","heureP":"15:10","timestampDeb":1637457000,"timestampFin":1637461800,"altP":"","titleP":"","legendeP":"Que sont-ils devenus ? L'incroyable destin des stars des émissions de télécrochet","desc":"Un documentaire français réalisé en 2019, Cindy Sander, Myriam Abel, Mario, Michal ou encore Magali Vaé ont fait les grandes heures des premières émissions de télécrochet modernes, dans les années 2000, Des années après leur passage, que reste-t-il de leur notoriété ? Comment ces candidats ont-ils vécu leur soudaine médiatisation ? Quels rapports entretenaient-ils avec les autres participants et les membres du jury, souvent intransigeants ?","srcP":"https://programme-tv.vini.pf/sites/default/files/img-icones/6e64cfbc55c1f4cbd11e3011401403d4dc08c6d2.jpg","urlP":"/les-docs-du-week-end-20112021-1510","width":41.666666666667,"active":false,"progression":0,"test":0,"nowphp":1637509179}]}]} \ No newline at end of file diff --git a/sites/programme-tv.vini.pf/__data__/content_1.json b/sites/programme-tv.vini.pf/__data__/content_1.json new file mode 100644 index 00000000..b8c311d0 --- /dev/null +++ b/sites/programme-tv.vini.pf/__data__/content_1.json @@ -0,0 +1 @@ +{"programmes":[{"nid":"8857261","src":"https://programme-tv.vini.pf/sites/default/files/img-icones/192.png","alt":"","title":"","url":"/tf1","programmes":[{"nidP":"24162437","categorieP":"Magazine","categorieTIDP":"1033","episodeP":"-1","titreP":"Les docs du week-end","heureP":"15:10","timestampDeb":1637457000,"timestampFin":1637461800,"altP":"","titleP":"","legendeP":"Que sont-ils devenus ? L'incroyable destin des stars des émissions de télécrochet","desc":"Un documentaire français réalisé en 2019, Cindy Sander, Myriam Abel, Mario, Michal ou encore Magali Vaé ont fait les grandes heures des premières émissions de télécrochet modernes, dans les années 2000, Des années après leur passage, que reste-t-il de leur notoriété ? Comment ces candidats ont-ils vécu leur soudaine médiatisation ? Quels rapports entretenaient-ils avec les autres participants et les membres du jury, souvent intransigeants ?","srcP":"https://programme-tv.vini.pf/sites/default/files/img-icones/6e64cfbc55c1f4cbd11e3011401403d4dc08c6d2.jpg","urlP":"/les-docs-du-week-end-20112021-1510","width":25,"active":false,"progression":0,"test":0,"nowphp":1637509998},{"nidP":"24162438","categorieP":"Magazine","categorieTIDP":"1033","episodeP":"-1","titreP":"50mn Inside","heureP":"16:30","timestampDeb":1637461800,"timestampFin":1637466300,"altP":"","titleP":"","legendeP":"L'actu","desc":"50'INSIDE, c'est toute l'actualité des stars résumée, chaque samedi, Le rendez-vous glamour pour retrouver toujours,,","srcP":"https://programme-tv.vini.pf/sites/default/files/img-icones/3d7e252312dacb5fb7a1a786fa0022ca1be15499.jpg","urlP":"/50mn-inside-20112021-1630","width":62.5,"active":false,"progression":0,"test":0,"nowphp":1637509998}]}]} \ No newline at end of file diff --git a/sites/programme-tv.vini.pf/__data__/content_2.json b/sites/programme-tv.vini.pf/__data__/content_2.json new file mode 100644 index 00000000..874680b9 --- /dev/null +++ b/sites/programme-tv.vini.pf/__data__/content_2.json @@ -0,0 +1 @@ +{"programmes":[{"nid":"8857261","src":"https://programme-tv.vini.pf/sites/default/files/img-icones/192.png","alt":"","title":"","url":"/tf1","programmes":[]}]} \ No newline at end of file diff --git a/sites/programme-tv.vini.pf/__data__/no_content.json b/sites/programme-tv.vini.pf/__data__/no_content.json new file mode 100644 index 00000000..874680b9 --- /dev/null +++ b/sites/programme-tv.vini.pf/__data__/no_content.json @@ -0,0 +1 @@ +{"programmes":[{"nid":"8857261","src":"https://programme-tv.vini.pf/sites/default/files/img-icones/192.png","alt":"","title":"","url":"/tf1","programmes":[]}]} \ No newline at end of file diff --git a/sites/programme-tv.vini.pf/programme-tv.vini.pf.test.js b/sites/programme-tv.vini.pf/programme-tv.vini.pf.test.js index 013682c9..ccbb8e41 100644 --- a/sites/programme-tv.vini.pf/programme-tv.vini.pf.test.js +++ b/sites/programme-tv.vini.pf/programme-tv.vini.pf.test.js @@ -1,4 +1,6 @@ const { parser, url, request } = require('./programme-tv.vini.pf.config.js') +const fs = require('fs') +const path = require('path') const axios = require('axios') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') @@ -31,21 +33,16 @@ it('can parse response', done => { axios.post.mockImplementation((url, data) => { if (data.dateDebut === '2021-11-20T16:00:00-10:00') { return Promise.resolve({ - data: Buffer.from( - '{"programmes":[{"nid":"8857261","src":"https://programme-tv.vini.pf/sites/default/files/img-icones/192.png","alt":"","title":"","url":"/tf1","programmes":[{"nidP":"24162437","categorieP":"Magazine","categorieTIDP":"1033","episodeP":"-1","titreP":"Les docs du week-end","heureP":"15:10","timestampDeb":1637457000,"timestampFin":1637461800,"altP":"","titleP":"","legendeP":"Que sont-ils devenus ? L\'incroyable destin des stars des émissions de télécrochet","desc":"Un documentaire français réalisé en 2019, Cindy Sander, Myriam Abel, Mario, Michal ou encore Magali Vaé ont fait les grandes heures des premières émissions de télécrochet modernes, dans les années 2000, Des années après leur passage, que reste-t-il de leur notoriété ? Comment ces candidats ont-ils vécu leur soudaine médiatisation ? Quels rapports entretenaient-ils avec les autres participants et les membres du jury, souvent intransigeants ?","srcP":"https://programme-tv.vini.pf/sites/default/files/img-icones/6e64cfbc55c1f4cbd11e3011401403d4dc08c6d2.jpg","urlP":"/les-docs-du-week-end-20112021-1510","width":25,"active":false,"progression":0,"test":0,"nowphp":1637509998},{"nidP":"24162438","categorieP":"Magazine","categorieTIDP":"1033","episodeP":"-1","titreP":"50mn Inside","heureP":"16:30","timestampDeb":1637461800,"timestampFin":1637466300,"altP":"","titleP":"","legendeP":"L\'actu","desc":"50\'INSIDE, c\'est toute l\'actualité des stars résumée, chaque samedi, Le rendez-vous glamour pour retrouver toujours,,","srcP":"https://programme-tv.vini.pf/sites/default/files/img-icones/3d7e252312dacb5fb7a1a786fa0022ca1be15499.jpg","urlP":"/50mn-inside-20112021-1630","width":62.5,"active":false,"progression":0,"test":0,"nowphp":1637509998}]}]}' - ) + data: Buffer.from(fs.readFileSync(path.resolve(__dirname, '__data__/content_1.json'))) }) } else { return Promise.resolve({ - data: Buffer.from( - '{"programmes":[{"nid":"8857261","src":"https://programme-tv.vini.pf/sites/default/files/img-icones/192.png","alt":"","title":"","url":"/tf1","programmes":[]}]}' - ) - }) - } - }) + data: Buffer.from(fs.readFileSync(path.resolve(__dirname, '__data__/content_2.json'))) + }) + } +}) - const content = - '{"programmes":[{"nid":"8857261","src":"https://programme-tv.vini.pf/sites/default/files/img-icones/192.png","alt":"","title":"","url":"/tf1","programmes":[{"nidP":"24162436","categorieP":"Magazine","categorieTIDP":"1033","episodeP":"-1","titreP":"Reportages découverte","heureP":"13:50","timestampDeb":1637452200,"timestampFin":1637457000,"altP":"","titleP":"","legendeP":"La coloc ne connaît pas la crise","desc":"Pour faire face à la crise du logement, aux loyers toujours plus élevés, à la solitude ou pour les gardes d\'enfants, les colocations ont le vent en poupe, Pour mieux comprendre ce nouveau phénomène, une équipe a partagé le quotidien de quatre foyers : une retraitée qui héberge des étudiants, des mamans solos, enceintes, qui partagent un appartement associatif, trois générations de la même famille sur un domaine viticole et une étudiante qui intègre une colocation XXL.","srcP":"https://programme-tv.vini.pf/sites/default/files/img-icones/52ada51ed86b7e7bc11eaee83ff2192785989d77.jpg","urlP":"/reportages-decouverte-20112021-1350","width":58.333333333333,"active":false,"progression":0,"test":0,"nowphp":1637509179},{"nidP":"24162437","categorieP":"Magazine","categorieTIDP":"1033","episodeP":"-1","titreP":"Les docs du week-end","heureP":"15:10","timestampDeb":1637457000,"timestampFin":1637461800,"altP":"","titleP":"","legendeP":"Que sont-ils devenus ? L\'incroyable destin des stars des émissions de télécrochet","desc":"Un documentaire français réalisé en 2019, Cindy Sander, Myriam Abel, Mario, Michal ou encore Magali Vaé ont fait les grandes heures des premières émissions de télécrochet modernes, dans les années 2000, Des années après leur passage, que reste-t-il de leur notoriété ? Comment ces candidats ont-ils vécu leur soudaine médiatisation ? Quels rapports entretenaient-ils avec les autres participants et les membres du jury, souvent intransigeants ?","srcP":"https://programme-tv.vini.pf/sites/default/files/img-icones/6e64cfbc55c1f4cbd11e3011401403d4dc08c6d2.jpg","urlP":"/les-docs-du-week-end-20112021-1510","width":41.666666666667,"active":false,"progression":0,"test":0,"nowphp":1637509179}]}]}' + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) parser({ content, channel, date }) .then(result => { @@ -98,7 +95,7 @@ it('can handle empty guide', done => { date, channel, content: - '{"programmes":[{"nid":"8857261","src":"https://programme-tv.vini.pf/sites/default/files/img-icones/192.png","alt":"","title":"","url":"/tf1","programmes":[]}]}' + '' }) .then(result => { expect(result).toMatchObject([]) diff --git a/sites/programtv.onet.pl/__data__/content.html b/sites/programtv.onet.pl/__data__/content.html new file mode 100644 index 00000000..fa2d325b --- /dev/null +++ b/sites/programtv.onet.pl/__data__/content.html @@ -0,0 +1 @@ +
13th Street
  • 03:20
    Law & Order, odc. 15: Letzte Worte Krimiserie

    Bei einer Reality-TV-Show stirbt einer der Teilnehmer. Zunächst tappen Briscoe (Jerry Orbach) und Green (Jesse L....

  • 23:30
    Navy CIS, odc. 1: New Orleans Krimiserie

    Der Abgeordnete Dan McLane, ein ehemaliger Vorgesetzter von Gibbs, wird in New Orleans ermordet. In den 90er Jahren...

  • 01:00
    Navy CIS: L.A, odc. 13: High Society Krimiserie

    Die Zahl der Drogentoten ist gestiegen. Das Team des NCIS glaubt, dass sich Terroristen durch den zunehmenden...

\ No newline at end of file diff --git a/sites/programtv.onet.pl/__data__/no_content.html b/sites/programtv.onet.pl/__data__/no_content.html new file mode 100644 index 00000000..6fedfd4c --- /dev/null +++ b/sites/programtv.onet.pl/__data__/no_content.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sites/programtv.onet.pl/programtv.onet.pl.test.js b/sites/programtv.onet.pl/programtv.onet.pl.test.js index 68f3a34a..3cfca2bf 100644 --- a/sites/programtv.onet.pl/programtv.onet.pl.test.js +++ b/sites/programtv.onet.pl/programtv.onet.pl.test.js @@ -1,5 +1,7 @@ const MockDate = require('mockdate') const { parser, url } = require('./programtv.onet.pl.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -11,8 +13,6 @@ const channel = { site_id: '13th-street-250', xmltv_id: '13thStreet.de' } -const content = - '
13th Street
  • 03:20
    Law & Order, odc. 15: Letzte Worte Krimiserie

    Bei einer Reality-TV-Show stirbt einer der Teilnehmer. Zunächst tappen Briscoe (Jerry Orbach) und Green (Jesse L....

  • 23:30
    Navy CIS, odc. 1: New Orleans Krimiserie

    Der Abgeordnete Dan McLane, ein ehemaliger Vorgesetzter von Gibbs, wird in New Orleans ermordet. In den 90er Jahren...

  • 01:00
    Navy CIS: L.A, odc. 13: High Society Krimiserie

    Die Zahl der Drogentoten ist gestiegen. Das Team des NCIS glaubt, dass sich Terroristen durch den zunehmenden...

' it('can generate valid url', () => { MockDate.set(dayjs.utc('2021-11-24', 'YYYY-MM-DD').startOf('d')) @@ -31,6 +31,7 @@ it('can generate valid url for next day', () => { }) it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html')) const result = parser({ content, date }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() @@ -69,7 +70,7 @@ it('can handle empty guide', () => { const result = parser({ date, channel, - content: '' + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html')) }) expect(result).toMatchObject([]) }) diff --git a/sites/raiplay.it/__data__/content.json b/sites/raiplay.it/__data__/content.json new file mode 100644 index 00000000..95d30306 --- /dev/null +++ b/sites/raiplay.it/__data__/content.json @@ -0,0 +1 @@ +{ "id": "Page-e120a813-1b92-4057-a214-15943d95aa68", "title": "Pagina Palinsesto", "channel": "Rai 2", "date": "03-05-2022", "events": [ { "id": "ContentItem-2f81030d-803b-456a-9ea5-40233234fd9d", "name": "The Good Doctor S3E5 - La prima volta", "episode_title": "La prima volta", "episode": "5", "season": "3", "description": "Shaun affronta il suo primo intervento. Il caso si rivela complicato e, nonostante Shaun abbia un'idea geniale, sarà Andrews a portare a termine l'operazione.", "channel": "Rai 2", "date": "03/05/2022", "hour": "19:40", "duration": "00:50:00", "duration_in_minutes": "50 min", "path_id": "", "weblink": "", "event_weblink": "/dirette/rai2/The-Good-Doctor-S3E5---La-prima-volta-2f81030d-803b-456a-9ea5-40233234fd9d.html", "has_video": false, "image": "/dl/img/2020/03/09/1583748471860_dddddd.jpg", "playlist_id": "11430689", "program": { "name": "The Good Doctor", "path_id": "/programmi/thegooddoctor.json", "info_url": "/programmi/info/757edeac-6fff-4dea-afcd-0bcb39f9ea83.json", "weblink": "/programmi/thegooddoctor" } } ], "track_info": { "id": "", "domain": "raiplay", "platform": "[platform]", "media_type": "", "page_type": "", "editor": "raiplay", "year": "2019", "edit_year": "", "section": "guida tv", "sub_section": "rai 2", "content": "guida tv", "title": "", "channel": "", "date": "2019-09-08", "typology": "", "genres": [], "sub_genres": [], "program_title": "", "program_typology": "", "program_genres": [], "program_sub_genres": [], "edition": "", "season": "", "episode_number": "", "episode_title": "", "form": "", "listaDateMo": [], "dfp": {} }} \ No newline at end of file diff --git a/sites/raiplay.it/__data__/no_content.json b/sites/raiplay.it/__data__/no_content.json new file mode 100644 index 00000000..33ba57bf --- /dev/null +++ b/sites/raiplay.it/__data__/no_content.json @@ -0,0 +1 @@ +{"events":[],"total":0} \ No newline at end of file diff --git a/sites/raiplay.it/raiplay.it.test.js b/sites/raiplay.it/raiplay.it.test.js index 057ca8bf..16700863 100644 --- a/sites/raiplay.it/raiplay.it.test.js +++ b/sites/raiplay.it/raiplay.it.test.js @@ -1,6 +1,6 @@ -// npm run grab --- --site=raiplay.it - const { parser, url } = require('./raiplay.it.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -18,8 +18,7 @@ it('can generate valid url', () => { }) it('can parse response', () => { - const content = - '{ "id": "Page-e120a813-1b92-4057-a214-15943d95aa68", "title": "Pagina Palinsesto", "channel": "Rai 2", "date": "03-05-2022", "events": [ { "id": "ContentItem-2f81030d-803b-456a-9ea5-40233234fd9d", "name": "The Good Doctor S3E5 - La prima volta", "episode_title": "La prima volta", "episode": "5", "season": "3", "description": "Shaun affronta il suo primo intervento. Il caso si rivela complicato e, nonostante Shaun abbia un\'idea geniale, sarà Andrews a portare a termine l\'operazione.", "channel": "Rai 2", "date": "03/05/2022", "hour": "19:40", "duration": "00:50:00", "duration_in_minutes": "50 min", "path_id": "", "weblink": "", "event_weblink": "/dirette/rai2/The-Good-Doctor-S3E5---La-prima-volta-2f81030d-803b-456a-9ea5-40233234fd9d.html", "has_video": false, "image": "/dl/img/2020/03/09/1583748471860_dddddd.jpg", "playlist_id": "11430689", "program": { "name": "The Good Doctor", "path_id": "/programmi/thegooddoctor.json", "info_url": "/programmi/info/757edeac-6fff-4dea-afcd-0bcb39f9ea83.json", "weblink": "/programmi/thegooddoctor" } } ], "track_info": { "id": "", "domain": "raiplay", "platform": "[platform]", "media_type": "", "page_type": "", "editor": "raiplay", "year": "2019", "edit_year": "", "section": "guida tv", "sub_section": "rai 2", "content": "guida tv", "title": "", "channel": "", "date": "2019-09-08", "typology": "", "genres": [], "sub_genres": [], "program_title": "", "program_typology": "", "program_genres": [], "program_sub_genres": [], "edition": "", "season": "", "episode_number": "", "episode_title": "", "form": "", "listaDateMo": [], "dfp": {} }}' + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ content, date }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() @@ -45,7 +44,7 @@ it('can parse response', () => { it('can handle empty guide', () => { const result = parser({ - content: '{"events":[],"total":0}' + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json')) }) expect(result).toMatchObject([]) }) diff --git a/sites/rikstv.no/__data__/content.json b/sites/rikstv.no/__data__/content.json new file mode 100644 index 00000000..7d2d5cb3 --- /dev/null +++ b/sites/rikstv.no/__data__/content.json @@ -0,0 +1,21 @@ +[ + { + "seriesName": "Vakre og ville Oman", + "name": "Vakre og ville Oman", + "description": "Oman er eit arabisk skattkammer av unike habitat og variert dyreliv. Rev, kvalhai, reptil og skjelpadder er blant skapningane du finn her.", + "season": 1, + "episode": 1, + "genres": [ + "Dokumentar", + "Fakta", + "Natur" + ], + "actors": [ + "Gergana Muskalla" + ], + "director": "Stefania Muller", + "imagePackUri": "https://imageservice.rikstv.no/hash/EC206C374F42287C0BDF850A7D3CB4D3.jpg", + "broadcastedTime": "2025-01-13T23:00:00Z", + "broadcastedTimeEnd": "2025-01-13T23:55:00Z" + } +] \ No newline at end of file diff --git a/sites/rikstv.no/rikstv.no.test.js b/sites/rikstv.no/rikstv.no.test.js index ce0f0959..0c79c07c 100644 --- a/sites/rikstv.no/rikstv.no.test.js +++ b/sites/rikstv.no/rikstv.no.test.js @@ -1,4 +1,6 @@ const { parser, url } = require('./rikstv.no.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -22,23 +24,7 @@ describe('rikstv.no Module Tests', () => { }) it('can parse response', () => { - const content = JSON.stringify([ - { - seriesName: 'Vakre og ville Oman', - name: 'Vakre og ville Oman', - description: - 'Oman er eit arabisk skattkammer av unike habitat og variert dyreliv. Rev, kvalhai, reptil og skjelpadder er blant skapningane du finn her.', - season: 1, - episode: 1, - genres: ['Dokumentar', 'Fakta', 'Natur'], - actors: ['Gergana Muskalla'], - director: 'Stefania Muller', - imagePackUri: 'https://imageservice.rikstv.no/hash/EC206C374F42287C0BDF850A7D3CB4D3.jpg', - broadcastedTime: '2025-01-13T23:00:00Z', - broadcastedTimeEnd: '2025-01-13T23:55:00Z' - } - ]) - + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ content }).map(p => { p.start = dayjs(p.start).toISOString() p.stop = dayjs(p.stop).toISOString() diff --git a/sites/rtmklik.rtm.gov.my/__data__/content.json b/sites/rtmklik.rtm.gov.my/__data__/content.json new file mode 100644 index 00000000..9ed7c329 --- /dev/null +++ b/sites/rtmklik.rtm.gov.my/__data__/content.json @@ -0,0 +1 @@ +{"id":2,"channel":"TV2","channelId":"2","image":"/live_channel/tv2_Trans.png","idAuthor":9,"type":"TV","timezone":8,"dateCreated":"2022-07-08T01:22:33.233","dateModified":"2022-07-21T21:58:39.77","itemCount":30,"prev":"https://rtm-admin.glueapi.io/v3/epg/2/ChannelSchedule?dateStart=2022-09-03&dateEnd=2022-09-03","next":"https://rtm-admin.glueapi.io/v3/epg/2/ChannelSchedule?dateStart=2022-09-05&dateEnd=2022-09-05","schedule":[{"idEPGProgramSchedule":109303,"dateTimeStart":"2022-09-04T19:00:00","dateTimeEnd":"2022-09-04T20:00:00","scheduleProgramTitle":"Hope Of Life","scheduleProgramDescription":"Kisah kehidupan 3 pakar bedah yang berbeza status dan latar belakang, namun mereka komited dengan kerjaya mereka sebagai doktor. Lakonan : Johnson Low, Elvis Chin, Mayjune Tan, Kelvin Liew, Jacky Kam dan Katrina Ho.","scheduleEpisodeNumber":0,"scheduleSeries":0,"duration":3600,"idEPGProgram":3603,"programTitle":"Hope Of Life","description":"Kisah kehidupan 3 pakar bedah yang berbeza status dan latar belakang, namun mereka komited dengan kerjaya mereka sebagai doktor. Lakonan : Johnson Low, Elvis Chin, Mayjune Tan, Kelvin Liew, Jacky Kam dan Katrina Ho.","episodeNumber":0,"series":0,"repeat":"Never","dateModified":"2022-08-29T02:14:56.647","dateCreated":"0001-01-01T00:00:00"}]} \ No newline at end of file diff --git a/sites/rtmklik.rtm.gov.my/__data__/no_content.json b/sites/rtmklik.rtm.gov.my/__data__/no_content.json new file mode 100644 index 00000000..908d1528 --- /dev/null +++ b/sites/rtmklik.rtm.gov.my/__data__/no_content.json @@ -0,0 +1 @@ +{"id":2,"channel":"TV2","channelId":"2","schedule":[]} \ No newline at end of file diff --git a/sites/rtmklik.rtm.gov.my/rtmklik.rtm.gov.my.test.js b/sites/rtmklik.rtm.gov.my/rtmklik.rtm.gov.my.test.js index ee59eca2..09586835 100644 --- a/sites/rtmklik.rtm.gov.my/rtmklik.rtm.gov.my.test.js +++ b/sites/rtmklik.rtm.gov.my/rtmklik.rtm.gov.my.test.js @@ -1,4 +1,6 @@ const { parser, url } = require('./rtmklik.rtm.gov.my.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -18,9 +20,7 @@ it('can generate valid url', () => { }) it('can parse response', () => { - const content = - '{"id":2,"channel":"TV2","channelId":"2","image":"/live_channel/tv2_Trans.png","idAuthor":9,"type":"TV","timezone":8,"dateCreated":"2022-07-08T01:22:33.233","dateModified":"2022-07-21T21:58:39.77","itemCount":30,"prev":"https://rtm-admin.glueapi.io/v3/epg/2/ChannelSchedule?dateStart=2022-09-03&dateEnd=2022-09-03","next":"https://rtm-admin.glueapi.io/v3/epg/2/ChannelSchedule?dateStart=2022-09-05&dateEnd=2022-09-05","schedule":[{"idEPGProgramSchedule":109303,"dateTimeStart":"2022-09-04T19:00:00","dateTimeEnd":"2022-09-04T20:00:00","scheduleProgramTitle":"Hope Of Life","scheduleProgramDescription":"Kisah kehidupan 3 pakar bedah yang berbeza status dan latar belakang, namun mereka komited dengan kerjaya mereka sebagai doktor. Lakonan : Johnson Low, Elvis Chin, Mayjune Tan, Kelvin Liew, Jacky Kam dan Katrina Ho.","scheduleEpisodeNumber":0,"scheduleSeries":0,"duration":3600,"idEPGProgram":3603,"programTitle":"Hope Of Life","description":"Kisah kehidupan 3 pakar bedah yang berbeza status dan latar belakang, namun mereka komited dengan kerjaya mereka sebagai doktor. Lakonan : Johnson Low, Elvis Chin, Mayjune Tan, Kelvin Liew, Jacky Kam dan Katrina Ho.","episodeNumber":0,"series":0,"repeat":"Never","dateModified":"2022-08-29T02:14:56.647","dateCreated":"0001-01-01T00:00:00"}]}' - + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ content, channel, date }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() @@ -42,7 +42,7 @@ it('can handle empty guide', () => { const result = parser({ date, channel, - content: '{"id":2,"channel":"TV2","channelId":"2","schedule":[]}' + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json')) }) expect(result).toMatchObject([]) }) diff --git a/sites/s.mxtv.jp/__data__/content.json b/sites/s.mxtv.jp/__data__/content.json new file mode 100644 index 00000000..c67c0663 --- /dev/null +++ b/sites/s.mxtv.jp/__data__/content.json @@ -0,0 +1 @@ +[{ "Event_id": "0x6a57", "Start_time": "2024年07月27日05時00分00秒", "Duration": "01:00:00", "Event_name": "ヒーリングタイム&ヘッドラインニュース", "Event_text": "ねこの足跡", "Component": "480i 16:9 パンベクトルなし", "Sound": "ステレオ", "Event_detail": ""}] \ No newline at end of file diff --git a/sites/s.mxtv.jp/s.mxtv.jp.test.js b/sites/s.mxtv.jp/s.mxtv.jp.test.js index b6891abc..16fd4bb7 100644 --- a/sites/s.mxtv.jp/s.mxtv.jp.test.js +++ b/sites/s.mxtv.jp/s.mxtv.jp.test.js @@ -1,4 +1,6 @@ const { parser, url } = require('./s.mxtv.jp.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -11,8 +13,6 @@ const channel = { name: 'Tokyo MX2', xmltv_id: 'TokyoMX2.jp' } -const content = - '[{ "Event_id": "0x6a57", "Start_time": "2024年07月27日05時00分00秒", "Duration": "01:00:00", "Event_name": "ヒーリングタイム&ヘッドラインニュース", "Event_text": "ねこの足跡", "Component": "480i 16:9 パンベクトルなし", "Sound": "ステレオ", "Event_detail": ""}]' it('can generate valid url', () => { const result = url({ date, channel }) @@ -20,6 +20,7 @@ it('can generate valid url', () => { }) it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ date, channel, content }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() diff --git a/sites/shahid.mbc.net/__data__/content.json b/sites/shahid.mbc.net/__data__/content.json new file mode 100644 index 00000000..eb889329 --- /dev/null +++ b/sites/shahid.mbc.net/__data__/content.json @@ -0,0 +1 @@ +{"items":[{"channelId":"996520","items":[{"actualFrom":"2023-11-11T00:00:00.000+00:00","actualTo":"2023-11-11T00:30:00.000+00:00","description":"The presenter reviews the most prominent episodes of news programs produced by the channel's team on a weekly basis, which include the most important global updates and developments at all levels.","duration":null,"emptySlot":false,"episodeNumber":194,"from":"2023-11-11T00:00:00.000+00:00","genres":["TV Show"],"productId":null,"productionYear":null,"productPoster":"https://imagesmbc.whatsonindia.com/dasimages/landscape/1920x1080/F968D4A39DB25793E9EED1BDAFBAD2EA8A8F9B30Z.jpg","productSubType":null,"productType":null,"replay":false,"restritectContent":null,"seasonId":null,"seasonNumber":"1","showId":null,"streamInfo":null,"title":"Menassaatona Fi Osboo'","to":"2023-11-11T00:30:00.000+00:00"}]}]} \ No newline at end of file diff --git a/sites/shahid.mbc.net/shahid.mbc.net.test.js b/sites/shahid.mbc.net/shahid.mbc.net.test.js index 7cc03032..2effd5f7 100644 --- a/sites/shahid.mbc.net/shahid.mbc.net.test.js +++ b/sites/shahid.mbc.net/shahid.mbc.net.test.js @@ -1,4 +1,6 @@ const { url, parser } = require('./shahid.mbc.net.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') @@ -18,8 +20,7 @@ it('can generate valid url', () => { }) it('can parse response', () => { - const content = - '{"items":[{"channelId":"996520","items":[{"actualFrom":"2023-11-11T00:00:00.000+00:00","actualTo":"2023-11-11T00:30:00.000+00:00","description":"The presenter reviews the most prominent episodes of news programs produced by the channel\'s team on a weekly basis, which include the most important global updates and developments at all levels.","duration":null,"emptySlot":false,"episodeNumber":194,"from":"2023-11-11T00:00:00.000+00:00","genres":["TV Show"],"productId":null,"productionYear":null,"productPoster":"https://imagesmbc.whatsonindia.com/dasimages/landscape/1920x1080/F968D4A39DB25793E9EED1BDAFBAD2EA8A8F9B30Z.jpg","productSubType":null,"productType":null,"replay":false,"restritectContent":null,"seasonId":null,"seasonNumber":"1","showId":null,"streamInfo":null,"title":"Menassaatona Fi Osboo\'","to":"2023-11-11T00:30:00.000+00:00"}]}]}' + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ content, channel, date }) expect(result).toMatchObject([ diff --git a/sites/siba.com.co/__data__/content.json b/sites/siba.com.co/__data__/content.json new file mode 100644 index 00000000..eaddd574 --- /dev/null +++ b/sites/siba.com.co/__data__/content.json @@ -0,0 +1 @@ +{"list":[{"id":"395","nom":"CANAL CLARO","num":"102","logo":"7c4b9e8566a6e867d1db4c7ce845f1f4.jpg","cat":"Exclusivos Claro","prog":[{"id":"665724465","nom":"Worst Cooks In America","ini":1636588800,"fin":1636592400}]}],"error":null} \ No newline at end of file diff --git a/sites/siba.com.co/__data__/no_content.json b/sites/siba.com.co/__data__/no_content.json new file mode 100644 index 00000000..97850767 --- /dev/null +++ b/sites/siba.com.co/__data__/no_content.json @@ -0,0 +1 @@ +{"list":[],"error":null} \ No newline at end of file diff --git a/sites/siba.com.co/siba.com.co.test.js b/sites/siba.com.co/siba.com.co.test.js index d63a0346..12d2a571 100644 --- a/sites/siba.com.co/siba.com.co.test.js +++ b/sites/siba.com.co/siba.com.co.test.js @@ -1,4 +1,6 @@ const { parser, url, request } = require('./siba.com.co.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -10,8 +12,6 @@ const channel = { site_id: '395', xmltv_id: 'CanalClaro.cl' } -const content = - '{"list":[{"id":"395","nom":"CANAL CLARO","num":"102","logo":"7c4b9e8566a6e867d1db4c7ce845f1f4.jpg","cat":"Exclusivos Claro","prog":[{"id":"665724465","nom":"Worst Cooks In America","ini":1636588800,"fin":1636592400}]}],"error":null}' it('can generate valid url', () => { expect(url).toBe('http://devportal.siba.com.co/index.php?action=grilla') @@ -32,6 +32,7 @@ it('can generate valid request data', () => { }) it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ date, channel, content }) expect(result).toMatchObject([ { @@ -46,7 +47,8 @@ it('can handle empty guide', () => { const result = parser({ date, channel, - content: '{"list":[],"error":null}' + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json')) + }) expect(result).toMatchObject([]) }) diff --git a/sites/sky.de/__data__/content.json b/sites/sky.de/__data__/content.json new file mode 100644 index 00000000..89a208b0 --- /dev/null +++ b/sites/sky.de/__data__/content.json @@ -0,0 +1 @@ +{"cl":[{"ci":522,"el":[{"ei":122309300,"bsdt":1645916700000,"bst":"00:05","bedt":1645918200000,"len":25,"et":"King of Queens","ec":"Comedyserie","cop":"USA","yop":2001,"fsk":"ab 0 Jahre","epit":"Der Experte","sn":"4","en":"11","pu":"/static/img/program_guide/1522936_s.jpg"},{"ei":122309301,"bsdt":1645918200000,"bst":"00:30","bedt":1645919700000,"len":25,"et":"King of Queens","ec":"Comedyserie","cop":"USA","yop":2001,"fsk":"ab 0 Jahre","epit":"Speedy Gonzales","sn":"4","en":"12","pu":"/static/img/program_guide/1522937_s.jpg"}]}]} \ No newline at end of file diff --git a/sites/sky.de/sky.de.test.js b/sites/sky.de/sky.de.test.js index 24835919..bdcb8a15 100644 --- a/sites/sky.de/sky.de.test.js +++ b/sites/sky.de/sky.de.test.js @@ -1,4 +1,6 @@ const { parser, url, request } = require('./sky.de.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') dayjs.extend(utc) @@ -9,9 +11,6 @@ const channel = { xmltv_id: 'WarnerTVComedyHD.de' } -const content = - '{"cl":[{"ci":522,"el":[{"ei":122309300,"bsdt":1645916700000,"bst":"00:05","bedt":1645918200000,"len":25,"et":"King of Queens","ec":"Comedyserie","cop":"USA","yop":2001,"fsk":"ab 0 Jahre","epit":"Der Experte","sn":"4","en":"11","pu":"/static/img/program_guide/1522936_s.jpg"},{"ei":122309301,"bsdt":1645918200000,"bst":"00:30","bedt":1645919700000,"len":25,"et":"King of Queens","ec":"Comedyserie","cop":"USA","yop":2001,"fsk":"ab 0 Jahre","epit":"Speedy Gonzales","sn":"4","en":"12","pu":"/static/img/program_guide/1522937_s.jpg"}]}]}' - it('can generate valid url', () => { expect(url).toBe('https://www.sky.de/sgtvg/service/getBroadcastsForGrid') }) @@ -28,6 +27,7 @@ it('can generate valid request data', () => { }) it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ content, channel }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() diff --git a/sites/stod2.is/__data__/content.json b/sites/stod2.is/__data__/content.json new file mode 100644 index 00000000..a08167b2 --- /dev/null +++ b/sites/stod2.is/__data__/content.json @@ -0,0 +1,34 @@ +[ + { + "midill": "STOD2", + "midill_heiti": "Stöð 2", + "dagsetning": "2025-01-03T00:00:00Z", + "upphaf": "2025-01-03T08:00:00Z", + "titill": "Telma Borgþórsdóttir", + "isltitill": "Heimsókn", + "undirtitill": "Telma Borgþórsdóttir", + "seria": 8, + "thattur": 5, + "thattafjoldi": 10, + "birta_thatt": 1, + "opin": 0, + "beint": 0, + "frumsyning": 0, + "framundan_i_beinni": 0, + "tegund": "SER", + "flokkur": "Icelandic", + "adalhlutverk": "", + "leikstjori": "", + "ar": "2019", + "bannad": "Green", + "recidefni": 592645105, + "recidlidur": 592645184, + "recidsyning": null, + "refno": null, + "frelsi": 0, + "netdagar": 0, + "lysing": "Frábærir þættir með Sindra Sindrasyni sem lítur inn hjá íslenskum fagurkerum. Heimilin eru jafn ólík og þau eru mörg en eiga það þó eitt sameiginlegt að vera sett saman af alúð og smekklegheitum. Sindri hefur líka einstakt lag á að ná fram því besta í viðmælendum sínum.", + "slott": 15, + "slotlengd": "00:15" + } +] \ No newline at end of file diff --git a/sites/stod2.is/stod2.is.test.js b/sites/stod2.is/stod2.is.test.js index 4dba9150..c8ff849d 100644 --- a/sites/stod2.is/stod2.is.test.js +++ b/sites/stod2.is/stod2.is.test.js @@ -1,4 +1,6 @@ const { parser, url } = require('./stod2.is.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -11,49 +13,13 @@ dayjs.extend(timezone) const date = dayjs.utc('2025-01-03', 'YYYY-MM-DD').startOf('day') const channel = { site_id: 'stod2', xmltv_id: 'Stod2.is' } -const mockEpgData = JSON.stringify([ - { - midill: 'STOD2', - midill_heiti: 'Stöð 2', - dagsetning: '2025-01-03T00:00:00Z', - upphaf: '2025-01-03T08:00:00Z', - titill: 'Telma Borgþórsdóttir', - isltitill: 'Heimsókn', - undirtitill: 'Telma Borgþórsdóttir', - seria: 8, - thattur: 5, - thattafjoldi: 10, - birta_thatt: 1, - opin: 0, - beint: 0, - frumsyning: 0, - framundan_i_beinni: 0, - tegund: 'SER', - flokkur: 'Icelandic', - adalhlutverk: '', - leikstjori: '', - ar: '2019', - bannad: 'Green', - recidefni: 592645105, - recidlidur: 592645184, - recidsyning: null, - refno: null, - frelsi: 0, - netdagar: 0, - lysing: - 'Frábærir þættir með Sindra Sindrasyni sem lítur inn hjá íslenskum fagurkerum. Heimilin eru jafn ólík og þau eru mörg en eiga það þó eitt sameiginlegt að vera sett saman af alúð og smekklegheitum. Sindri hefur líka einstakt lag á að ná fram því besta í viðmælendum sínum.', - slott: 15, - slotlengd: '00:15' - } -]) - it('can generate valid url', () => { const generatedUrl = url({ date, channel }) expect(generatedUrl).toBe('https://api.stod2.is/dagskra/api/stod2/2025-01-03') }) it('can parse response', () => { - const content = mockEpgData + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ content }).map(p => { p.start = p.start.toISOString() p.stop = p.stop.toISOString() diff --git a/sites/taiwanplus.com/__data__/content.json b/sites/taiwanplus.com/__data__/content.json new file mode 100644 index 00000000..021decf9 --- /dev/null +++ b/sites/taiwanplus.com/__data__/content.json @@ -0,0 +1 @@ +{"data":[{"date":"2023/08/20","weekday":"SUN","schedule":[{"programId":30668,"dateTime":"2023/08/20 00:00","time":"00:00","image":"https://prod-img.taiwanplus.com/live-schedule/Single/S30668_20230810104937.webp","title":"Master Class","shortDescription":"From blockchain to Buddha statues, Taiwan’s culture is a kaleidoscope of old and new just waiting to be discovered.","description":"From blockchain to Buddha statues, Taiwan’s culture is a kaleidoscope of old and new just waiting to be discovered.","ageRating":"0+","programWebSiteType":"4","url":"","vodId":null,"categoryId":90000474,"categoryType":2,"categoryName":"TaiwanPlus ✕ Discovery","categoryFullPath":"Originals/TaiwanPlus ✕ Discovery","encodedCategoryFullPath":"originals/taiwanplus-discovery"}]}],"success":true,"code":"0000","message":""} \ No newline at end of file diff --git a/sites/taiwanplus.com/taiwanplus.com.test.js b/sites/taiwanplus.com/taiwanplus.com.test.js index 57784598..6ca25797 100644 --- a/sites/taiwanplus.com/taiwanplus.com.test.js +++ b/sites/taiwanplus.com/taiwanplus.com.test.js @@ -1,4 +1,6 @@ const { url, parser } = require('./taiwanplus.com.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') dayjs.extend(utc) @@ -16,8 +18,7 @@ it('can generate valid url', () => { }) it('can parse response', () => { - const content = - '{"data":[{"date":"2023/08/20","weekday":"SUN","schedule":[{"programId":30668,"dateTime":"2023/08/20 00:00","time":"00:00","image":"https://prod-img.taiwanplus.com/live-schedule/Single/S30668_20230810104937.webp","title":"Master Class","shortDescription":"From blockchain to Buddha statues, Taiwan’s culture is a kaleidoscope of old and new just waiting to be discovered.","description":"From blockchain to Buddha statues, Taiwan’s culture is a kaleidoscope of old and new just waiting to be discovered.","ageRating":"0+","programWebSiteType":"4","url":"","vodId":null,"categoryId":90000474,"categoryType":2,"categoryName":"TaiwanPlus ✕ Discovery","categoryFullPath":"Originals/TaiwanPlus ✕ Discovery","encodedCategoryFullPath":"originals/taiwanplus-discovery"}]}],"success":true,"code":"0000","message":""}' + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const results = parser({ content, date }) diff --git a/sites/tapdmv.com/__data__/content.json b/sites/tapdmv.com/__data__/content.json new file mode 100644 index 00000000..989997a5 --- /dev/null +++ b/sites/tapdmv.com/__data__/content.json @@ -0,0 +1 @@ +[{"id":"0afc3cc0-eab8-4960-a8b5-55d76edeb8f0","program":"The Bourne Ultimatum","episode":"The Bourne Ultimatum","description":"Jason Bourne dodges a ruthless C.I.A. official and his Agents from a new assassination program while searching for the origins of his life as a trained killer.","genre":"Action","thumbnailImage":"https://s3.ap-southeast-1.amazonaws.com/epg.tapdmv.com/tapactionflix.png","startTime":"2022-10-03T23:05:00.000Z","endTime":"2022-10-04T01:00:00.000Z","fileId":"94b7db9b-5bbd-47d3-a2d3-ce792342a756","createdAt":"2022-09-30T13:02:10.586Z","updatedAt":"2022-09-30T13:02:10.586Z"},{"id":"8dccd5e0-ab88-44b6-a2af-18d31c6e9ed7","program":"The Devil Inside ","episode":"The Devil Inside ","description":"In Italy, a woman becomes involved in a series of unauthorized exorcisms during her mission to discover what happened to her mother, who allegedly murdered three people during her own exorcism.","genre":"Horror","thumbnailImage":"https://s3.ap-southeast-1.amazonaws.com/epg.tapdmv.com/tapactionflix.png","startTime":"2022-10-04T01:00:00.000Z","endTime":"2022-10-04T02:25:00.000Z","fileId":"94b7db9b-5bbd-47d3-a2d3-ce792342a756","createdAt":"2022-09-30T13:02:24.031Z","updatedAt":"2022-09-30T13:02:24.031Z"}] \ No newline at end of file diff --git a/sites/tapdmv.com/__data__/no_content.json b/sites/tapdmv.com/__data__/no_content.json new file mode 100644 index 00000000..0637a088 --- /dev/null +++ b/sites/tapdmv.com/__data__/no_content.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sites/tapdmv.com/tapdmv.com.test.js b/sites/tapdmv.com/tapdmv.com.test.js index be9d8d03..55e11772 100644 --- a/sites/tapdmv.com/tapdmv.com.test.js +++ b/sites/tapdmv.com/tapdmv.com.test.js @@ -1,4 +1,6 @@ const { parser, url } = require('./tapdmv.com.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -18,8 +20,7 @@ it('can generate valid url', () => { }) it('can parse response', () => { - const content = - '[{"id":"0afc3cc0-eab8-4960-a8b5-55d76edeb8f0","program":"The Bourne Ultimatum","episode":"The Bourne Ultimatum","description":"Jason Bourne dodges a ruthless C.I.A. official and his Agents from a new assassination program while searching for the origins of his life as a trained killer.","genre":"Action","thumbnailImage":"https://s3.ap-southeast-1.amazonaws.com/epg.tapdmv.com/tapactionflix.png","startTime":"2022-10-03T23:05:00.000Z","endTime":"2022-10-04T01:00:00.000Z","fileId":"94b7db9b-5bbd-47d3-a2d3-ce792342a756","createdAt":"2022-09-30T13:02:10.586Z","updatedAt":"2022-09-30T13:02:10.586Z"},{"id":"8dccd5e0-ab88-44b6-a2af-18d31c6e9ed7","program":"The Devil Inside ","episode":"The Devil Inside ","description":"In Italy, a woman becomes involved in a series of unauthorized exorcisms during her mission to discover what happened to her mother, who allegedly murdered three people during her own exorcism.","genre":"Horror","thumbnailImage":"https://s3.ap-southeast-1.amazonaws.com/epg.tapdmv.com/tapactionflix.png","startTime":"2022-10-04T01:00:00.000Z","endTime":"2022-10-04T02:25:00.000Z","fileId":"94b7db9b-5bbd-47d3-a2d3-ce792342a756","createdAt":"2022-09-30T13:02:24.031Z","updatedAt":"2022-09-30T13:02:24.031Z"}]' + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ content, date }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() @@ -41,7 +42,7 @@ it('can parse response', () => { it('can handle empty guide', () => { const result = parser({ - content: '[]', + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json')), date }) expect(result).toMatchObject([]) diff --git a/sites/tataplay.com/__data__/content.json b/sites/tataplay.com/__data__/content.json new file mode 100644 index 00000000..07b9a7b2 --- /dev/null +++ b/sites/tataplay.com/__data__/content.json @@ -0,0 +1,22 @@ +{ + "data": { + "epg": [ + { + "title": "Yeh Rishta Kya Kehlata Hai", + "startTime": "2025-06-09T18:00:00.000Z", + "endTime": "2025-06-09T18:30:00.000Z", + "desc": "The story of the Rajshri family and their journey through life.", + "category": "Drama", + "boxCoverImage": "https://img.tataplay.com/thumbnails/1001/yeh-rishta.jpg" + }, + { + "title": "Anupamaa", + "startTime": "2025-06-09T18:30:00.000Z", + "endTime": "2025-06-09T19:00:00.000Z", + "desc": "The story of Anupamaa, a housewife who rediscovers herself.", + "category": "Drama", + "boxCoverImage": "https://img.tataplay.com/thumbnails/1001/anupamaa.jpg" + } + ] + } +} \ No newline at end of file diff --git a/sites/tataplay.com/tataplay.com.test.js b/sites/tataplay.com/tataplay.com.test.js index 5262f6cd..b7adff1c 100644 --- a/sites/tataplay.com/tataplay.com.test.js +++ b/sites/tataplay.com/tataplay.com.test.js @@ -1,4 +1,6 @@ const { parser, url, channels } = require('./tataplay.com.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -13,28 +15,7 @@ it('can generate valid url', () => { }) it('can parse response', () => { - const content = JSON.stringify({ - data: { - epg: [ - { - title: 'Yeh Rishta Kya Kehlata Hai', - startTime: '2025-06-09T18:00:00.000Z', - endTime: '2025-06-09T18:30:00.000Z', - desc: 'The story of the Rajshri family and their journey through life.', - category: 'Drama', - boxCoverImage: 'https://img.tataplay.com/thumbnails/1001/yeh-rishta.jpg' - }, - { - title: 'Anupamaa', - startTime: '2025-06-09T18:30:00.000Z', - endTime: '2025-06-09T19:00:00.000Z', - desc: 'The story of Anupamaa, a housewife who rediscovers herself.', - category: 'Drama', - boxCoverImage: 'https://img.tataplay.com/thumbnails/1001/anupamaa.jpg' - } - ] - } - }) + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const results = parser({ content, date }) diff --git a/sites/teliatv.ee/__data__/content.json b/sites/teliatv.ee/__data__/content.json new file mode 100644 index 00000000..b65aebbf --- /dev/null +++ b/sites/teliatv.ee/__data__/content.json @@ -0,0 +1 @@ +{"categoryItems":{"1":[{"id":136227,"type":"epgSeries","name":"Inimjaht","originalName":"Manhunt","price":null,"owner":"ETV","ownerId":1,"images":{"webGuideItemLarge":"/resized/ri93Qj4OLXXvg7QAsUOcKMnIb3g=/570x330/filters:format(jpeg)/inet-static.mw.elion.ee/epg_images/9/b/17e48b3966e65c02.jpg"},"packetIds":[30,34,38,129,130,162,191,242,243,244,447,483,484,485,486],"related":{"programmeIds":[27224371]}}]},"relations":{"programmes":{"27224371":{"id":27224371,"startAt":"2021-11-20T00:05:00+02:00","endAt":"2021-11-20T00:55:00+02:00","publicTo":"2021-12-04T02:05:00+02:00","status":"default","channelId":1,"broadcastId":78248901,"hasMarkers":false,"catchup":false}}}} \ No newline at end of file diff --git a/sites/teliatv.ee/__data__/no_content.json b/sites/teliatv.ee/__data__/no_content.json new file mode 100644 index 00000000..8ef893c4 --- /dev/null +++ b/sites/teliatv.ee/__data__/no_content.json @@ -0,0 +1 @@ +{"categoryItems":{},"relations":{}} \ No newline at end of file diff --git a/sites/teliatv.ee/teliatv.ee.test.js b/sites/teliatv.ee/teliatv.ee.test.js index 2643046c..322f9591 100644 --- a/sites/teliatv.ee/teliatv.ee.test.js +++ b/sites/teliatv.ee/teliatv.ee.test.js @@ -1,4 +1,6 @@ const { parser, url } = require('./teliatv.ee.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -30,8 +32,7 @@ it('can generate valid url with different language', () => { }) it('can parse response', () => { - const content = - '{"categoryItems":{"1":[{"id":136227,"type":"epgSeries","name":"Inimjaht","originalName":"Manhunt","price":null,"owner":"ETV","ownerId":1,"images":{"webGuideItemLarge":"/resized/ri93Qj4OLXXvg7QAsUOcKMnIb3g=/570x330/filters:format(jpeg)/inet-static.mw.elion.ee/epg_images/9/b/17e48b3966e65c02.jpg"},"packetIds":[30,34,38,129,130,162,191,242,243,244,447,483,484,485,486],"related":{"programmeIds":[27224371]}}]},"relations":{"programmes":{"27224371":{"id":27224371,"startAt":"2021-11-20T00:05:00+02:00","endAt":"2021-11-20T00:55:00+02:00","publicTo":"2021-12-04T02:05:00+02:00","status":"default","channelId":1,"broadcastId":78248901,"hasMarkers":false,"catchup":false}}}}' + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const result = parser({ content, channel }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() @@ -53,7 +54,7 @@ it('can handle empty guide', () => { const result = parser({ date, channel, - content: '{"categoryItems":{},"relations":{}}' + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json')) }) expect(result).toMatchObject([]) }) diff --git a/sites/tvim.tv/__data__/content.json b/sites/tvim.tv/__data__/content.json new file mode 100644 index 00000000..a18c491b --- /dev/null +++ b/sites/tvim.tv/__data__/content.json @@ -0,0 +1 @@ +{"response":"ok","data":{"thumb":"https://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_rel":"https://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_large_rel":"https://mobile-api.tvim.tv/images/chan_logos/120x60/T7.png","thumb_http":"http://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_large":"http://mobile-api.tvim.tv/images/chan_logos/120x60/T7.png","server_time":1635100951,"catchup_length":2,"_id":"T73","ind":2,"genre":"national","name":"T7","epg_id":"T7","chan":"T7","prog":[{"id":"T7-1635026400","title":"Programi i T7","from":1635026400,"end":1635040800,"starting":"00:00","from_utc":1635026400,"end_utc":1635040800,"desc":"Programi i T7","genre":"test","chan":"T7","epg_id":"T7","eng":""}]}} \ No newline at end of file diff --git a/sites/tvim.tv/__data__/no_content.json b/sites/tvim.tv/__data__/no_content.json new file mode 100644 index 00000000..7033b039 --- /dev/null +++ b/sites/tvim.tv/__data__/no_content.json @@ -0,0 +1 @@ +{"response":"ok","data":{"server_time":1635100927}} \ No newline at end of file diff --git a/sites/tvim.tv/tvim.tv.test.js b/sites/tvim.tv/tvim.tv.test.js index 9232cf38..b7c221cd 100644 --- a/sites/tvim.tv/tvim.tv.test.js +++ b/sites/tvim.tv/tvim.tv.test.js @@ -1,4 +1,6 @@ const { parser, url } = require('./tvim.tv.config.js') +const fs = require('fs') +const path = require('path') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const customParseFormat = require('dayjs/plugin/customParseFormat') @@ -7,8 +9,7 @@ dayjs.extend(utc) const date = dayjs.utc('2021-10-24', 'YYYY-MM-DD').startOf('d') const channel = { site_id: 'T7', xmltv_id: 'T7.rs' } -const content = - '{"response":"ok","data":{"thumb":"https://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_rel":"https://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_large_rel":"https://mobile-api.tvim.tv/images/chan_logos/120x60/T7.png","thumb_http":"http://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_large":"http://mobile-api.tvim.tv/images/chan_logos/120x60/T7.png","server_time":1635100951,"catchup_length":2,"_id":"T73","ind":2,"genre":"national","name":"T7","epg_id":"T7","chan":"T7","prog":[{"id":"T7-1635026400","title":"Programi i T7","from":1635026400,"end":1635040800,"starting":"00:00","from_utc":1635026400,"end_utc":1635040800,"desc":"Programi i T7","genre":"test","chan":"T7","epg_id":"T7","eng":""}]}}' +const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) it('can generate valid url', () => { const result = url({ date, channel }) @@ -34,7 +35,7 @@ it('can handle empty guide', () => { const result = parser({ date, channel, - content: '{"response":"ok","data":{"server_time":1635100927}}' + content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json')) }) expect(result).toMatchObject([]) })