diff --git a/.github/workflows/abc.net.au.yml b/.github/workflows/abc.net.au.yml
new file mode 100644
index 00000000..4ebe1b9b
--- /dev/null
+++ b/.github/workflows/abc.net.au.yml
@@ -0,0 +1,17 @@
+name: abc.net.au
+on:
+ schedule:
+ - cron: '0 3 * * *'
+ workflow_dispatch:
+ workflow_run:
+ workflows: [_trigger]
+ types:
+ - completed
+jobs:
+ load:
+ uses: ./.github/workflows/_load.yml
+ with:
+ site: ${{github.workflow}}
+ secrets:
+ APP_ID: ${{ secrets.APP_ID }}
+ APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
diff --git a/sites/abc.net.au/abc.net.au.config.js b/sites/abc.net.au/abc.net.au.config.js
new file mode 100644
index 00000000..21a98795
--- /dev/null
+++ b/sites/abc.net.au/abc.net.au.config.js
@@ -0,0 +1,74 @@
+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: 'abc.net.au',
+ request: {
+ cache: {
+ ttl: 60 * 60 * 1000 // 1 hour
+ }
+ },
+ url({ date }) {
+ return `https://epg.abctv.net.au/processed/Sydney_${date.format('YYYY-MM-DD')}.json`
+ },
+ parser({ content, channel }) {
+ let programs = []
+ const items = parseItems(content, channel)
+ items.forEach(item => {
+ programs.push({
+ title: item.title,
+ sub_title: item.episode_title,
+ category: item.genres,
+ description: item.description,
+ season: parseSeason(item),
+ episode: parseEpisode(item),
+ rating: parseRating(item),
+ icon: parseIcon(item),
+ start: parseTime(item.start_time),
+ stop: parseTime(item.end_time)
+ })
+ })
+
+ return programs
+ }
+}
+
+function parseItems(content, channel) {
+ try {
+ const data = JSON.parse(content)
+ if (!data) return []
+ if (!Array.isArray(data.schedule)) return []
+
+ const channelData = data.schedule.find(i => i.channel == channel.site_id)
+ return channelData.listing && Array.isArray(channelData.listing) ? channelData.listing : []
+ } catch (err) {
+ return []
+ }
+}
+
+function parseSeason(item) {
+ return item.series_num || null
+}
+function parseEpisode(item) {
+ return item.episode_num || null
+}
+function parseTime(time) {
+ return dayjs.tz(time, 'YYYY-MM-DD HH:mm', 'Australia/Sydney')
+}
+function parseIcon(item) {
+ return item.image_file ? `https://www.abc.net.au/tv/common/images/publicity/${item.image_file}` : null
+}
+function parseRating(item) {
+ return item.rating
+ ? {
+ system: 'ACB',
+ value: item.rating
+ }
+ : null
+ }
\ No newline at end of file
diff --git a/sites/abc.net.au/abc.net.au.test.js b/sites/abc.net.au/abc.net.au.test.js
new file mode 100644
index 00000000..ce9b7164
--- /dev/null
+++ b/sites/abc.net.au/abc.net.au.test.js
@@ -0,0 +1,54 @@
+// npx epg-grabber --config=sites/abc.net.au/abc.net.au.config.js --channels=sites/abc.net.au/abc.net.au_au.channels.xml --output=guide.xml --days=2
+
+const { parser, url } = require('./abc.net.au.config.js')
+const dayjs = require('dayjs')
+const utc = require('dayjs/plugin/utc')
+dayjs.extend(utc)
+
+const date = dayjs.utc('2022-12-22', 'YYYY-MM-DD').startOf('d')
+const channel = {
+ site_id: 'ABC1',
+ xmltv_id: 'ABCTV.au'
+}
+it('can generate valid url', () => {
+ expect(url({ date })).toBe(
+ 'https://epg.abctv.net.au/processed/Sydney_2022-12-22.json'
+ )
+})
+
+it('can parse response', () => {
+ const content = `{"date":"2022-12-22","region":"Sydney","schedule":[{"channel":"ABC1","listing":[{"consumer_advice":"Adult Themes, Drug Use, Violence","rating":"M","show_id":912747,"repeat":true,"description":"When tragedy strikes close to home, it puts head teacher Noah Taylor on a collision course with the criminals responsible. Can the Lyell team help him stop the cycle of violence?","title":"Silent Witness","crid":"ZW2178A004S00","start_time":"2022-12-22T00:46:00","series-crid":"ZW2178A","live":false,"captioning":true,"show_type":"Episode","series_num":22,"episode_title":"Lift Up Your Hearts (part Two)","length":58,"onair_title":"Silent Witness","end_time":"2022-12-22T01:44:00","genres":["Entertainment"],"image_file":"ZW2178A004S00_460.jpg","prog_slug":"silent-witness","episode_num":4}]}]}`
+
+ const result = parser({ content, channel }).map(p => {
+ p.start = p.start.toJSON()
+ p.stop = p.stop.toJSON()
+ return p
+ })
+
+ expect(result).toMatchObject([
+ {
+ title: 'Silent Witness',
+ sub_title: 'Lift Up Your Hearts (part Two)',
+ description: `When tragedy strikes close to home, it puts head teacher Noah Taylor on a collision course with the criminals responsible. Can the Lyell team help him stop the cycle of violence?`,
+ category: ['Entertainment'],
+ rating: {
+ system: 'ACB',
+ value: 'M'},
+ season: 22,
+ episode: 4,
+ icon: 'https://www.abc.net.au/tv/common/images/publicity/ZW2178A004S00_460.jpg',
+ start: '2022-12-21T13:46:00.000Z',
+ stop: '2022-12-21T14:44:00.000Z'
+ }
+ ])
+})
+
+it('can handle empty guide', () => {
+ const result = parser(
+ {
+ content: `NoSuchKey
The specified key does not exist.processed/Sydney_2023-01-17.json6MRHX5TJ12X39B3Y59rH6XRMrmkFywg8Kv58iqpI6O1fuOCuEbKa1HRRYa4buByXMBTvAhz8zuAK7X5D+ZN9ZuWxyGs=`
+ },
+ channel
+ )
+ expect(result).toMatchObject([])
+})
diff --git a/sites/abc.net.au/abc.net.au_au.channels.xml b/sites/abc.net.au/abc.net.au_au.channels.xml
new file mode 100644
index 00000000..ab4dfc52
--- /dev/null
+++ b/sites/abc.net.au/abc.net.au_au.channels.xml
@@ -0,0 +1,37 @@
+
+
+
+ 10 Bold
+ 10 Peach
+ 10 Shake
+ 7flix
+ 7mate
+ 7two
+ 9 Gem
+ 9 Go!
+ 9 Life
+ 9 Rush
+ ABC Kids
+ ABC ME
+ ABC News
+ ABC TV
+ ABC TV Plus
+ Channel 10
+ Channel 7
+ Channel 9
+ NITV
+ Racing.com
+ SBS One
+ SBS Food
+ SBS Viceland
+ SBS World Movies
+ SBS World Watch
+ Spree TV
+ TSVN
+
+
+
+
+
+
+