mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Merge pull request #2468 from Mauricio300808/master
Adding headers to tvtv.us
This commit is contained in:
commit
78dad4cfb4
2 changed files with 20 additions and 4 deletions
|
@ -11,5 +11,5 @@ npm run grab -- --site=tvtv.us
|
||||||
### Test
|
### Test
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm test -- tvprofil.com
|
npm test -- tvtv.us
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
@ -8,17 +8,33 @@ module.exports = {
|
||||||
delay: 1500, // 1500 ms (otherwise the server returns error 429: https://github.com/iptv-org/epg/issues/2176)
|
delay: 1500, // 1500 ms (otherwise the server returns error 429: https://github.com/iptv-org/epg/issues/2176)
|
||||||
days: 2,
|
days: 2,
|
||||||
url: function ({ date, channel }) {
|
url: function ({ date, channel }) {
|
||||||
|
if (!dayjs.isDayjs(date)) {
|
||||||
|
throw new Error('Invalid date object passed to url function')
|
||||||
|
}
|
||||||
|
|
||||||
return `https://www.tvtv.us/api/v1/lineup/USA-NY71652-X/grid/${date.toJSON()}/${date
|
return `https://www.tvtv.us/api/v1/lineup/USA-NY71652-X/grid/${date.toJSON()}/${date
|
||||||
.add(1, 'd')
|
.add(1, 'day')
|
||||||
.toJSON()}/${channel.site_id}`
|
.toJSON()}/${channel.site_id}`
|
||||||
},
|
},
|
||||||
|
request: {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
Accept: '*/*',
|
||||||
|
Connection: 'keep-alive',
|
||||||
|
'User-Agent':
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
|
||||||
|
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
|
||||||
|
'sec-ch-ua-mobile': '?0',
|
||||||
|
'sec-ch-ua-platform': '"Windows"'
|
||||||
|
}
|
||||||
|
},
|
||||||
parser: function ({ content }) {
|
parser: function ({ content }) {
|
||||||
let programs = []
|
let programs = []
|
||||||
|
|
||||||
const items = parseItems(content)
|
const items = parseItems(content)
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
const start = dayjs.utc(item.startTime)
|
const start = dayjs.utc(item.startTime)
|
||||||
const stop = start.add(item.runTime, 'm')
|
const stop = start.add(item.runTime, 'minute')
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.title,
|
title: item.title,
|
||||||
description: item.subtitle,
|
description: item.subtitle,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue