fix: episode image retrival

This commit is contained in:
Michel Roux 2024-01-11 23:54:21 +01:00
parent 767a6e9bac
commit b2f2a96f2b
1 changed files with 4 additions and 16 deletions

View File

@ -61,14 +61,9 @@ class EpisodeActionReader
// Get episode image
$image = $this->stringOrNull($item->image->url);
$itemChildren = $item->children('http://www.itunes.com/dtds/podcast-1.0.dtd');
if (!$image && $itemChildren) {
$imageAttributes = (array) $itemChildren->image->attributes();
$image = $this->stringOrNull(array_key_exists('href', $imageAttributes) ? (string) $imageAttributes['href'] : '');
}
if (!$image && $iTunesItemChildren) {
$image = $this->stringOrNull($iTunesItemChildren->image['href']);
$imageAttributes = $iTunesItemChildren->image->attributes();
$image = $this->stringOrNull($imageAttributes ? (string) $imageAttributes->href : '');
}
if (!$image) {
@ -76,15 +71,8 @@ class EpisodeActionReader
}
if (!$image && $iTunesChannelChildren) {
$image = $this->stringOrNull($iTunesChannelChildren->image['href']);
}
if (!$image) {
$channelChildren = $channel->children('http://www.itunes.com/dtds/podcast-1.0.dtd');
if ($channelChildren) {
$imageAttributes = (array) $channelChildren->image->attributes();
$image = $this->stringOrNull(array_key_exists('href', $imageAttributes) ? (string) $imageAttributes['href'] : '');
}
$imageAttributes = $iTunesChannelChildren->image->attributes();
$image = $this->stringOrNull($imageAttributes ? (string) $imageAttributes->href : '');
}
if (!$image) {