mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
[update] add @BellezaEmporium code
This commit is contained in:
parent
f641443a9d
commit
55ab874160
1 changed files with 25 additions and 17 deletions
|
@ -18,14 +18,24 @@ module.exports = {
|
||||||
url: function ({ date, channel }) {
|
url: function ({ date, channel }) {
|
||||||
let [type, ...code] = channel.site_id.split('_')
|
let [type, ...code] = channel.site_id.split('_')
|
||||||
code = code.join('_')
|
code = code.join('_')
|
||||||
console.log(`https://www.skyperfectv.co.jp/program/schedule/${type}/channel:${code}/date:${date.format('YYMMDD')}`)
|
|
||||||
return `https://www.skyperfectv.co.jp/program/schedule/${type}/channel:${code}/date:${date.format('YYMMDD')}`
|
return `https://www.skyperfectv.co.jp/program/schedule/${type}/channel:${code}/date:${date.format('YYMMDD')}`
|
||||||
},
|
},
|
||||||
logo: function ({channel}) {
|
logo: function ({ channel }) {
|
||||||
return `https://www.skyperfectv.co.jp/library/common/img/channel/icon/basic/m_${channel.site_id.toLowerCase()}.gif`
|
return `https://www.skyperfectv.co.jp/library/common/img/channel/icon/basic/m_${channel.site_id.toLowerCase()}.gif`
|
||||||
},
|
},
|
||||||
parser: function ({ content, date }) {
|
// Specific function that permits to gather NSFW channels (needs confirmation)
|
||||||
const $ = cheerio.load(content)
|
async fetchSchedule({ date, channel }) {
|
||||||
|
const url = this.url({ date, channel })
|
||||||
|
const response = await axios.get(url, {
|
||||||
|
headers: {
|
||||||
|
'Cookie': 'adult_auth=true'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return response.data
|
||||||
|
},
|
||||||
|
async parser({ date, channel }) {
|
||||||
|
const sched = await this.fetchSchedule({ date, channel })
|
||||||
|
const $ = cheerio.load(sched)
|
||||||
const programs = []
|
const programs = []
|
||||||
|
|
||||||
const sections = [
|
const sections = [
|
||||||
|
@ -39,26 +49,20 @@ module.exports = {
|
||||||
// `td` is a column for a day
|
// `td` is a column for a day
|
||||||
// the next `td` will be the next day
|
// the next `td` will be the next day
|
||||||
const today = date.add(index + addition, 'd').tz('Asia/Tokyo')
|
const today = date.add(index + addition, 'd').tz('Asia/Tokyo')
|
||||||
|
|
||||||
const parseTime = (timeString) => {
|
const parseTime = (timeString) => {
|
||||||
// timeString is in the format "HH:mm"
|
// timeString is in the format "HH:mm"
|
||||||
// replace `today` with the time from timeString
|
// replace `today` with the time from timeString
|
||||||
const [hour, minute] = timeString.split(':').map(Number)
|
const [hour, minute] = timeString.split(':').map(Number)
|
||||||
return today.hour(hour).minute(minute)
|
return today.hour(hour).minute(minute)
|
||||||
}
|
}
|
||||||
|
|
||||||
const $element = $(element) // Wrap element with Cheerio
|
const $element = $(element) // Wrap element with Cheerio
|
||||||
$element.find('.p-program__item').each((itemIndex, itemElement) => {
|
$element.find('.p-program__item').each((itemIndex, itemElement) => {
|
||||||
const $itemElement = $(itemElement) // Wrap itemElement with Cheerio
|
const $itemElement = $(itemElement) // Wrap itemElement with Cheerio
|
||||||
const [start, stop] = $itemElement.find('.p-program__range').first().text().split('〜').map(parseTime)
|
const [start, stop] = $itemElement.find('.p-program__range').first().text().split('〜').map(parseTime)
|
||||||
const title = $itemElement.find('.p-program__name').first().text()
|
const title = $itemElement.find('.p-program__name').first().text()
|
||||||
const image = $itemElement.find('.js-program_thumbnail').first().attr('data-lazysrc')
|
const image = $itemElement.find('.js-program_thumbnail').first().attr('data-lazysrc')
|
||||||
console.log({
|
|
||||||
title,
|
|
||||||
start,
|
|
||||||
stop,
|
|
||||||
image
|
|
||||||
})
|
|
||||||
programs.push({
|
programs.push({
|
||||||
title,
|
title,
|
||||||
start,
|
start,
|
||||||
|
@ -68,7 +72,7 @@ module.exports = {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
},
|
},
|
||||||
async channels() {
|
async channels() {
|
||||||
|
@ -78,18 +82,22 @@ module.exports = {
|
||||||
|
|
||||||
const $ = cheerio.load(content)
|
const $ = cheerio.load(content)
|
||||||
const channels = []
|
const channels = []
|
||||||
|
|
||||||
$('.p-channel').each((index, element) => {
|
$('.p-channel').each((index, element) => {
|
||||||
const site_id = `${type}_${$(element).find('.p-channel__id').text()}`
|
const site_id = `${type}_${$(element).find('.p-channel__id').text()}`
|
||||||
const name = $(element).find('.p-channel__name').text()
|
const name = $(element).find('.p-channel__name').text()
|
||||||
channels.push({ site_id, name, lang: 'ja' })
|
channels.push({ site_id, name, lang: 'ja' })
|
||||||
})
|
})
|
||||||
|
|
||||||
return channels
|
return channels
|
||||||
}
|
}
|
||||||
|
|
||||||
const getChannels = async (type) => {
|
const getChannels = async (type) => {
|
||||||
const response = await axios.get(`https://www.skyperfectv.co.jp/program/schedule/${type}/`)
|
const response = await axios.get(`https://www.skyperfectv.co.jp/program/schedule/${type}/`, {
|
||||||
|
headers: {
|
||||||
|
'Cookie': 'adult_auth=true;'
|
||||||
|
}
|
||||||
|
})
|
||||||
return pageParser(response.data, type)
|
return pageParser(response.data, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,4 +110,4 @@ module.exports = {
|
||||||
|
|
||||||
return await fetchAllChannels()
|
return await fetchAllChannels()
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue