A REST API that searches WXYC playlist archives and returns archive.wxyc.org URLs for playback.
- Runtime: Node.js with TypeScript
- Framework: Hono
- HTML Parsing: cheerio
- Testing: Vitest
- Deployment: Railway
npm installRun the development server:
npm run devThe server starts on http://localhost:3000 by default. Set the PORT environment variable to change this.
npm run buildnpm testSearch WXYC playlist archives. Returns results from the last 2 weeks with archive playback URLs.
Query Parameters:
| Param | Description |
|---|---|
q |
General search term (searches all fields) |
artist |
Filter by artist name |
song |
Filter by song title |
album |
Filter by album/release name |
At least one parameter is required.
Example Request:
curl "http://localhost:3000/search?q=radiohead"
curl "http://localhost:3000/search?artist=radiohead&song=creep"Example Response:
{
"results": [
{
"artist": "Radiohead",
"song": "Creep",
"album": "Pablo Honey",
"label": "Capitol",
"showDate": "2024-03-29",
"showTime": "8:00 AM - 10:00 AM",
"dj": "DJ Deceitful",
"archiveUrl": "https://archive.wxyc.org/?t=20240329080000"
}
],
"total": 1
}Health check endpoint for deployment platforms.
Response:
{
"status": "ok"
}- Install the Railway CLI
- Run
railway initto create a new project - Run
railway upto deploy
The npm run start script is configured for production deployments.
wxyc-archive-search/
├── src/
│ ├── index.ts # Hono app and routes
│ ├── services/
│ │ ├── playlist.ts # Search and parse playlist results
│ │ └── show.ts # Fetch and parse show details
│ ├── utils/
│ │ └── date.ts # Date parsing and archive URL generation
│ └── types.ts # TypeScript interfaces
├── test/
│ ├── fixtures/ # Sample HTML files for testing
│ ├── playlist.test.ts
│ ├── show.test.ts
│ └── date.test.ts
├── package.json
├── tsconfig.json
└── README.md
- User makes a search request with query parameters
- Service fetches results from the WXYC playlist proxy
- HTML table is parsed to extract search results
- Results are filtered to entries from the last 2 weeks
- For each result, the show detail page is fetched to get DJ name and show time
- Archive URLs are constructed using the show start time
- JSON response is returned with all metadata and archive URLs
ISC