--------------------------------------------------------------------------------------- #!/usr/bin/env python3 import re from datetime import datetime from zoneinfo import ZoneInfo from email.utils import format_datetime from hashlib import md5 BASE_FILE = "/var/www/index.html" BASE_URL = "https://yourwebsite.com" OUTPUT_FILE = "/var/www/rss.xml" with open(BASE_FILE, "r", encoding="utf-8") as f: html = f.read() # Match dividers OR

tags (optionally with data-date) pattern = r'(

)|(.*?)

' matches = re.findall(pattern, html, re.DOTALL) posts = [] current_post = None collecting = False # Only collect after a

starts a post for divider, date_str, content in matches: content = content.strip() if divider: # Divider ends the current post collecting = False continue if date_str: # New post starts collecting = True if current_post: posts.append(current_post) current_post = { "date": date_str.strip(), "content": content } elif collecting and current_post: # Continuation paragraph for current post current_post["content"] += "\n\n" + content # Append the last post if current_post: posts.append(current_post) items = [] for post in reversed(posts): # EST timezone + noon to avoid previous-day shift date_obj = datetime.strptime(post["date"], "%Y-%m-%d").replace( hour=12, tzinfo=ZoneInfo("America/New_York") ) full_content = post["content"] # Title: first sentence or first 60 chars title = full_content.split(".")[0][:60] or post["date"] # Unique GUID per post guid_hash = md5(full_content.encode()).hexdigest() items.append(f""" {title} {BASE_URL}/ {BASE_URL}/#{guid_hash} {format_datetime(date_obj)} """) rss = f""" Example {BASE_URL} Daily posts {format_datetime(datetime.now(ZoneInfo("America/New_York")))} {''.join(items)} """ with open(OUTPUT_FILE, "w", encoding="utf-8") as f: f.write(rss) print(f"RSS feed generated with {len(items)} items.") ---------------------------------------------------------------- For each post your going to have to use the data-date format on each post like so >>>>

my new post.

also add a extra

element if you want to add more text into your post . Basically the first p acts as a title of your post. Now for the cron job run crontab -e and insert this 0 * * * * /usr/bin/python3 /var/www/rss.py >> /var/www/rss.log 2>&1 which will run the script every hour to fetch for new posts make sure you copy the script above and paste it where your index.html resides. AND THERE YOU HAVE IT YOUR OWN RSS FEED.