Bilibili Subtitle Agent

Help you get bilibili subtitles and summarize the content.

Setup the testing data in Datasets

[
  {
    "role": "user",
    "content": "BV1Lu411J7Z8"
  }
]

Extract content from Code Action

_fun = (env) => {
  // use `env.state.Action_NAME` to refer output from previous Actions.
  return env.state.INPUT.messages.slice(-1)[0].content
} 

Use LLM to process user's input

_fun = (env) => {
  // use `env.state.Action_NAME` to refer output from previous Actions.
 return env.state.GET_BV.completion.text
}

Extract content from Code Action

_fun = (env) => {
  // use `env.state.Action_NAME` to refer output from previous Actions.
 return env.state.GET_BV.completion.text
}

Use Http Request Maker and request for CID

api.bilibili.com/x/player/pagelist?bvid={{BV}}

Extract content from Code Action

_fun = (env) => {
  // use `env.state.Action_NAME` to refer output from previous Actions.
 return env.state.GET_CID.body.data[0].cid
}

Use Http Request Maker and request for the url for subtitles

api.bilibili.com/x/player/v2?bvid={{BV}}&cid={{CID}}

Extract content from Code Action

_fun = (env) => {
  // use `env.state.Action_NAME` to refer output from previous Actions.
  // const data = JSON.stringify(env.state.GET_URL.body)
  // const regex = /<subtitle>(.*?)<\/subtitle>/;
  // const match = data.match(regex);
  // const subtitleURL = match ? match[1] : "";
  // const obj = subtitleURL.replace(new RegExp("\\\\\"","gm"),"\"")
  // const result = JSON.parse(obj)['subtitles'][0]['subtitle_url'].replace("//", "")
  const url = env.state.GET_URL.body.data.subtitle.subtitles[0].subtitle_url
  const result = url.replace(/\/\//g, "");
  return result
  
}

Use Http Request Maker and request for the subtitles

{{GET_CC_URL}}

Extract content from Code Action

_fun = (env) => {
  // use `env.state.Action_NAME` to refer output from previous Actions.
  let arr = []
  for(let i in env.state.GET_CC.body.body) {
    arr.push(env.state.GET_CC.body.body[i].content)
  }
 return arr.join(',')
}

Send subtitles to the LLM to summarize


<div data-gb-custom-block data-tag="if" data-0='0' data-1='0' data-2='0' data-3='0' data-4='0' data-5='0' data-6='0' data-7='0' data-8='0' data-9='0' data-10='0' data-11='0' data-12='0' data-13='0' data-14='0' data-15='0' data-16='0' data-17='0' data-18='0' data-19='0' data-20='0' data-21='0' data-22='0' data-23='0' data-24='0' data-25='0' data-26='0' data-27='0' data-28='0' data-29='0' data-30='0' data-31='0' data-32='0' data-33='0' data-34='0' data-35='0' data-36='0' data-37='0' data-38='' data-39='' data-40='' data-41='' data-42='' data-43='' data-44=''>

please reply to me with the phrase: "I apologize for being unable to retrieve content from the URL you provided. Please verify the correctness of the web address"

<div data-gb-custom-block data-tag="else"></div>

You are an AI with advanced comprehension and summarization skills. Your task is to read the following passage and provide a concise, clear summary that captures the main points and key details. 

Passage: 
{{CC}}

Please provide a summary of the above passage and respond to me in Chinese.

</div>

Extract content from Code Action

_fun = (env) => {
  // use `env.state.Action_NAME` to refer output from previous Actions.
 return {
   role: "assistant",
   content: env.state.OUTPUT_STREAM.completion.text,
   retrievals: env.state.RETRIEVALS
 }
}

Output the final results

Last updated