File size: 353 Bytes
818a838
 
 
 
 
bcfdcee
 
 
 
 
 
818a838
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

from GoogleNews import GoogleNews
import pandas as pd

# get the news with lang and country parameters
def get_news(settings, query):
  googlenews = GoogleNews(
    lang=settings["lang"], 
    region=settings["region"],
    period=settings["period"],
  )
  googlenews.search(query)
  result = googlenews.result()
  df = pd.DataFrame(result)
  return df