This project scrapes events from Step Out Buffalo website and generates a formatted email template with the events.
- Node.js (v14 or higher)
- npm (Node Package Manager)
- Buttondown API key
- Install dependencies:
npm install- Set up your API keys:
- Create a
.envfile in the project root - Add your Buttondown API key:
BUTTONDOWN_API_KEY=your-buttondown-api-key-here- Replace the OpenAI API key in
start.jswith your own key:
const openai = new OpenAI({ apiKey: "your-api-key-here", });
- Create a
Run the scraper:
npm startThis will:
- Scrape events from Step Out Buffalo
- Filter for events with zip code 14075
- Take the first 6 events
- Generate a formatted email template
- Send the email via Buttondown API
- Save two files:
populated-email.html: The formatted emaileventsZip14075.json: The raw event data
populated-email.html: The final formatted emaileventsZip14075.json: Raw event data in JSON format
- The script uses Puppeteer with stealth plugin to avoid detection
- Events are filtered for zip code 14075
- The email template is responsive and works on both desktop and mobile
- The script includes rate limiting to avoid overwhelming the target website
- Emails are sent via Buttondown API (initially as drafts for testing)