mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-09 16:49:01 +01:00
Add json param to /transcript
This commit is contained in:
parent
5cf64a2613
commit
6cb82fc21e
@ -60,6 +60,7 @@ router.post('/transcript', jsonParser, async (request, response) => {
|
||||
const RE_XML_TRANSCRIPT = /<text start="([^"]*)" dur="([^"]*)">([^<]*)<\/text>/g;
|
||||
const id = request.body.id;
|
||||
const lang = request.body.lang;
|
||||
const json = request.body.json;
|
||||
|
||||
if (!id) {
|
||||
console.log('Id is required for /transcript');
|
||||
@ -129,7 +130,9 @@ router.post('/transcript', jsonParser, async (request, response) => {
|
||||
// The text is double-encoded
|
||||
const transcriptText = transcript.map((line) => he.decode(he.decode(line.text))).join(' ');
|
||||
|
||||
return response.send(transcriptText);
|
||||
return json
|
||||
? response.json({ transcript: transcriptText, html: videoPageBody })
|
||||
: response.send(transcriptText);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return response.sendStatus(500);
|
||||
|
Loading…
x
Reference in New Issue
Block a user