https://github.com/drhdev/rss2supabase
A simple python script that reads an RSS feed and publishes new entries to Supabase.
https://github.com/drhdev/rss2supabase
Last synced: 10 months ago
JSON representation
A simple python script that reads an RSS feed and publishes new entries to Supabase.
- Host: GitHub
- URL: https://github.com/drhdev/rss2supabase
- Owner: drhdev
- License: gpl-3.0
- Created: 2025-03-18T20:52:00.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-18T21:17:34.000Z (11 months ago)
- Last Synced: 2025-03-18T21:38:23.138Z (11 months ago)
- Language: Python
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RSS2Supabase
## Overview
**RSS2Supabase** is a Python script that fetches an RSS feed, processes new entries, and stores them in a **Supabase** database. It ensures data integrity, retries on network failures, and logs each step for debugging.
## Features
- Fetches and parses RSS feeds.
- Avoids duplicates by checking existing entries in Supabase.
- Implements error handling and retry logic for network failures.
- Logs all actions for debugging.
- Uses UTF-8 encoding to prevent character corruption.
- Secure API credentials using `.env` file.
## Prerequisites
- Python 3.8+
- A **Supabase** account
- An active RSS feed URL
## Installation
### 1. Clone the Repository
```bash
git clone https://github.com/yourusername/rss2supabase.git
cd rss2supabase
```
### 2. Install Dependencies
```bash
pip install -r requirements.txt
```
### 3. Set Up Environment Variables
Create a `.env` file in the root directory and add:
```ini
SUPABASE_URL=your-supabase-url
SUPABASE_KEY=your-supabase-api-key
RSS_FEED_URL=https://example.com/rss.xml
```
### 4. Run the Script
```bash
python rss2supabase.py
```
## Database Schema (Supabase)
Make sure you have a `rss_entries` table in your Supabase database:
```
CREATE TABLE rss_entries (
id BIGSERIAL PRIMARY KEY, -- Ensures unique identifier with a larger range
title TEXT NOT NULL CHECK (char_length(title) > 0), -- Ensures title is not empty
content TEXT NOT NULL, -- Can contain large text
published TIMESTAMP WITH TIME ZONE NOT NULL, -- Ensures proper datetime handling
link TEXT NOT NULL UNIQUE CHECK (position('http' IN link) = 1), -- Ensures a valid URL format
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() -- Timestamp of entry insertion
);
```
## Logging
The script generates a `rss2supabase.log` file in the working directory, which is overwritten each time the script runs.
## License
This project is licensed under the **GNU Public License v3**.