Merge pull request #1151 from iptv-org/add-tapdmv.com

Add guide from tapdmv.com
This commit is contained in:
Aleksandr Statciuk 2022-10-04 20:06:24 +03:00 committed by GitHub
commit 769c4010a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 161 additions and 0 deletions

17
.github/workflows/tapdmv.com.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: tapdmv.com
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 }}

View file

@ -0,0 +1,60 @@
const axios = require('axios')
const dayjs = require('dayjs')
module.exports = {
site: 'tapdmv.com',
url({ channel, date }) {
return `https://epg.tapdmv.com/calendar/${
channel.site_id
}?%24limit=10000&%24sort%5BcreatedAt%5D=-1&start=${date.toJSON()}&end=${date
.add(1, 'd')
.toJSON()}`
},
parser: function ({ content, date }) {
let programs = []
const items = parseItems(content, date)
items.forEach(item => {
programs.push({
title: item.program.trim(),
description: item.description,
category: item.genre,
icon: item.thumbnailImage,
start: parseStart(item),
stop: parseStop(item)
})
})
return programs
},
async channels() {
const items = await axios
.get(`https://epg.tapdmv.com/calendar?$limit=10000&$sort[createdAt]=-1`)
.then(r => r.data.data)
.catch(console.log)
return items.map(item => {
const [_, name] = item.name.match(/epg-tapgo-([^\.]+).json/)
return {
site_id: item.id,
name
}
})
}
}
function parseStart(item) {
return dayjs(item.startTime)
}
function parseStop(item) {
return dayjs(item.endTime)
}
function parseItems(content, date) {
if (!content) return []
const data = JSON.parse(content)
if (!Array.isArray(data)) return []
const d = date.format('YYYY-MM-DD')
return data.filter(i => i.startTime.includes(d))
}

View file

