Skip to content

Commit c69b8ff

Browse files
committed
cleanup
1 parent 66fffbb commit c69b8ff

File tree

2 files changed

+35
-79
lines changed

2 files changed

+35
-79
lines changed

src/config/swagger.ts

Lines changed: 3 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,7 @@ const options: swaggerJsdoc.Options = {
88
info: {
99
title: 'Open Podcast Analytics API',
1010
version: version,
11-
description: `
12-
# Open Podcast Analytics API
13-
14-
Comprehensive podcast analytics API providing metrics from multiple platforms including Spotify, Apple Podcasts, and custom hosting providers.
15-
16-
## Available Data
17-
18-
### Spotify Data
19-
- Episode and podcast streams (starts and completed streams, daily granularity)
20-
- Listener counts (unique listeners over time)
21-
- Followers of the podcast (daily snapshots)
22-
- Episode performance (median listen percentage, median seconds, percentiles, listen-through curves on a per-second basis)
23-
- Audience demographics (age groups, gender, country, at both episode and podcast level)
24-
- Podcast metadata (episode titles, descriptions, artwork, URLs, release dates, explicit flag, duration, language)
25-
- Historical metadata snapshots (track changes over time)
26-
- Impressions and funnel data (total impressions, impressions by source such as home, search, library, other, funnel stages from impressions to considerations to streams, conversion percentages per day)
27-
28-
### Apple Podcasts Data
29-
- Episode metadata (episode name, collection/podcast name, release datetime, GUID, episode number, type)
30-
- Episode details (plays, total time listened, unique engaged listeners, unique listeners, engaged plays vs. total plays)
31-
- Playback histograms (listen-through on a time-bucket basis, top countries and cities, median listeners at different quarters of the episode)
32-
- Trends (daily episode-level metrics: plays, total time listened, unique listeners, engaged listeners)
33-
- Trends (daily podcast-level metrics: same as above, aggregated across episodes)
34-
- Listening time split by followers vs. non-followers
35-
- Follower statistics (total followers, unfollowers, gained/lost per day)
36-
37-
### General Metrics
38-
- Plays, streams, downloads (episode and podcast level, daily)
39-
- Listen-through data (per-second or per-bucket playback curves, histograms, medians, percentiles)
40-
- Audience demographics (age, gender, country)
41-
- Followers and subscribers (absolute numbers and gained/lost trends)
42-
- Impressions and funnel steps (Spotify)
43-
- Metadata (titles, descriptions, release dates, artwork, language)
44-
- Historical snapshots (to track changes over time)
45-
46-
## Authentication
47-
48-
All endpoints require a Bearer token in the Authorization header:
49-
50-
\`\`\`
51-
Authorization: Bearer YOUR_TOKEN
52-
\`\`\`
53-
54-
## Date Parameters
55-
56-
Most endpoints accept date range parameters:
57-
- \`start\`: Start date in YYYY-MM-DD format
58-
- \`end\`: End date in YYYY-MM-DD format
59-
`,
11+
description: 'Podcast analytics API providing metrics from Spotify, Apple Podcasts, and custom hosting providers. See https://github.com/openpodcast/api/blob/main/docs/AVAILABLE_QUERIES.md for a complete list of available queries.',
6012
contact: {
6113
name: 'Open Podcast',
6214
url: 'https://openpodcast.dev',
@@ -127,28 +79,8 @@ Most endpoints accept date range parameters:
12779
],
12880
tags: [
12981
{
130-
name: 'Spotify',
131-
description: 'Spotify podcast analytics endpoints',
132-
},
133-
{
134-
name: 'Apple Podcasts',
135-
description: 'Apple Podcasts analytics endpoints',
136-
},
137-
{
138-
name: 'Episodes',
139-
description: 'Episode-level metrics across platforms',
140-
},
141-
{
142-
name: 'Podcast',
143-
description: 'Podcast-level metrics and metadata',
144-
},
145-
{
146-
name: 'Hoster',
147-
description: 'Generic hosting provider metrics',
148-
},
149-
{
150-
name: 'Charts',
151-
description: 'Chart rankings and positions',
82+
name: 'Analytics',
83+
description: 'Query podcast analytics data from multiple sources',
15284
},
15385
],
15486
},

src/index.ts

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,18 @@ app.get(
280280
* get:
281281
* summary: Get analytics data for a podcast
282282
* description: |
283-
* Returns analytics data for a specific podcast and query endpoint.
283+
* Query analytics data for a specific podcast.
284284
*
285-
* Supports multiple data sources (Spotify, Apple Podcasts, generic hosters) and various metrics including:
286-
* - Episode and podcast performance metrics
287-
* - Audience demographics
288-
* - Listen-through data
289-
* - Follower statistics
290-
* - Chart rankings
285+
* The `query` parameter specifies which metric to retrieve. Common queries include:
286+
* - `reportSpotifyPodcastBaseMetrics` - Spotify podcast metrics (streams, listeners, followers)
287+
* - `reportApplePodcastBaseMetrics` - Apple Podcasts metrics (plays, listeners, engagement)
288+
* - `episodesTotalMetrics` - Combined episode metrics across platforms
289+
* - `reportHosterPlatforms` - Platform/app distribution (e.g., Apple Podcasts, Spotify, Overcast)
290+
* - `reportHosterClients` - Client/device distribution
291291
*
292-
* Results can be returned in JSON or CSV format.
292+
* See [AVAILABLE_QUERIES.md](https://github.com/openpodcast/api/blob/main/docs/AVAILABLE_QUERIES.md) for the complete list of 50+ available queries.
293+
*
294+
* Results can be returned in JSON (default) or CSV format by appending `/csv` to the path.
293295
* tags:
294296
* - Analytics
295297
* parameters:
@@ -344,21 +346,43 @@ app.get(
344346
* properties:
345347
* query:
346348
* type: string
349+
* example: reportHosterPlatforms
347350
* podcastId:
348351
* type: string
352+
* example: "123"
349353
* date:
350354
* type: string
351355
* format: date-time
356+
* example: "2024-09-24T12:00:00Z"
352357
* startDate:
353358
* type: string
354359
* format: date
360+
* example: "2024-08-01"
355361
* endDate:
356362
* type: string
357363
* format: date
364+
* example: "2024-08-31"
358365
* data:
359366
* type: array
360367
* items:
361368
* type: object
369+
* example:
370+
* meta:
371+
* query: reportHosterPlatforms
372+
* podcastId: "123"
373+
* date: "2024-09-24T12:00:00Z"
374+
* startDate: "2024-08-01"
375+
* endDate: "2024-08-31"
376+
* data:
377+
* - platform_name: "Apple Podcasts"
378+
* total_downloads: 15420
379+
* percentage: 45.2
380+
* - platform_name: "Spotify"
381+
* total_downloads: 10280
382+
* percentage: 30.1
383+
* - platform_name: "Overcast"
384+
* total_downloads: 4120
385+
* percentage: 12.1
362386
* text/csv:
363387
* schema:
364388
* type: string

0 commit comments

Comments
 (0)