import { ProviderId , Scraper , SearchError , SearchOptions , } from "../scrapers/types" ; import * as scrapers from "../scrapers" ; import { getProviderName } from "../routers/manga-page" ; import { ScraperResponse } from "../types" ; export async function doSearch ( provider , query = "" , searchOptions = { } ) { const scraper = scrapers [ getProviderName ( provider ) ] ; if ( ! scraper ) { return null ; } const searchResults = await scraper . search ( query , { ... searchOptions , resultCount : 20 } ) ; return searchResults || [ ] ; }