This project provides scripts and a database for querying and managing RSS feed information using Python and SQLite.
- Python 3.7+ (comes with
sqlite3module) - SQLite (for direct DB inspection, optional)
- Download the SQLite tools zip for Windows.
- Extract the contents to a folder (e.g.,
C:\sqlite). - Add the folder to your system
PATH(optional, for command-line access).
sudo apt update
sudo apt install sqlite3-
Open a terminal or command prompt in the project directory.
-
Create a virtual environment:
python -m venv env
-
Activate the environment:
- Windows (PowerShell):
.\env\Scripts\Activate.ps1
- Windows (cmd):
.\env\Scripts\activate.bat
- Linux/macOS:
source env/bin/activate
- Windows (PowerShell):
-
Install dependencies (No Current Requirements):
pip install -r requirements.txt
Note: The built-in
sqlite3module does not need to be installed.
-
Make sure your virtual environment is activated.
-
Run the desired script. For example:
python SearchDB.py
or
python Query_All_Records.py
-
The script will connect to the SQLite database and output the results to the console.
You can specify filter variables (such as subscription, catdesc, name, or id) by editing the script directly in the if __name__ == "__main__": section.
For example, in SearchDB.py:
# Query the database with optional parameters:
if __name__ == "__main__":
# Get the directory where this script is located
base_dir = Path(__file__).parent
# Build paths relative to the script location
db_path = base_dir / 'rssfeeds.db'
sql_path = base_dir / 'SearchDB.sql'
# Parameters for the search
subscription = ''
catdesc = ''
name = ''
id = None
try:
DBresults = searchDB(db_path, sql_path, subscription, catdesc, name, id)
print(DBresults)
except Exception as e:
print(f"Error: {e}")
# Total number of records returned
print(f"\033[92mRecord Count: {len(DBresults)}\033[0m")Tip:
- Leave a variable as an empty string (
'') orNoneif you do not want to filter by that field. - You can combine filters as needed.
If you want to allow users to specify filters from the command line, you can add argument parsing with the argparse module.
Example usage (after modifying the script):
python SearchDB.py --subscription No --catdesc News --name Fox --id 10- You can modify the SQL queries in
SearchDB.sqlfile to change what data is returned. - Update the script parameters to filter results as needed.
MIT License