mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-23 12:50:47 +08:00
ChatGPTBox v2.0.0
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user