2.3 KiB
Facebook to RSS Scraper
This tool scrapes public posts from a Facebook page and converts them into an RSS feed (.xml). It can be run locally or automated using GitHub Actions.
Prerequisites
- Python 3.9+
- pip (Python package installer)
Local Installation & Usage
-
Clone the repository:
git clone <repository-url> cd fb-rss-bridge -
Install dependencies: It is recommended to use a virtual environment.
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt -
Run the scraper:
python3 main.py <page_name>Replace
<page_name>with the Facebook page ID or username.Options:
--output: Specify output file name (default:feed.xml)--pages: Number of pages to scrape (default: 1)
Example:
python3 main.py GitHub --pages 2 --output github_feed.xml
GitHub Actions Automated Feed (Free Cloud Solution)
This repository is configured to run automatically on GitHub's free tier for public repositories.
-
How it works:
- The
.github/workflows/update_feed.ymlfile defines a "cron job" that runs every 6 hours. - It spins up a temporary server (runner), installs Python, runs the script, and saves the
feed.xmlback to your code. - This entire process is free for public repositories on GitHub.
- The
-
Configuration: The workflow is scheduled to run every 6 hours. You can customize the target Facebook page in
.github/workflows/update_feed.yml:env: FB_PAGE_NAME: "GitHub" # Change this to the desired page ID/username -
Getting your RSS Link: To make the generated
feed.xmlaccessible to your RSS reader, you must enable GitHub Pages:- Go to your repository Settings tab.
- On the left sidebar, click Pages.
- Under Build and deployment / Branch, select
main(ormaster) and click Save. - Wait a minute or two. GitHub will deploy your site.
- Your RSS feed URL will be:
https://<your-username>.github.io/<repo-name>/feed.xml
Example: If your username is
nthrmand the repo isfb-rss-bridge, the link is:https://nthrm.github.io/fb-rss-bridge/feed.xml