Initial Commit
This commit is contained in:
72
sites/vidio.com/vidio.com.channels.xml
Normal file
72
sites/vidio.com/vidio.com.channels.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site site="vidio.com">
|
||||
<channels>
|
||||
<channel lang="id" xmltv_id="AjwaTV.id" site_id="7464">Ajwa TV</channel>
|
||||
<channel lang="id" xmltv_id="AlJazeeraEnglish.qa" site_id="6410">Aljazeera English</channel>
|
||||
<channel lang="id" xmltv_id="ANTV.id" site_id="782">ANTV</channel>
|
||||
<channel lang="id" xmltv_id="ArirangWorld.kr" site_id="6784">Arirang World</channel>
|
||||
<channel lang="id" xmltv_id="beINSports1Indonesia.id" site_id="6299">BeIn Sports 1 Indonesia</channel>
|
||||
<channel lang="id" xmltv_id="beINSports3Indonesia.id" site_id="6317">BeIn Sports 3 Indonesia</channel>
|
||||
<channel lang="id" xmltv_id="BeritaSatu.id" site_id="6165">Berita Satu</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTV1.id" site_id="6685">Champions TV 1</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTV2.id" site_id="6686">Champions TV 2</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTV3.id" site_id="6786">Champions TV 3</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTV4.id" site_id="7953">Champions TV 4</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTV5.id" site_id="9182">Champions TV 5</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTV6.id" site_id="9183">Champions TV 6</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTVEPL.id" site_id="9353">Champions TV EPL</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTVGoal.id" site_id="9045">Champions TV Goal</channel>
|
||||
<channel lang="id" xmltv_id="ChampionsTVXtraHD.id" site_id="8624">Champions TV Xtra</channel>
|
||||
<channel lang="id" xmltv_id="CitraBioskop.id" site_id="6684">Citra Bioskop</channel>
|
||||
<channel lang="id" xmltv_id="CitraCulinaryTravel.id" site_id="8558">Citra Culinary & Travel</channel>
|
||||
<channel lang="id" xmltv_id="CitraDangdut.id" site_id="6587">Citra Dangdut</channel>
|
||||
<channel lang="id" xmltv_id="CitraDrama.id" site_id="6401">Citra Drama</channel>
|
||||
<channel lang="id" xmltv_id="CitraEntertainment.id" site_id="6402">Citra Entertainment</channel>
|
||||
<channel lang="id" xmltv_id="CitraMuslim.id" site_id="6678">Citra Muslim</channel>
|
||||
<channel lang="id" xmltv_id="CNA.sg" site_id="6411">CNA</channel>
|
||||
<channel lang="id" xmltv_id="DAAITV.id" site_id="6482">Da Ai TV</channel>
|
||||
<channel lang="id" xmltv_id="DaVinciAsia.de" site_id="6549">Da Vinci Asia</channel>
|
||||
<channel lang="id" xmltv_id="DWEnglish.de" site_id="5075">DW English</channel>
|
||||
<channel lang="id" xmltv_id="EuronewsEnglish.fr" site_id="6412">EuroNews English</channel>
|
||||
<channel lang="id" xmltv_id="FashionTVAsia.fr" site_id="6511">Fashion TV Asia</channel>
|
||||
<channel lang="id" xmltv_id="FashionTVLOriginal.fr" site_id="6507">Fashion TV L'Original</channel>
|
||||
<channel lang="id" xmltv_id="FashionTVMidnightSecrets.fr" site_id="6504">Fashion TV Midnite Secret</channel>
|
||||
<channel lang="id" xmltv_id="HipHipHoree.id" site_id="7052">Hip Hip Horee!</channel>
|
||||
<channel lang="id" xmltv_id="Horee.id" site_id="6397">Horee!</channel>
|
||||
<channel lang="id" xmltv_id="Indosiar.id" site_id="205">Indosiar</channel>
|
||||
<channel lang="id" xmltv_id="JakTV.id" site_id="5415">Jak TV</channel>
|
||||
<channel lang="id" xmltv_id="JPMTV.id" site_id="9714">JPM TV</channel>
|
||||
<channel lang="id" xmltv_id="JTV.id" site_id="9713">JTV</channel>
|
||||
<channel lang="id" xmltv_id="KompasTV.id" site_id="874">Kompas TV</channel>
|
||||
<channel lang="id" xmltv_id="LFCTV.uk" site_id="7916">Liverpool FC TV</channel>
|
||||
<channel lang="id" xmltv_id="MagnaChannel.id" site_id="7230">Magna Channel</channel>
|
||||
<channel lang="id" xmltv_id="MetroTV.id" site_id="777">Metro TV</channel>
|
||||
<channel lang="id" xmltv_id="MentariTV.id" site_id="8237">Mentari TV</channel>
|
||||
<channel lang="id" xmltv_id="MyTV.id" site_id="6711">My TV</channel>
|
||||
<channel lang="id" xmltv_id="NBATV.us" site_id="6717">NBA TV</channel>
|
||||
<channel lang="id" xmltv_id="NET.id" site_id="875">NET</channel>
|
||||
<channel lang="id" xmltv_id="NHKWorldJapan.jp" site_id="7968">NHK World Japan</channel>
|
||||
<channel lang="id" xmltv_id="NusantaraTV.id" site_id="7432">Nusantara</channel>
|
||||
<channel lang="id" xmltv_id="OChannel.id" site_id="206">O Channel</channel>
|
||||
<channel lang="id" xmltv_id="Reformed21.id" site_id="6853">Reformed 21 TV</channel>
|
||||
<channel lang="id" xmltv_id="PetTV.id" site_id="8556">Pet TV</channel>
|
||||
<channel lang="id" xmltv_id="ROCKEntertainment.sg" site_id="8120">Rock Entertainment</channel>
|
||||
<channel lang="id" xmltv_id="ROCKExtreme.sg" site_id="8121">Rock Extreme</channel>
|
||||
<channel lang="id" xmltv_id="RajawaliTV.id" site_id="1561">RTV</channel>
|
||||
<channel lang="id" xmltv_id="SCTV.id" site_id="204">SCTV</channel>
|
||||
<channel lang="id" xmltv_id="UChannel.id" site_id="6898">U Channel</channel>
|
||||
<channel lang="id" xmltv_id="Trans7.id" site_id="734">Trans 7</channel>
|
||||
<channel lang="id" xmltv_id="TransTV.id" site_id="733">Trans TV</channel>
|
||||
<channel lang="id" xmltv_id="TVEdukasi.id" site_id="6838">TV Edukasi</channel>
|
||||
<channel lang="id" xmltv_id="tvOne.id" site_id="783">tvOne</channel>
|
||||
<channel lang="id" xmltv_id="TVRINasional.id" site_id="6441">TVRI Nasional</channel>
|
||||
<channel lang="id" xmltv_id="ZeeBioskop.id" site_id="6399">Zee Bioskop</channel>
|
||||
<channel lang="id" xmltv_id="Zing.in" site_id="6747">Zing Asia</channel>
|
||||
<channel lang="id" xmltv_id="ZooMoo.sg" site_id="6533">Zoo Moo Asia</channel>
|
||||
<channel lang="id" xmltv_id="RANSEntertainment.id" site_id="8241">RANS Entertainment</channel>
|
||||
<channel lang="id" xmltv_id="TVTempo.id" site_id="7946">TV Tempo</channel>
|
||||
<channel lang="id" xmltv_id="SEAToday.id" site_id="7687">SEA Today</channel>
|
||||
<channel lang="id" xmltv_id="ABCNewsAustralia.au" site_id="7150">ABC Australia</channel>
|
||||
<channel lang="id" xmltv_id="MakkahTV.sa" site_id="6852">Makkah TV</channel>
|
||||
</channels>
|
||||
</site>
|
||||
72
sites/vidio.com/vidio.com.config.js
Normal file
72
sites/vidio.com/vidio.com.config.js
Normal file
@@ -0,0 +1,72 @@
|
||||
const cheerio = require('cheerio')
|
||||
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: 'vidio.com',
|
||||
days: 2,
|
||||
url({ channel }) {
|
||||
return `https://www.vidio.com/live/${channel.site_id}/schedules`
|
||||
},
|
||||
parser({ content, date }) {
|
||||
const programs = []
|
||||
const items = parseItems(content, date)
|
||||
items.forEach(item => {
|
||||
const prev = programs[programs.length - 1]
|
||||
const $item = cheerio.load(item)
|
||||
let start = parseStart($item, date)
|
||||
if (prev && start.isBefore(prev.start)) {
|
||||
start = start.add(1, 'd')
|
||||
date = date.add(1, 'd')
|
||||
}
|
||||
let stop = parseStop($item, date)
|
||||
if (stop.isBefore(start)) {
|
||||
stop = stop.add(1, 'd')
|
||||
date = date.add(1, 'd')
|
||||
}
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
function parseStart($item, date) {
|
||||
const timeString = $item('div.b-livestreaming-daily-schedule__item-content-caption').text()
|
||||
const [_, start] = timeString.match(/(\d{2}:\d{2}) -/) || [null, null]
|
||||
const dateString = `${date.format('YYYY-MM-DD')} ${start}`
|
||||
|
||||
return dayjs.tz(dateString, 'YYYY-MM-DD HH:mm', 'Asia/Jakarta')
|
||||
}
|
||||
|
||||
function parseStop($item, date) {
|
||||
const timeString = $item('div.b-livestreaming-daily-schedule__item-content-caption').text()
|
||||
const [_, stop] = timeString.match(/- (\d{2}:\d{2}) WIB/) || [null, null]
|
||||
const dateString = `${date.format('YYYY-MM-DD')} ${stop}`
|
||||
|
||||
return dayjs.tz(dateString, 'YYYY-MM-DD HH:mm', 'Asia/Jakarta')
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item('div.b-livestreaming-daily-schedule__item-content-title').text()
|
||||
}
|
||||
|
||||
function parseItems(content, date) {
|
||||
const $ = cheerio.load(content)
|
||||
|
||||
return $(
|
||||
`#schedule-content-${date.format(
|
||||
'YYYYMMDD'
|
||||
)} > .b-livestreaming-daily-schedule__scroll-container .b-livestreaming-daily-schedule__item`
|
||||
).toArray()
|
||||
}
|
||||
54
sites/vidio.com/vidio.com.test.js
Normal file
54
sites/vidio.com/vidio.com.test.js
Normal file
@@ -0,0 +1,54 @@
|
||||
// npx epg-grabber --config=sites/vidio.com/vidio.com.config.js --channels=sites/vidio.com/vidio.com.channels.xml --output=guide.xml --days=2
|
||||
|
||||
const { parser, url } = require('./vidio.com.config.js')
|
||||
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-11-24', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: '7464',
|
||||
xmltv_id: 'AjwaTV.id'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel })).toBe('https://www.vidio.com/live/7464/schedules')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = `<div class="b-livestreaming-daily-schedule__section b-livestreaming-daily-schedule__contents"> <div class="b-livestreaming-daily-schedule__content" id="schedule-content-20211124"> <div class="js-ahoy b-livestreaming-schedule__ahoy-impression" data-ahoy-component="Ahoy::Builder" data-ahoy-impression="true" data-ahoy-title="LIVESTREAMING" data-use-bounding-client-rect="true" ></div><div class="b-livestreaming-daily-schedule__scroll-container"> <a class="" href="/watch/2361692-30-hari-30-juz-24-november-2021" ><div class="b-livestreaming-daily-schedule__item js-ahoy" data-ahoy-click="true" data-ahoy-component="Ahoy::Builder" data-ahoy-props='{"section":"schedule","stream_type":"TvStream","livestreaming_id":7464,"schedule_day":-1,"schedule_id":1471806,"schedule_title":"30 Hari 30 Juz","action":"click"}' data-ahoy-title="LIVESTREAMING" id="schedule-item-1471806" > <div class="b-livestreaming-daily-schedule__item-icon"> <div class="b-livestreaming-daily-schedule__item-icon-play"></div></div><div class="b-livestreaming-daily-schedule__item-content"> <div class="b-livestreaming-daily-schedule__item-content-caption"> 00:30 - 01:30 WIB </div><div class="b-livestreaming-daily-schedule__item-content-title">30 Hari 30 Juz</div></div></div></a ><a class="" href="/watch/2361785-makkah-live-24-november-2021" ><div class="b-livestreaming-daily-schedule__item js-ahoy" data-ahoy-click="true" data-ahoy-component="Ahoy::Builder" data-ahoy-props='{"section":"schedule","stream_type":"TvStream","livestreaming_id":7464,"schedule_day":-1,"schedule_id":1471807,"schedule_title":"Makkah Live","action":"click"}' data-ahoy-title="LIVESTREAMING" id="schedule-item-1471807" > <div class="b-livestreaming-daily-schedule__item-icon"> <div class="b-livestreaming-daily-schedule__item-icon-play"></div></div><div class="b-livestreaming-daily-schedule__item-content"> <div class="b-livestreaming-daily-schedule__item-content-caption"> 01:30 - 04:00 WIB </div><div class="b-livestreaming-daily-schedule__item-content-title">Makkah Live</div></div></div></a ><a class="" href="/watch/2362889-ftv-islami-24-november-2021" ><div class="b-livestreaming-daily-schedule__item js-ahoy" data-ahoy-click="true" data-ahoy-component="Ahoy::Builder" data-ahoy-props='{"section":"schedule","stream_type":"TvStream","livestreaming_id":7464,"schedule_day":-1,"schedule_id":1473829,"schedule_title":"FTV Islami","action":"click"}' data-ahoy-title="LIVESTREAMING" id="schedule-item-1473829" > <div class="b-livestreaming-daily-schedule__item-icon"> <div class="b-livestreaming-daily-schedule__item-icon-play"></div></div><div class="b-livestreaming-daily-schedule__item-content"> <div class="b-livestreaming-daily-schedule__item-content-caption"> 22:30 - 00:30 WIB </div><div class="b-livestreaming-daily-schedule__item-content-title">FTV Islami</div></div></div></a > </div></div><div class="b-livestreaming-daily-schedule__content tab-active" id="schedule-content-20211125"> <div class="js-ahoy b-livestreaming-schedule__ahoy-impression" data-ahoy-component="Ahoy::Builder" data-ahoy-impression="true" data-ahoy-title="LIVESTREAMING" data-use-bounding-client-rect="true" ></div><div class="b-livestreaming-daily-schedule__scroll-container"> <a class="" href="/watch/2362921-30-hari-30-juz-25-november-2021" ><div class="b-livestreaming-daily-schedule__item js-ahoy" data-ahoy-click="true" data-ahoy-component="Ahoy::Builder" data-ahoy-props='{"section":"schedule","stream_type":"TvStream","livestreaming_id":7464,"schedule_day":0,"schedule_id":1473830,"schedule_title":"30 Hari 30 Juz","action":"click"}' data-ahoy-title="LIVESTREAMING" id="schedule-item-1473830" > <div class="b-livestreaming-daily-schedule__item-icon"> <div class="b-livestreaming-daily-schedule__item-icon-play"></div></div><div class="b-livestreaming-daily-schedule__item-content"> <div class="b-livestreaming-daily-schedule__item-content-caption"> 00:30 - 01:30 WIB </div><div class="b-livestreaming-daily-schedule__item-content-title">30 Hari 30 Juz</div></div></div></a > </div></div></div>`
|
||||
const result = parser({ content, date }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: '2021-11-23T17:30:00.000Z',
|
||||
stop: '2021-11-23T18:30:00.000Z',
|
||||
title: `30 Hari 30 Juz`
|
||||
},
|
||||
{
|
||||
start: '2021-11-23T18:30:00.000Z',
|
||||
stop: '2021-11-23T21:00:00.000Z',
|
||||
title: `Makkah Live`
|
||||
},
|
||||
{
|
||||
start: '2021-11-24T15:30:00.000Z',
|
||||
stop: '2021-11-24T17:30:00.000Z',
|
||||
title: `FTV Islami`
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
date,
|
||||
channel,
|
||||
content: `<!DOCTYPE html><html><head></head><body></body></html>`
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
Reference in New Issue
Block a user