From c54509f95ed89422ca5dcb647ac6e99f2e8e60ee Mon Sep 17 00:00:00 2001 From: Toha Date: Sun, 15 Dec 2024 03:46:36 +0700 Subject: [PATCH] Update sky.com guide. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test: ```sh npm test -- /sky.com > test > run-script-os /sky.com > test:win32 > SET "TZ=Pacific/Nauru" && npx jest --runInBand /sky.com PASS sites/sky.com/sky.com.test.js √ can generate valid url (3 ms) √ can parse response (11 ms) √ can handle empty guide Test Suites: 1 passed, 1 total Tests: 3 passed, 3 total Snapshots: 0 total Time: 3.533 s, estimated 4 s Ran all test suites matching /\\sky.com/i. ``` Grab: ```sh npm run grab -- --site=sky.com > grab > npx tsx scripts/commands/epg/grab.ts --site=sky.com starting... config: output: guide.xml maxConnections: 1 gzip: false site: sky.com loading channels... found 558 channel(s) run #1: [1/1116] sky.com (en) - 1009 - Dec 14, 2024 (35 programs) [2/1116] sky.com (en) - 1009 - Dec 15, 2024 (34 programs) ... [1115/1116] sky.com (en) - SkySportsNews.uk - Dec 15, 2024 (26 programs) [1116/1116] sky.com (en) - TLCHD.uk - Dec 14, 2024 (30 programs) saving to "guide.xml"... done in 00h 04m 32s ``` Signed-off-by: Toha --- sites/sky.com/__data__/content.json | 1033 +++++++++++++++++++++++++++ sites/sky.com/sky.com.channels.xml | 396 ++++++---- sites/sky.com/sky.com.config.js | 163 +++-- sites/sky.com/sky.com.test.js | 51 +- 4 files changed, 1445 insertions(+), 198 deletions(-) create mode 100644 sites/sky.com/__data__/content.json diff --git a/sites/sky.com/__data__/content.json b/sites/sky.com/__data__/content.json new file mode 100644 index 00000000..079239dc --- /dev/null +++ b/sites/sky.com/__data__/content.json @@ -0,0 +1,1033 @@ +{ + "date": "20241214", + "schedule": [ + { + "sid": "4086", + "events": [ + { + "st": 1734127200, + "d": 3600, + "eid": "Eff6-94e", + "cgid": 10053, + "programmeuuid": "42dd62d5-7d64-38b7-aafc-1c624c005f16", + "seasonnumber": 4, + "episodenumber": 14, + "seasonuuid": "e80e2f5d-fd36-3894-af55-4ac2adb146a5", + "seriesuuid": "e8a9a443-fdc5-4fb7-affd-2cd7872edf61", + "haschildren": false, + "t": "The UnXplained With...", + "sy": "The Hunt for Jack the Ripper: Jack the Ripper's identity has eluded police, historians and armchair detectives for over a century. What do we know about the notorious killer? (S3, ep 21)", + "eg": 5, + "esg": 6, + "tso": 4, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734130800, + "d": 3600, + "eid": "Eff6-906", + "cgid": 10053, + "programmeuuid": "f0bc3b53-8966-37ed-8aad-6540dbabfec6", + "seasonnumber": 4, + "episodenumber": 15, + "seasonuuid": "e80e2f5d-fd36-3894-af55-4ac2adb146a5", + "seriesuuid": "e8a9a443-fdc5-4fb7-affd-2cd7872edf61", + "haschildren": false, + "t": "The UnXplained With...", + "sy": "The Search for Extraterrestrial Life: Scientists have forever been involved in a quest to understand the universe. But for each answer science provides, more questions arise. (S3, ep 22)", + "eg": 5, + "esg": 6, + "tso": 4, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734134400, + "d": 1800, + "eid": "Eff6-c1a", + "cgid": 10053, + "programmeuuid": "b9572a38-8db7-471e-a2d7-462e1dd26af2", + "seasonnumber": 12, + "episodenumber": 4, + "seasonuuid": "9058f9fd-122d-4d2d-ae6f-9d52104cbc16", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "A Sale Of Two Cities: Emily brings her mother along with her to Walnut, and Darrell wastes no time finding an advantage. Ivy and Ivy jr clean up with their locker. (S12, ep 4)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734136200, + "d": 1800, + "eid": "Eff6-c2d", + "cgid": 10053, + "programmeuuid": "25b56296-e3e0-484d-9ebb-210dd8563b37", + "seasonnumber": 12, + "episodenumber": 5, + "seasonuuid": "9058f9fd-122d-4d2d-ae6f-9d52104cbc16", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "The Wind Beneath My Birds: 30mph winds batter Desert Hot Springs, and the buyers do their best to keep standing. Rene and Gunther dust off an old locker. (S12, ep 5)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734138000, + "d": 1800, + "eid": "Eff6-ad8", + "cgid": 10053, + "programmeuuid": "e9521ccc-bdcc-4075-9c2e-bc835247148b", + "seasonnumber": 12, + "episodenumber": 6, + "seasonuuid": "9058f9fd-122d-4d2d-ae6f-9d52104cbc16", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Not All That Glitters Is Gourd: Back in the city of Orange, the Vegas Ladies arrive in vintage style - though not everyone agrees. (S12, ep 6)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734139800, + "d": 1800, + "eid": "Eff6-ad9", + "cgid": 10053, + "programmeuuid": "51dfc5f0-cd80-4f0a-83d7-3e344caef670", + "seasonnumber": 12, + "episodenumber": 7, + "seasonuuid": "9058f9fd-122d-4d2d-ae6f-9d52104cbc16", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Mistress Of The Snark: Ivy thinks he's a comedian, but the gizmo in his locker is no joke. Brandi and Jarrod make sure that what they find in their unit doesn't stay there. (S12, ep 7)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734141600, + "d": 3600, + "eid": "Eff6-ae2", + "cgid": 10053, + "programmeuuid": "2186ede3-4342-33fe-be9a-b83fadf3004d", + "seasonnumber": 1, + "episodenumber": 3, + "seasonuuid": "12752fb2-73bd-3b9a-91c3-6a90dc45eb5d", + "seriesuuid": "fa56948a-eaf7-3346-a3c7-513436902aaa", + "haschildren": false, + "t": "Holy Marvels With Dennis Quaid", + "sy": "Crucifixion Relics: Relics from the crucifixion of Jesus Christ have fascinated the faithful for 2,000 years. (S1, ep 3)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734145200, + "d": 1800, + "eid": "Eff6-a9f", + "cgid": 10053, + "programmeuuid": "8f2918f5-6dfc-38c7-9660-b956de7f8769", + "seasonnumber": 1, + "episodenumber": 3, + "seasonuuid": "a8d487fc-fe07-317f-a57a-ddc5a3d29e52", + "seriesuuid": "1870ec1a-aeb3-4677-8cde-ac1224506454", + "haschildren": false, + "t": "Container Wars", + "sy": "Episode 3: New auctioneer Penny has Israeli young guns Uzi and Schlomi seeing red. (S1, ep 3)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734147000, + "d": 1800, + "eid": "Eff6-aa2", + "cgid": 10053, + "programmeuuid": "c31222bb-8b4f-3e1c-92f4-ca72dcc073ba", + "seasonnumber": 1, + "episodenumber": 4, + "seasonuuid": "a8d487fc-fe07-317f-a57a-ddc5a3d29e52", + "seriesuuid": "1870ec1a-aeb3-4677-8cde-ac1224506454", + "haschildren": false, + "t": "Container Wars", + "sy": "Secret Stash: At the port of Los Angeles, the Uzi and Shlomi are out to destroy the competition. (S1, ep 4)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734148800, + "d": 3600, + "eid": "Eff6-a0b", + "cgid": 10053, + "programmeuuid": "a34c935b-829c-48e3-9528-ba883c7ed0aa", + "seasonnumber": 19, + "episodenumber": 10, + "seasonuuid": "88069c5d-9f4e-4b8d-b2e3-8d8fe3c3981a", + "seriesuuid": "ad899916-d2c8-413c-9722-38605858c7cd", + "haschildren": false, + "t": "Pawn Stars", + "sy": "No Sleep Til Vegas: A seller sends in the original cover art for one of the greatest albums of all time, and Rick fights for his right to buy it.", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734152400, + "d": 3600, + "eid": "Eff6-145", + "cgid": 10053, + "programmeuuid": "792e5446-d28f-4fd1-a4a0-74fbafffa728", + "seasonnumber": 20, + "episodenumber": 8, + "seasonuuid": "4413cc02-0919-420c-a6f0-0c1ae267987d", + "seriesuuid": "ad899916-d2c8-413c-9722-38605858c7cd", + "haschildren": false, + "t": "Pawn Stars", + "sy": "Rick's Big Check: The shop travels back in time when a map from the late 1800s comes in. Meanwhile, Corey spots a killer Mustang for sale.", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734156000, + "d": 3600, + "eid": "Eff6-b70", + "cgid": 10053, + "programmeuuid": "3ba268e3-96f9-43fc-a1a7-0b8b89b74a31", + "seasonnumber": 8, + "episodenumber": 36, + "seasonuuid": "594683dd-8948-46b7-8a84-d18aafd89205", + "seriesuuid": "01bee8e1-6a03-496e-ac1e-30f826edb18c", + "haschildren": false, + "t": "Forged In Fire", + "sy": "The Dark Side: The smiths dig into the dark side of history and the weapons that come along with it, as they are tasked with making a knife out of the gruesome guillotine.", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734159600, + "d": 1800, + "eid": "Eff6-89a", + "cgid": 10053, + "programmeuuid": "b9572a38-8db7-471e-a2d7-462e1dd26af2", + "seasonnumber": 12, + "episodenumber": 4, + "seasonuuid": "9058f9fd-122d-4d2d-ae6f-9d52104cbc16", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "A Sale Of Two Cities: Emily brings her mother along with her to Walnut, and Darrell wastes no time finding an advantage. Ivy and Ivy jr clean up with their locker. (S12, ep 4)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734161400, + "d": 1800, + "eid": "Eff6-889", + "cgid": 10053, + "programmeuuid": "25b56296-e3e0-484d-9ebb-210dd8563b37", + "seasonnumber": 12, + "episodenumber": 5, + "seasonuuid": "9058f9fd-122d-4d2d-ae6f-9d52104cbc16", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "The Wind Beneath My Birds: 30mph winds batter Desert Hot Springs, and the buyers do their best to keep standing. Rene and Gunther dust off an old locker. (S12, ep 5)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734163200, + "d": 1800, + "eid": "Eff6-3a1", + "cgid": 10053, + "programmeuuid": "e9521ccc-bdcc-4075-9c2e-bc835247148b", + "seasonnumber": 12, + "episodenumber": 6, + "seasonuuid": "9058f9fd-122d-4d2d-ae6f-9d52104cbc16", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Not All That Glitters Is Gourd: Back in the city of Orange, the Vegas Ladies arrive in vintage style - though not everyone agrees. (S12, ep 6)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734165000, + "d": 1800, + "eid": "Eff6-d", + "cgid": 10053, + "programmeuuid": "51dfc5f0-cd80-4f0a-83d7-3e344caef670", + "seasonnumber": 12, + "episodenumber": 7, + "seasonuuid": "9058f9fd-122d-4d2d-ae6f-9d52104cbc16", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Mistress Of The Snark: Ivy thinks he's a comedian, but the gizmo in his locker is no joke. Brandi and Jarrod make sure that what they find in their unit doesn't stay there. (S12, ep 7)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734166800, + "d": 3600, + "eid": "Eff6-10", + "cgid": 10053, + "programmeuuid": "792e5446-d28f-4fd1-a4a0-74fbafffa728", + "seasonnumber": 20, + "episodenumber": 8, + "seasonuuid": "4413cc02-0919-420c-a6f0-0c1ae267987d", + "seriesuuid": "ad899916-d2c8-413c-9722-38605858c7cd", + "haschildren": false, + "t": "Pawn Stars", + "sy": "Rick's Big Check: The shop travels back in time when a map from the late 1800s comes in. Meanwhile, Corey spots a killer Mustang for sale.", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734170400, + "d": 3600, + "eid": "Eff6-ff", + "cgid": 10053, + "programmeuuid": "39941b03-db5e-4445-bbc1-623482fe889a", + "seasonnumber": 24, + "episodenumber": 4, + "seasonuuid": "ecb63727-ec13-377c-aa9b-296bae2615ba", + "seriesuuid": "b2e57450-1fb1-42cf-ad0e-01f9d6045f67", + "haschildren": false, + "t": "American Pickers", + "sy": "Wolfes Go West: The Wolfe brothers visit a Nebraskan village boasting a visionary's epic collection and outbuildings which have been vacant since the 50s. (S19, ep 18)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": false, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734174000, + "d": 3600, + "eid": "Eff6-10a", + "cgid": 10053, + "programmeuuid": "6ad30f01-5c26-4bfc-89ac-b06e04bd9bf4", + "seasonnumber": 1, + "episodenumber": 1, + "seasonuuid": "aa145565-36b1-41c8-af20-8c48ba15f8c9", + "seriesuuid": "2a33f076-2969-4bab-9a51-c6807bd3f968", + "haschildren": false, + "t": "Legends Of The Pharaohs", + "sy": "Egypt's First Pyramid: Ancient Egypt, 4700 years ago. Revolution is brewing - and the most ambitious building project on the planet sets off a chain of transformative events. (S1, ep 1)", + "eg": 3, + "esg": 11, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734177600, + "d": 3600, + "eid": "Eff6-4b", + "cgid": 10053, + "programmeuuid": "058c04d4-de2e-4301-90fb-aed300c91407", + "seasonnumber": 1, + "episodenumber": 2, + "seasonuuid": "aa145565-36b1-41c8-af20-8c48ba15f8c9", + "seriesuuid": "2a33f076-2969-4bab-9a51-c6807bd3f968", + "haschildren": false, + "t": "Legends Of The Pharaohs", + "sy": "Curse Of The Pyramids: Head back to Ancient Egypt to explore more legends. Now, the pyramid age has begun and a new pharaoh, Snefru, has ascended to the throne. (S1, ep 2)", + "eg": 3, + "esg": 11, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734181200, + "d": 3600, + "eid": "Eff6-3ef", + "cgid": 10053, + "programmeuuid": "2ccb1bbe-9003-4055-a3a3-74c5ba2325a5", + "seasonnumber": 1, + "episodenumber": 3, + "seasonuuid": "aa145565-36b1-41c8-af20-8c48ba15f8c9", + "seriesuuid": "2a33f076-2969-4bab-9a51-c6807bd3f968", + "haschildren": false, + "t": "Legends Of The Pharaohs", + "sy": "The Tyrant King: The Great Pyramid of Giza is the world's most famous tomb, built by Khufu - a Pharaoh with a reputation for cruelty. But what's the truth about this tyrant king? (S1, ep 3)", + "eg": 3, + "esg": 11, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734184800, + "d": 1800, + "eid": "Eff6-3f5", + "cgid": 10053, + "programmeuuid": "bf76cb2f-334a-4f00-b46f-51a1cb8bd0d4", + "seasonnumber": 13, + "episodenumber": 5, + "seasonuuid": "59fb8f63-fbab-4f46-854b-2f51b33de6e4", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Rules #1: Ivy and his son leave Moreno Valley with yo-yo's of an unexpected kind. Rene and Casey discover that their shoes are more 'air' and less 'Jordan.' (S13, ep 5)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734186600, + "d": 1800, + "eid": "Eff6-3f9", + "cgid": 10053, + "programmeuuid": "248f18da-6562-4737-b5da-d600b4d387f7", + "seasonnumber": 13, + "episodenumber": 6, + "seasonuuid": "59fb8f63-fbab-4f46-854b-2f51b33de6e4", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Queen-Baya!: The buyers hear of some interesting units in Santa Clarita. Kenny searches for his soul sister and Ivy and Isaiah choose quantity over quality. (S13, ep 6)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734188400, + "d": 1800, + "eid": "Eff6-384", + "cgid": 10053, + "programmeuuid": "820a66b0-60bf-4246-bf49-e824f195d5f1", + "seasonnumber": 13, + "episodenumber": 7, + "seasonuuid": "59fb8f63-fbab-4f46-854b-2f51b33de6e4", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Game Of Groans: Whittier Is Coming: Kenny tries to reclaim the title of King of Whittier but hits a snag along the way. Lisa finds an unlikely mentor. (S13, ep 7)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734190200, + "d": 1800, + "eid": "Eff6-3aa", + "cgid": 10053, + "programmeuuid": "3b4495a4-9288-43ad-af95-1647acc1bd47", + "seasonnumber": 13, + "episodenumber": 8, + "seasonuuid": "59fb8f63-fbab-4f46-854b-2f51b33de6e4", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Breaking Bread: Kenny indulges in Perris, California. Also, Jarrod's lousy locker doesn't offer him any protection and Rene's tools end up being older than he expects. (S13, ep 8)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734192000, + "d": 1800, + "eid": "Eff6-35c", + "cgid": 10053, + "programmeuuid": "0321878e-e432-4259-9fbf-eb8c0a16e698", + "seasonnumber": 13, + "episodenumber": 9, + "seasonuuid": "59fb8f63-fbab-4f46-854b-2f51b33de6e4", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "Dr D and the Mystery Machines: Rene makes a costly gamble. Meanwhile, Brandi wades through trash and Ivy and Pops clear up confusion over a massive mysterious mechanism.", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734193800, + "d": 1800, + "eid": "Eff6-371", + "cgid": 10053, + "programmeuuid": "75280169-5885-44e4-9442-3583bf4add19", + "seasonnumber": 13, + "episodenumber": 10, + "seasonuuid": "59fb8f63-fbab-4f46-854b-2f51b33de6e4", + "seriesuuid": "1368de41-ca15-46b6-b03a-19db2616e161", + "haschildren": false, + "t": "Storage Wars", + "sy": "A Plane Flew Over the Cuckoo's Nest: Brandi tries to teach Danielle a lesson about the true meaning of trash. Meanwhile, Ivy gets distracted by a decoy.", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734195600, + "d": 3600, + "eid": "Eff6-c55", + "cgid": 10053, + "programmeuuid": "52a53017-4898-393e-a64c-45ca5c9b4993", + "seasonnumber": 3, + "episodenumber": 9, + "seasonuuid": "a7b99c40-d860-360c-85da-bf7dce33dffd", + "seriesuuid": "6fb33a3a-9e0a-4b56-9cc6-b7dc918f19e2", + "haschildren": false, + "t": "Flipping Bangers", + "sy": "Audi 100: Gus and Will are looking for a BMW, but Gus is drawn to a classic Audi that catches his eye and manages to convince Will - who falls in love with it too. (S3, ep 7)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734199200, + "d": 3600, + "eid": "Eff6-8b6", + "cgid": 10053, + "programmeuuid": "cc59a927-574d-33a4-8f11-1b179a7e2230", + "seasonnumber": 1, + "episodenumber": 1, + "seasonuuid": "1d02538f-4a85-3a46-b6a5-22efa7cb35fd", + "seriesuuid": "aef567f1-a6c3-3715-b2c2-4277f6437574", + "haschildren": false, + "t": "Dictators' Hideouts", + "sy": "Hitler's Last Secret: Countless Nazi prisoners were forced to dig tunnels and chambers spanning kilometers in a remote region of Poland. (S1, ep 1)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734202800, + "d": 3600, + "eid": "Eff6-863", + "cgid": 10053, + "programmeuuid": "e3b50aa5-9215-4922-adc2-7a01a8bcf25d", + "seasonnumber": 1, + "episodenumber": 2, + "seasonuuid": "115232d5-204a-4781-b0a6-051acac741a4", + "seriesuuid": "977af0a6-2635-4c52-825e-9fe7df66560c", + "haschildren": false, + "t": "Shipwrecks: When History Resurfaces", + "sy": "Uss Corsica: The Aircraft Carrier Island: The epic journey through the remains of six of the world's most spectacular underwater disasters continues. (2 of 6)", + "eg": 3, + "esg": 11, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734206400, + "d": 3600, + "eid": "Eff6-868", + "cgid": 10053, + "programmeuuid": "b316f482-e215-452b-b296-15bb3b906a51", + "seasonnumber": 1, + "episodenumber": 3, + "seasonuuid": "115232d5-204a-4781-b0a6-051acac741a4", + "seriesuuid": "977af0a6-2635-4c52-825e-9fe7df66560c", + "haschildren": false, + "t": "Shipwrecks: When History Resurfaces", + "sy": "Empress of Ireland: The Forgotten Shipwreck: The tragic, yet largely forgotten story of the disaster that killed over 1,000 passengers in 1914. (3 of 6)", + "eg": 3, + "esg": 11, + "tso": 0, + "r": "--", + "at": "S", + "s": false, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734210000, + "d": 7200, + "eid": "Eff6-7da", + "cgid": 10053, + "programmeuuid": "2833050b-f746-3e40-9e67-f4a6cfa44368", + "seasonnumber": 1, + "episodenumber": 1, + "seasonuuid": "d849c3a5-47c4-3632-8737-cb0933bca927", + "seriesuuid": "a568e6c3-cabf-3512-8d0a-8f1d05e10dbb", + "haschildren": false, + "t": "American Godfathers: The Five Families", + "sy": "Death of the Old Rules: Follow the American Mafia from their early development in New York City neighbourhoods, discovering how public violence affected their operations. (S1, ep 1)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": true, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + }, + { + "st": 1734217200, + "d": 7200, + "eid": "Eff6-851", + "cgid": 10053, + "programmeuuid": "4e38c66b-c2ae-3669-a7ff-e7588743e7ac", + "seasonnumber": 1, + "episodenumber": 2, + "seasonuuid": "d849c3a5-47c4-3632-8737-cb0933bca927", + "seriesuuid": "a568e6c3-cabf-3512-8d0a-8f1d05e10dbb", + "haschildren": false, + "t": "American Godfathers: The Five Families", + "sy": "Rise of the New Dons: Follow the conflict between the families' old guard and a new generation of younger, American-born mobsters willing to defy their authority. (S1, ep 2)", + "eg": 5, + "esg": 6, + "tso": 0, + "r": "--", + "at": "S", + "s": true, + "ad": false, + "hd": true, + "new": false, + "canl": true, + "canb": true, + "hasAlternativeAudio": false, + "restartable": false, + "slo": false, + "w": true, + "ippv": false, + "oppv": false + } + ] + } + ] + } \ No newline at end of file diff --git a/sites/sky.com/sky.com.channels.xml b/sites/sky.com/sky.com.channels.xml index d871b52f..eb8f5bcf 100644 --- a/sites/sky.com/sky.com.channels.xml +++ b/sites/sky.com/sky.com.channels.xml @@ -1,26 +1,106 @@ - Islam Bangla - ATN - Deen TV - IQRA Bangla QTV Religious PBC + Sky Intro + Virgin One+1 + Climax + XXX Girl Girl + Rewind TV + TVX 40+ + SkySpBoxOffHD + Virgin Two HD HUM Masala + Heart 90s + MstHveIdeasHD + TNTSBoxOff2HD + Ideal World HD + Sky Intro + NOW XMAS + Sky Intro + TRUE CRIME + Virgin Radio + STV HD + STV HD HobbyMakerHD - Best Xmas Music - DAZN PPV HD - Sky Intro - Sky Intro - SONY TV + STV HD + LBC News + That's Dance + TRUE CRIME X + Tiny Pop + Oireachtas TV + RTÉ Radio 1 + RTÉ 2FM + RTÉ R na G + RTÉ Lyric fm + Tiny Pop+1 + That's Melody + Virgin Four HD + Chl Line-up + Cúla4 HD + BBC R Cymru 2 + BBC R5L + BBC R5SX + BBC R1 + BBC R2 + BBC R3 + BBC R4 + BBC R Scot + BBC R Wales + BBC R Ulster + BBC Asian Net + BBC World Sv + BBC R Cymru + BBC R Foyle + BBC R1X + BBC R6 Music + BBC R4 Extra + BBC RnGàid + BBC R London + ID + Virgin Three + talkSPORT + Gold Radio + Radio X + Capital + Heart + Smooth + Heart Dance + LBC + Heart 80s + Capital XTRA EWTN Catholic MTA1 World HD TRUE CRIME + Panjab Radio + BFBS Radio SonLife + Babenation + Classic FM NTD CHSTV + Virgin One HD + TG4 HD + STV HD + TWR + WRN Europe + EWTN Catholic + Xpanded TV + Television X + Adult Channel + babes&brazzers NTV - 4Music + DMAX + STV + STV + ITV1 Wales HD + UTV HD + My Sky + My Account + Program Your Remote + Help and Support + Reset your PIN + Get Sky Products 4seven 5ACTION 5SELECT @@ -28,30 +108,35 @@ 5STAR+1 5 USA 5USA+1 + Islam Bangla + Aastha Ahlebait TV Akaal Channel - alibi - alibi HD - alibi+1 + U&Alibi + U&Alibi + U&Alibi HD + U&Alibi HD + U&Alibi+1 Al Jazeera HD Animal Planet Animal Plnt+1 Arirang TV HD Arise News - Ayozat TV + ARY Digital + ATN + B4U Movies + B4U Music BabyTV - BBC ALBA BBC ALBA HD - BBC Four BBC Four HD - BBC NEWS + BBC Four HD BBC NEWS HD - BBC One BBC One CI HD BBC One EastHD BBC One EMidHD BBC One Lon HD BBC One NE HD + BBC One NI HD BBC One NI HD BBC One NW HD BBC One ScotHD @@ -63,65 +148,78 @@ BBC One WM HD BBC One Yks HD BBC One Y&L HD - BBC Parliament BBC Parl HD - BBC RB 1 BBC RB 1 HD - BBC Scotland BBCScotlandHD - BBC Three BBC Three HD - BBC Two + BBC Three HD BBC Two HD + BBC Two NI HD BBC Two NI HD BBC Two Wal HD Best Direct BLAZE + BLAZE Bloomberg HD Boomerang Boomerang HD Boomerang+1 Brit Asia TV - British Muslim Cartoonito Cartoon Net HD Cartoon Netwrk CN+1 - CBBC + CBBC HD CBBC HD - CBeebies CBeebies HD + CBeebies HD TRUE CRIME+1 Challenge - Channel 4 + Challenge + Channel 4 HD + Channel 4 HD + Channel 4 HD + Channel 4 HD + Channel 4 HD + Channel 4 HD Channel 4 HD + Channel 4+1 Channel 4+1 + Channel 4+1 + Channel 4+1 + Channel 4+1 Channel 5 Channel 5 HD Channel 5+1 - Channel 7 Channels 24 Clubland TV CNBC HD CNN HD + COLORS + ColorsCineplex + ColorsGujarati COLORS HD + ColorsRishtey ComedyCentral + ComedyCentral ComedyXtra + ComedyXtra ComedyCentHD ComedyCent+1 Court TV - Craft Extra - Create&CraftHD + Crime+Inv Crime+Inv Crime+Inv HD Crime+Inv+1 Cruise1st.tv - Dave - Dave HD - Dave ja vu + U&Dave + U&Dave + U&Dave HD + U&Dave HD + U&DaveJaVu DAYSTAR HD - DAZN 1 HD - Direct Store TV + Deen TV + Discovery Discovery Discovery HD Discovery+1 @@ -133,19 +231,18 @@ Disc.Turbo+1 DMAX DMAX+1 - Drama - Drama+1 + U&Drama + U&Drama + U&Drama+1 Dunamis TV - Dunya News - E! E4 + E4 E4 Extra E4 HD + E4+1 E4+1 - EarthxTV HD - Eden - Eden+1 - E! HD + U&Eden + U&Eden+1 Eman Channel Euronews Eurosport 1 @@ -154,102 +251,123 @@ Eurosport 2 HD Faith UK Faith World TV + Film4 Film4 Film4 HD Film4+1 Food Network + Food Network Food Netwrk+1 - Foodxp + Music India FRANCE 24 HD GB News HD Gems TV GEO News + GEO TV GOD Channel - GOLD - GOLD HD - GOLD+1 + U&Gold + U&Gold + U&Gold HD + U&Gold+1 GREAT! action GREAT!action+1 + GREAT! movies GREAT! movies GREAT! movies+1 + GREAT! xmas GREAT! xmas GREAT! xmas+1 + GREAT! tv GREAT! tv GREAT! tv+1 HGTV + HGTV HGTV+1 - Hidayat TV High Street TV 1 High Street TV 2 High Street TV 3 - High Street TV 4 LEGEND XTRA LEGEND XTRA+1 - Ideal World + HUM EUROPE India Today - Inspiration TV ID ID+1 iON TV + IQRA Bangla IQRA TV Islam Channel + Islam Ch Urdu Islam TV - ITV1 + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD + ITV1 HD ITV1 HD + ITV1 HD + ITV1+1 ITV1+1 - ITV2 + ITV1+1 + ITV1+1 ITV2 HD ITV2+1 - ITV3 ITV3 HD ITV3+1 - ITV4 ITV4 HD ITV4+1 - ITVBe + ITV Be HD JewelleryMaker - JML Direct Kanshi TV - Kerrang! - KICC TV - KISS LEGEND LFCTV HD London Live LoveWorld HD Madani Chnl - Magic + MATV National More4 + More4 More4 HD More4+1 Christmas24 Christmas24+ MTV + MTV MTV XMAS MTV 80s MTV HD MTV HITS MTV MUSIC MUTV HD - MUTV Nat Geo Nat Geo HD Nat Geo+1 Nat Geo Wild NatGeoWild HD - NBCNewsNowHD - NDTV 24x7 - New Media HD + NDTV World New Vision TV NHK World HD Nickelodeon + Nickelodeon NickelodeonHD Nickelodeon+1 Nick Jr. + Nick Jr. Nick Jr. HD Nick Jr+1 - NickJrPAWPatrol - NickSpongeBob + Nick Jr. Too + Nick Jr. Too + Nicktoons + Nicktoons Noor TV NOW 70s NOW 80s @@ -263,10 +381,10 @@ POP Max+1 POP+1 PTC PUNJABI - PTV Global QUEST HD QUEST QUEST+1 + Quest Red Quest Red Quest Red+1 QVC Beauty @@ -276,104 +394,129 @@ Racing TV Racing TV HD TRUE CRIME X + Really Really revelation + RTÉ2 HD + RTÉ2+1 + RTÉjr + RTÉ News + RTÉ One HD + RTÉ One+1 S4C S4C HD - Samaa TV Sangat + Sanskar Sikh Channel + Sky Arts Sky Arts Sky Arts HD Sky Atlantic + Sky Atlantic Sky Atlantic HD Sky Atlantic+1 - Sky Action Sky Action HD SkyAnimationHD Sky Comedy HD SkyChristmasHD - Sky Family - Sky Family HD - Sky 80s Icons - 80s Icons HD - Sky Hits HD - Sky Premiere + SkyKidsBooksHD + Favourites HD + Sky 90s HD SkyPremiereHD - SkyPremiere+1 Sky ScFi/HorHD - SkyBestOf23HD + SkyBestOf24HD Sky Thriller HD + Sky Comedy Sky Comedy Sky Comedy HD + Sky Crime Sky Crime Sky Crime HD + Sky Crime HD Sky Crime+1 SkyDocumntrs + SkyDocumntrs SkyDocmntrsHD - Sky History Sky History2 SkyHistory2HD + Sky History + Sky History Sky HistoryHD Sky History+1 Sky Kids HD + Sky Max Sky Max Sky Max HD Sky Mix HD + Sky Mix HD Sky Nature HD Sky Nature + Sky Nature Sky News + Sky News SkyNewsArabia Sky News HD + Sky News HD Sky Replay + Sky Replay Sky Sci-Fi Sky Sci-Fi HD Sky Showcase + Sky Showcase SkyShowcaseHD + SkyShowcaseHD SkyShowcase+1 - SkySp Arena - SkySp ArenaHD - SkySpBoxOff + SkySp+ + SkySp+ HD SkySp Cricket SkySpCricket HD - SkySp F1 - SkySp F1 HD - SkySp F'ball - SkySp F'ball HD - SkySp Golf + SkySp Darts + SkySp DartsHD + SkySp F'ball + SkySp F'ball HD + SkySp Golf + SkySp Golf HD SkySp Golf HD - SkySpMainEv + SkySpMainEv SkySpMainEvHD + SkySpMainEvHD SkySp Mix HD SkySp Mix SkySp News + SkySp News + SkySp News HD SkySp News HD SkySp NFL SkySp NFL HD - SkySp PL + SkySp PL + SkySp PL HD SkySp PL HD SkySp Racing SkySp Racing HD - SkySp Tennis + SkySp Racing HD + SkySp Tennis HD + SkySp Tennis Sky Witness + Sky Witness + Sky Witness HD Sky Witness HD Sky Witness+1 + SONY TV + SONY TV HD + SONY MAX 2 SONY MAX SONY MAX HD - SportyStuff HD + SONY SAB + Takbeer TV TalkingPictures - TalkTV HD TBN UK - That's 60s - That's Christmas - That's 90s - That's TV - BoXmas + That's Christmas + That's TV 2 + That's Fabulous + That's TV Word Network - Tiny Pop - Tiny Pop+1 - TJC TJC HD + TLC TLC TLC HD TLC+1 @@ -385,51 +528,34 @@ TNT Sports 3 TNT Sports 4 TNTSports4 HD - TNTSBoxOff2HD Together - Trace Vault Travelxp TRT World TRT World HD TVC News TV One TV Warehouse - Utsav Gold HD - Utsav Plus HD - Siraj TV - Viaplay 1 HD - Viaplay 2 HD - ViaplayXtraHD - W - W HD - WION HD - W+1 - YESTERDAY - YESTERDAY HD - YESTERDAY+1 - Zee TV - 92 News - AAJ TAK - Aastha - ARY Digital - B4U Movies - B4U Music - COLORS - ColorsCineplex - ColorsGujarati - ColorsRishtey - GEO TV - HUM EUROPE - Islam Ch Urdu - MATV National - Sanskar - SONY TV HD - SONY MAX 2 - SONY SAB - Takbeer TV Utsav Bharat Utsav Gold + Utsav Gold HD Utsav Plus + Utsav Plus HD + Premier 1 HD + Premier 1 HD + Premier 2 HD + Premier 2 HD + U&W + U&W + U&W HD + U&W HD + WION HD + U&W+1 + U&Yesterday + U&Yesterday HD + U&Yesterday+1 Zee Cinema + Zee Punjabi + Zee TV + AAJ TAK Zee TV HD diff --git a/sites/sky.com/sky.com.config.js b/sites/sky.com/sky.com.config.js index 2e2b78bb..1a0fcfcc 100644 --- a/sites/sky.com/sky.com.config.js +++ b/sites/sky.com/sky.com.config.js @@ -1,58 +1,141 @@ +const cheerio = require('cheerio') const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const debug = require('debug')('site:sky.com') + +dayjs.extend(utc) + +const nworker = 10 module.exports = { site: 'sky.com', days: 2, - url: function ({ date, channel }) { - return `https://epgservices.sky.com/5.2.2/api/2.0/channel/json/${ + url({ date, channel }) { + return `https://awk.epgsky.com/hawk/linear/schedule/${ + date.format('YYYYMMDD') + }/${ channel.site_id - }/${date.unix()}/86400/4` + }` }, - parser: function ({ content, channel }) { + parser({ content, channel }) { const programs = [] - const items = parseItems(content, channel) - - items.forEach(item => { - programs.push({ - title: item.t, - description: item.d, - start: dayjs.unix(item.s), - stop: dayjs.unix(item.s + item.m[1]), - image: item.img ? `http://epgstatic.sky.com/epgdata/1.0/paimage/46/1/${item.img}` : null - }) - }) + if (content) { + const items = JSON.parse(content) || null + if (Array.isArray(items.schedule)) { + items.schedule + .filter(schedule => schedule.sid === channel.site_id) + .forEach(schedule => { + if (Array.isArray(schedule.events)) { + schedule.events + .forEach(event => { + const start = dayjs.utc(event.st * 1000) + const stop = start.add(event.d, 's') + programs.push({ + title: event.t, + description: event.sy, + season: event.seasonnumber, + episode: event.episodenumber, + start, + stop + }) + }) + } + }) + } + } return programs }, async channels() { - const axios = require('axios') - const cheerio = require('cheerio') - - const data = await axios - .get(`https://www.sky.com/tv-guide/`) - .then(r => r.data) - .catch(console.log) - - let channels = [] - - const $ = cheerio.load(data) - let initialData = $('#initialData').text() - initialData = JSON.parse(decodeURIComponent(initialData)) - - initialData.state.epgData.channelsForRegion.forEach(item => { - channels.push({ - lang: 'en', - site_id: item.sid, - name: item.t - }) + const channels = {} + const queues = [{ t: 'r', u: 'https://www.sky.com/tv-guide' }] + await doFetch(queues, (queue, res) => { + // process regions + if (queue.t === 'r') { + const $ = cheerio.load(res) + const initialData = JSON.parse(decodeURIComponent($('#initialData').text())) + initialData.state.epgData.regions + .forEach(region => { + queues.push({ t: 'c', u: `https://awk.epgsky.com/hawk/linear/services/${region.bouquet}/${region.subBouquet}` }) + }) + } + // process channels + if (queue.t === 'c') { + if (Array.isArray(res.services)) { + for (const ch of res.services) { + if (channels[ch.sid] === undefined) { + channels[ch.sid] = { + lang: 'en', + site_id: ch.sid, + name: ch.t + } + } + } + } + } }) - return channels + return Object.values(channels) } } -function parseItems(content, channel) { - const data = JSON.parse(content) - - return data && data.listings ? data.listings[channel.site_id] : [] +async function doFetch(queues, cb) { + const axios = require('axios') + let n = Math.min(nworker, queues.length) + const workers = [] + const adjustWorker = () => { + if (queues.length > workers.length && workers.length < nworker) { + let nw = Math.min(nworker, queues.length) + if (n < nw) { + n = nw + createWorker() + } + } + } + const createWorker = () => { + while (workers.length < n) { + startWorker() + } + } + const startWorker = () => { + const worker = () => { + if (queues.length) { + const queue = queues.shift() + const done = (res, headers) => { + if (res) { + cb(queue, res, headers) + adjustWorker() + } + worker() + } + const url = typeof queue === 'string' ? queue : queue.u + const params = typeof queue === 'object' && queue.params ? queue.params : {} + const method = typeof queue === 'object' && queue.m ? queue.m : 'get' + if (typeof debug === 'function') { + debug(`fetch %s with %s`, url, JSON.stringify(params)) + } + axios[method](url, params) + .then(response => { + done(response.data, response.headers) + }) + .catch(err => { + console.error(`Unable to fetch ${url}: ${err.message}!`) + done() + }) + } else { + workers.splice(workers.indexOf(worker), 1) + } + } + workers.push(worker) + worker() + } + createWorker() + await new Promise(resolve => { + const interval = setInterval(() => { + if (workers.length === 0) { + clearInterval(interval) + resolve() + } + }, 500) + }) } diff --git a/sites/sky.com/sky.com.test.js b/sites/sky.com/sky.com.test.js index 9e776c5b..c4cce548 100644 --- a/sites/sky.com/sky.com.test.js +++ b/sites/sky.com/sky.com.test.js @@ -1,54 +1,59 @@ const { parser, url } = require('./sky.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') + dayjs.extend(customParseFormat) dayjs.extend(utc) -const date = dayjs.utc('2021-12-15', 'YYYY-MM-DD').startOf('d') +const date = dayjs.utc('2024-12-14', 'YYYY-MM-DD').startOf('d') const channel = { - site_id: '2002', - xmltv_id: 'BBCOneLondon.uk' + site_id: '4086', + xmltv_id: 'SkyHistoryHD.uk' } -const content = - '{"listings":{"2002":[{"s":1639446600,"t":"Question of Sport","audioDescription":false,"m":[27170,1800,1,1,"--"],"rr":"S","subtitleHearing":true,"sid":53228,"d":"14/36. In this Christmas special, Paddy, Sam and Ugo are joined by Anton Du Beke, Shaun Wallace, Big Zuu and Jules Breach. Also in HD. [S]","img":"lisa/5.2.2/linear/channel/7f80ef03-3d8a-4f73-bf7d-6b03f410c7a8/2002"},{"s":1639448400,"t":"Weather for the Week Ahead","audioDescription":false,"m":[27171,300,1,1,"--"],"rr":"S","subtitleHearing":true,"sid":64799,"d":"Detailed weather forecast. Also in HD. [S]","img":"lisa/5.2.2/linear/channel/8fcf08b7-4081-499a-bf63-d100908e2d75/2002"}]}}' it('can generate valid url', () => { expect(url({ channel, date })).toBe( - 'https://epgservices.sky.com/5.2.2/api/2.0/channel/json/2002/1639526400/86400/4' + 'https://awk.epgsky.com/hawk/linear/schedule/20241214/4086' ) }) it('can parse response', () => { + const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.json')) const result = parser({ content, channel, date }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() return p }) - expect(result).toMatchObject([ - { - start: '2021-12-14T01:50:00.000Z', - stop: '2021-12-14T02:20:00.000Z', - title: 'Question of Sport', - image: - 'http://epgstatic.sky.com/epgdata/1.0/paimage/46/1/lisa/5.2.2/linear/channel/7f80ef03-3d8a-4f73-bf7d-6b03f410c7a8/2002' - }, - { - start: '2021-12-14T02:20:00.000Z', - stop: '2021-12-14T02:25:00.000Z', - title: 'Weather for the Week Ahead', - image: - 'http://epgstatic.sky.com/epgdata/1.0/paimage/46/1/lisa/5.2.2/linear/channel/8fcf08b7-4081-499a-bf63-d100908e2d75/2002' - } - ]) + expect(result.length).toBe(33) + expect(result[0]).toMatchObject({ + start: '2024-12-13T22:00:00.000Z', + stop: '2024-12-13T23:00:00.000Z', + title: 'The UnXplained With...', + description: + 'The Hunt for Jack the Ripper: Jack the Ripper\'s identity has eluded police, historians and armchair detectives for over a century. What do we know about the notorious killer? (S3, ep 21)', + season: 4, + episode: 14 + }) + expect(result[4]).toMatchObject({ + start: '2024-12-14T01:00:00.000Z', + stop: '2024-12-14T01:30:00.000Z', + title: 'Storage Wars', + description: + 'Not All That Glitters Is Gourd: Back in the city of Orange, the Vegas Ladies arrive in vintage style - though not everyone agrees. (S12, ep 6)', + season: 12, + episode: 6 + }) }) it('can handle empty guide', () => { const result = parser({ date, channel, - content: '{"listings":{"2002":[]}}' + content: '' }) expect(result).toMatchObject([]) })