mirror of
https://github.com/R0m1k3/podcastic.git
synced 2026-10-23 23:18:05 +02:00
feat: implement podcast discovery with PodcastIndex API integration and Discover page
This commit is contained in:
1 parent
d7f158a498
commit
9bb61cc8a7
10 files changed
+1254
-5
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import api from './api';
|
||||
|
||||
export interface DiscoveryPodcast {
|
||||
id: string;
|
||||
title: string;
|
||||
rssUrl: string;
|
||||
description: string;
|
||||
author?: string;
|
||||
imageUrl?: string;
|
||||
language?: string;
|
||||
episodeCount?: number;
|
||||
}
|
||||
|
||||
export interface DiscoveryResponse {
|
||||
source: 'podcastindex' | 'local';
|
||||
podcasts: DiscoveryPodcast[];
|
||||
count: number;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export const discoveryService = {
|
||||
discoverPodcasts: async (
|
||||
query: string,
|
||||
limit: number = 20,
|
||||
offset: number = 0
|
||||
): Promise<DiscoveryResponse> => {
|
||||
const response = await api.get('/podcasts/discover', {
|
||||
params: { q: query, limit, offset },
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
getTrendingPodcasts: async (limit: number = 20): Promise<DiscoveryResponse> => {
|
||||
const response = await api.get('/podcasts/trending', {
|
||||
params: { limit },
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
subscribeFromDiscovery: async (
|
||||
rssUrl: string,
|
||||
metadata?: {
|
||||
title?: string;
|
||||
author?: string;
|
||||
imageUrl?: string;
|
||||
}
|
||||
): Promise<{ message: string; podcast: any }> => {
|
||||
const response = await api.post('/podcasts/subscribe-discovery', {
|
||||
rssUrl,
|
||||
...metadata,
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user