Google News API
Using Google News API you can scrape Google News results without worrying about proxy rotation and data parsing. Our API is fast and reliable. Each successful request will cost you 5 API credits
You have to send a GET request to http://api.scrapingdog.com/google_news
with the below-given parameters.
Google News API pricing is available here.
Parameters
api_key
required
Your personal API key. Available on your dashboard Type: String
query
required
This is a Google Search Query.
Example1 - query=pizza
results
Number of results you want to scrape. Its value could be anything between 1 and 100.
Default Value - 10
Type - String
country
page
This is the page number of Google searches. Its value can be 0 for the first page, 1 for the second page, and so on.
Default Value - 0
Type - String
domain
To obtain local results from a specific country, for example, for India, it will be "google.co.in," and for the UK, it will be "google.co.uk".
Type: String
Default: "google.com"
language
Language of the results. Possible Values - en
, es
, fr
, de
, etc.
Default Value - en
Type - String
lr
Type: String
Limit the search to one or multiple languages.
It is used as lang_{language code}
.
For example - "lang_us"
result_time
The "tbs" parameter is often accompanied by additional parameters that define specific search options.
These options can include parameters such as time range, language, country, file type, and more. Possible Value - qdr:d
Type - String
tbs
to be searched - An advanced parameter to filter search results.
Type: String
safe
To filter the adult content set safe
to active
or to disable it set off
.
Type: String [active/off]
Default: off
nfpr
Type: Boolean
Default: 0
It excludes the result from an auto-corrected query that is spelled wrong.
It can be set to 1
to exclude these results or 0
to include them.
html
To render the response as raw HTML.
Type: Boolean
Default: false
API Example
curl "https://api.scrapingdog.com/google_news/?api_key=5eaa61a6e562fc52fe763tr516e4653&query=football&results=10&country=us"
import requests
api_key = "5eaa61a6e562fc52fe763tr516e4653"
url = "https://api.scrapingdog.com/google_news"
params = {
"api_key": api_key,
"query": "football",
"results": 10,
"country": "us"
}
response = requests.get(url, params=params)
if response.status_code == 200:
data = response.json()
print(data)
else:
print(f"Request failed with status code: {response.status_code}")
const axios = require('axios');
const api_key = '5eaa61a6e562fc52fe763tr516e4653';
const url = 'https://api.scrapingdog.com/google_news';
const params = {
api_key: api_key,
query: 'football',
results: 10,
country: 'us'
};
axios
.get(url, { params: params })
.then(function (response) {
if (response.status === 200) {
const data = response.data;
console.log(data)
} else {
console.log('Request failed with status code: ' + response.status);
}
})
.catch(function (error) {
console.error('Error making the request: ' + error.message);
});
<?php
// Set the API key and request parameters
$api_key = '5eaa61a6e562fc52fe763tr516e4653';
$query = 'football';
$results = 10;
$country = 'us';
// Set the API endpoint
$url = 'https://api.scrapingdog.com/google_news/?api_key=' . $api_key . '&query=' . $query . '&results=' . $results . '&country=' . $country;
// Initialize cURL session
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the cURL request
$response = curl_exec($ch);
// Check if the request was successful
if ($response === false) {
echo 'cURL error: ' . curl_error($ch);
} else {
// Process the response data as needed
echo $response;
}
// Close the cURL session
curl_close($ch);
require 'net/http'
require 'uri'
# Set the API key and request parameters
api_key = '5eaa61a6e562fc52fe763tr516e4653'
query = 'football'
results = 10
country = 'us'
# Construct the API endpoint URL
url = URI.parse("https://api.scrapingdog.com/google_news/?api_key=#{api_key}&query=#{query}&results=#{results}&country=#{country}")
# Create an HTTP GET request
request = Net::HTTP::Get.new(url)
# Create an HTTP client
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true # Enable SSL (https)
# Send the request and get the response
response = http.request(request)
# Check if the request was successful
if response.is_a?(Net::HTTPSuccess)
puts response.body # Process the response data as needed
else
puts "HTTP request failed with code: #{response.code}, message: #{response.message}"
end
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
try {
// Set the API key and request parameters
String apiKey = "5eaa61a6e562fc52fe763tr516e4653";
String query = "football";
int results = 10;
String country = "us";
// Construct the API endpoint URL
String apiUrl = "https://api.scrapingdog.com/google_news/?api_key=" + apiKey
+ "&query=" + query
+ "&results=" + results
+ "&country=" + country
// Create a URL object from the API URL string
URL url = new URL(apiUrl);
// Open a connection to the URL
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Set the request method to GET
connection.setRequestMethod("GET");
// Get the response code
int responseCode = connection.getResponseCode();
if (responseCode == 200) {
// Read the response from the connection
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = reader.readLine()) != null) {
response.append(inputLine);
}
reader.close();
// Process the response data as needed
System.out.println(response.toString());
} else {
System.out.println("HTTP request failed with response code: " + responseCode);
}
// Close the connection
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Response
{
"subArticles": [
{
"name": "News about college football",
"news_results": [
{
"title": "Staff Picks: Kendall Milton, Cameron Ward among college football breakout \nstars in 2022 season",
"source": "CBS Sports",
"image": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"date": "2 days ago",
"url": "https://www.cbssports.com/college-football/news/staff-picks-kendall-milton-cameron-ward-among-college-football-breakout-stars-in-2022-season/"
},
{
"title": "College Football World Reacts To Peyton Manning's Recruiting Admission",
"source": "The Spun",
"image": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"date": "18 mins ago",
"url": "https://thespun.com/college-football/college-football-world-reacts-to-peyton-mannings-recruiting-admission"
},
{
"title": "For Air Force football, Troy Calhoun believes every year requires resetting \nexpectations",
"source": "The Athletic",
"image": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"date": "7 hours ago",
"url": "https://theathletic.com/3376293/2022/06/26/air-force-football-preview-troy-calhoun/"
}
]
},
{
"name": "News about Fantasy football",
"news_results": [
{
"title": "Fantasy football 2022: A deeper dive on Saquon Barkley",
"source": "The Athletic",
"image": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"date": "7 hours ago",
"url": "https://theathletic.com/3365167/2022/06/26/fantasy-football-2022-a-deeper-dive-on-saquon-barkley/"
},
{
"title": "Fantasy football mock draft - Four WRs go in first round in 12-team PPR",
"source": "ESPN",
"image": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"date": "3 days ago",
"url": "https://www.espn.com/fantasy/football/story/_/id/34138347/fantasy-football-mock-draft-four-wrs-go-first-round-12-team-ppr"
},
{
"title": "Fantasy football sleepers roundtable: Allen Lazard, Chris Olave and 8 more \nfavorites",
"source": "The Athletic",
"image": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"date": "2 hours ago",
"url": "https://theathletic.com/3367894/2022/06/26/fantasy-football-sleepers-2022/"
}
]
}
],
"news_results": [
{
"title": "Martin Bengtsson: football’s Swedish wonderkid whose dream died at Inter",
"snippet": "If Martin Bengtsson feels stressed he kicks a football around on his own and, almost immediately, the tension begins to ebb away.",
"source": "The Guardian",
"imgSrc": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"lastUpdated": "3 hours ago",
"rank": "1"
},
{
"title": "Ten years that changed the face of women’s football",
"snippet": "It was a landmark moment for women's football. Under the arch of Wembley stadium, to the soundtrack of Beyonc's feminist anthem Run the...",
"source": "The Guardian",
"imgSrc": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"lastUpdated": "4 hours ago",
"rank": "2"
},
{
"title": "Milan choose between Asensio and Ziyech - Football Italia",
"snippet": "Milan must choose between Hakim Ziyech of Chelsea and Real Madrid's Marco Asensio to reinforce the front line this summer, shifting the priority from \na.",
"source": "Football Italia",
"imgSrc": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"lastUpdated": "2 hours ago",
"rank": "3"
},
{
"title": "Gabriel Jesus: Arsenal agree terms with Manchester City forward on five-year deal",
"snippet": "Arsenal have agreed personal terms with Manchester City forward Gabriel Jesus on a five-year deal ahead of a proposed 45 million move.",
"source": "The Athletic",
"imgSrc": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"lastUpdated": "47 mins ago",
"rank": "4"
},
{
"title": "Reports Di Maria has said yes to Juventus - Football Italia",
"snippet": "Multiple sources claim Juventus have finally reached a breakthrough for Angel Di Maria and are finalising the details of his contract.",
"source": "Football Italia",
"imgSrc": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"lastUpdated": "3 hours ago",
"rank": "5"
},
{
"title": "Tottenham news and transfers LIVE: £42m Gvardiol enquiry, Conte eyes Calhanoglu, Jesus confirmed",
"snippet": "It has already been a busy transfer window for Tottenham Hotspur Football Club. Unlike Spurs teams of the past, business has been done early...",
"source": "Football.London",
"imgSrc": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"lastUpdated": "3 hours ago",
"rank": "6"
},
{
"title": "Brazil's 1982 World Cup team are feted as heroes but Zico claims Italy defeat scarred the game",
"snippet": "EXCLUSIVE INTERVIEW BY OLIVER HOLT: Next week, it will be 40 years since the Brazil of Zico, Socrates, Eder, Falcao and Junior lost that...",
"source": "Daily Mail",
"imgSrc": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"lastUpdated": "21 hours ago",
"rank": "7"
},
{
"title": "Real Madrid sign Deportivo talent to play for Castilla",
"snippet": "Real Madrid have completed the signing of Noel Lopez from Deportivo La Coruna. The 19 year old will play in the Real Madrid Castilla team in...",
"source": "Football Espana",
"imgSrc": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
"lastUpdated": "8 hours ago",
"rank": "8"
}
],
"pagination": {
"current": "1",
"next": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=10&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8NMDegQIARBK",
"page_no": {
"2": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=10&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARA4",
"3": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=20&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARA6",
"4": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=30&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARA8",
"5": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=40&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARA-",
"6": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=50&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARBA",
"7": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=60&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARBC",
"8": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=70&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARBE",
"9": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=80&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARBG",
"10": "https://www.google.com/search?q=football&gl=us&tbm=nws&ei=RK24YtfoNIur5NoPisGm4AQ&start=90&sa=N&ved=2ahUKEwjXmoCP58v4AhWLFVkFHYqgCUwQ8tMDegQIARBI"
}
},
"serpdog_pagination": {
"current": "1",
"page_no": {
"2": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=10",
"3": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=20",
"4": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=30",
"5": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=40",
"6": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=50",
"7": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=60",
"8": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=70",
"9": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=80",
"10": "https://api.scrapingdog.com/news?api_key=APIKEY&q=football&gl=us&start=90"
}
}
}
Last updated