by Lazy Sloth
Daily News Summarizer from Google Alerts RSS Feed
import re
import requests
from bs4 import BeautifulSoup
from abilities import (
download_content_from_url,
apply_llm_prompt_to_every_item,
)
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime, timedelta
# TODO: Replace with the actual Google Alerts RSS feed URL.
GOOGLE_ALERTS_RSS_URL = "https://www.example.com/rss_feed_url"
def get_daily_news():
try:
response = download_content_from_url(GOOGLE_ALERTS_RSS_URL)
content = response["content"]
soup = BeautifulSoup(content, "lxml-xml")
news_list = [
{
"title": item.title.text,
"url": item.link["href"],
"published": item.published.text,
}
Frequently Asked Questions
How can businesses benefit from using the Daily News Summarizer app?
The Daily News Summarizer app can provide significant value to businesses by: - Saving time: Instead of reading through multiple articles, employees can quickly get summaries of the most relevant news. - Staying informed: It helps businesses stay up-to-date with the latest industry news and trends. - Competitive intelligence: By setting up Google Alerts for competitors or industry keywords, businesses can efficiently monitor their market landscape. - Content curation: The summaries can be used as a basis for creating newsletters or social media content, keeping the business's audience engaged with current events.
What types of industries or roles would find the Daily News Summarizer most useful?
The Daily News Summarizer can be particularly beneficial for: - Public Relations and Communications teams: To stay on top of industry news and potential PR opportunities or crises. - Market Research analysts: To quickly gather insights on market trends and competitor activities. - Executive teams: To maintain a broad overview of industry developments without spending hours reading full articles. - Content marketers: To find inspiration and stay informed about trending topics in their industry. - Investors and financial analysts: To keep track of news that might impact investment decisions.
How can the Daily News Summarizer be customized for specific business needs?
The Daily News Summarizer can be tailored to specific business needs by:
- Customizing the Google Alerts RSS feed: Businesses can create alerts for specific keywords, competitors, or industry terms.
- Adjusting the summary length: The apply_llm_prompt_to_every_item
function can be modified to generate longer or shorter summaries based on preference.
- Implementing additional filters: Beyond the date filter, businesses could add filters for specific sources or topics.
- Integrating with other systems: The app could be modified to send summaries via email or post them to internal communication platforms.
- Expanding language support: The app could be adapted to summarize articles in multiple languages to support global business needs.
How can I modify the Daily News Summarizer to include sentiment analysis of the articles?
To include sentiment analysis, you can modify the generate_summary_articles
function to include a sentiment analysis step. Here's an example of how you might do this using the TextBlob library:
```python from textblob import TextBlob
def generate_summary_articles(news_list): summaries = [] # ... existing code ...
for future, redirected_url in futures:
try:
llm_response = future.result(timeout=60)
summary = llm_response["responses"][0]
# Perform sentiment analysis
blob = TextBlob(summary)
sentiment = blob.sentiment.polarity
summaries.append({
"title": news["title"],
"url": redirected_url,
"summary": summary,
"sentiment": sentiment
})
except Exception as e:
print(f"Error while generating summary article: {e}")
return summaries
```
This modification adds a sentiment score to each summary, which can provide additional insights into the tone of the news articles.
Can the Daily News Summarizer be adapted to work with multiple RSS feeds?
Yes, the Daily News Summarizer can be easily modified to work with multiple RSS feeds. Here's an example of how you could adapt the get_daily_news
function:
```python def get_daily_news(rss_feeds): news_list = [] for feed_url in rss_feeds: try: response = download_content_from_url(feed_url) content = response["content"] soup = BeautifulSoup(content, "lxml-xml") feed_news = [ { "title": item.title.text, "url": item.link["href"], "published": item.published.text, "source": feed_url # Add source information } for item in soup.find_all("entry") ] news_list.extend(feed_news) except Exception as e: print(f"Error while fetching news from {feed_url}: {e}") return news_list
# Usage rss_feeds = [ "https://www.example1.com/rss_feed_url", "https://www.example2.com/rss_feed_url", "https://www.example3.com/rss_feed_url" ] news_list = get_daily_news(rss_feeds) ```
This modification allows the Daily News Summarizer to aggregate news from multiple sources, providing a more comprehensive news summary.
Created: | Last Updated:
Introduction to the Daily News Summarizer from Google Alerts RSS Feed Template
Welcome to the Daily News Summarizer template! This template is designed to help you create an application that automatically pulls news from a Google Alerts RSS feed and generates concise summaries using a language model. It's perfect for staying up-to-date with the latest news in your field of interest. The app filters articles to include only those published today and provides a user-friendly interface to generate summaries on demand.
Getting Started with the Template
To begin using this template, simply click on the "Start with this Template" button. This will set up the template in your Lazy builder interface, pre-populating the code and preparing the environment for your use.
Initial Setup
Before you can start using the app, you need to provide the Google Alerts RSS feed URL. This URL will be used to fetch the news articles that you want to summarize. To do this, replace the placeholder https://www.example.com/rss_feed_url
with your actual Google Alerts RSS feed URL in the GOOGLE_ALERTS_RSS_URL
variable within the code.
Test: Pressing the Test Button
Once you have set the Google Alerts RSS feed URL, it's time to test the app to ensure everything is working correctly. Press the "Test" button to deploy the app. The Lazy CLI will handle the deployment, and you will not need to worry about installing libraries or setting up the environment.
Entering Input
After pressing the "Test" button, you will be prompted to enter any required user input through the Lazy CLI. For this template, you will be asked to type 'generate' to start generating news summaries on demand.
Using the App
Once the app is running, you will interact with it through the CLI. After entering the required input, the app will fetch the news articles, generate summaries, and display them in the CLI. There is no frontend experience for this app.
Integrating the App
If you wish to integrate the generated summaries into another service or frontend, you will need to take the output from the CLI and manually insert it into your desired platform. This template does not include direct integration steps as it is designed to be used within the Lazy platform.
Remember, the Lazy platform handles all the deployment, so you can focus on using the app without worrying about the technical details of setting up the environment.
If you encounter any issues or have questions about using the template, refer to the documentation provided in the code or reach out for support through the Lazy platform.
Here's a sample code snippet from the template that you might find helpful:
def get_daily_news():
# ... existing code ...
return news_list
This function is responsible for fetching the daily news from the provided Google Alerts RSS feed URL.
Enjoy building your Daily News Summarizer and stay informed with ease!
Here are 5 key business benefits for this Daily News Summarizer template:
Template Benefits
-
Efficient Information Processing: This template allows businesses to quickly digest large volumes of news and information related to their industry or specific topics of interest, saving time and improving productivity.
-
Competitive Intelligence: By summarizing news articles from Google Alerts, companies can stay informed about their competitors' activities, industry trends, and market developments without spending hours reading full articles.
-
Customizable News Monitoring: The template can be easily adapted to focus on specific keywords or topics by modifying the Google Alerts RSS feed URL, enabling businesses to tailor their news monitoring to their exact needs.
-
Automated Content Curation: This tool can serve as a foundation for content curation efforts, providing summarized news articles that can be used in company newsletters, social media posts, or internal briefings.
-
Enhanced Decision Making: By providing concise summaries of relevant news, this template supports faster and more informed decision-making processes for business leaders and strategists.