parse media:content tags as attachments, some feed content detection tweaks

This commit is contained in:
Andrew Dolgov 2008-05-28 05:34:29 +01:00
parent 225ce6bb48
commit e91ab107a3
1 changed files with 22 additions and 1 deletions

View File

@ -846,6 +846,7 @@
$entry_content = $item["content:escaped"]; $entry_content = $item["content:escaped"];
if (!$entry_content) $entry_content = $item["content:encoded"]; if (!$entry_content) $entry_content = $item["content:encoded"];
if (!$entry_content) $entry_content = $item["content"]["encoded"];
if (!$entry_content) $entry_content = $item["content"]; if (!$entry_content) $entry_content = $item["content"];
// Magpie bugs are getting ridiculous // Magpie bugs are getting ridiculous
@ -853,7 +854,11 @@
if (!$entry_content) $entry_content = $item["atom_content"]; if (!$entry_content) $entry_content = $item["atom_content"];
if (!$entry_content) $entry_content = $item["summary"]; if (!$entry_content) $entry_content = $item["summary"];
if (!$entry_content) $entry_content = $item["description"];
if (!$entry_content ||
strlen($entry_content) < strlen($item["description"])) {
$entry_content = $item["description"];
};
// WTF // WTF
if (is_array($entry_content)) { if (is_array($entry_content)) {
@ -1003,6 +1008,8 @@
} }
} else { } else {
// <enclosure>
$e_ctr = $item['enclosure#']; $e_ctr = $item['enclosure#'];
if ($e_ctr > 0) { if ($e_ctr > 0) {
@ -1023,6 +1030,20 @@
} }
} }
// <media:content>
// can there be many of those? -fox
$m_ctr = $item['media']['content#'];
if ($m_ctr > 0) {
$e_item = array($item['media']['content@url'],
$item['media']['content@medium'],
$item['media']['content@length']);
array_push($enclosures, $e_item);
}
// FIXME: parse more of those, if needed.
} }
# sanitize content # sanitize content