Files
bitify/app/api/search/route.ts
T
bitc0de e061d85975 Release v1.2.0 - YouTube search integration and playbar fix
New features:
- YouTube search integration with live results
- Smart input detection (URL vs search query)
- Real-time search with thumbnails and metadata
- Fixed progress bar not advancing for single songs

Technical improvements:
- Added searchYoutube function to ytdlp.ts
- Created /api/search endpoint
- Enhanced Header component with search UI
- Fixed PlayerBar useEffect dependencies
2026-01-04 00:26:25 +01:00

20 lines
599 B
TypeScript

import { NextRequest, NextResponse } from 'next/server'
import { searchYoutube } from '@/lib/ytdlp'
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url)
const query = searchParams.get('q')
if (!query) {
return NextResponse.json({ error: 'Query parameter is required' }, { status: 400 })
}
const results = await searchYoutube(query, 10)
return NextResponse.json(results)
} catch (error) {
console.error('Search error:', error)
return NextResponse.json({ error: 'Failed to search' }, { status: 500 })
}
}