gsr
    Preparing search index...

    Function searchWithPages

    • Performs a Google search across multiple pages and returns parsed results.

      This function efficiently searches multiple pages by reusing the same parsers and request configuration. Results are returned as a 2D array where each sub-array contains results from one page.

      Type Parameters

      Parameters

      Returns Promise<SearchResultTypeFromParser<R, N>[][]>

      Promise that resolves to a 2D array where each sub-array contains results from one page

      import { searchWithPages, OrganicResult } from 'google-sr';

      // Search first 3 pages
      const results = await searchWithPages({
      query: 'machine learning',
      parsers: [OrganicResult],
      pages: 3, // Will search pages 0, 10, 20
      delay: 1000 // 1 second delay between requests
      });

      // Search specific pages
      const specificResults = await searchWithPages({
      query: 'react hooks',
      parsers: [OrganicResult],
      pages: [0, 20, 40], // Search pages 1, 3, and 5
      });

      When options is not provided or pages parameter is invalid