Skip to content

Commit

Permalink
fix session
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed Feb 5, 2024
1 parent 89fec3f commit aa25902
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions handlers/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class Stream {
if (image) {
const channel = await TwitchService.getChannel()
await bot.say(target, `Captura de ${user}: ${config.externalUrl}/images/${image.fileName}`)
if (channel.live) {
await notifierBot.sendPhoto(config.telegram.chatId, image.buffer, {
caption: `Captura del directo _${channel.title}_ \n por *${user}*`,
parse_mode: 'Markdown'
})
}
// if (channel.live) {
// await notifierBot.sendPhoto(config.telegram.chatId, image.buffer, {
// caption: `Captura del directo _${channel.title}_ \n por *${user}*`,
// parse_mode: 'Markdown'
// })
// }
}
}

Expand Down
4 changes: 4 additions & 0 deletions services/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ async function getScreenshot() {
try {
const browser = await puppeteer.connect({ browserWSEndpoint: `wss://${config.browserlessUrl}` })
const page = await browser.newPage()

const session = await page.target().createCDPSession()
await session.send("Page.enable")

await page.goto("https://www.twitch.tv/" + config.twitch.channels, { waitUntil: 'networkidle0' })
await page.waitForSelector('div.persistent-player')
await page.$eval('.video-player__default-player', el => el.remove())
Expand Down

0 comments on commit aa25902

Please sign in to comment.