Skip to main content
Version: 3.8

extractUrlsFromCheerio

Callable

  • extractUrlsFromCheerio($: CheerioAPI, selector?: string, baseUrl?: string): string[]

  • Extracts URLs from a given Cheerio object.

    @throws

    when a relative URL is encountered with no baseUrl set


    Parameters

    • $: CheerioAPI

      the Cheerio object to extract URLs from

    • selector: string = 'a'

      a CSS selector for matching link elements

    • baseUrl: string = ''

      a URL for resolving relative links

    Returns string[]

    An array of absolute URLs