How to get a Google news search results count going back 1 year

Hi all, I’m trying to programmatically get a count of Google News search results (i.e. how many results) for a list of search terms, but only for the last 1 year. Searching with the user interface, a results count appears only in the regular search, but doesn’t appear when going under “Tools > Recent > Past Year”. I tried the code below in python (to first return search results count for google news, without the ‘last 1 year’ filter, but there is a problem with it- it reports a wrong results count. For example, going to Google news and searching for Apple, yields 321 million results.

But the code below reports 415 million results.

So how can I do this, and also later limit the count for results in the last year? it doesn’t have to be in python, of course.

Many thanks.

The python code:

import requests
from bs4 import BeautifulSoup
import argparse

parser = argparse.ArgumentParser(description=‘Get Google Count.’)
parser.add_argument(‘word’, help=‘word to count’)
args = parser.parse_args()

r = requests.get(‘h t t p : // www dot google dot com slash search’,


soup = BeautifulSoup(r.text,“html.parser”)
print (soup.find(‘div’,{‘id’:‘resultStats’}).text)