diff --git a/.gh-pages/guides/programme-tv.net.xml b/.gh-pages/guides/programme-tv.net.xml
new file mode 100644
index 00000000..04f3952c
--- /dev/null
+++ b/.gh-pages/guides/programme-tv.net.xml
@@ -0,0 +1,33 @@
+
+TF1
+Dr HouseSérie hospitalière
+Dr HouseSérie hospitalière
+Programmes de la nuitProgramme indéterminé
+TFouMagazine jeunesse
+MétéoMétéo
+TéléshoppingMagazine de télé-achat
+MétéoMétéo
+Petits secrets en familleSérie réaliste
+Ici tout commenceSérie dramatique
+Demain nous appartientSérie dramatique
+Les feux de l'amourFeuilleton sentimental
+Petits plats en équilibreMagazine de la gastronomie
+Les douze coups de midiJeu
+Petits plats en équilibreMagazine de la gastronomie
+JournalJournal
+Petits plats en équilibreMagazine de la gastronomie
+MétéoMétéo
+Météo des neigesMétéo
+L'ombre d'une mère indigneTéléfilm dramatique
+Ma fille, kidnappée à 4 ansTéléfilm de suspense
+Familles nombreuses : la vie en XXLTéléréalité
+Ici tout commenceSérie dramatique
+Demain nous appartientSérie dramatique
+MétéoMétéo
+JournalJournal
+MétéoMétéo
+C'est CanteloupDivertissement-humour
+Section de recherchesSérie policière
+Section de recherchesSérie policière
+Section de recherchesSérie policière
+
\ No newline at end of file
diff --git a/bin/epg-grabber/index.js b/bin/epg-grabber/index.js
index a2022536..562f0b65 100755
--- a/bin/epg-grabber/index.js
+++ b/bin/epg-grabber/index.js
@@ -71,7 +71,8 @@ async function main() {
.parser({
channel,
content: response.data,
- date
+ date,
+ lang: config.lang || 'en'
})
.filter(p => p)
diff --git a/bin/epg-grabber/utils.js b/bin/epg-grabber/utils.js
index 463f1910..d4976aa5 100644
--- a/bin/epg-grabber/utils.js
+++ b/bin/epg-grabber/utils.js
@@ -83,6 +83,7 @@ utils.parseConfig = function (configPath) {
const userAgent = this.getElementText('user-agent', settings.elements)
const timezone = this.getElementText('timezone', settings.elements)
const cookie = this.getElementText('cookie', settings.elements)
+ const lang = this.getElementText('lang', settings.elements)
const channels = settings.elements
.filter(el => el.name === 'channel')
.map(el => {
@@ -98,7 +99,8 @@ utils.parseConfig = function (configPath) {
userAgent,
timezone,
channels,
- cookie
+ cookie,
+ lang
}
}
diff --git a/package-lock.json b/package-lock.json
index 9ec22576..a2f0e416 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,6 +15,7 @@
"glob": "^7.1.6",
"html-to-text": "^7.0.0",
"jsdom": "^16.5.0",
+ "parse-duration": "^0.4.4",
"tough-cookie": "^4.0.0",
"xml-js": "^1.6.11"
}
@@ -965,6 +966,11 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/parse-duration": {
+ "version": "0.4.4",
+ "resolved": "https://registry.npmjs.org/parse-duration/-/parse-duration-0.4.4.tgz",
+ "integrity": "sha512-KbAJuYGUhZkB9gotDiKLnZ7Z3VTacK3fgwmDdB6ZVDtJbMBT6MfLga0WJaYpPDu0mzqT0NgHtHDt5PY4l0nidg=="
+ },
"node_modules/parse5": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
@@ -2113,6 +2119,11 @@
"word-wrap": "~1.2.3"
}
},
+ "parse-duration": {
+ "version": "0.4.4",
+ "resolved": "https://registry.npmjs.org/parse-duration/-/parse-duration-0.4.4.tgz",
+ "integrity": "sha512-KbAJuYGUhZkB9gotDiKLnZ7Z3VTacK3fgwmDdB6ZVDtJbMBT6MfLga0WJaYpPDu0mzqT0NgHtHDt5PY4l0nidg=="
+ },
"parse5": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
diff --git a/package.json b/package.json
index 75209d2a..898edcb5 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,7 @@
"glob": "^7.1.6",
"html-to-text": "^7.0.0",
"jsdom": "^16.5.0",
+ "parse-duration": "^0.4.4",
"tough-cookie": "^4.0.0",
"xml-js": "^1.6.11"
}
diff --git a/sites/programme-tv.net.config.xml b/sites/programme-tv.net.config.xml
new file mode 100755
index 00000000..a8b489c2
--- /dev/null
+++ b/sites/programme-tv.net.config.xml
@@ -0,0 +1,286 @@
+
+
+
+ ../../.gh-pages/guides/programme-tv.net.xml
+ Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 Edg/79.0.309.71
+ 1
+ fr
+
+ TF1
+
+
+
diff --git a/sites/programme-tv.net.js b/sites/programme-tv.net.js
new file mode 100644
index 00000000..c4270edc
--- /dev/null
+++ b/sites/programme-tv.net.js
@@ -0,0 +1,69 @@
+const jsdom = require('jsdom')
+const { JSDOM } = jsdom
+const dayjs = require('dayjs')
+var customParseFormat = require('dayjs/plugin/customParseFormat')
+var duration = require('dayjs/plugin/duration')
+dayjs.extend(duration)
+dayjs.extend(customParseFormat)
+const { htmlToText } = require('html-to-text')
+var parse = require('parse-duration')
+
+module.exports = {
+ url: function ({ date, channel }) {
+ return `https://www.programme-tv.net/programme/chaine/${date.format('YYYY-MM-DD')}/programme-${
+ channel.site_id
+ }.html`
+ },
+ parser: function ({ channel, content, date, lang }) {
+ // console.log(content)
+ const programs = []
+ const dom = new JSDOM(content)
+ const broadcastCards = dom.window.document.querySelectorAll('.singleBroadcastCard')
+ broadcastCards.forEach(card => {
+ const hour = (
+ card.getElementsByClassName('singleBroadcastCard-hour')[0] || { textContent: '' }
+ ).textContent
+ .toString()
+ .trim()
+ const durationContent = (
+ card.getElementsByClassName('singleBroadcastCard-durationContent')[0] || { textContent: '' }
+ ).textContent
+ .toString()
+ .trim()
+ const title = (
+ card.getElementsByClassName('singleBroadcastCard-title')[0] || { textContent: '' }
+ ).textContent
+ .toString()
+ .trim()
+ const category = (
+ card.getElementsByClassName('singleBroadcastCard-genre')[0] || { textContent: '' }
+ ).textContent
+ .toString()
+ .trim()
+
+ if (hour && title) {
+ const start = dayjs
+ .utc(hour.replace('h', '-'), 'HH-mm')
+ .set('D', date.get('D'))
+ .set('M', date.get('M'))
+ .set('y', date.get('y'))
+
+ const durationInMilliseconds = parse(durationContent)
+ const stop = start.add(dayjs.duration(durationInMilliseconds))
+
+ programs.push({
+ title,
+ lang,
+ category,
+ start: start.toString(),
+ stop: stop.toString(),
+ channel: channel['xmltv_id']
+ })
+ }
+ })
+
+ // console.log(programs)
+
+ return programs
+ }
+}
diff --git a/sites/tv.yandex.ru.config.xml b/sites/tv.yandex.ru.config.xml
index afa46c38..ec7500db 100755
--- a/sites/tv.yandex.ru.config.xml
+++ b/sites/tv.yandex.ru.config.xml
@@ -5,6 +5,7 @@
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 Edg/79.0.309.71
yandexuid=8747786251615498142; Expires=Tue, 11 Mar 2031 21:29:02 GMT; Domain=yandex.ru; Path=/
1
+ ru
1 HD Music Television