我想要此RSS Feed中的Media:thumbnail! https://myanimelist.net/rss/news.xml。
有人可以帮助我解析可以解析“ Media:thumbnail”的PHP解析器吗?
<?php
//Feed URLs
$feeds = array(
"https://myanimelist.net/rss/news.xml",
);
$entries = simplexml_load_file('http://myanimelist.net/rss/news.xml');
//Read each feed's items
$entries = array();
foreach($feeds as $feed) {
$xml = simplexml_load_file($feed);
$entries = array_merge($entries, $xml->xpath("//item"));
}
//Sort feed entries by pubDate
usort($entries, function ($feed1, $feed2) {
return strtotime($feed2->pubDate) - strtotime($feed1->pubDate);
});
// Photo
$photo = $entries->xpath ('channel/item/media:thumbnail');
foreach ($photo as $Photos) {
}
?>
<ul>
<?php
$NUMITEMS = 5;
$count = 0;
//Print all the entries
foreach($entries as $entry){
?>
<hr>
<div id="block">
<li><a href="<?= $entry->link ?>"><?= $entry->title ?></a></li>
<p><?= $entry->atom ?></p>
<p class="text"><?= $entry->description ?></p></li>
<p class="date"><?= strftime('Op %d/%m/%Y en om %H:%M', strtotime($entry->pubDate)) ?></p>
<img class="img" src="<?= $Photos; ?>">laden...</img>
</div>
<?php
if(++$count >= $NUMITEMS) break;
}
标题,描述,链接和日期很好用,但是Media:thumbnail不能用!