mirror of
https://github.com/iptv-org/epg
synced 2025-12-18 03:16:53 -05:00
Update musor.tv selectors
This commit is contained in:
@@ -3,6 +3,7 @@ const axios = require('axios')
|
|||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
|
const uniqBy = require('lodash.uniqby')
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
@@ -49,38 +50,42 @@ module.exports = {
|
|||||||
|
|
||||||
const $ = cheerio.load(html)
|
const $ = cheerio.load(html)
|
||||||
const channels = $('body > div.big_content > div > nav > table > tbody > tr > td > a').toArray()
|
const channels = $('body > div.big_content > div > nav > table > tbody > tr > td > a').toArray()
|
||||||
return channels
|
|
||||||
.map(item => {
|
return uniqBy(
|
||||||
const $item = $(item)
|
channels
|
||||||
const url = $item.attr('href')
|
.map(item => {
|
||||||
if (!url.startsWith('//musor.tv/mai/tvmusor/')) return null
|
const $item = $(item)
|
||||||
const site_id = url.replace('//musor.tv/mai/tvmusor/', '')
|
const url = $item.attr('href')
|
||||||
return {
|
if (!url.startsWith('//musor.tv/mai/tvmusor/')) return null
|
||||||
lang: 'hu',
|
const site_id = url.replace('//musor.tv/mai/tvmusor/', '')
|
||||||
site_id,
|
return {
|
||||||
name: $item.text()
|
lang: 'hu',
|
||||||
}
|
site_id,
|
||||||
})
|
name: $item.text()
|
||||||
.filter(i => i)
|
}
|
||||||
|
})
|
||||||
|
.filter(i => i),
|
||||||
|
'site_id'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseImage($item) {
|
function parseImage($item) {
|
||||||
const imgSrc = $item.find('div.smartpe_screenshot > img').attr('src')
|
const imgSrc = $item.find('div.progentry_screenshot > img').attr('src')
|
||||||
|
|
||||||
return imgSrc ? `https:${imgSrc}` : null
|
return imgSrc ? `https:${imgSrc}` : null
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseTitle($item) {
|
function parseTitle($item) {
|
||||||
return $item.find('div:nth-child(2) > div > h3 > a').text().trim()
|
return $item.find('h3 > a').text().trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseDescription($item) {
|
function parseDescription($item) {
|
||||||
return $item.find('div:nth-child(5) > div > div').text().trim()
|
return $item.find('div.progentrylong').text().trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStart($item) {
|
function parseStart($item) {
|
||||||
let datetime = $item.find('div:nth-child(1) > div > div > div > div > time').attr('content')
|
let datetime = $item.find('time').attr('content')
|
||||||
if (!datetime) return null
|
if (!datetime) return null
|
||||||
|
|
||||||
return dayjs.utc(datetime.replace('GMT', 'T'), 'YYYY-MM-DDTHH:mm:ss')
|
return dayjs.utc(datetime.replace('GMT', 'T'), 'YYYY-MM-DDTHH:mm:ss')
|
||||||
@@ -89,5 +94,5 @@ function parseStart($item) {
|
|||||||
function parseItems(content) {
|
function parseItems(content) {
|
||||||
const $ = cheerio.load(content)
|
const $ = cheerio.load(content)
|
||||||
|
|
||||||
return [$, $('div.multicolumndayprogarea > div.smartpe_progentry').toArray()]
|
return [$, $('div.progarea > div.progentry > div.progentry_internal').toArray()]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user