Update Init

This commit is contained in:
CyberPoison
2026-01-24 03:31:40 +01:00
parent 57a82236f5
commit 4434f6f5a3
3 changed files with 98 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@@ -5,24 +5,33 @@ const utc = require('dayjs/plugin/utc')
dayjs.extend(utc) dayjs.extend(utc)
const headers = { const headers = {
'X-Apikey': 'xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI', 'accept': 'application/json, text/plain, */*',
'X-Core-Appversion': '2.20.0.3', 'accept-language': 'fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6,cs;q=0.5',
'X-Core-Contentratinglimit': '0', 'cache-control': 'no-cache',
'X-Core-Deviceid': '', 'origin': 'https://nostv.pt',
'X-Core-Devicetype': 'web', 'pragma': 'no-cache',
Origin: 'https://nostv.pt', 'priority': 'u=1, i',
'User-Agent': 'referer': 'https://nostv.pt/',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' 'sec-ch-ua': '"Not(A:Brand";v="8", "Chromium";v="144", "Google Chrome";v="144"',
'sec-ch-ua-mobile': '?1',
'sec-ch-ua-platform': '"Android"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36',
'x-apikey': 'xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI',
'x-core-appversion': '2.20.2.2',
'x-core-contentratinglimit': '0',
'x-core-deviceid': '',
'x-core-devicetype': 'web',
'x-core-timezoneoffset': '3600000'
} }
module.exports = { module.exports = {
site: 'nostv.pt', site: 'nostv.pt',
days: 2, days: 2,
url({ channel, date }) { url({ channel, date }) {
return `https://api.clg.nos.pt/nostv/ott/schedule/range/contents/guest?channels=${channel.site_id return `https://api.clg.nos.pt/nostv/ott/schedule/range/contents/guest?channels=${channel.site_id}&minDate=${date.format('YYYY-MM-DD')}T00:00:00Z&maxDate=${date.format('YYYY-MM-DD')}T23:59:59Z&isDateInclusive=true&client_id=${headers['x-apikey']}`
}&minDate=${date.format('YYYY-MM-DD')}T00:00:00Z&maxDate=${date.format(
'YYYY-MM-DD'
)}T23:59:59Z&isDateInclusive=true&client_id=${headers['X-Apikey']}`
}, },
request: { headers }, request: { headers },
parser({ content }) { parser({ content }) {
@@ -31,7 +40,7 @@ module.exports = {
const items = Array.isArray(content) ? content : JSON.parse(content) const items = Array.isArray(content) ? content : JSON.parse(content)
items.forEach(item => { items.forEach(item => {
const image = item.Images const image = item.Images
? `https://mage.stream.nos.pt/mage/v1/Images?sourceUri=${item.Images[0].Url}&profile=ott_1_452x340&client_id=${headers['X-Apikey']}` ? `https://mage.stream.nos.pt/mage/v1/Images?sourceUri=${item.Images[0].Url}&profile=ott_1_452x340&client_id=${headers['x-apikey']}`
: null : null
programs.push({ programs.push({
title: item.Metadata?.Title, title: item.Metadata?.Title,
@@ -54,7 +63,7 @@ module.exports = {
async channels() { async channels() {
const result = await axios const result = await axios
.get( .get(
`https://api.clg.nos.pt/nostv/ott/channels/guest?client_id=${headers['X-Apikey']}`, `https://api.clg.nos.pt/nostv/ott/channels/guest?client_id=${headers['x-apikey']}`,
{ headers } { headers }
) )
.then(r => r.data) .then(r => r.data)

View File

@@ -28,20 +28,17 @@ it('can parse response', () => {
return p return p
}) })
const image = 'https://mage.stream.nos.pt/mage/v1/Images?sourceUri=http://vip.pam.local.internal/PAM.Images/Store/8329ed1aec5d4c0faa2056972256ff9f&profile=ott_1_452x340&client_id=xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI'
expect(results[0]).toMatchObject({ expect(results[0]).toMatchObject({
start: '2023-12-11T16:30:00.000Z', start: '2026-01-23T22:39:00.000Z',
stop: '2023-12-11T17:00:00.000Z', stop: '2026-01-24T00:23:00.000Z',
title: 'Village Vets', title: 'Em Casa d\'Amália',
description: description: 'Que mais poderíamos pedir para o regresso deste programa, do que receber um dos poetas de Amália? Manuel Alegre, autor do icónico "Trova do Vento que Passa", estará connosco. A este raro momento, juntam-se também ilustres convidados: Paulo de Carvalho e o seu filho Agir, Rita Guerra e André Amaro...',
'A história de dois melhores amigos veterinários e o seu extraordinário trabalho na Austrália.', season: 9,
season: 1, episode: 15,
episode: 12,
icon: { icon: {
src: image src: 'https://mage.stream.nos.pt/mage/v1/Images?sourceUri=http://vip.pam.local.internal/PAM.Images/Store/901d96a8f1534749b076212c296d821e&profile=ott_1_452x340&client_id=xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI'
}, },
image image: 'https://mage.stream.nos.pt/mage/v1/Images?sourceUri=http://vip.pam.local.internal/PAM.Images/Store/901d96a8f1534749b076212c296d821e&profile=ott_1_452x340&client_id=xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI'
}) })
}) })