Replaces icon with image

This commit is contained in:
freearhey
2024-06-24 16:49:35 +03:00
parent 0eaff54a31
commit bb6771f539
170 changed files with 428 additions and 351 deletions

View File

@@ -10,15 +10,20 @@ const headers = {
'X-Core-Contentratinglimit': '0',
'X-Core-Deviceid': '',
'X-Core-Devicetype': 'web',
'Origin': 'https://nostv.pt',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
Origin: 'https://nostv.pt',
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
}
module.exports = {
site: 'nostv.pt',
days: 2,
url({ channel, date }) {
return `https://tyr-prod.apigee.net/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']}`
return `https://tyr-prod.apigee.net/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']}`
},
request: { headers },
parser({ content }) {
@@ -32,9 +37,9 @@ module.exports = {
description: item.Metadata?.Description,
season: item.Metadata?.Season,
episode: item.Metadata?.Episode,
icon: item.Images ?
`https://mage.stream.nos.pt/v1/nostv_mage/Images?sourceUri=${item.Images[0].Url}&profile=ott_1_452x340&client_id=${headers['X-Apikey']}` :
null,
image: item.Images
? `https://mage.stream.nos.pt/v1/nostv_mage/Images?sourceUri=${item.Images[0].Url}&profile=ott_1_452x340&client_id=${headers['X-Apikey']}`
: null,
start: dayjs.utc(item.UtcDateTimeStart),
stop: dayjs.utc(item.UtcDateTimeEnd)
})
@@ -45,7 +50,10 @@ module.exports = {
},
async channels() {
const result = await axios
.get(`https://tyr-prod.apigee.net/nostv/ott/channels/guest?client_id=${headers['X-Apikey']}`, { headers })
.get(
`https://tyr-prod.apigee.net/nostv/ott/channels/guest?client_id=${headers['X-Apikey']}`,
{ headers }
)
.then(r => r.data)
.catch(console.error)

View File

@@ -22,12 +22,11 @@ it('can generate valid url', () => {
it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/data.json'))
const results = parser({ content })
.map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
const results = parser({ content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results[0]).toMatchObject({
start: '2023-12-11T16:30:00.000Z',
@@ -37,7 +36,8 @@ it('can parse response', () => {
'A história de dois melhores amigos veterinários e o seu extraordinário trabalho na Austrália.',
season: 1,
episode: 12,
icon: 'https://mage.stream.nos.pt/v1/nostv_mage/Images?sourceUri=http://vip.pam.local.internal/PAM.Images/Store/8329ed1aec5d4c0faa2056972256ff9f&profile=ott_1_452x340&client_id=xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI'
image:
'https://mage.stream.nos.pt/v1/nostv_mage/Images?sourceUri=http://vip.pam.local.internal/PAM.Images/Store/8329ed1aec5d4c0faa2056972256ff9f&profile=ott_1_452x340&client_id=xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI'
})
})