How to have GoogleNews Package return a list of news articles about a list of stocks

Viewed 41

Right now, I have created a program that fetched news articles about a stock using the GoogleNews package.

import datetime as dt

from GoogleNews import GoogleNews
from newspaper import Article
from newspaper import Config

now = dt.date.today()
now = now.strftime('%m-%d-%Y')
yesterday = dt.date.today() - dt.timedelta(days = 1)
yesterday = yesterday.strftime('%m-%d-%Y')

now = dt.date.today()
now = now.strftime('%m-%d-%Y')
yesterday = dt.date.today() - dt.timedelta(days = 1)
yesterday = yesterday.strftime('%m-%d-%Y')

googlenews = GoogleNews(start=yesterday, end=now)
googlenews.search("AMZN")
result = googlenews.result()
print(result)

I would like to have GoogleNews return me a list of news articles about a list of stocks.

stocks = [‘AAPL’, ‘AMZN’, ‘GOOGL’]

This would be my list of stocks, and I would like to have it return me a list of news articles based off these stock symbols. Is there a way to do that?

0 Answers
Related