🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@apify/google-extractors

Package Overview
Dependencies
Maintainers
10
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apify/google-extractors

Extractors for paid and organic results from Google Search.

latest
Source
npmnpm
Version
1.2.10
Version published
Weekly downloads
58
1833.33%
Maintainers
10
Weekly downloads
 
Created
Source

Google Extractors

Parses detailed data from Google Search Result Page (SERP) HTML.

Features

  • Provides both desktop and mobile format parsers
  • Supports multiple old and new layouts for both desktop and mobile
  • Extracts
    • Organic results
    • Paid results
    • Site links
    • Paid products
    • Related queries
    • People also ask

Usage

const httpRequest = require('@apify/http-request');
const { extractResults } = require('@apify/google-extractors');

(async () => {
    // Obtain Google results HTML with desktop or mobile user agent using your favourite HTTP client
    const response = await httpRequest({
        url: 'https://www.google.com/search?q=web+scraping',
        headers: {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36',
        },
    });
    const html = response.body;

    const data = extractResults(html, { mobile: false });

    // print organic results
    console.dir(data.organicResults, { depth: null, colors: true });
    // print paid results
    console.dir(data.paidResults, { depth: null, colors: true });
})();

Output format

The output format is the same as for Google Search Results Scraper actor provided by Apify.

Changelog

2022-01-31 (1.2.2)

  • Implemented csvFriendlyOutput option
  • Handled missing www. on domains 2022-01-21 (1.2.2)
  • Fixed organic results for desktop (new layout)
  • Added date field 2021-01-19 (1.2.0)
  • Fixed new layout for organic results
  • Added emphasizedKeywords field for each organic result 2020-11-19
  • Fixed new layout for paid mobile results

FAQs

Package last updated on 07 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts