← Public packages
@reng/air-quality
Scrape air-quality.com for AQI, pollutants, pollen, and weather (HA-style field set).
src/searchPlaces.ts
23 lines · 785 B · TypeScriptimport { searchPlaces as scrapeSearch } from './scrape'
import type { PlaceHit } from './types'
export type { PlaceHit }
/**
* Search air-quality.com places by Chinese or English name.
* Use before getSnapshot when you need to pick among stations/districts.
*
* @param input - Search term and optional limit
* @returns Ranked place hits with `place` paths usable by getSnapshot
*
* @example
* import { searchPlaces } from 'kody:@reng/air-quality/searchPlaces'
*
* const hits = await searchPlaces({ term: '海淀', limit: 5 })
* // [{ name, place: 'china/.../...', ... }]
*/
export async function searchPlaces(input: { term: string; limit?: number } = { term: '' }): Promise<PlaceHit[]> {
return scrapeSearch(input.term, input.limit ?? 20)
}
export default searchPlaces