LF to CRLF

This commit is contained in:
freearhey
2025-09-28 13:06:13 +03:00
parent 5b93a92136
commit ab42da3b0b
17 changed files with 5084 additions and 5056 deletions

View File

@@ -10,7 +10,8 @@ module.exports = {
}, },
request: { request: {
headers: { headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36' 'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36'
} }
}, },
parser({ content, date }) { parser({ content, date }) {
@@ -39,7 +40,12 @@ module.exports = {
}, },
async channels() { async channels() {
const html = await axios const html = await axios
.get('https://www.awilime.com/tv/napi_musor', { headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36' } }) .get('https://www.awilime.com/tv/napi_musor', {
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36'
}
})
.then(r => r.data) .then(r => r.data)
.catch(console.log) .catch(console.log)
const $ = cheerio.load(html) const $ = cheerio.load(html)

View File

@@ -73,7 +73,8 @@ module.exports = {
let channels = [] let channels = []
const cookies = await axios.get('https://www.directv.com.ar/guia/guia.aspx', { const cookies = await axios.get('https://www.directv.com.ar/guia/guia.aspx', {
headers: { headers: {
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8', Accept:
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br, zstd', 'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'es-419,es;q=0.9', 'Accept-Language': 'es-419,es;q=0.9',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
@@ -87,56 +88,62 @@ module.exports = {
'Sec-Fetch-User': '?1', 'Sec-Fetch-User': '?1',
'Sec-GPC': 1, 'Sec-GPC': 1,
'Upgrade-Insecure-Requests': 1, 'Upgrade-Insecure-Requests': 1,
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36', 'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
'sec-ch-ua': '"Not;A=Brand";v="99", "Brave";v="139", "Chromium";v="139"', 'sec-ch-ua': '"Not;A=Brand";v="99", "Brave";v="139", "Chromium";v="139"',
'sec-ch-ua-mobile': '?0', 'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"' 'sec-ch-ua-platform': '"Windows"'
}}) }
const cookieHeader = cookies.headers['set-cookie'].map(cookie => cookie.split(';')[0]).join('; ') })
const cookieHeader = cookies.headers['set-cookie']
.map(cookie => cookie.split(';')[0])
.join('; ')
const date = dayjs().tz('America/Argentina/Buenos_Aires') const date = dayjs().tz('America/Argentina/Buenos_Aires')
const response = await axios.post( const response = await axios
'https://www.directv.com.ar/guia/guia.aspx/GetProgramming', .post(
{ 'https://www.directv.com.ar/guia/guia.aspx/GetProgramming',
filterParam: { {
day: date.date(), filterParam: {
time: date.hour(), day: date.date(),
minute: 0, time: date.hour(),
month: date.month() + 1, minute: 0,
year: date.year(), month: date.month() + 1,
offSetValue: 0, year: date.year(),
homeScreenFilter: '', offSetValue: 0,
filtersScreenFilters: [''], homeScreenFilter: '',
isHd: '' filtersScreenFilters: [''],
isHd: ''
}
},
{
headers: {
Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'es-419,es;q=0.9',
'Cache-Control': 'no-cache',
Connection: 'keep-alive',
'Content-Type': 'application/json; charset=UTF-8',
Cookie: cookieHeader,
Host: 'www.directv.com.ar',
Origin: 'https://www.directv.com.ar',
Pragma: 'no-cache',
Referer: 'https://www.directv.com.ar/guia/guia.aspx',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'Sec-GPC': 1,
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest',
'sec-ch-ua': '"Not;A=Brand";v="99", "Brave";v="139", "Chromium";v="139"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
uzlc: true
}
} }
}, )
{
headers: {
Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'es-419,es;q=0.9',
'Cache-Control': 'no-cache',
Connection: 'keep-alive',
'Content-Type': 'application/json; charset=UTF-8',
Cookie: cookieHeader,
Host: 'www.directv.com.ar',
Origin: 'https://www.directv.com.ar',
Pragma: 'no-cache',
Referer: 'https://www.directv.com.ar/guia/guia.aspx',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'Sec-GPC': 1,
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest',
'sec-ch-ua': '"Not;A=Brand";v="99", "Brave";v="139", "Chromium";v="139"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'uzlc': true,
}
}
)
.then(r => r.data) .then(r => r.data)
.catch(console.log) .catch(console.log)

View File

@@ -58,7 +58,8 @@ module.exports = {
let channels = [] let channels = []
const cookies = await axios.get('https://www.directv.com.uy/guia/guia.aspx', { const cookies = await axios.get('https://www.directv.com.uy/guia/guia.aspx', {
headers: { headers: {
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8', Accept:
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br, zstd', 'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'es-419,es;q=0.9', 'Accept-Language': 'es-419,es;q=0.9',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
@@ -72,56 +73,62 @@ module.exports = {
'Sec-Fetch-User': '?1', 'Sec-Fetch-User': '?1',
'Sec-GPC': 1, 'Sec-GPC': 1,
'Upgrade-Insecure-Requests': 1, 'Upgrade-Insecure-Requests': 1,
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36', 'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
'sec-ch-ua': '"Not;A=Brand";v="99", "Brave";v="139", "Chromium";v="139"', 'sec-ch-ua': '"Not;A=Brand";v="99", "Brave";v="139", "Chromium";v="139"',
'sec-ch-ua-mobile': '?0', 'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"' 'sec-ch-ua-platform': '"Windows"'
}}) }
const cookieHeader = cookies.headers['set-cookie'].map(cookie => cookie.split(';')[0]).join('; ') })
const cookieHeader = cookies.headers['set-cookie']
.map(cookie => cookie.split(';')[0])
.join('; ')
const date = dayjs().tz('America/Montevideo') const date = dayjs().tz('America/Montevideo')
const response = await axios.post( const response = await axios
'https://www.directv.com.uy/guia/guia.aspx/GetProgramming', .post(
{ 'https://www.directv.com.uy/guia/guia.aspx/GetProgramming',
filterParam: { {
day: date.date(), filterParam: {
time: date.hour(), day: date.date(),
minute: 0, time: date.hour(),
month: date.month() + 1, minute: 0,
year: date.year(), month: date.month() + 1,
offSetValue: 0, year: date.year(),
homeScreenFilter: '', offSetValue: 0,
filtersScreenFilters: [''], homeScreenFilter: '',
isHd: '' filtersScreenFilters: [''],
isHd: ''
}
},
{
headers: {
Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'es-419,es;q=0.9',
'Cache-Control': 'no-cache',
Connection: 'keep-alive',
'Content-Type': 'application/json; charset=UTF-8',
Cookie: cookieHeader,
Host: 'www.directv.com.ar',
Origin: 'https://www.directv.com.uy',
Pragma: 'no-cache',
Referer: 'https://www.directv.com.uy/guia/guia.aspx',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'Sec-GPC': 1,
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest',
'sec-ch-ua': '"Not;A=Brand";v="99", "Brave";v="139", "Chromium";v="139"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
uzlc: true
}
} }
}, )
{
headers: {
Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'es-419,es;q=0.9',
'Cache-Control': 'no-cache',
Connection: 'keep-alive',
'Content-Type': 'application/json; charset=UTF-8',
Cookie: cookieHeader,
Host: 'www.directv.com.ar',
Origin: 'https://www.directv.com.uy',
Pragma: 'no-cache',
Referer: 'https://www.directv.com.uy/guia/guia.aspx',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'Sec-GPC': 1,
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest',
'sec-ch-ua': '"Not;A=Brand";v="99", "Brave";v="139", "Chromium";v="139"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'uzlc': true,
}
}
)
.then(r => r.data) .then(r => r.data)
.catch(console.log) .catch(console.log)

View File

@@ -151,7 +151,8 @@ async function fetchToken() {
'sec-fetch-site': 'same-origin', 'sec-fetch-site': 'same-origin',
'x-requested-with': 'XMLHttpRequest', 'x-requested-with': 'XMLHttpRequest',
Referer: 'https://www.dishtv.in/channel-guide.html', Referer: 'https://www.dishtv.in/channel-guide.html',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' 'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
} }
}) })
.then(r => r.data) .then(r => r.data)

View File

@@ -22,7 +22,8 @@ axios.post.mockImplementation((url, data, params) => {
'sec-fetch-site': 'same-origin', 'sec-fetch-site': 'same-origin',
'x-requested-with': 'XMLHttpRequest', 'x-requested-with': 'XMLHttpRequest',
Referer: 'https://www.dishtv.in/channel-guide.html', Referer: 'https://www.dishtv.in/channel-guide.html',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' 'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
} }
}) })
) { ) {

View File

@@ -11,7 +11,8 @@ dayjs.extend(utc)
const headers = { const headers = {
'User-Agent': 'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 OPR/115.0.0.0' } 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 OPR/115.0.0.0'
}
module.exports = { module.exports = {
site: 'elcinema.com', site: 'elcinema.com',

View File

@@ -27,7 +27,10 @@ module.exports = {
const data = await axios const data = await axios
.get('https://epg.112114.xyz/pp.xml') .get('https://epg.112114.xyz/pp.xml')
.then(r => r.data) .then(r => r.data)
.catch(e => { console.log(e); return null }) .catch(e => {
console.log(e)
return null
})
if (!data) return [] if (!data) return []
const { channels = [] } = parser.parse(data) const { channels = [] } = parser.parse(data)

View File

@@ -18,20 +18,22 @@ module.exports = {
)}&toTime=${date )}&toTime=${date
.add(1, 'days') .add(1, 'days')
.subtract(1, 's') .subtract(1, 's')
.format('YYYY-MM-DDTHH:mm:ss-00:00')}&communityId=${communityId}&languageId=${languageId}&cid=${channel.site_id}` .format(
'YYYY-MM-DDTHH:mm:ss-00:00'
)}&communityId=${communityId}&languageId=${languageId}&cid=${channel.site_id}`
}, },
request: { request: {
async headers({ country } = {}) { async headers({ country } = {}) {
if (!session) { if (!session) {
session = await loadSessionDetails() session = await loadSessionDetails()
if (!session || !session.access_token) return null if (!session || !session.access_token) return null
} }
const referer = country === 'me' ? 'https://epg.telemach.me/' : 'https://epg.telemach.ba/' const referer = country === 'me' ? 'https://epg.telemach.me/' : 'https://epg.telemach.ba/'
return { return {
Authorization: `Bearer ${session.access_token}`, Authorization: `Bearer ${session.access_token}`,
Referer: referer Referer: referer
} }
} }
}, },
@@ -94,7 +96,8 @@ module.exports = {
.sort((a, b) => { .sort((a, b) => {
const ai = Number(a.site_id) const ai = Number(a.site_id)
const bi = Number(b.site_id) const bi = Number(b.site_id)
if (!Number.isFinite(ai) || !Number.isFinite(bi)) return String(a.site_id).localeCompare(String(b.site_id)) if (!Number.isFinite(ai) || !Number.isFinite(bi))
return String(a.site_id).localeCompare(String(b.site_id))
return ai - bi return ai - bi
}) })
} }
@@ -108,16 +111,15 @@ function parseImage(item) {
async function loadSessionDetails() { async function loadSessionDetails() {
try { try {
const r = await axios const r = await axios.post(
.post( 'https://api-web.ug-be.cdn.united.cloud/oauth/token?grant_type=client_credentials',
'https://api-web.ug-be.cdn.united.cloud/oauth/token?grant_type=client_credentials', {},
{}, {
{ headers: {
headers: { Authorization: `Basic ${BASIC_TOKEN}`
Authorization: `Basic ${BASIC_TOKEN}`
}
} }
) }
)
return r.data return r.data
} catch (message) { } catch (message) {
return console.log(message) return console.log(message)

View File

@@ -36,7 +36,7 @@ const channel = {
} }
it('can generate valid url', async () => { it('can generate valid url', async () => {
const result = url({ date, channel, country : 'ba' }) const result = url({ date, channel, country: 'ba' })
expect(result).toBe( expect(result).toBe(
'https://api-web.ug-be.cdn.united.cloud/v1/public/events/epg?fromTime=2025-01-20T00:00:00-00:00&toTime=2025-01-20T23:59:59-00:00&communityId=12&languageId=59&cid=1607' 'https://api-web.ug-be.cdn.united.cloud/v1/public/events/epg?fromTime=2025-01-20T00:00:00-00:00&toTime=2025-01-20T23:59:59-00:00&communityId=12&languageId=59&cid=1607'

View File

@@ -56,7 +56,8 @@ module.exports = {
curTag = 'displayName' curTag = 'displayName'
curText = '' curText = ''
// capture possible lang attribute (xml:lang or lang) // capture possible lang attribute (xml:lang or lang)
current._lang = node.attributes['xml:lang'] || node.attributes['xml:Lang'] || node.attributes.lang current._lang =
node.attributes['xml:lang'] || node.attributes['xml:Lang'] || node.attributes.lang
} }
}) })
@@ -85,15 +86,14 @@ module.exports = {
}) })
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
res.data res.data.pipe(zlib.createGunzip()).pipe(parserStream).on('end', resolve).on('error', reject)
.pipe(zlib.createGunzip())
.pipe(parserStream)
.on('end', resolve)
.on('error', reject)
}) })
return channels.map(channel => { return channels.map(channel => {
const displayName = (channel.displayName && channel.displayName[0]) || { lang: 'en', value: channel.id } const displayName = (channel.displayName && channel.displayName[0]) || {
lang: 'en',
value: channel.id
}
return { return {
lang: displayName.lang || 'en', lang: displayName.lang || 'en',
site_id: `${tag}#${channel.id}`, site_id: `${tag}#${channel.id}`,