mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 18:37:01 -05:00
Merge pull request #85 from iptv-org/update-elcinema-com-config-js
Update elcinema.com.config.js
This commit is contained in:
@@ -26,7 +26,7 @@ module.exports = {
|
||||
parser({ content, date }) {
|
||||
const programs = []
|
||||
|
||||
const items = parseItems(content)
|
||||
const items = parseItems(content, date)
|
||||
items.forEach(item => {
|
||||
const title = parseTitle(item)
|
||||
const description = parseDescription(item)
|
||||
@@ -122,8 +122,10 @@ function parseDescription(item) {
|
||||
return excerpt.replace('...اقرأ المزيد', '') + desc
|
||||
}
|
||||
|
||||
function parseItems(content) {
|
||||
function parseItems(content, date) {
|
||||
const dom = new JSDOM(content)
|
||||
const diff = date.diff(dayjs().startOf('d'), 'd')
|
||||
const listNum = (diff + 1) * 2
|
||||
|
||||
return dom.window.document.querySelectorAll('.tvgrid > div:nth-child(2) > .padded-half')
|
||||
return dom.window.document.querySelectorAll(`.tvgrid > div:nth-child(${listNum}) > .padded-half`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user