Skip to content

Commit 627b155

Browse files
Merge pull request #51 from kirbylife/podverse-search-provider
Add podverse search provider
2 parents 598573f + b28efe5 commit 627b155

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

src/gpodder/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def _load_plugins(self):
9393
'gpodder.plugins.itunes',
9494
'gpodder.plugins.youtube',
9595
'gpodder.plugins.vimeo',
96+
'gpodder.plugins.podverse',
9697

9798
# Directory plugins
9899
'gpodder.plugins.gpoddernet',

src/gpodder/plugins/podverse.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# gpodder.plugins.podverse: podverse.fm directory integration (2024-03-12)
3+
# Copyright (c) 2024, kirbylife <[email protected]>
4+
#
5+
# Permission to use, copy, modify, and/or distribute this software for any
6+
# purpose with or without fee is hereby granted, provided that the above
7+
# copyright notice and this permission notice appear in all copies.
8+
#
9+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10+
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11+
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12+
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13+
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14+
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15+
# PERFORMANCE OF THIS SOFTWARE.
16+
#
17+
18+
19+
import gpodder
20+
21+
from gpodder import util
22+
from gpodder import registry
23+
from gpodder import directory
24+
25+
import logging
26+
import urllib.parse
27+
28+
logger = logging.getLogger(__name__)
29+
30+
31+
@registry.directory.register_instance
32+
class PodverseSearchProvider(directory.Provider):
33+
def __init__(self):
34+
self.name = 'Podverse search'
35+
self.kind = directory.Provider.PROVIDER_SEARCH
36+
self.priority = directory.Provider.PRIORITY_SECONDARY_SEARCH
37+
38+
def on_search(self, query):
39+
json_url = "https://api.podverse.fm/api/v1/podcast?page=1&searchTitle={}&sort=top-past-week".format(urllib.parse.quote(query))
40+
41+
result_data = []
42+
json_data = util.read_json(json_url)[0]
43+
44+
for entry in json_data:
45+
if entry["credentialsRequired"]:
46+
continue
47+
48+
title = entry["title"]
49+
url = entry["feedUrls"][0]["url"]
50+
image = entry["imageUrl"]
51+
description = entry["description"]
52+
53+
result_data.append(directory.DirectoryEntry(title, url, image, -1, description))
54+
55+
return result_data

0 commit comments

Comments
 (0)