Google News API (Async)

This endpoint will retrieve news data from a Google news result page and transform it into usable JSON.

Single Query Request:

import fetch from 'node-fetch';
const options = {
  method: 'POST',
  body: JSON.stringify({
    apiKey: 'APIKEY',
     query: 'QUERY',
    tld: 'TLD',
    uule: 'UULE',
    num: 'NUM',
    hl: 'HOSTLANGUAGE',
    gl: 'GUESTLANGUAGE',
    ie: 'QUERYENCODING',
    oe: 'RESULTENCODING',
    start: 'START',
    callback: {
            type: 'webhook',
            url: 'CALLBACK' }}),
  headers: {
    'Content-Type': 'application/json',
  },
}

fetch('https://async.scraperapi.com/structured/google/news', options)
  .then(response => {
    response.text().then(text => console.log(text));
  })
  .catch(error => {
    console.log(error)
  })

import fetch from 'node-fetch';
const options = {
  method: 'POST',
  body: JSON.stringify({
    apiKey: 'APIKEY',
     queries: ['QUERY1','QUERY2','QUERY3'],
    tld: 'TLD',
    uule: 'UULE',
    num: 'NUM',
    hl: 'HOSTLANGUAGE',
    gl: 'GUESTLANGUAGE',
    ie: 'QUERYENCODING',
    oe: 'RESULTENCODING',
    start: 'START',
    callback: {
            type: 'webhook',
            url: 'CALLBACK' }}),
  headers: {
    'Content-Type': 'application/json',
  },
}

fetch('https://async.scraperapi.com/structured/google/news', options)
  .then(response => {
    response.text().then(text => console.log(text));
  })
  .catch(error => {
    console.log(error)
  })

Multiple Parameters can be used with this method:

Sample Response

Single Query Request:

{
	"id": "89b388bf-0cea-49c1-8db6-9e00042c8c3a",
	"status": "running",
	"statusUrl": "http://async.scraperapi.com/structured/google/news/89b388bf-0cea-49c1-8db6-9e00042c8c3a",
	"query": "US economy"
}

Multiple Query Request:

[
	{
		"id": "2955ad23-c812-475c-bc52-572576815d78",
		"status": "running",
		"statusUrl": "http://async.scraperapi.com/structured/google/news/2955ad23-c812-475c-bc52-572576815d78",
		"query": "US Economy"
	},
	{
		"id": "120a7344-7832-4fd0-a64f-ce9cd39726f3",
		"status": "running",
		"statusUrl": "http://async.scraperapi.com/structured/google/news/120a7344-7832-4fd0-a64f-ce9cd39726f3",
		"query": "Crowdfunding"
	}
]

After the job(s) finish, you will find the result under the response key in the response JSON object. The structure is the same as in the corresponding SYNC data endpoint.

Last updated