pnpm i @extractus/extractus
Extract html with default extractors, transformer, selector
import { extract } from '@extractus/extractus'
extract(htmlString, options)
Extract all strings from the html Example: packages/defaults/extractors.ts
type Extractor =
| ((input: string, context?: ExtractContext) => string | undefined)
| ((input: string) => string | undefined)
Transform the extracted strings. Such as normalize urls, filter blank strings Example: packages/defaults/transformer.ts
type Transformer =
| ((input: Iterable<string | undefined>, context?: ExtractContext) => Iterable<string | undefined>)
| ((input: Iterable<string | undefined>) => Iterable<string | undefined>)
Select one value from transformed values. Such as the first title, string to date object Example: packages/defaults/selector.ts
type Selector =
| ((input: Iterable<string>, context?: ExtractContext) => T)
| ((input: Iterable<string>) => T)
Using pnpm for manage workspace
- Clone repo
- Open project in terminal or IDE
- Run
pnpm i
at the root of project