Skip to content

Commit f5dbf37

Browse files
authored
Update README.md
1 parent f4471d0 commit f5dbf37

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Desktop Notifier - News Notifier
2+
3+
This Python script fetches news articles from various categories such as world, technology, sports, business, health, science, and entertainment from CNN's RSS feeds and displays toast notifications on Windows 10. Users can click on the notifications to open the corresponding news articles in their web browser.
4+
5+
## How it Works
6+
7+
1. **RSS Feeds Configuration**: The script is configured with RSS feed URLs for different news categories from CNN.
8+
9+
2. **Notification Setup**: It uses the `win10toast-click` library to create toast notifications on Windows 10. Notifications include the title and summary of news articles truncated to a maximum length.
10+
11+
3. **Fetching News**: The script fetches news articles from the provided RSS feed URL using the `feedparser` library.
12+
13+
4. **Truncating Strings**: A helper function is used to truncate long strings (title and summary) to a specified maximum length to fit within the notification window.
14+
15+
5. **Showing Notifications**: The `notify_news` function creates and displays toast notifications for each news article fetched. Clicking on a notification opens the corresponding news article in the default web browser.
16+
17+
6. **Main Loop**: An asynchronous main loop periodically fetches news articles from the selected category's RSS feed and displays notifications for new articles.
18+
19+
7. **User Interaction**: Users are prompted to select a news category from the available options. If an invalid category is selected, an error message is displayed.
20+
21+
## Usage
22+
23+
1. Clone the repository.
24+
2. Install required dependencies using `pip install -r requirements.txt`.
25+
3. Run the script using `python news_notifier.py`.
26+
4. Follow the on-screen instructions to select a news category.
27+
28+
## Requirements
29+
30+
- Python 3.x
31+
- `feedparser` library
32+
- `win10toast-click` library
33+
34+
## Example
35+
36+
```bash
37+
$ python news_notifier.py
38+
Please select a news category from the following options:
39+
- world
40+
- technology
41+
- sports
42+
- business
43+
- health
44+
- science
45+
- entertainment
46+
Enter the category: health

0 commit comments

Comments
 (0)