Update tvprofil.com

This commit is contained in:
freearhey 2023-12-01 23:16:00 +03:00
parent 3b3a858e8e
commit 08085f4808
4 changed files with 5928 additions and 572 deletions

View file

@ -0,0 +1,21 @@
# tvprofil.com
https://tvprofil.com/tvprogram/
### Download the guide
```sh
npm run grab -- --channels=sites/tvprofil.com/tvprofil.com.channels.xml
```
### Update channel list
```sh
npm run channels:parse -- --config=./sites/tvprofil.com/tvprofil.com.config.js --output=./sites/tvprofil.com/tvprofil.com.channels.xml
```
### Test
```sh
npm test -- tvprofil.com
```

File diff suppressed because it is too large Load diff

View file

@ -31,6 +31,73 @@ module.exports = {
})
return programs
},
async channels() {
const axios = require('axios')
// prettier-ignore
const countries = {
al: { channelsPath: '/al', progsPath: 'al/programacioni', lang: 'sq' },
at: { channelsPath: '/at', progsPath: 'at/tvprogramm', lang: 'de' },
ba: { channelsPath: '/ba', progsPath: 'ba/tvprogram', lang: 'bs' },
bg: { channelsPath: '/bg', progsPath: 'bg/tv-programa', lang: 'bg' },
ch: { channelsPath: '/ch', progsPath: 'ch/tv-programm', lang: 'de' },
de: { channelsPath: '/de', progsPath: 'de/tvprogramm', lang: 'de' },
es: { channelsPath: '/es', progsPath: 'es/programacion-tv', lang: 'es' },
fr: { channelsPath: '/fr', progsPath: 'fr/programme-tv', lang: 'fr' },
hr: { channelsPath: '', progsPath: 'tvprogram', lang: 'hr' },
hu: { channelsPath: '/hu', progsPath: 'hu/tvmusor', lang: 'hu' },
ie: { channelsPath: '/ie', progsPath: 'ie/tvschedule', lang: 'en' },
it: { channelsPath: '/it', progsPath: 'it/guida-tv', lang: 'it' },
ks: { channelsPath: '/ks', progsPath: 'ks/programacioni', lang: 'al' },
me: { channelsPath: '/me', progsPath: 'me/tvprogram', lang: 'en' },
mk: { channelsPath: '/mk', progsPath: 'mk/tv-raspored', lang: 'mk' },
pl: { channelsPath: '/pl', progsPath: 'pl/program', lang: 'pl' },
pt: { channelsPath: '/pt', progsPath: 'pt/programacao', lang: 'pt' },
ro: { channelsPath: '/ro', progsPath: 'ro/program-tv', lang: 'ro' },
rs: { channelsPath: '/rs', progsPath: 'rs/tvprogram', lang: 'sr' },
si: { channelsPath: '/si', progsPath: 'si/tvspored', lang: 'sl' },
tr: { channelsPath: '/tr', progsPath: 'tr/tv-rehberi', lang: 'tr' },
uk: { channelsPath: '/gb', progsPath: 'gb/tvschedule', lang: 'en' },
}
let channels = []
for (let country in countries) {
const config = countries[country]
const lang = config.lang
const url = `https://tvprofil.com${config.channelsPath}/channels/getChannels/`
console.log(url)
const cb = await axios
.get(url, {
params: {
callback: 'cb'
}
})
.then(r => r.data)
.catch(err => {
console.error(err.message)
})
if (!cb) continue
const [, json] = cb.match(/^cb\((.*)\)$/i)
const data = JSON.parse(json)
data.data.forEach(group => {
group.channels.forEach(item => {
channels.push({
lang,
site_id: `${config.progsPath}#${item.urlID}`,
name: item.title
})
})
})
}
return channels
}
}
@ -90,7 +157,7 @@ function buildQuery(site_id, date) {
}
b = b.toString()
const key = 'b' + b.charCodeAt(b.length-1)
const key = 'b' + b.charCodeAt(b.length - 1)
query[key] = b

View file

@ -1,5 +1,3 @@
// npm run grab -- --site=tvprofil.com
const { parser, url, request } = require('./tvprofil.com.config.js')
const fs = require('fs')
const path = require('path')