\u0425\u0440\u0430\u043d\u0430 \u0438 \u043d\u0430\u043f\u0438\u0442\u043a\u0438<\/a> 1, \u0435\u043f. 1<\/div><\/div><\/div>","lastUpdateUser":0,"meta":{"title":"24Kitchen","keywords":"\u0422\u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0430, 24Kitchen","description":"\u0422\u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0430 \u0437\u0430 24Kitchen \u0437\u0430 Thursday, 12.01.2023","url":"https:\/\/tvprofil.com\/bg\/tv-programa\/#datum=2023-01-12&kanal=24kitchen-bg","image":"https:\/\/cdn-0.tvprofil.com\/cdn\/img\/covers\/img912406-tv3565844.jpg"}}})
\ No newline at end of file
diff --git a/sites/tvprofil.com/__data__/no_content.txt b/sites/tvprofil.com/__data__/no_content.txt
new file mode 100644
index 00000000..332ac9be
--- /dev/null
+++ b/sites/tvprofil.com/__data__/no_content.txt
@@ -0,0 +1 @@
+cb({"redirect":null,"code":502,"message":"Invalid request data. Please reload the page.","description":null,"data":null})
\ No newline at end of file
diff --git a/sites/tvprofil.com/tvprofil.com.channels.xml b/sites/tvprofil.com/tvprofil.com.channels.xml
index a63732dd..c233fac9 100644
--- a/sites/tvprofil.com/tvprofil.com.channels.xml
+++ b/sites/tvprofil.com/tvprofil.com.channels.xml
@@ -2,27 +2,27 @@
24 Kitchen Bulgaria
+ AXN Black
+ AXN Bulgaria
+ AXN White
Action+
Agro TV
Alfa TV
Animal Planet Rossiya
- AXN Black
- AXN Bulgaria
- AXN White
B1B Box
- Barely Legal TV
BG Music Channel
- Bloomberg TV Bulgaria
BNT 1
BNT 2
BNT 3
BNT 4
- Box TV
BTV
BTV Action
BTV Cinema
BTV Comedy
BTV Lady
+ Barely Legal TV
+ Bloomberg TV Bulgaria
+ Box TV
Bulgaria 24
Bulgaria On Air
Cinema+
@@ -34,6 +34,7 @@
Disney Channel Bulgaria
EKids
Evrokom
+ Fuel TV
Fen Folk
Fen TV
FilmBox Stars Adria
@@ -41,7 +42,6 @@
Fox Bulgaria
Fox Crime Adria
Fox Life Bulgaria
- Fuel TV
HBO
Hobby TV
Kino Nova
@@ -62,15 +62,15 @@
Rodina
SKAT
Sport+ HD
+ TV 1
+ TV Evropa
+ TV+
The Voice TV
Tiankov Folk
Travel TV
Travelxp HD Europe
- TV 1
- TV Evropa
- TV+
- Vivacom Arena
VTK
+ Vivacom Arena
Wness TV
XXL
24 Kitchen Srbija
@@ -79,14 +79,21 @@
4 Fun Dance
4 Fun Kids
4 Fun TV
- Agro TV
- Alfa TV
- Aljazeera Balkans
- Aljazeera English
- Alpha TV
- Alsat M
AMC Magyarország
Ant1 Europe
+ ARTE Deutsch
+ ATV
+ ATV
+ ATV Avrupa
+ AXN
+ AXN Central Europe
+ AXN Spin
+ Agro TV
+ Aljazeera Balkans
+ Aljazeera English
+ Alfa TV
+ Alpha TV
+ Alsat M
Apostol TV
Arena4
Arena Esport
@@ -107,31 +114,25 @@
Arena Sport 7 Hrvatska
Arena Sport 8 Hrvatska
Arena Sport 9 Hrvatska
- ARTE Deutsch
- ATV
- ATV
- ATV Avrupa
Aurora TV
- AXN
- AXN Central Europe
- AXN Spin
B1
B92
- Balkanika Music TV
- Balkan Trip
BBC Earth
BBC News
BBC World News Europe
BN Music
BN 2
+ Balkan Trip
+ Balkanika Music TV
Boomerang Central & Eastern Europe
Brainz TV
Brazzers TV
Brio
- Canale 5
CBS Reality Europe
CGTN Documentary
- Cinemania
+ CNN International Europe
+ CNN Türk
+ Canale 5
CineStar TV 1
CineStar TV 1 Srbija
CineStar TV 2
@@ -141,16 +142,17 @@
CineStar TV Fantasy
CineStar TV Premiere 1
CineStar TV Premiere 2
- CNN International Europe
- CNN Türk
+ Cinemania
Comedy Central Family Hungary
Comedy Central Hungary
Cool
Crime + Investigation UK
Çufo
d1 TV
- Das Erste
+ DM Sat
+ DW English
Da Vinci
+ Das Erste
Decija TV
Dexy TV
Digi Animal World
@@ -162,7 +164,6 @@
Discovery Channel Hungary
Discovery Science
Disney Channel Hungary
- DM Sat
DocuBox HD
Doku TV
Doma Hrvatska
@@ -171,16 +172,15 @@
Dr. Fit Channel
Duck TV HD
Dusk
- DW English
E! Europe
+ ETV HD
English Club TV
Epic Drama
Erox HD
Eroxxx HD
Eska TV
- ETV HD
- Eurochannel
Euro D
+ Eurochannel
EuroNews Albania
Eurosport 1
Eurosport 2
@@ -188,11 +188,11 @@
Explorer Natyra
Explorer Shkencë
Extreme Sports Channel
+ FEM3
Face TV
FashionBox HD
FashionTV Europe
Fast & FunBox HD
- FEM3
FightBox HD
Fight Network
Film4
@@ -221,29 +221,29 @@
France 24 Français
France 3
France 5
+ Ginx eSports TV International
Galaxy4
Gametoon
- Ginx eSports TV International
Gold UK
Golica TV
Grand
- Habertürk
- Ha Ha
- Hayat
- Hayat Folk
- Hayat Music
- Hayatovci
- Hayat Plus
HBO Hungary
HGTV UK
- Hír TV
- History 2
HNTV
HRT 1
HRT 2
HRT 3
HRT 4
HRT International
+ Ha Ha
+ Habertürk
+ Hayat
+ Hayat Folk
+ Hayat Music
+ Hayat Plus
+ Hayatovci
+ Hír TV
+ History 2
H!t Music Channel Hungary
IDJ TV
In TV
@@ -254,13 +254,13 @@
Jocky TV
Jugoton TV
K3
+ K CN 1
+ K CN 2
+ K CN 3
Kanal 5
Kanal A
Kanal D
Kazbuka
- K CN 1
- K CN 2
- K CN 3
Kino
Kino TV
Kitchen TV
@@ -278,26 +278,26 @@
Lov i ribolov
M1 Film
M1 Gold
- Mediaset Italia
- Mezzo
- Mezzo Live HD
- Minimax Romania
- Mini TV
- Mozi+
- Moziverzum
MRT 1
MRT 2 Sat
MTV Hungary
MTV Live HD
+ Mediaset Italia
+ Mezzo
+ Mezzo Live HD
+ Mini TV
+ Minimax Romania
+ Mozi+
+ Moziverzum
Muse
Muzsika TV
MyZen TV
N1 Bosna i Hercegovina
N1 Hrvatska
N1 Serbia
+ NBA TV
National Geographic Hungary
National Geographic Wild Hungary
- NBA TV
News 24
Nick Jr Hungary
Nitro Deutschland
@@ -312,9 +312,9 @@
Novosadska TV
OBN
O Kanal
+ Oto
One
Ora News
- Oto
Pax TV
Pickbox TV
Pikaboo
@@ -332,7 +332,6 @@
Pink Kuvar
Pink M
Pink Movies
- Pink n Roll
Pink Pedia
Pink Premium
Pink Romance
@@ -348,13 +347,14 @@
Pink World
Pink World Cinema
Pink Zabava
- Planeta TV
+ Pink n Roll
Planet Earth
Planet TV
+ Planeta TV
Playboy TV Europe
Pop TV
- Power Türk TV
Power TV
+ Power Türk TV
Prime
Private TV
ProSieben
@@ -371,18 +371,6 @@
Puls 4
QVC Style Deutschland
QVC Style UK
- Radio Bremen Fernsehen
- Rai 1
- Rai 2
- Rai 3
- Rai Gulp
- Rai News 24
- Rai Sport
- Rai Storia
- Real Time Italia
- Red TV
- Report TV
- Rete 4
RT News
RT Documentary
RTK 1
@@ -413,10 +401,23 @@
RTV 1
RTV 2
RTV 21 Sat
+ Radio Bremen Fernsehen
+ Rai 1
+ Rai 2
+ Rai 3
+ Rai Gulp
+ Rai News 24
+ Rai Sport
+ Rai Storia
+ Real Time Italia
+ Red TV
+ Report TV
+ Rete 4
Rossiya 24
Sat. 1
Sat. 1 Gold
SBN International
+ STV Folk
Scifi Srbija
Show Turk
Sitel TV
@@ -437,50 +438,23 @@
Sport Klub Esports
Sport Klub Golf
Sport Klub HD
- Sportska TV
Sport TV 1
Sport TV 1
Sport TV 2
Sport TV 2
- Stars TV
+ Sportska TV
Star TV
+ Stars TV
Stinët
Stingray IConcerts
Story4
Studio B
- STV Folk
Super RTL
- Superstar TV
- Super Tennis
Super TV2
+ Super Tennis
+ Superstar TV
TGCom 24
- The Fishing & Hunting Channel
- Tip TV
TLC
- Toggo Plus
- Top Channel
- Top News
- Trace Urban
- Travel Channel
- Tring Action
- Tring Classic
- Tring Comedy
- Tring Family
- Tring Fantasy
- Tring History
- Tring International
- Tring Jolly HD
- Tring Kids
- Tring Life
- Tring Planet
- Tring Shqip
- Tring Sport 1
- Tring Sport 2
- Tring Sport 3
- Tring Sport News
- Tring Super
- Tring Tring
- Tring World
TRT 1
TRT 2
TRT Arabi
@@ -513,13 +487,39 @@
TVN
TVN 24
TV Novi Pazar
- TV Paprika
TVP Polonia
+ TV Paprika
TV Slovenija 1
TV Slovenija 2
TV Slovenija 3
TV Sonce
TV Vijesti
+ The Fishing & Hunting Channel
+ Tip TV
+ Toggo Plus
+ Top Channel
+ Top News
+ Trace Urban
+ Travel Channel
+ Tring Action
+ Tring Classic
+ Tring Comedy
+ Tring Family
+ Tring Fantasy
+ Tring History
+ Tring International
+ Tring Jolly HD
+ Tring Kids
+ Tring Life
+ Tring Planet
+ Tring Shqip
+ Tring Sport 1
+ Tring Sport 2
+ Tring Sport 3
+ Tring Sport News
+ Tring Super
+ Tring Tring
+ Tring World
Ülke TV
Vavoom
Viasat2
diff --git a/sites/tvprofil.com/tvprofil.com.config.js b/sites/tvprofil.com/tvprofil.com.config.js
index 41a4d9f6..d3581236 100644
--- a/sites/tvprofil.com/tvprofil.com.config.js
+++ b/sites/tvprofil.com/tvprofil.com.config.js
@@ -4,7 +4,6 @@ const dayjs = require('dayjs')
module.exports = {
site: 'tvprofil.com',
days: 2,
- skip: true, // NOTE: server is not stable
url: function ({ channel, date }) {
const parts = channel.site_id.split('#')
const query = buildQuery(parts[1], date)
@@ -16,11 +15,9 @@ module.exports = {
'x-requested-with': 'XMLHttpRequest'
}
},
- parser: function ({ content, channel, date }) {
+ parser: function ({ content }) {
let programs = []
- const result = parseContent(content)
- if (!result) return programs
- const items = parseItems(result.data.program)
+ const items = parseItems(content)
items.forEach(item => {
const $item = cheerio.load(item)
const title = parseTitle($item)
@@ -62,18 +59,17 @@ function parseTitle($item) {
return title.replace('®', '').trim().replace(/,$/, '')
}
-function parseItems(program) {
- const $ = cheerio.load(program)
+function parseItems(content) {
+ let data = (content.match(/cb\((.*)\)/) || [null, null])[1]
+ if (!data) return []
+ let json = JSON.parse(data)
+ if (!json || !json.data || !json.data.program) return []
+
+ const $ = cheerio.load(json.data.program)
return $('.row').toArray()
}
-function parseContent(content) {
- let data = (content.match(/cb\((.*)\)/) || [null, null])[1]
-
- return JSON.parse(data)
-}
-
function buildQuery(site_id, date) {
const query = {
datum: date.format('YYYY-MM-DD'),
diff --git a/sites/tvprofil.com/tvprofil.com.test.js b/sites/tvprofil.com/tvprofil.com.test.js
new file mode 100644
index 00000000..1796b7eb
--- /dev/null
+++ b/sites/tvprofil.com/tvprofil.com.test.js
@@ -0,0 +1,49 @@
+// npx epg-grabber --config=sites/tvprofil.com/tvprofil.com.config.js --channels=sites/tvprofil.com/tvprofil.com.channels.xml --output=guide.xml --days=2
+
+const { parser, url, request } = require('./tvprofil.com.config.js')
+const fs = require('fs')
+const path = require('path')
+const dayjs = require('dayjs')
+const utc = require('dayjs/plugin/utc')
+const customParseFormat = require('dayjs/plugin/customParseFormat')
+dayjs.extend(customParseFormat)
+dayjs.extend(utc)
+
+const date = dayjs.utc('2023-01-12', 'YYYY-MM-DD').startOf('d')
+const channel = {
+ site_id: 'bg/tv-programa#24kitchen-bg',
+ xmltv_id: '24KitchenBulgaria.bg'
+}
+
+it('can generate valid url', () => {
+ expect(url({ channel, date })).toBe(
+ `https://tvprofil.com/bg/tv-programa/program/?datum=2023-01-12&kanal=24kitchen-bg&callback=cb&b55=747917`
+ )
+})
+
+it('can generate valid request headers', () => {
+ expect(request.headers).toMatchObject({
+ 'x-requested-with': 'XMLHttpRequest'
+ })
+})
+
+it('can parse response', () => {
+ const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.txt'), 'utf8')
+ const results = parser({ content }).map(p => {
+ p.start = p.start.toJSON()
+ p.stop = p.stop.toJSON()
+ return p
+ })
+
+ expect(results[0]).toMatchObject({
+ title: 'Мексиканска кухня с Пати 10, еп. 9',
+ start: '2023-01-12T04:00:00.000Z',
+ stop: '2023-01-12T04:30:00.000Z'
+ })
+})
+
+it('can handle empty guide', () => {
+ const content = fs.readFileSync(path.resolve(__dirname, '__data__/no_content.txt'), 'utf8')
+
+ expect(parser({ content })).toMatchObject([])
+})