Browse Source

parser: support media:content elements within media:group

Andrew Dolgov 7 years ago
parent
commit
4289b68f0d
2 changed files with 24 additions and 0 deletions
  1. 12 0
      classes/feeditem/atom.php
  2. 12 0
      classes/feeditem/rss.php

+ 12 - 0
classes/feeditem/atom.php

@@ -149,6 +149,18 @@ class FeedItem_Atom extends FeedItem_Common {
 			array_push($encs, $enc);
 		}
 
+		$enclosures = $this->xpath->query("media:group/media:content", $this->elem);
+
+		foreach ($enclosures as $enclosure) {
+			$enc = new FeedEnclosure();
+
+			$enc->type = $enclosure->getAttribute("type");
+			$enc->link = $enclosure->getAttribute("url");
+			$enc->length = $enclosure->getAttribute("length");
+
+			array_push($encs, $enc);
+		}
+
 		return $encs;
 	}
 

+ 12 - 0
classes/feeditem/rss.php

@@ -124,6 +124,18 @@ class FeedItem_RSS extends FeedItem_Common {
 			array_push($encs, $enc);
 		}
 
+		$enclosures = $this->xpath->query("media:group/media:content", $this->elem);
+
+		foreach ($enclosures as $enclosure) {
+			$enc = new FeedEnclosure();
+
+			$enc->type = $enclosure->getAttribute("type");
+			$enc->link = $enclosure->getAttribute("url");
+			$enc->length = $enclosure->getAttribute("length");
+
+			array_push($encs, $enc);
+		}
+
 		return $encs;
 	}