mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Merge pull request #2587 from iptv-org/add-epg.iptvx.one
Add epg.iptvx.one
This commit is contained in:
commit
d1e5ca200c
8 changed files with 3027 additions and 0 deletions
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -60,6 +60,7 @@
|
||||||
"node-cleanup": "^2.1.2",
|
"node-cleanup": "^2.1.2",
|
||||||
"node-gzip": "^1.1.2",
|
"node-gzip": "^1.1.2",
|
||||||
"numeral": "^2.0.6",
|
"numeral": "^2.0.6",
|
||||||
|
"pako": "^2.1.0",
|
||||||
"parse-duration": "^1.0.0",
|
"parse-duration": "^1.0.0",
|
||||||
"pdf-parse": "^1.1.1",
|
"pdf-parse": "^1.1.1",
|
||||||
"serve": "^14.2.4",
|
"serve": "^14.2.4",
|
||||||
|
@ -7400,6 +7401,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
|
||||||
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="
|
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/pako": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="
|
||||||
|
},
|
||||||
"node_modules/parent-module": {
|
"node_modules/parent-module": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||||
|
@ -14513,6 +14519,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
|
||||||
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="
|
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="
|
||||||
},
|
},
|
||||||
|
"pako": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="
|
||||||
|
},
|
||||||
"parent-module": {
|
"parent-module": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
"node-cleanup": "^2.1.2",
|
"node-cleanup": "^2.1.2",
|
||||||
"node-gzip": "^1.1.2",
|
"node-gzip": "^1.1.2",
|
||||||
"numeral": "^2.0.6",
|
"numeral": "^2.0.6",
|
||||||
|
"pako": "^2.1.0",
|
||||||
"parse-duration": "^1.0.0",
|
"parse-duration": "^1.0.0",
|
||||||
"pdf-parse": "^1.1.1",
|
"pdf-parse": "^1.1.1",
|
||||||
"serve": "^14.2.4",
|
"serve": "^14.2.4",
|
||||||
|
|
BIN
sites/epg.iptvx.one/__data__/content.xml.gz
Normal file
BIN
sites/epg.iptvx.one/__data__/content.xml.gz
Normal file
Binary file not shown.
2865
sites/epg.iptvx.one/epg.iptvx.one.channels.xml
Normal file
2865
sites/epg.iptvx.one/epg.iptvx.one.channels.xml
Normal file
File diff suppressed because it is too large
Load diff
64
sites/epg.iptvx.one/epg.iptvx.one.config.js
Normal file
64
sites/epg.iptvx.one/epg.iptvx.one.config.js
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
const axios = require('axios')
|
||||||
|
const iconv = require('iconv-lite')
|
||||||
|
const parser = require('epg-parser')
|
||||||
|
const { ungzip } = require('pako')
|
||||||
|
|
||||||
|
let cachedContent
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'epg.iptvx.one',
|
||||||
|
days: 2,
|
||||||
|
url: 'https://iptvx.one/epg/epg_noarch.xml.gz',
|
||||||
|
request: {
|
||||||
|
maxContentLength: 500000000, // 500 MB
|
||||||
|
cache: {
|
||||||
|
ttl: 24 * 60 * 60 * 1000 // 1 day
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parser: function ({ buffer, channel, date, cached }) {
|
||||||
|
if (!cached) cachedContent = undefined
|
||||||
|
|
||||||
|
let programs = []
|
||||||
|
const items = parseItems(buffer, channel, date)
|
||||||
|
items.forEach(item => {
|
||||||
|
programs.push({
|
||||||
|
title: item.title?.[0]?.value,
|
||||||
|
description: item.desc?.[0]?.value,
|
||||||
|
start: item.start,
|
||||||
|
stop: item.stop
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
},
|
||||||
|
async channels() {
|
||||||
|
const data = await axios
|
||||||
|
.get('https://epg.iptvx.one/api/channels.json')
|
||||||
|
.then(r => r.data)
|
||||||
|
.catch(console.log)
|
||||||
|
|
||||||
|
return data.channels.map(channel => {
|
||||||
|
const [name] = channel.chan_names.split(' • ')
|
||||||
|
|
||||||
|
return {
|
||||||
|
lang: 'ru',
|
||||||
|
site_id: channel.chan_id,
|
||||||
|
name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(buffer, channel, date) {
|
||||||
|
if (!buffer) return []
|
||||||
|
|
||||||
|
if (!cachedContent) {
|
||||||
|
const content = ungzip(buffer)
|
||||||
|
const encoded = iconv.decode(content, 'utf8')
|
||||||
|
cachedContent = parser.parse(encoded)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { programs } = cachedContent
|
||||||
|
|
||||||
|
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
|
||||||
|
}
|
46
sites/epg.iptvx.one/epg.iptvx.one.test.js
Normal file
46
sites/epg.iptvx.one/epg.iptvx.one.test.js
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
const { parser, url } = require('./epg.iptvx.one.config.js')
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
dayjs.extend(utc)
|
||||||
|
dayjs.extend(timezone)
|
||||||
|
|
||||||
|
const date = dayjs.utc('2025-01-13', 'YYYY-MM-DD').startOf('d')
|
||||||
|
const channel = { site_id: '12-omsk', xmltv_id: 'Channel12.ru' }
|
||||||
|
|
||||||
|
it('can generate valid url', () => {
|
||||||
|
expect(url).toBe('https://iptvx.one/epg/epg_noarch.xml.gz')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can parse response', () => {
|
||||||
|
const buffer = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml.gz'))
|
||||||
|
const results = parser({ date, buffer, channel })
|
||||||
|
|
||||||
|
expect(results.length).toBe(29)
|
||||||
|
expect(results[0]).toMatchObject({
|
||||||
|
start: '2025-01-13T00:00:00.000Z',
|
||||||
|
stop: '2025-01-13T00:55:00.000Z',
|
||||||
|
title: 'Акценты недели',
|
||||||
|
description:
|
||||||
|
'Программа расскажет зрителям о том, как развивались самые яркие события недели, поможет расставить акценты над самыми обсуждаемыми новостями. Россия, ток-шоу'
|
||||||
|
})
|
||||||
|
expect(results[28]).toMatchObject({
|
||||||
|
start: '2025-01-13T22:15:00.000Z',
|
||||||
|
stop: '2025-01-14T00:00:00.000Z',
|
||||||
|
title: 'д/с Необыкновенные люди',
|
||||||
|
description:
|
||||||
|
'Герои цикла – врачи, спортсмены, представители творческих профессий, волонтеры и многие-многие другие. Их деятельность связана с жизнью особенных людей. Россия, док. сериал'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can handle empty guide', () => {
|
||||||
|
const result = parser({
|
||||||
|
date,
|
||||||
|
channel,
|
||||||
|
buffer: ''
|
||||||
|
})
|
||||||
|
expect(result).toMatchObject([])
|
||||||
|
})
|
35
sites/epg.iptvx.one/readme.md
Normal file
35
sites/epg.iptvx.one/readme.md
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
# epg.iptvx.one
|
||||||
|
|
||||||
|
https://epg.iptvx.one/
|
||||||
|
|
||||||
|
### Download the guide
|
||||||
|
|
||||||
|
Windows (Command Prompt):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
SET "NODE_OPTIONS=--max-old-space-size=5000" && npm run grab --- --site=epg.iptvx.one
|
||||||
|
```
|
||||||
|
|
||||||
|
Windows (PowerShell):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$env:NODE_OPTIONS="--max-old-space-size=5000"; npm run grab --- --site=epg.iptvx.one
|
||||||
|
```
|
||||||
|
|
||||||
|
Linux and macOS:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
NODE_OPTIONS=--max-old-space-size=5000 npm run grab --- --site=epg.iptvx.one
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update channel list
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run channels:parse --- --config=./sites/epg.iptvx.one/epg.iptvx.one.config.js --output=./sites/epg.iptvx.one/epg.iptvx.one.channels.xml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm test --- epg.iptvx.one
|
||||||
|
```
|
|
@ -4264,6 +4264,11 @@ package-json-from-dist@^1.0.0:
|
||||||
resolved "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz"
|
resolved "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz"
|
||||||
integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==
|
integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==
|
||||||
|
|
||||||
|
pako@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz"
|
||||||
|
integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==
|
||||||
|
|
||||||
parent-module@^1.0.0:
|
parent-module@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz"
|
resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue