From 6ce6e2d44bbd3b65692b924e55de2884fb2255db Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 13 Jan 2022 20:19:09 +0300 Subject: [PATCH] Fix osn.com --- sites/osn.com/osn.com.config.js | 4 ++++ sites/osn.com/osn.com.test.js | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sites/osn.com/osn.com.config.js b/sites/osn.com/osn.com.config.js index 28c68b45..908b149f 100644 --- a/sites/osn.com/osn.com.config.js +++ b/sites/osn.com/osn.com.config.js @@ -9,6 +9,10 @@ module.exports = { site: 'osn.com', request: { method: 'POST', + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + Referer: 'https://www.osn.com' + }, data({ channel, date }) { const [selectedCountry, channelCode] = channel.site_id.split('#') return { diff --git a/sites/osn.com/osn.com.test.js b/sites/osn.com/osn.com.test.js index b0e2cce9..12a667b7 100644 --- a/sites/osn.com/osn.com.test.js +++ b/sites/osn.com/osn.com.test.js @@ -1,4 +1,4 @@ -// NODE_OPTIONS=--insecure-http-parser npx epg-grabber --config=sites/osn.com/osn.com.config.js --channels=sites/osn.com/osn.com_ae.channels.xml --days=2 --output=guide.xml +// NODE_OPTIONS=--insecure-http-parser npx epg-grabber --config=sites/osn.com/osn.com.config.js --channels=sites/osn.com/osn.com_ae.channels.xml --output=guide.xml --days=2 const { parser, url, logo, request } = require('./osn.com.config.js') const dayjs = require('dayjs') @@ -24,6 +24,14 @@ it('can generate valid request data', () => { }) }) +it('can generate valid request headers', () => { + const result = request.headers + expect(result).toMatchObject({ + 'Content-Type': 'application/json; charset=UTF-8', + Referer: 'https://www.osn.com' + }) +}) + it('can generate valid url', () => { const result = url() expect(result).toBe(