Summary
This script parses articles chosen by the user from various categories (e.g., AI, ML, Tech, Sports, etc.) and creates a Notion page in a database for each article. The workflow is automated using GitHub Actions, allowing users to fetch and store RSS feed data in Notion effortlessly. If the article is one week old, the script will automatically delete the page.
Table of Contents
- Category-Based Parsing: Organize articles by tags like
AI
,ML
,Tech
, and more. - Notion Integration: Automatically create Notion pages for parsed articles.
- Automated Workflow: Runs daily using GitHub Actions or can be triggered manually.
- Article Deletion: Automatically delete articles older than one week.
- Link Validation: Ensure that only valid RSS links are processed using
link_checker.py
.
- Python 3.12.1 or Later: Ensure Python is installed on your local machine.
- Notion Integration: Create an integration and save the token from Notion (Create Integration). Then add your integration to your Notion database (Add Integration to databse + first comment).
- GitHub Secrets Setup:
- Add a secret called
CONFIG_JSON
containing the following:{ "api": "your-notion-api-key", "name": "your-notion-database-name" }
- Add a secret called
To set up the repository locally:
- Clone the repository:
git clone https://github.com/CR0ZER/rss-flow-py-to-notion
cd rss-flow-py-to-notion
- Install dependencies:
pip install -r requirements.txt
To use the script, you will have to manually add these properties in your database:
- Change the
Name
property toTitle
. Category
- Property type: Select - Options:tech news
,data science
,machine learning
,ai
.Content Type
- Property type: Select - Options:Full article
,Summary
.Author
- Property type: Text.Article Date
- Property type: Date.Created Time
- Property type: Created Time (automatic property for page creation date).Link
- Property type: URL.
Do not change property's names.
You can also add more properties in your Notion database, but the script will not fill them.
- Add your RSS feed links to the
rss_links.json
file. - Run the script:
python feed_to_notion.py
- Ensure the workflow file (
.github/workflows/rss_feed_to_notion.yml
) is in place. - Push the repository to GitHub.
- The script will:
- Run daily at 1 AM UTC (configurable in the workflow file).
- Fetch articles and create Notion pages.
To update your RSS feed links, modify your rss_links.json
structure as follows:
{
"rss_feeds": {
"subject 1": [
"link 1",
"link 2"...
],
"subject 2": [
"link 1",
"link 2"...
]...
}
}
Do not forget to add or change subjects in the Category
property in your Notion database.
You can use by yourself the script link_checker.py
to check if the RSS feed link is valid:
python link_checker.py <link>
If the program don't return an error, the link is valid.
The included GitHub Actions workflow file (feed_to_notion_workflow.yml
) is set up to:
- Install Python and dependencies.
- Create a config.json file from the CONFIG_JSON GitHub secret.
- Run the feed_to_notion.py script daily or on manual triggers.
name: RSS Feed to Notion
on:
# Run daily at 1 AM UTC
schedule:
- cron: '0 0 * * *'
# Manually trigger the workflow
workflow_dispatch:
jobs:
sync-rss-to-notion:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v4
# Set up Python 3.12.1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12.1'
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Create config.json from secrets
- name: Create config.json
env:
CONFIG_JSON: ${{ secrets.CONFIG_JSON }}
run: echo $CONFIG_JSON > config.json
# Run the script
- name: Run the script
run: |
python feed_to_notion.py
Feel free to fork this repository and submit pull requests. Ensure you follow these steps:
- Fork the repository.
- Make your changes.
- Test thoroughly.
- Submit a pull request with a clear description.
If you have any questions or suggestions, feel free to open an issue.