Skip to content

Commit 78dad4c

Browse files
Merge pull request #2468 from Mauricio300808/master
Adding headers to tvtv.us
2 parents b311572 + 61b202e commit 78dad4c

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

sites/tvtv.us/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ npm run grab -- --site=tvtv.us
1111
### Test
1212

1313
```sh
14-
npm test -- tvprofil.com
14+
npm test -- tvtv.us
1515
```

sites/tvtv.us/tvtv.us.config.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const dayjs = require('dayjs')
1+
const dayjs = require('dayjs')
22
const utc = require('dayjs/plugin/utc')
33

44
dayjs.extend(utc)
@@ -8,17 +8,33 @@ module.exports = {
88
delay: 1500, // 1500 ms (otherwise the server returns error 429: https://github.com/iptv-org/epg/issues/2176)
99
days: 2,
1010
url: function ({ date, channel }) {
11+
if (!dayjs.isDayjs(date)) {
12+
throw new Error('Invalid date object passed to url function')
13+
}
14+
1115
return `https://www.tvtv.us/api/v1/lineup/USA-NY71652-X/grid/${date.toJSON()}/${date
12-
.add(1, 'd')
16+
.add(1, 'day')
1317
.toJSON()}/${channel.site_id}`
1418
},
19+
request: {
20+
method: 'GET',
21+
headers: {
22+
Accept: '*/*',
23+
Connection: 'keep-alive',
24+
'User-Agent':
25+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
26+
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
27+
'sec-ch-ua-mobile': '?0',
28+
'sec-ch-ua-platform': '"Windows"'
29+
}
30+
},
1531
parser: function ({ content }) {
1632
let programs = []
1733

1834
const items = parseItems(content)
1935
items.forEach(item => {
2036
const start = dayjs.utc(item.startTime)
21-
const stop = start.add(item.runTime, 'm')
37+
const stop = start.add(item.runTime, 'minute')
2238
programs.push({
2339
title: item.title,
2440
description: item.subtitle,

0 commit comments

Comments
 (0)