Fixes EOL character

This commit is contained in:
freearhey committed 2026-05-05 12:42:41 +03:00
1 parent f2cfb97ebe
commit e440b4c356
2 files changed
+15 -14

No files matched your search

+12 -8
View File
@@ -28,7 +28,9 @@ module.exports = {
}) })
const f = dt => dayjs.tz(dt, tz).isSame(date, 'day') const f = dt => dayjs.tz(dt, tz).isSame(date, 'day')
schedules schedules
.filter(entry => entry.parentId === channel.site_id && (f(entry.startTime) || f(entry.endTime))) .filter(
entry => entry.parentId === channel.site_id && (f(entry.startTime) || f(entry.endTime))
)
.forEach(entry => { .forEach(entry => {
const [, , , season, , , session2, , , episode] = entry.tvProgram.match( const [, , , season, , , session2, , , episode] = entry.tvProgram.match(
/((\s(\d+)[a-zA-Z]{2})?\s(Season(\s)?||S)(\d+)?)?(\s-\sEps\.(\s)?(\d+))/ /((\s(\d+)[a-zA-Z]{2})?\s(Season(\s)?||S)(\d+)?)?(\s-\sEps\.(\s)?(\d+))/
@@ -55,13 +57,15 @@ module.exports = {
.catch(console.error) .catch(console.error)
if (Array.isArray(data?.videos)) { if (Array.isArray(data?.videos)) {
channels.push(...data.videos channels.push(
.filter(item => item?.contentType === 'Channel') ...data.videos
.map(item => ({ .filter(item => item?.contentType === 'Channel')
lang: 'id', .map(item => ({
site_id: item.id, lang: 'id',
name: item.translations.id.title site_id: item.id,
}))) name: item.translations.id.title
}))
)
} }
return channels return channels
+3 -6
View File
@@ -10,14 +10,11 @@ const date = dayjs.utc('2026-05-02').startOf('d')
const channel = { site_id: '0_86sal99e' } const channel = { site_id: '0_86sal99e' }
it('can generate valid url', () => { it('can generate valid url', () => {
expect(url({ channel })).toBe( expect(url({ channel })).toBe('https://vmp.maxstream.tv/api/v3/videos/0_86sal99e/schedules')
'https://vmp.maxstream.tv/api/v3/videos/0_86sal99e/schedules'
)
}) })
it('can parse response', () => { it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')).toString()
.toString()
const results = parser({ content, channel, date }).map(p => { const results = parser({ content, channel, date }).map(p => {
p.start = p.start.toJSON() p.start = p.start.toJSON()
p.stop = p.stop.toJSON() p.stop = p.stop.toJSON()
@@ -26,7 +23,7 @@ it('can parse response', () => {
expect(results.length).toBe(49) expect(results.length).toBe(49)
expect(results[0]).toMatchObject({ expect(results[0]).toMatchObject({
title: 'I\'ll Become A Villainess Who Goes Down In History - Eps.12', title: "I'll Become A Villainess Who Goes Down In History - Eps.12",
description: description:
'Seorang gadis bereinkarnasi sebagai tokoh antagonis dalam novel fantasi. Ia bertekad menjadi villain sejati, namun pilihan tindakannya justru mengubah jalan cerita dan memengaruhi hubungan dengan karakter lain.', 'Seorang gadis bereinkarnasi sebagai tokoh antagonis dalam novel fantasi. Ia bertekad menjadi villain sejati, namun pilihan tindakannya justru mengubah jalan cerita dan memengaruhi hubungan dengan karakter lain.',
start: '2026-05-01T16:30:00.000Z', start: '2026-05-01T16:30:00.000Z',