Unparalleled suite of productivity-boosting Web APIs & cloud-based micro-service applications for developers and companies of any size.


Google News API + OpenAI Text Generation – Learn how to build your own personal news aggregator service

In this roundup, we will introduce you to the pros and cons of personalized news aggregator services so that you will know what a personalized news aggregator service is and consider what you might want to do with one. A lot of business people and entrepreneurs reading this might like to think about the opportunities to make money from using APIs to create a news aggregator service. We hope that this article will inspire you.

At the end of this article we will provide you with the code for how to build your own simple desktop news aggregator software that retrieves the most recent news from Google and uses the power of OpenAI’s GPT3 to analyze the news any way that you tell it too. How cool is that? Once you know how to instruct a software development team or start coding your own personalized news aggregator with GPT3’s interpretive abilities, it will be like becoming the head of your own news publication! Who knows, you might discover a way to scale and monetize it, and distribute GPT-3’s analysis of the news to a large fee-paying subscription base of users, just like the traditional personalized news aggregator services listed below.


A More Informed World

With the advent of news aggregators and personalized news feeds, staying informed about the latest developments in the world has never been easier. News aggregators and personalized news feeds allow users to curate their news consumption based on their interests and preferences, providing them with a customized news experience.

One of the biggest benefits of news aggregators and personalized news feeds is that they save time. Instead of spending hours browsing different news sources, users can simply log in to their aggregator or news feed and quickly scan the headlines and articles that are most relevant to them. This can be especially useful for busy individuals who don’t have the time to keep up with the news on a regular basis.


News Aggregator Services

There are several news aggregators and personalized news feed services currently available. Here are some of the most popular options:

  1. Google News – Google News is a news aggregator that compiles headlines from a wide range of news sources, and allows users to customize their news feeds based on their interests.
  2. Flipboard – Flipboard is a personalized news magazine that allows users to create customized feeds based on their interests, and provides a visually appealing interface for browsing articles.
  3. Apple News – Apple News is a news aggregator that provides personalized news feeds based on the user’s interests and reading history.
  4. Feedly – Feedly is a news aggregator that allows users to subscribe to RSS feeds from their favorite websites, and provides a customizable interface for browsing articles.
  5. News360 – News360 is a personalized news app that uses natural language processing and machine learning to curate news feeds based on the user’s interests.
  6. SmartNews – SmartNews is a news aggregator that uses machine learning algorithms to provide personalized news feeds based on the user’s interests and reading history.
  7. Pocket – Pocket is a read-it-later app that allows users to save articles for later reading, and provides personalized recommendations based on the user’s reading history.

These are just a few examples of the many news aggregators and personalized news feed services that are currently available. Each service has its own unique features and benefits, so it’s important to do your research and choose the one that best fits your needs and preferences.


The Cons of Personalized News Aggregators

If you rely too heavily on news aggregators and personalized news feeds, there are some potential drawbacks that you should be aware of. One of the biggest concerns is the possibility of filter bubbles. This occurs when you only consume news that confirms your existing beliefs and biases, which can lead to a narrow and limited understanding of the world. It can also contribute to polarization and division, which can be detrimental to society.

Another drawback of relying solely on news aggregators and personalized news feeds is the lack of context and analysis that is often provided by traditional news sources. News aggregators and personalized news feeds mainly focus on breaking news and headlines, rather than providing in-depth analysis and context. This can be problematic because it can lead to a shallow understanding of complex issues and events. As a result, it is important to be aware of these drawbacks and to supplement your news consumption with additional sources to gain a more comprehensive understanding of the world.


The Pros of Personalized News Aggregators

We have covered how news aggregators and personalized news feeds can save you time. Instead of spending hours browsing different news sources, you can simply log in to your favorite aggregator or news feed and quickly scan the headlines and articles that are most relevant to you. 

Overall, news aggregators and personalized news feeds can be valuable tools for helping you stay informed about the world. However, it’s important to use them in conjunction with other news sources and to be aware of their potential limitations.


Artificial Intelligence and a New Generation of News Aggregators

With the rise of artificial intelligence and machine learning, there is a growing interest in the potential of these technologies for news interpretation. One of the most exciting developments in this area is the use of GPT3 and natural language processing to automate the interpretation of news feeds in different ways.

One potential application of GPT3 and natural language processing is for the summarization of news articles. Rather than reading through entire articles, users could receive a summary of the article that highlights the most important points. This could save time and make it easier for individuals to stay informed about the latest developments in the world.

Another potential application is the use of humor and satire to summarize news articles. This could make news consumption more entertaining and engaging, and could help to attract younger audiences who may be less interested in traditional news sources.

GPT3 and natural language processing could also be used to provide bullet-point summaries of news articles. This could be particularly useful for individuals who are short on time or who have difficulty reading longer articles.

GPT3 and natural language processing could also be used to rewrite news articles from an opposing viewpoint. This could be a valuable tool for individuals who want to gain a better understanding of different perspectives and opinions on a particular issue.

Not to mention that GPT3 is also highly efficient at language translation, so consider how easy it would be for you to pull worldwide news on any subject and disseminate summaries of it in any style or tone of your choosing in languages of your choice.

