diff --git a/lib/Parser/XML/Feed.php b/lib/Parser/XML/Feed.php
index a6701aa..d0a1c55 100644
--- a/lib/Parser/XML/Feed.php
+++ b/lib/Parser/XML/Feed.php
@@ -90,7 +90,7 @@ class Feed extends Construct implements \MensBeam\Lax\Parser\Feed {
$feed->summary = $this->getSummary();
$feed->dateModified = $this->getDateModified();
$feed->icon = $this->getIcon();
- //$feed->image = $this->getImage();
+ $feed->image = $this->getImage();
//$feed->people = $this->getPeople();
//$feed->categories = $this->getCategories();
//$feed->entries = $this->getEntries($feed);
@@ -170,11 +170,11 @@ class Feed extends Construct implements \MensBeam\Lax\Parser\Feed {
}
public function getImage(): ?Url {
- return $this->fetchUrl("atom:logo") // Atom logo URL
- ?? $this->fetchUrl("(rss0:image|rss1:image)/url") // RSS 0.90 or RSS 1.0 channel image
- ?? $this->fetchUrl("(/rss0:image|/rss1:image)/url") // RSS 0.90 or RSS 1.0 root image
- ?? $this->fetchUrl("image/url") // RSS 2.0 channel image
- ?? $this->fetchURL("(apple:image|gplay:image)/@href"); // iTunes or Google Play podcast image
+ return $this->fetchUrl("atom:logo") // Atom logo URL
+ ?? $this->fetchUrl("rss0:image/rss0:url|rss1:image/rss1:url") // RSS 0.90 or RSS 1.0 channel image
+ ?? $this->fetchUrl("/rdf:RDF/rss0:image/rss0:url|/rdf:RDF/rss1:image/rss1:url") // RSS 0.90 or RSS 1.0 root image
+ ?? $this->fetchUrl("image/url") // RSS 2.0 channel image
+ ?? $this->fetchUrl("(apple:image|gplay:image)/@href"); // iTunes or Google Play podcast image
}
public function getCategories(): CategoryCollection {
diff --git a/tests/cases/XML/feed-atom.yaml b/tests/cases/XML/feed-atom.yaml
index 2abd1c2..878414f 100644
--- a/tests/cases/XML/feed-atom.yaml
+++ b/tests/cases/XML/feed-atom.yaml
@@ -435,3 +435,13 @@ Reversed shortcut icon relation URL:
format: atom
version: '1.0'
icon: 'http://example.com/'
+
+Logo URL:
+ input: >
+
+ http://example.com/
+
+ output:
+ format: atom
+ version: '1.0'
+ image: 'http://example.com/'
diff --git a/tests/cases/XML/feed-other.yaml b/tests/cases/XML/feed-other.yaml
index 526de13..48770e9 100644
--- a/tests/cases/XML/feed-other.yaml
+++ b/tests/cases/XML/feed-other.yaml
@@ -83,3 +83,21 @@ Google Play summary:
format: rss
summary:
plain: 'Plain text'
+
+iTunes image:
+ input: >
+
+
+
+ output:
+ format: rss
+ image: 'http://example.com/'
+
+Google Play image:
+ input: >
+
+
+
+ output:
+ format: rss
+ image: 'http://example.com/'
diff --git a/tests/cases/XML/feed-rss0.yaml b/tests/cases/XML/feed-rss0.yaml
index 15add05..ec1fb86 100644
--- a/tests/cases/XML/feed-rss0.yaml
+++ b/tests/cases/XML/feed-rss0.yaml
@@ -59,9 +59,9 @@ Feed link:
input: >
-
- http://[example.net]/
- http://example.com/
+
+ http://[example.net]/
+ http://example.com/
output:
@@ -73,7 +73,7 @@ Feed title 1:
input: >
- Loose text
+ Loose text
output:
@@ -86,7 +86,7 @@ Feed title 2:
input: >
- Loose text
+ Loose text
output:
@@ -100,7 +100,7 @@ Feed summary:
input: >
- Loose text
+ Loose text
output:
@@ -108,3 +108,47 @@ Feed summary:
version: '0.90'
summary:
loose: 'Loose text'
+
+Feed channel image:
+ input: >
+
+
+
+ http://example.com/
+
+
+
+ output:
+ format: rdf
+ version: '0.90'
+ image: 'http://example.com/'
+
+Feed root image:
+ input: >
+
+
+
+ http://example.com/
+
+
+ output:
+ format: rdf
+ version: '0.90'
+ image: 'http://example.com/'
+
+Feed channel and root images:
+ input: >
+
+
+ http://example.net/
+
+
+
+ http://example.com/
+
+
+
+ output:
+ format: rdf
+ version: '0.90'
+ image: 'http://example.com/'
diff --git a/tests/cases/XML/feed-rss1.yaml b/tests/cases/XML/feed-rss1.yaml
index c2c48fb..518c31e 100644
--- a/tests/cases/XML/feed-rss1.yaml
+++ b/tests/cases/XML/feed-rss1.yaml
@@ -295,3 +295,47 @@ Multiple DC dates:
format: rdf
version: '1.0'
dateModified: '2020-03-03T00:00:00-04:00'
+
+Feed channel image:
+ input: >
+
+
+
+ http://example.com/
+
+
+
+ output:
+ format: rdf
+ version: '1.0'
+ image: 'http://example.com/'
+
+Feed root image:
+ input: >
+
+
+
+ http://example.com/
+
+
+ output:
+ format: rdf
+ version: '1.0'
+ image: 'http://example.com/'
+
+Feed channel and root images:
+ input: >
+
+
+ http://example.net/
+
+
+
+ http://example.com/
+
+
+
+ output:
+ format: rdf
+ version: '1.0'
+ image: 'http://example.com/'
diff --git a/tests/cases/XML/feed-rss2.yaml b/tests/cases/XML/feed-rss2.yaml
index a676416..4ccfcc1 100644
--- a/tests/cases/XML/feed-rss2.yaml
+++ b/tests/cases/XML/feed-rss2.yaml
@@ -370,3 +370,14 @@ Multiple dates 2:
output:
format: rss
dateModified: '2020-03-03T00:00:00-04:00'
+
+Channel image:
+ input: >
+
+
+ http://example.com/
+
+
+ output:
+ format: rss
+ image: 'http://example.com/'