Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -63,21 +63,23 @@ def search_pexels_videos(
|
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
| 70 |
_handle_provider_error(result)
|
| 71 |
return result
|
| 72 |
|
| 73 |
-
|
| 74 |
@app.get("/api/providers/audiobook/genres/{genre}")
|
| 75 |
def get_audiobooks_by_genre(genre: str):
|
| 76 |
-
"""Fetches audiobooks for a specific genre."""
|
| 77 |
result = audiobook_provider.get_by_genre(genre=genre)
|
| 78 |
_handle_provider_error(result)
|
| 79 |
return result
|
| 80 |
|
|
|
|
|
|
|
| 81 |
@app.get("/api/providers/audiobook/content/{gutenberg_id}")
|
| 82 |
def get_audiobook_content(gutenberg_id: str):
|
| 83 |
"""Gets text content (cover image and clean text) from Gutenberg."""
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
+
|
| 67 |
+
@app.get("/api/providers/audiobook/search")
|
| 68 |
+
def search_audiobooks(q: str, by: str = "title"):
|
| 69 |
+
"""Searches for audiobooks by title or author."""
|
| 70 |
+
result = audiobook_provider.search(query=q, search_by=by)
|
| 71 |
_handle_provider_error(result)
|
| 72 |
return result
|
| 73 |
|
|
|
|
| 74 |
@app.get("/api/providers/audiobook/genres/{genre}")
|
| 75 |
def get_audiobooks_by_genre(genre: str):
|
| 76 |
+
"""Fetches audiobooks for a specific genre (only books with Gutenberg text available)."""
|
| 77 |
result = audiobook_provider.get_by_genre(genre=genre)
|
| 78 |
_handle_provider_error(result)
|
| 79 |
return result
|
| 80 |
|
| 81 |
+
|
| 82 |
+
|
| 83 |
@app.get("/api/providers/audiobook/content/{gutenberg_id}")
|
| 84 |
def get_audiobook_content(gutenberg_id: str):
|
| 85 |
"""Gets text content (cover image and clean text) from Gutenberg."""
|