GPT3 can turn news into poems, song lyrics, even rap songs if that is your thing!


The possibilities are endless

So at the end of this article we will show you the basic Python code for how to create a news aggregator that extracts the news from GoogleNews (a free to use Python library that pulls the news on any topic of your choice from Google) and then interprets that news in any way that you want using OpenAI’s GPT3 API.

Consider this, the more advanced you build your Personalized News Aggregator, you could get developers to implement payment processing APIs, multi user logons, text to speech APIs, videos of virtual people presenting the news summaries using APIs such as D-ID that generate text to speech videos of virtual presenters.


Building Your Own News Aggregator

The code we will provide you with below utilizes two technologies: 

GoogleNews (Python developers: pip install googlenews)


OpenAI’s API (sign up for an API key at OpenAI)

News data is scraped from the hyperlinks provided by Google news and analyzed by OpenAI’s powerful GPT3 API using text prompts of your choice.


Google News

GoogleNews allows developers to programmatically access the latest news articles from thousands of sources, while OpenAI’s text generation technology can be used to create personalized summaries and highlights of these articles.

The Python GoogleNews library is similar to the Google News API, which provides access to the latest news articles from thousands of sources, including major news outlets like CNN, The New York Times, and The Guardian. With the API, developers can access articles by category, location, or keyword, making it easy to retrieve the latest news on specific topics.

The Google News API also provides a wealth of information about each article, including its title, author, publication date, and content. This makes it possible to create a comprehensive news aggregator that includes not only the latest headlines, but also the most important details from each article.



OpenAI’s text generation capabilities have revolutionized the field of natural language processing. With its advanced machine learning algorithms, OpenAI can generate high-quality text that mimics the style and tone of human writing.

Using OpenAI’s text generation technology, we will show you how it is possible to create personalized summaries and highlights of news articles. By analyzing the content of an article and extracting the most important information, OpenAI can generate a concise summary that captures the essence of the article in just a few sentences.


Sending Data To OpenAI API To Analyze

For purposes of showing you how to create a news aggregator in this article, we have created the Python program using the free web scraping library called Beautiful Soup.

However, the cleaner the data content that you can scrape from the news URL, the better the analysis that OpenAI will be able to do with it. You can research available web scraping APIs from APILayer on this link where a number of advanced web scraping tools are offered.

Perhaps the best way to scrape an online news URL is to use an API like Screenshotlayer and convert the screenshot of the news URL to text, and pass that text to OpenAI API to analyze it.


Creating a News Aggregator

By combining the Google News API with OpenAI’s text generation capabilities, it is possible to create a powerful news aggregator that delivers personalized summaries of the latest news articles. Here’s how it works:

Retrieve the latest news articles from the Google News API, using keywords, categories, or locations to filter the results.

Extract the most important information from each article, such as the main topic, key quotes, and relevant statistics.

Use OpenAI’s text generation technology to create a personalized summary of each article, based on the extracted information.

Display the latest news articles along with their personalized summaries and highlights on a web page or mobile app.

The result is a news aggregator that provides users with a comprehensive overview of the latest news, personalized to their interests and preferences. By using advanced machine learning algorithms to analyze and summarize news articles, this news aggregator can save users time and provide them with a more streamlined and efficient way to stay informed.


Google News Aggregator Using OpenAI API to Summarize Tech News in a humorous tone

news aggregator OpenAI

Google News Aggregator Using OpenAI API Summarizing Tech News Arabic

news aggregator OpenAI

Google News Aggregator Using OpenAI API to Bullet Point Key Issues In Water News

news aggregator OpenAI

The Code

Without further ado below is the code for the application that you see in the screenshots above.

Copy and paste the code below saving it into a Python file that you run from your Windows Command Prompt or Mac Terminal.

Save the code below into a file called google_news_aggregator.py. Update the code with your own OpenAI API key.


import openai

import re

from GoogleNews import GoogleNews

import webbrowser

from tkinter import *

import requests

from bs4 import BeautifulSoup


openai.api_key = ‘Use your own OpenAI API key’


def search_and_display():

    # Get the search input from the input box

    search_query = input_box.get()


    # Create a GoogleNews object and search for news articles

    googlenews = GoogleNews()



    # Retrieve the search results and summarize each article


        result = googlenews.result()

    except AttributeError:

        print(“No results found”)


    summaries = []

    for article in result:

        summary = summarize_article(article[‘desc’], article[‘link’])



    # Update the text area with the search results and summaries

    text_area.delete(‘1.0’, END)

    text_area.insert(END, f”Search results for ‘{search_query}’:\n\n”)

    for i, article in enumerate(result):

        text_area.insert(END, f”Article {i+1}\n”)

        text_area.insert(END, f”Title: {article[‘title’]}\n”, ‘title’)

        text_area.insert(END, f”Summary: {summaries[i]}\n”, ‘content’)

        text_area.insert(END, article[‘link’], (‘content’, ‘hyperlink’))

        text_area.insert(END, “\n\n”)

    text_area.tag_configure(‘hyperlink’, foreground=’blue’, underline=True)

    text_area.tag_bind(‘hyperlink’, ‘<Button-1>’, open_link)


