Update server.js
Browse files
server.js
CHANGED
|
@@ -7,7 +7,7 @@ const app = express();
|
|
| 7 |
const PORT = 7860;
|
| 8 |
|
| 9 |
async function transcript(url) {
|
| 10 |
-
const response = await axios.post(
|
| 11 |
'https://youtubetotranscript.com/transcript',
|
| 12 |
new URLSearchParams({ youtube_url: url }),
|
| 13 |
{ headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
|
|
@@ -20,7 +20,9 @@ async function transcript(url) {
|
|
| 20 |
.get()
|
| 21 |
.join(' ');
|
| 22 |
|
| 23 |
-
return text
|
|
|
|
|
|
|
| 24 |
};
|
| 25 |
|
| 26 |
app.get('/summary', async (req, res) => {
|
|
@@ -29,7 +31,7 @@ app.get('/summary', async (req, res) => {
|
|
| 29 |
try {
|
| 30 |
const rttex = await transcript(url);
|
| 31 |
const prompt = `INPUT: ${rttex}`;
|
| 32 |
-
const sysp = `You are an advanced AI designed for high-quality summarization. Your task is to generate precise, concise, and accurate summaries, extracting only the essential information while maintaining clarity. Do not include explanations, opinions, or unnecessary details. Ensure the summary is in the same language as the input.`;
|
| 33 |
const form = new FormData();
|
| 34 |
form.append('content', `${sysp}\n${prompt}`);
|
| 35 |
form.append('model', '@google/gemini-2.0-pro-exp-02-05');
|
|
|
|
| 7 |
const PORT = 7860;
|
| 8 |
|
| 9 |
async function transcript(url) {
|
| 10 |
+
/*const response = await axios.post(
|
| 11 |
'https://youtubetotranscript.com/transcript',
|
| 12 |
new URLSearchParams({ youtube_url: url }),
|
| 13 |
{ headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
|
|
|
|
| 20 |
.get()
|
| 21 |
.join(' ');
|
| 22 |
|
| 23 |
+
return text;*/
|
| 24 |
+
const { data } = await axios.get(`https://fastrestapis.fasturl.cloud/tool/yt-transcript?url=${encodeURIComponent(url)}`);
|
| 25 |
+
return data?.status === 200 ? data?.result : undefined;
|
| 26 |
};
|
| 27 |
|
| 28 |
app.get('/summary', async (req, res) => {
|
|
|
|
| 31 |
try {
|
| 32 |
const rttex = await transcript(url);
|
| 33 |
const prompt = `INPUT: ${rttex}`;
|
| 34 |
+
const sysp = `You are an advanced AI designed for high-quality summarization. Your task is to generate precise, concise, and accurate summaries, extracting only the essential information while maintaining clarity. Do not include explanations, opinions, or unnecessary details. Ensure the summary is in the same language as the input. Dont use any symbol, max words 150, to the point.`;
|
| 35 |
const form = new FormData();
|
| 36 |
form.append('content', `${sysp}\n${prompt}`);
|
| 37 |
form.append('model', '@google/gemini-2.0-pro-exp-02-05');
|