MCPcopy
hub / github.com/gcui-art/suno-api / GET

Function GET

src/app/api/get_aligned_lyrics/route.ts:8–54  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

6export const dynamic = "force-dynamic";
7
8export async function GET(req: NextRequest) {
9 if (req.method === 'GET') {
10 try {
11 const url = new URL(req.url);
12 const song_id = url.searchParams.get('song_id');
13
14 if (!song_id) {
15 return new NextResponse(JSON.stringify({ error: 'Song ID is required' }), {
16 status: 400,
17 headers: {
18 'Content-Type': 'application/json',
19 ...corsHeaders
20 }
21 });
22 }
23
24 const lyricAlignment = await (await sunoApi((await cookies()).toString())).getLyricAlignment(song_id);
25
26
27 return new NextResponse(JSON.stringify(lyricAlignment), {
28 status: 200,
29 headers: {
30 'Content-Type': 'application/json',
31 ...corsHeaders
32 }
33 });
34 } catch (error) {
35 console.error('Error fetching lyric alignment:', error);
36
37 return new NextResponse(JSON.stringify({ error: 'Internal server error. ' + error }), {
38 status: 500,
39 headers: {
40 'Content-Type': 'application/json',
41 ...corsHeaders
42 }
43 });
44 }
45 } else {
46 return new NextResponse('Method Not Allowed', {
47 headers: {
48 Allow: 'GET',
49 ...corsHeaders
50 },
51 status: 405
52 });
53 }
54}
55
56export async function OPTIONS(request: Request) {
57 return new Response(null, {

Callers

nothing calls this directly

Calls 3

sunoApiFunction · 0.90
getMethod · 0.80
getLyricAlignmentMethod · 0.80

Tested by

no test coverage detected