diff options
| author | 2020-04-16 18:11:26 +0200 | |
|---|---|---|
| committer | 2020-04-16 18:11:26 +0200 | |
| commit | bdc4da6ad07f2f5dfa7cf397cf3a379199c0a2ed (patch) | |
| tree | 17d3ce149bf6bdea7aaab3e7672c6b39e2a4a39a /p | |
| parent | 5ddae689535cb5df7ae4d54f0efc3806d71a266c (diff) | |
Expose podcast in API (#2898)
* Expose podcast in API
Expose RSS enclosures in our API, e.g. for clients supporting podcasts
* PHP CS?
* Annoying linter
* Light optimisation
Diffstat (limited to 'p')
| -rw-r--r-- | p/api/greader.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/p/api/greader.php b/p/api/greader.php index 69962e9d5..d538ec429 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -508,6 +508,18 @@ function entriesToArray($entries) { //'htmlUrl' => $line['f_website'], ), ); + foreach ($entry->enclosures() as $enclosure) { + if (!empty($enclosure['url']) && !empty($enclosure['type'])) { + $media = [ + 'href' => $enclosure['url'], + 'type' => $enclosure['type'], + ]; + if (!empty($enclosure['length'])) { + $media['length'] = intval($enclosure['length']); + } + $item['enclosure'][] = $media; + } + } $author = $entry->authors(true); $author = trim($author, '; '); if ($author != '') { |
