This Discord bot scrapes Craigslist for free items and wanted posts, matches them based on similarity, and sends the results to a Discord channel. It's built with Python, using libraries like requests
, BeautifulSoup
, difflib
, csv
, discord.py
, pandas
, and asyncio
.
- Python 3.6 or higher
- A Discord account and bot token
- Basic knowledge of creating and managing Discord bots
Clone the repository and install the required Python libraries:
git clone https://github.com/crackkillz/freebot.git
cd freebot
pip install requests beautifulsoup4 discord.py pandas
-
Discord Bot Token: Obtain a Discord bot token and replace
YOUR_BOT_TOKEN_PLACEHOLDER
in the script with your actual token. -
Channel and URL Setup: Replace
CHANNEL_ID_PLACEHOLDER
,FREE_SECTION_URL_PLACEHOLDER
, andWANTED_SECTION_URL_PLACEHOLDER
with your Discord channel ID and Craigslist section URLs.
Start the bot by running the following command in your terminal:
python freebot.py
- Craigslist Scraping: Uses BeautifulSoup to scrape Craigslist.
- Matching Logic: Utilizes
difflib.SequenceMatcher
for comparing post titles. - Discord Integration: Sends summaries and individual matches to a Discord channel.
- Error Handling: Basic handling for web requests and Discord interactions.
- You can modify the command prefix, bot token, channel ID, and URLs in the script.
- Adjust the similarity threshold in
find_matches_with_links
for custom matching logic. - Customize the message format sent to Discord in
send_results_to_discord
.
- The bot's functionality is dependent on Craigslist's HTML structure, which is subject to change.
- It does not support real-time monitoring and needs to be run manually.
Contributions are welcome! Please adhere to standard coding practices and document your changes.
This project is open-source and available under the MIT License.
Note: Replace [repository-url]
and [project-directory]
with the actual URL of your repository and the name of your project directory. This README is a guideline and might require adjustments based on your specific requirements and setup.