@ -0,0 +1,50 @@
// npx epg-grabber --config=sites/tapdmv.com/tapdmv.com.config.js --channels=sites/tapdmv.com/tapdmv.com_ph.channels.xml --output=guide.xml --days=2
// npm run channels:parse -- --config=./sites/tapdmv.com/tapdmv.com.config.js --output=./sites/tapdmv.com/tapdmv.com_ph.channels.xml
const { parser, url } = require('./tapdmv.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('2022-10-04', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '94b7db9b-5bbd-47d3-a2d3-ce792342a756',
xmltv_id: 'TAPActionFlix.ph'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe(
'https://epg.tapdmv.com/calendar/94b7db9b-5bbd-47d3-a2d3-ce792342a756?%24limit=10000&%24sort%5BcreatedAt%5D=-1&start=2022-10-04T00:00:00.000Z&end=2022-10-05T00:00:00.000Z'
)
})
it('can parse response', () => {
const content = `[{"id":"0afc3cc0-eab8-4960-a8b5-55d76edeb8f0","program":"The Bourne Ultimatum","episode":"The Bourne Ultimatum","description":"Jason Bourne dodges a ruthless C.I.A. official and his Agents from a new assassination program while searching for the origins of his life as a trained killer.","genre":"Action","thumbnailImage":"https://s3.ap-southeast-1.amazonaws.com/epg.tapdmv.com/tapactionflix.png","startTime":"2022-10-03T23:05:00.000Z","endTime":"2022-10-04T01:00:00.000Z","fileId":"94b7db9b-5bbd-47d3-a2d3-ce792342a756","createdAt":"2022-09-30T13:02:10.586Z","updatedAt":"2022-09-30T13:02:10.586Z"},{"id":"8dccd5e0-ab88-44b6-a2af-18d31c6e9ed7","program":"The Devil Inside ","episode":"The Devil Inside ","description":"In Italy, a woman becomes involved in a series of unauthorized exorcisms during her mission to discover what happened to her mother, who allegedly murdered three people during her own exorcism.","genre":"Horror","thumbnailImage":"https://s3.ap-southeast-1.amazonaws.com/epg.tapdmv.com/tapactionflix.png","startTime":"2022-10-04T01:00:00.000Z","endTime":"2022-10-04T02:25:00.000Z","fileId":"94b7db9b-5bbd-47d3-a2d3-ce792342a756","createdAt":"2022-09-30T13:02:24.031Z","updatedAt":"2022-09-30T13:02:24.031Z"}]`
const result = parser({ content, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result).toMatchObject([
{
start: '2022-10-04T01:00:00.000Z',
stop: '2022-10-04T02:25:00.000Z',
title: 'The Devil Inside',
description:
'In Italy, a woman becomes involved in a series of unauthorized exorcisms during her mission to discover what happened to her mother, who allegedly murdered three people during her own exorcism.',
category: 'Horror',
icon: 'https://s3.ap-southeast-1.amazonaws.com/epg.tapdmv.com/tapactionflix.png'
}
])
})
it('can handle empty guide', () => {
const result = parser({
content: `[]`,
date
})
expect(result).toMatchObject([])
})

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="tapdmv.com">
<channels>
<channel lang="en" xmltv_id="ANC.ph" site_id="ee9500aa-a198-4ea8-8aa8-3a60070457f3">anc</channel>
<channel lang="en" xmltv_id="AsianFoodNetwork.sg" site_id="f3d648ca-f988-4f1d-bdf2-eebff8b8a334">asianfoodchannel</channel>
<channel lang="en" xmltv_id="CinemaWorld.my" site_id="c703509c-392a-4eec-bcb0-513a30a3b933">cinemaworld</channel>
<channel lang="en" xmltv_id="EDGEsportPhilippines.ph" site_id="470085cd-91c6-4878-9233-6f8c894538ef">edgesport</channel>
<channel lang="en" xmltv_id="KBSWorld.kr" site_id="ebb29a3b-ba35-45d8-981d-f690434935c5">kbsworld</channel>
<channel lang="en" xmltv_id="KnowledgeChannel.ph" site_id="e78dde4a-ed1b-4118-9453-7752de4dde62">knowledgechannel</channel>
<channel lang="en" xmltv_id="PremierFootball.ph" site_id="3ceaf9fa-5f4e-4263-ad6b-925061275d24">premierfootball</channel>
<channel lang="en" xmltv_id="PremierSports.ph" site_id="24249e64-374c-4c32-bc02-1bfa953fa5ea">premiersports1</channel>
<channel lang="en" xmltv_id="PremierSports2.ph" site_id="c8997290-0446-455e-9b55-ca3c749786b6">premiersports2</channel>
<channel lang="en" xmltv_id="TAPActionFlix.ph" site_id="94b7db9b-5bbd-47d3-a2d3-ce792342a756">tapactionflix</channel>
<channel lang="en" xmltv_id="TAPEdge.ph" site_id="94905664-50bb-4d4a-8ba2-d06a2ccd71c3">tapedge</channel>
<channel lang="en" xmltv_id="TAPMovies.ph" site_id="848ee7a7-f082-436c-9e10-128dd9e52e05">tapmovies</channel>
<channel lang="en" xmltv_id="TAPSports.ph" site_id="40457bed-1f64-4833-adc9-1ff9015788a4">tapsports</channel>
<channel lang="en" xmltv_id="TAPTV.ph" site_id="fb372a75-1595-4e41-82af-d731c4353b8b">taptv</channel>
<channel lang="en" xmltv_id="TeleRadyo.ph" site_id="bb90c36c-7f9f-4df9-97c5-c8f05c3ee767">teleradyo</channel>
<!-- <channel lang="en" xmltv_id="" site_id="08220d6a-1597-4d6d-b35b-d575e5361b2e">paramountnetwork</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="3e4ab1a8-c898-4a8b-82bf-7e4438d64a9a">dmax</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="538051ca-9faf-4a61-b28c-387cc9529971">nickelodeon</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="59050ed4-7885-4159-87de-2ee5735c61f4">cnbc</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="7b7ecc4e-5c43-44b5-afc9-fb4dc1ad64ab">hgtv</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="7bcedd9b-2544-4c3c-b6a9-e2951a7e7143">animax</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="a845a4bd-7539-4c4c-bfa9-d977ea9465db">davincikids</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="b725a8bd-dcf3-4fa9-a85b-8423fb9229be">kartoonchannel</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="c9c7dc62-a2f3-4c25-a6c6-a5d14870b204">tlc</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="cb13167a-16b5-44a9-9056-bb3380cbab04">aniplus</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="e2c11771-36e1-4eed-aea7-2653fe78af20">discoveryscience</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="ee09a248-6c17-4424-8aa6-0cf70ebcc308">dreamworks</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="ef6fe7d2-7dfd-403a-9531-510f3b56e5e7">discoverychannel</channel> -->
<!-- <channel lang="en" xmltv_id="" site_id="f08995d0-11b6-484d-97cd-f3211c12b941">animalplanet</channel> -->
</channels>
</site>