mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Merge pull request #2581 from iptv-org/add-gigatv.3bbtv.co.th
Add gigatv.3bbtv.co.th
This commit is contained in:
commit
53d81b8f4b
5 changed files with 214 additions and 0 deletions
1
sites/gigatv.3bbtv.co.th/__data__/content.json
Normal file
1
sites/gigatv.3bbtv.co.th/__data__/content.json
Normal file
File diff suppressed because one or more lines are too long
82
sites/gigatv.3bbtv.co.th/gigatv.3bbtv.co.th.channels.xml
Normal file
82
sites/gigatv.3bbtv.co.th/gigatv.3bbtv.co.th.channels.xml
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<channels>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="2">NBT</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="ThaiPBS.th" site_id="3">ThaiPBS</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="ALTV.th" site_id="4">ALTV</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="TV5HD.th" site_id="5">TV5 HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="TSports7.th" site_id="7">T Sports 7</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="ThaiParliamentTelevision.th" site_id="10">TPTV</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="TNN16.th" site_id="16">TNN16</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="JKN18.th" site_id="18">JKN 18</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="NationTV.th" site_id="22">Nation TV</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="WorkpointTV.th" site_id="23">Workpoint</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="True4U.th" site_id="24">True4U</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="GMM25.th" site_id="25">GMM 25</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="27">CH8</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="MONO29.th" site_id="29">Mono 29</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="MCOTHD.th" site_id="30">MCOT HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="31">ONE31 HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="ThairathTV.th" site_id="32">Thairath TV</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="33">3HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="AmarinTV.th" site_id="34">AmarinTV HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="35">CH7 HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="PPTV.th" site_id="36">PPTV HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="101">3BB Asian</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="103">HBO</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="104">HBO Signature</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="105">HBO Hits</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="106">HBO Family</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="107">Cinemax</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="109">Mono29 Plus</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="110">Warner TV</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="111">Rock Action</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="112">Rock Entertainment</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="Mangorn.th" site_id="121">Mangorn</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="202">MONO 29 Music Station</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="203">RUSH Stories</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="AlureChannel.th" site_id="204">A'lure Channel</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="205">Food Network</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="206">Asian Food Network</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="207">Hunan TV HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="208">Yunnan International</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="210">TLC</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="Khongdee.th" site_id="221">Khongdee</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="ThainessTV.th" site_id="222">Thainess</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="301">Cartoon Network</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="302">Cartoonito</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="303">Nickelodeon</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="304">Nick Jr.</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="306">Boomerang (Thai)</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="401">3BB Sports One</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="411">Golf Channel Thailand HD Plus</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="503">Discovery Channel</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="504">Animal Planet</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="505">Discovery Asia</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="Samrujlok.th" site_id="521">Samrujlok</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="MySci.th" site_id="522">MySci</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="523">Animal Show</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="601">BBC News</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="602">CNN INTERNATIONNAL</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="603">Bloomberg</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="604">CGTN</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="605">CCTV 4</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="606">Al Jazeera English HD</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="607">CNA</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="" site_id="608">NHK WORLD-JAPAN</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV1.th" site_id="701">DLTV 1</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV2.th" site_id="702">DLTV 2</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV3.th" site_id="703">DLTV 3</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV4.th" site_id="704">DLTV 4</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV5.th" site_id="705">DLTV 5</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV6.th" site_id="706">DLTV 6</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV7.th" site_id="707">DLTV 7</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV8.th" site_id="708">DLTV 8</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV9.th" site_id="709">DLTV 9</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV10.th" site_id="710">DLTV 10</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV11.th" site_id="711">DLTV 11</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV12.th" site_id="712">DLTV 12</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV13.th" site_id="713">DLTV 13</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV14.th" site_id="714">DLTV 14</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="DLTV15.th" site_id="715">DLTV 15</channel>
|
||||||
|
<channel site="gigatv.3bbtv.co.th" lang="th" xmltv_id="ETV.th" site_id="716">ETV</channel>
|
||||||
|
</channels>
|
65
sites/gigatv.3bbtv.co.th/gigatv.3bbtv.co.th.config.js
Normal file
65
sites/gigatv.3bbtv.co.th/gigatv.3bbtv.co.th.config.js
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
const axios = require('axios')
|
||||||
|
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: 'gigatv.3bbtv.co.th',
|
||||||
|
days: 1,
|
||||||
|
url({ channel }) {
|
||||||
|
return `https://gigatv.3bbtv.co.th/wp-content/themes/changwattana/epg/${channel.site_id}.json`
|
||||||
|
},
|
||||||
|
parser: function ({ content, date }) {
|
||||||
|
let programs = []
|
||||||
|
const items = parseItems(content, date)
|
||||||
|
items.forEach(item => {
|
||||||
|
programs.push({
|
||||||
|
title: item.programName,
|
||||||
|
start: parseTime(item.startTime),
|
||||||
|
stop: parseTime(item.endTime)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
},
|
||||||
|
async channels() {
|
||||||
|
const data = await axios
|
||||||
|
.get('https://gigatv.3bbtv.co.th/wp-content/themes/changwattana/epg/channel.json')
|
||||||
|
.then(r => r.data)
|
||||||
|
.catch(console.log)
|
||||||
|
|
||||||
|
const channels = []
|
||||||
|
data.forEach(group => {
|
||||||
|
group.channel_list.forEach(channel => {
|
||||||
|
channels.push({
|
||||||
|
lang: 'th',
|
||||||
|
site_id: channel.channel_id,
|
||||||
|
name: channel.channel_name
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return channels
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseTime(string) {
|
||||||
|
return dayjs.tz(string, 'YYYY-MM-DD HH:mm:ss', 'Asia/Bangkok')
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, date) {
|
||||||
|
try {
|
||||||
|
let data = JSON.parse(content)
|
||||||
|
if (!Array.isArray(data)) return []
|
||||||
|
data = data.filter(p => date.isSame(parseTime(p.startTime), 'day'))
|
||||||
|
|
||||||
|
return data
|
||||||
|
} catch {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
45
sites/gigatv.3bbtv.co.th/gigatv.3bbtv.co.th.test.js
Normal file
45
sites/gigatv.3bbtv.co.th/gigatv.3bbtv.co.th.test.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
const { parser, url } = require('./gigatv.3bbtv.co.th.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('2025-01-12', 'YYYY-MM-DD').startOf('d')
|
||||||
|
const channel = {
|
||||||
|
site_id: '222',
|
||||||
|
xmltv_id: 'ThainessTV.th'
|
||||||
|
}
|
||||||
|
|
||||||
|
it('can generate valid url', () => {
|
||||||
|
expect(url({ channel })).toBe(
|
||||||
|
'https://gigatv.3bbtv.co.th/wp-content/themes/changwattana/epg/222.json'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can parse response', () => {
|
||||||
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||||
|
let results = parser({ content, date }).map(p => {
|
||||||
|
p.start = p.start.toJSON()
|
||||||
|
p.stop = p.stop.toJSON()
|
||||||
|
return p
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(results.length).toBe(32)
|
||||||
|
expect(results[0]).toMatchObject({
|
||||||
|
start: '2025-01-12T00:00:00.000Z',
|
||||||
|
stop: '2025-01-12T00:30:00.000Z',
|
||||||
|
title: 'THAILAND FORM ABOVE : TAK'
|
||||||
|
})
|
||||||
|
expect(results[31]).toMatchObject({
|
||||||
|
start: '2025-01-12T23:30:00.000Z',
|
||||||
|
stop: '2025-01-13T00:00:00.000Z',
|
||||||
|
title: 'MAESA ELEPHANT CAMP'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can handle empty guide', () => {
|
||||||
|
expect(parser({ content: '', date })).toMatchObject([])
|
||||||
|
})
|
21
sites/gigatv.3bbtv.co.th/readme.md
Normal file
21
sites/gigatv.3bbtv.co.th/readme.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# gigatv.3bbtv.co.th
|
||||||
|
|
||||||
|
https://gigatv.3bbtv.co.th/epg
|
||||||
|
|
||||||
|
### Download the guide
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run grab --- --site=gigatv.3bbtv.co.th
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update channel list
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run channels:parse --- --config=./sites/gigatv.3bbtv.co.th/gigatv.3bbtv.co.th.config.js --output=./sites/gigatv.3bbtv.co.th/gigatv.3bbtv.co.th.channels.xml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm test --- gigatv.3bbtv.co.th
|
||||||
|
```
|
Loading…
Add table
Add a link
Reference in a new issue