mirror of
https://github.com/iptv-org/epg
synced 2026-05-02 07:26:58 -04:00
Replace LF line endings with CRLF
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="" site_id="98201">SPL02</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="AnimaxAsia.sg" site_id="242030">Animax</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Channel5.sg" site_id="97098">Channel 5</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Channel8.sg" site_id="97104">Channel 8</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="ChannelU.sg" site_id="97129">Channel U</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="CinemaWorld.my" site_id="382872">CinemaWorld</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="CinemaxAsia.sg" site_id="97155">Cinemax</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="CNA.sg" site_id="97072">CNA</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="GlobalTrekker.sg" site_id="158961">Global Trekker</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="HBOAsia.sg" site_id="97137">HBO</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="HBOFamilyAsia.sg" site_id="97147">HBO Family</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="HBOHitsAsia.sg" site_id="97140">HBO Hits</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="HBOSignatureAsia.sg" site_id="97146">HBO Signature</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="meWATCHLIVE1.sg" site_id="97073">LIVE 1</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="meWATCHLIVE2.sg" site_id="97078">LIVE 2</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Now70s.uk" site_id="158964">NOW 70s</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Now80s.uk" site_id="158965">NOW 80s</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="NOWRock.uk" site_id="158963">NOW Rock</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="oktolidays.sg" site_id="186574">oktolidays</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="ROCKAction.sg" site_id="227349">ROCK Action</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="ROCKEntertainment.sg" site_id="227348">ROCK Entertainment</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="SPLCH01.sg" site_id="98200">SPL01</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Suria.sg" site_id="97084">Suria</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="TraceUrban.fr" site_id="158962">TRACE Urban</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Vasantham.sg" site_id="97096">Vasantham</channel>
|
||||
</channels>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="" site_id="98201">SPL02</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="AnimaxAsia.sg" site_id="242030">Animax</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Channel5.sg" site_id="97098">Channel 5</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Channel8.sg" site_id="97104">Channel 8</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="ChannelU.sg" site_id="97129">Channel U</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="CinemaWorld.my" site_id="382872">CinemaWorld</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="CinemaxAsia.sg" site_id="97155">Cinemax</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="CNA.sg" site_id="97072">CNA</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="GlobalTrekker.sg" site_id="158961">Global Trekker</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="HBOAsia.sg" site_id="97137">HBO</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="HBOFamilyAsia.sg" site_id="97147">HBO Family</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="HBOHitsAsia.sg" site_id="97140">HBO Hits</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="HBOSignatureAsia.sg" site_id="97146">HBO Signature</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="meWATCHLIVE1.sg" site_id="97073">LIVE 1</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="meWATCHLIVE2.sg" site_id="97078">LIVE 2</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Now70s.uk" site_id="158964">NOW 70s</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Now80s.uk" site_id="158965">NOW 80s</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="NOWRock.uk" site_id="158963">NOW Rock</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="oktolidays.sg" site_id="186574">oktolidays</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="ROCKAction.sg" site_id="227349">ROCK Action</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="ROCKEntertainment.sg" site_id="227348">ROCK Entertainment</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="SPLCH01.sg" site_id="98200">SPL01</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Suria.sg" site_id="97084">Suria</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="TraceUrban.fr" site_id="158962">TRACE Urban</channel>
|
||||
<channel site="mewatch.sg" lang="en" xmltv_id="Vasantham.sg" site_id="97096">Vasantham</channel>
|
||||
</channels>
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.extend(customParseFormat)
|
||||
|
||||
module.exports = {
|
||||
site: 'mewatch.sg',
|
||||
days: 2,
|
||||
url: function ({ channel, date }) {
|
||||
const utcDate = date.isUTC() ? date.tz(dayjs.tz.guess(), true).utc() : date.utc()
|
||||
|
||||
return `https://cdn.mewatch.sg/api/schedules?channels=${channel.site_id}&date=${utcDate.format(
|
||||
'YYYY-MM-DD'
|
||||
)}&duration=24&ff=idp,ldp,rpt,cd&hour=${utcDate.format(
|
||||
'HH'
|
||||
)}&intersect=true&lang=en&segments=all`
|
||||
},
|
||||
parser: function ({ content, channel }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel)
|
||||
items.forEach(item => {
|
||||
const info = item.item
|
||||
programs.push({
|
||||
title: info.title,
|
||||
description: info.description,
|
||||
image: info.images.tile,
|
||||
episode: info.episodeNumber,
|
||||
season: info.seasonNumber,
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item),
|
||||
rating: parseRating(info)
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const data = await axios
|
||||
.get('https://www.mewatch.sg/channel-guide')
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
let channels = []
|
||||
const $ = cheerio.load(data)
|
||||
$('#side-nav > div > div > div > nav:nth-child(1) > ul > li > ul > li').each((i, el) => {
|
||||
const name = $(el).find('a > span').text()
|
||||
const url = $(el).find('a').attr('href')
|
||||
const [, site_id = null] = url.match(/\/(\d+)\?player-fullscreen/) ?? []
|
||||
|
||||
if (!site_id) {
|
||||
return
|
||||
}
|
||||
|
||||
channels.push({
|
||||
lang: 'en',
|
||||
name,
|
||||
site_id
|
||||
})
|
||||
})
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseStart(item) {
|
||||
return dayjs(item.startDate)
|
||||
}
|
||||
|
||||
function parseStop(item) {
|
||||
return dayjs(item.endDate)
|
||||
}
|
||||
|
||||
function parseRating(info) {
|
||||
const classification = info.classification
|
||||
if (classification && classification.code) {
|
||||
const [, system, value] = classification.code.match(/^([A-Z]+)-([A-Z0-9]+)/) || [
|
||||
null,
|
||||
null,
|
||||
null
|
||||
]
|
||||
|
||||
return { system, value }
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const data = JSON.parse(content)
|
||||
if (!data || !Array.isArray(data)) return []
|
||||
const channelData = data.find(i => i.channelId === channel.site_id)
|
||||
|
||||
return channelData && Array.isArray(channelData.schedules) ? channelData.schedules : []
|
||||
}
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.extend(customParseFormat)
|
||||
|
||||
module.exports = {
|
||||
site: 'mewatch.sg',
|
||||
days: 2,
|
||||
url: function ({ channel, date }) {
|
||||
const utcDate = date.isUTC() ? date.tz(dayjs.tz.guess(), true).utc() : date.utc()
|
||||
|
||||
return `https://cdn.mewatch.sg/api/schedules?channels=${channel.site_id}&date=${utcDate.format(
|
||||
'YYYY-MM-DD'
|
||||
)}&duration=24&ff=idp,ldp,rpt,cd&hour=${utcDate.format(
|
||||
'HH'
|
||||
)}&intersect=true&lang=en&segments=all`
|
||||
},
|
||||
parser: function ({ content, channel }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel)
|
||||
items.forEach(item => {
|
||||
const info = item.item
|
||||
programs.push({
|
||||
title: info.title,
|
||||
description: info.description,
|
||||
image: info.images.tile,
|
||||
episode: info.episodeNumber,
|
||||
season: info.seasonNumber,
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item),
|
||||
rating: parseRating(info)
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const data = await axios
|
||||
.get('https://www.mewatch.sg/channel-guide')
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
let channels = []
|
||||
const $ = cheerio.load(data)
|
||||
$('#side-nav > div > div > div > nav:nth-child(1) > ul > li > ul > li').each((i, el) => {
|
||||
const name = $(el).find('a > span').text()
|
||||
const url = $(el).find('a').attr('href')
|
||||
const [, site_id = null] = url.match(/\/(\d+)\?player-fullscreen/) ?? []
|
||||
|
||||
if (!site_id) {
|
||||
return
|
||||
}
|
||||
|
||||
channels.push({
|
||||
lang: 'en',
|
||||
name,
|
||||
site_id
|
||||
})
|
||||
})
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseStart(item) {
|
||||
return dayjs(item.startDate)
|
||||
}
|
||||
|
||||
function parseStop(item) {
|
||||
return dayjs(item.endDate)
|
||||
}
|
||||
|
||||
function parseRating(info) {
|
||||
const classification = info.classification
|
||||
if (classification && classification.code) {
|
||||
const [, system, value] = classification.code.match(/^([A-Z]+)-([A-Z0-9]+)/) || [
|
||||
null,
|
||||
null,
|
||||
null
|
||||
]
|
||||
|
||||
return { system, value }
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const data = JSON.parse(content)
|
||||
if (!data || !Array.isArray(data)) return []
|
||||
const channelData = data.find(i => i.channelId === channel.site_id)
|
||||
|
||||
return channelData && Array.isArray(channelData.schedules) ? channelData.schedules : []
|
||||
}
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
const { parser, url } = require('./mewatch.sg.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('2022-06-11', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: '97098',
|
||||
xmltv_id: 'Channel5Singapore.sg'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe(
|
||||
'https://cdn.mewatch.sg/api/schedules?channels=97098&date=2022-06-10&duration=24&ff=idp,ldp,rpt,cd&hour=12&intersect=true&lang=en&segments=all'
|
||||
)
|
||||
})
|
||||
|
||||
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()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: '2022-06-11T21:00:00.000Z',
|
||||
stop: '2022-06-11T21:30:00.000Z',
|
||||
title: 'Open Homes S3 - EP 2',
|
||||
description:
|
||||
'Mike heads down to the Sydney beaches to visit a beachside renovation with all the bells and whistles, we see a kitchen tip and recipe anyone can do at home. We finish up in the prestigious Byron bay to visit a multi million dollar award winning home.',
|
||||
image:
|
||||
"https://production.togglestatic.com/shain/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=85&ImageId='4853697'&EntityType='LinearSchedule'&EntityId='788a7dd9-9b12-446f-91b4-c8ac9fec95e5'&Width=1280&Height=720&device=web_browser&subscriptions=Anonymous&segmentationTags=all",
|
||||
episode: 2,
|
||||
season: 3,
|
||||
rating: {
|
||||
system: 'IMDA',
|
||||
value: 'G'
|
||||
}
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
content:
|
||||
fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json')),
|
||||
channel
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
const { parser, url } = require('./mewatch.sg.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('2022-06-11', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: '97098',
|
||||
xmltv_id: 'Channel5Singapore.sg'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe(
|
||||
'https://cdn.mewatch.sg/api/schedules?channels=97098&date=2022-06-10&duration=24&ff=idp,ldp,rpt,cd&hour=12&intersect=true&lang=en&segments=all'
|
||||
)
|
||||
})
|
||||
|
||||
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()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: '2022-06-11T21:00:00.000Z',
|
||||
stop: '2022-06-11T21:30:00.000Z',
|
||||
title: 'Open Homes S3 - EP 2',
|
||||
description:
|
||||
'Mike heads down to the Sydney beaches to visit a beachside renovation with all the bells and whistles, we see a kitchen tip and recipe anyone can do at home. We finish up in the prestigious Byron bay to visit a multi million dollar award winning home.',
|
||||
image:
|
||||
"https://production.togglestatic.com/shain/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=85&ImageId='4853697'&EntityType='LinearSchedule'&EntityId='788a7dd9-9b12-446f-91b4-c8ac9fec95e5'&Width=1280&Height=720&device=web_browser&subscriptions=Anonymous&segmentationTags=all",
|
||||
episode: 2,
|
||||
season: 3,
|
||||
rating: {
|
||||
system: 'IMDA',
|
||||
value: 'G'
|
||||
}
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
content:
|
||||
fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json')),
|
||||
channel
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
# mewatch.sg
|
||||
|
||||
https://www.mewatch.sg/channel-guide
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=mewatch.sg
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/mewatch.sg/mewatch.sg.config.js --output=./sites/mewatch.sg/mewatch.sg.channels.xml
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- mewatch.sg
|
||||
```
|
||||
# mewatch.sg
|
||||
|
||||
https://www.mewatch.sg/channel-guide
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=mewatch.sg
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/mewatch.sg/mewatch.sg.config.js --output=./sites/mewatch.sg/mewatch.sg.channels.xml
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- mewatch.sg
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user