A MagicMirror module for displaying news headlines from Israeli news sources in Hebrew, with support for both RSS feeds and HTML news flash pages.
- Mixed Source Support: Supports both RSS feeds and HTML news flash pages
- Automatic URL Type Detection: Automatically detects whether a URL is RSS or HTML
- Robust XML Parsing: Handles malformed RSS feeds with automatic XML cleanup
- Favicon Display: Shows source favicons next to news items
- Time Filtering: Filter news by publication time (e.g., last 4 hours)
- Scrolling Display: Smooth scrolling animation for multiple news items
- Hebrew Support: Optimized for Hebrew text display
- Navigate to your MagicMirror modules directory:
cd ~/MagicMirror/modules
- Clone this repository:
git clone https://github.com/yourusername/MMM-IsraelNews.git
- Install dependencies:
cd MMM-IsraelNews
npm install
Add the module to your config/config.js
file:
{
module: "MMM-IsraelNews",
position: "lower_third",
config: {
numLines: 10,
scrollSpeed: 200,
updateInterval: 300,
newsHoursBack: 4,
urls: [
"https://www.ynet.co.il/Integration/StoryRss1854.xml",
"https://www.israelhayom.co.il/israelnow"
]
}
}
{
module: "MMM-IsraelNews",
position: "lower_third",
config: {
numLines: 15,
scrollSpeed: 150,
updateInterval: 300,
newsHoursBack: 6,
urls: [
// RSS feeds (recommended - reliable and fast)
"https://www.ynet.co.il/Integration/StoryRss1854.xml",
"https://www.srugim.co.il/feed",
"https://rss.walla.co.il/feed/22",
// HTML sources (for sites without RSS feeds)
{
url: "https://example-news-site.com/flash/",
type: "html",
selector: ".news-item",
titleSelector: ".headline",
linkSelector: "a"
},
// RSS with explicit type (optional)
{
url: "https://www.maariv.co.il/Rss/RssFeedsMivzakiChadashot",
type: "rss"
}
]
}
}
Option | Default | Description |
---|---|---|
numLines |
10 |
Number of news lines to display at once |
scrollSpeed |
200 |
Speed of scrolling animation (milliseconds per item) |
updateInterval |
300 |
Update interval in seconds (300 = 5 minutes) |
newsHoursBack |
4 |
Show news from the last X hours only |
urls |
[] |
Array of news source URLs (supports mixed format) |
For RSS feeds, you can use simple string URLs:
urls: [
"https://www.ynet.co.il/Integration/StoryRss1854.xml",
"https://www.srugim.co.il/feed"
]
For explicit control over source types:
urls: [
{
url: "https://www.ynet.co.il/Integration/StoryRss1854.xml",
type: "rss"
},
{
url: "https://www.israelhayom.co.il/israelnow",
type: "html"
}
]
You can mix both formats in the same configuration:
urls: [
"https://www.ynet.co.il/Integration/StoryRss1854.xml", // Auto-detected as RSS
{
url: "https://www.israelhayom.co.il/israelnow",
type: "html"
}
]
- Ynet:
https://www.ynet.co.il/Integration/StoryRss1854.xml
- Srugim:
https://www.srugim.co.il/feed
- Walla:
https://rss.walla.co.il/feed/22
- Maariv:
https://www.maariv.co.il/Rss/RssFeedsMivzakiChadashot
- Israel Hayom RSS:
https://www.israelhayom.co.il/rss
For HTML sources that don't provide RSS feeds, you can specify CSS selectors to scrape content:
urls: [
{
url: "https://www.kan.org.il/newsflash/",
type: "html",
selector: ".flashes-item", // Main container selector
titleSelector: ".flashes-item", // Title text selector (can be same as main)
linkSelector: "a", // Link selector (optional)
dateSelector: ".date-class" // Date selector (optional)
}
]
Option | Default | Description |
---|---|---|
type |
"rss" |
Set to "html" for HTML scraping |
selector |
".flashes-item" |
CSS selector for news item containers |
titleSelector |
Same as selector |
CSS selector for title text within each item |
linkSelector |
"a" |
CSS selector for links within each item (optional) |
dateSelector |
null |
CSS selector for date within each item (optional, uses current time if not found) |
The module uses the rss-parser
library to fetch and parse RSS feeds. It includes robust error handling for malformed XML:
- Direct Parsing: Attempts to parse the RSS feed directly
- XML Cleanup: If parsing fails, cleans common XML issues (unescaped ampersands, control characters)
- Retry Parsing: Attempts to parse the cleaned XML
For HTML sources, the module uses Cheerio to parse the page and extract news items:
- HTTP Request: Fetches the HTML page using axios
- DOM Parsing: Parses the HTML using Cheerio (server-side jQuery)
- Content Extraction: Uses CSS selectors to extract title, link, and date information
- Link Resolution: Converts relative links to absolute URLs
For sites with server-side rendered content, the module can scrape HTML:
Example configuration for a hypothetical static HTML news site:
{
url: "https://example-news-site.com/flash/",
type: "html",
selector: ".news-item", // CSS selector for news containers
titleSelector: ".headline", // Selector for title within each item
linkSelector: "a", // Selector for links (optional)
dateSelector: ".timestamp" // Selector for dates (optional)
}
Known Limitations:
- Sites that load content via JavaScript (like Kan News Flash) will not work with HTML scraping
- Consider using RSS feeds when available for better reliability
The module automatically detects URL types based on patterns:
- URLs containing
.xml
,/rss
, or/feed
are treated as RSS - Other URLs are treated as HTML
- You can override detection by explicitly setting the
type
field
rss-parser
: For parsing RSS feedscheerio
: For HTML parsing (future HTML scraping features)axios
: For HTTP requests
The module uses the following CSS classes:
.MMM-IsraelNews
: Main container.news-container
: Container for news items.news-item
: Individual news item.news-icon-time
: Container for favicon and timestamp.news-favicon
: News source favicon.news-time
: Publication timestamp.news-headline
: News headline text
If you see XML parsing errors, the module will automatically attempt to clean and re-parse the feed. Check the console logs for detailed error information.
- Check that your URLs are accessible
- Verify the
newsHoursBack
setting isn't too restrictive - Check console logs for error messages
- Reduce the number of sources in
urls
- Increase
updateInterval
to reduce fetch frequency - Check network connectivity to news sources
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
This project is licensed under the MIT License. See the LICENSE file for details.