This project generates a RSS feed for Facebook Marketplace, allowing you to track new ads based on customizable filters.
Note: the code has been tested with Python3
on Linux
and Windows 10
.
Clone the Repository:
git clone https://github.com/regek/facebook-marketplace-rss.git
cd facebook-marketplace-rss
Install Python Requirements:
pip install -r requirements.txt
Install Firefox Browser:
Modify or Create config.json
:
config.json.example
to config.json
and adjust the settings as needed. currency
field.$
, Canada: CA$
, Europe: €
, UK: £
, Australia: A$
Example config.json
:
{
"server_ip": "0.0.0.0", // Listen on all IPs or specify an IP address
"server_port": "5000", // Port for the RSS server
"currency": "$", // Currency used in your local marketplace
"refresh_interval_minutes": 15, // Interval for checking new ads (recommened 15 interval minutes)
"log_filename": "fb-rssfeed.log",
"url_filters": {
"https://www.facebook.com/marketplace/page1": {
"level1": ["tv"],
"level2": ["smart"],
"level3": ["55\"", "55 inch"]
},
"https://www.facebook.com/marketplace/page2": {
"level1": ["dishwasher"],
"level2": ["kitchenaid", "samsung"]
},
"https://www.facebook.com/marketplace/page2": {}
}
}
Configuring URL Filters:
The search function on Facebook Marketplace is incredibly frustrating. It often returns irrelevant results, even when you're searching for something specific. For instance, when you set the filter to "Date listed: Newest First," you might end up with spammy listings rather than relevant items. To improve the chances of finding what you're looking for, make sure to use the search filters.
Define Search Terms: For each URL, specify search terms in levels.
Keywords within a level are OR
operations, and keywords between levels are AND
operations.
Only ad title
is searched
Example:
https://www.facebook.com/marketplace/page1
This configuration will match titles containing "tv" and "smart" and either "55\"" or "55 inch". e.g., TCL 55" smart tv, smart tv 55 inch LG
https://www.facebook.com/marketplace/page2
This will match titles containing "dishwasher" and either "kitchenaid" or "samsung". e.g., samsung dishwasher xyz, slightly used kicthenaid dishwasher
No custom filtering
https://www.facebook.com/marketplace/page2
Initialize the Database:
python init_db.py
Run the Server:
python fb_ad_monitor.py
Feed URL: http://server_ip:server_port/rss
Replace server_ip
and server_port
with your configured values.
Feed Updates: New ads are added to the feed only if they haven't been seen in the past week.
RSS Reader: Use any RSS feed reader to monitor updates. For example, you can use Feedbro.
export LOG_LEVEL=ERROR
/path/to/config/directory
server_ip
and server_port
as default
docker run --name fb-mp-rss -d \
-v /path/to/config/directory:/app/config \
-e CONFIG_FILE=/app/config/config.json \
-p 5000:5000 \
regek/fb-mp-rss:latest