ChatGPTBox v2.0.0

This commit is contained in:
josc146
2023-03-15 17:09:28 +08:00
parent e642f2b922
commit f9ef9620ac
11 changed files with 38 additions and 25 deletions
@@ -24,7 +24,10 @@ export default {
})
).text()
let subtitleUrl = docText.substring(docText.indexOf('https://www.youtube.com/api/timedtext'))
const subtitleUrlStartAt = docText.indexOf('https://www.youtube.com/api/timedtext')
if (subtitleUrlStartAt === -1) return
let subtitleUrl = docText.substring(subtitleUrlStartAt)
subtitleUrl = subtitleUrl.substring(0, subtitleUrl.indexOf('"'))
subtitleUrl = subtitleUrl.replaceAll('\\u0026', '&')
@@ -32,6 +35,7 @@ export default {
title = title.substring(0, title.indexOf('","'))
const subtitleResponse = await fetch(subtitleUrl)
if (!subtitleResponse.ok) return
let subtitleData = await subtitleResponse.text()
let subtitleContent = ''
@@ -44,7 +48,7 @@ export default {
return cropText(
`Provide a brief summary of the video using concise language and incorporating the video title.` +
`The video title is:"${title}".The subtitle content is as follows:\n${subtitleContent}`,
`The video title is:"${title}".The subtitle content is as follows:\n${subtitleContent}`,
)
} catch (e) {
console.log(e)