Google News API (Async)

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

Single Query Request:

import requests

url = "https://async.scraperapi.com/structured/google/news"
headers = {
    "Content-Type": "application/json"
}
data = {
    "apiKey": APIKEY,
    "query": QUERY,
    "tld": TLD,
    "uule": UULE,
    "num": NUM,
    "hl": HOSTLANGUAGE,
    "gl": GUESTLANGUAGE,
    "ie": QUERYENCODING,
    "oe": RESULTENCODING,
    "start": START,
    "callback": {
        "type": "webhook",
        "url": "YYYY"
    }
}

response = requests.post(url, json=data, headers=headers)
print(response.text)

Multiple Query Request:

import requests

url = "https://async.scraperapi.com/structured/google/news"
headers = {
    "Content-Type": "application/json"
}
data = {
    "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": "YYYY"
    }
}

response = requests.post(url, json=data, headers=headers)
print(response.text)

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