def summarize_article(article, url):

    response = requests.get(url)


   # three different web scraping methods are used to try and collect data from news urls to pass to OpenAI


    text = “”



        soup = BeautifulSoup(response.content, “html.parser”)

        text = soup.get_text()

        text = text[:1000] #This tries to scrape web page with 1000 character limit




    if not text:


            text = response.json()

            text = str(text)[:1000]




    if not text:


            text = response.content

            text = str(text)[:1000]




    model_engine = “text-davinci-003”


    # Get the prompt text from the text box

    prompt_text = prompt_input.get(“1.0”, “end-1c”)


    # Add the article and scraped text to the prompt

    prompt = f”{prompt_text}\n{article}\n\nHere is some additional scraped data for context. Ignore anything spurious such as HTML tags or social share/subscribe calls to action that doesn’t relate to {article}:\n{text}”


    response = openai.Completion.create(engine=model_engine, prompt=prompt, temperature=0.2, max_tokens=1500, n=1, stop=None)

    summary = response.choices[0].text


    return re.sub(‘\s+’, ‘ ‘, summary).strip()


def open_link(event):  # Define a function to open the link 

    text_widget = event.widget  # Get the widget which is clicked 

    index = text_widget.index(f”@{event.x},{event.y}”)

    tag_names = text_widget.tag_names(index)


    if ‘hyperlink’ in tag_names:

        line_start = text_widget.index(f”{index} linestart”)

        line_end = text_widget.index(f”{index} lineend”)

        line_text = text_widget.get(line_start, line_end)

        url_match = re.search(“(?P<url>https?://[^\s]+)”, line_text)

        if url_match:

            url = url_match.group(“url”)

            webbrowser.open_new(url)  # Open the URL in a new window 


# Create a GoogleNews object

googlenews = GoogleNews()


# Create the Tkinter application and set the title

root = Tk()

root.title(“Google News Aggregator”)



# Create the input box label

input_label = Label(root, text=”Enter search query:”)

input_label.pack(padx=10, pady=10)


# Create the input box

input_box = Entry(root, width=50)

input_box.pack(padx=10, pady=10)


# Create the prompt label

prompt_label = Label(root, text=”Enter prompt data:”)

prompt_label.pack(padx=10, pady=10)


# Create the prompt input box

prompt_input = Text(root, height=5, width=50)

prompt_input.pack(padx=10, pady=10)


# Create the search button

search_button = Button(root, text=”Search”, command=search_and_display)

search_button.pack(padx=10, pady=10)


# Create the text area

text_area = Text(root, height=30, width=200, bg=’#FFFFFF’, fg=’black’)

scrollbar = Scrollbar(root)

scrollbar.pack(side=RIGHT, fill=Y)

text_area.pack(side=LEFT, fill=Y)



text_area.insert(END, “Google News Aggregator\n\n”)

text_area.tag_configure(‘title’, background=’lightblue’, font=(‘Arial’, 14, ‘bold’))

text_area.tag_configure(‘content’, background=’yellow’, font=(‘Arial’, 12))

text_area.tag_configure(‘hyperlink’, foreground=’blue’, underline=True)

text_area.tag_bind(‘hyperlink’, ‘<Button-1>’, open_link)


# Set the tag configuration for hyperlink text

text_area.tag_configure(‘hyperlink’, foreground=’blue’, underline=True)

# Bind the hyperlink tag to open the link in a web browser

text_area.tag_bind(‘hyperlink’, ‘<Button-1>’, open_link)

# Start the main loop



Note to developers

Although Python users can copy-paste and run the code in a Python file, we are assuming that you have the latest version of Python that can support f strings, and that you are experienced in looking up and importing Python modules. ChatGPT and Stackoverflow offer excellent solutions for troubleshooting code issues.



As a developer, you have access to an incredibly powerful tool by combining the news with OpenAI’s next-generation capabilities. With this combination, you can create a personalized news aggregator that can deliver the latest news in real time, providing your users with concise and customized summaries of the most important articles. 

This is made possible by harnessing the power of machine learning and natural language processing, which can help you to automate the process of finding and summarizing news articles. By leveraging these technologies, you can help people stay informed in today’s fast-paced world, all while streamlining the process of consuming news for your users. 

So, if you’re looking to build a news aggregator or any other kind of AI-powered application, consider using these powerful tools to create a more intelligent and personalized user experience.

If this article has inspired you, you should seriously check out the bespoke news aggregator APIs available from APILayer such as mediastack and financelayer, which have very simple documentation for multiple programming languages which you and your developers can begin integrating into your own software applications.


Related posts

API Key vs. Token: What Is the Difference?


What Is API Orchestration, Why, and How? (With Examples)


The Best IP Locations API With Enterprise Plans

AIAPICurrencyLocationNews and UpdatesSecurity

Importance of API Integration to Improve User Experience on Your Website

Leave a Reply

Your email address will not be published. Required fields are marked *