Check 'head' and 'body' when searching HTML for feed links.

YouTube, for some reason, puts theirs in 'body'.
This commit is contained in:
wn_ 2024-05-08 23:59:25 +00:00
parent d832907125
commit 7a5ea2a2b9
1 changed files with 2 additions and 2 deletions

View File

@ -2097,8 +2097,8 @@ class Feeds extends Handler_Protected {
$doc = new DOMDocument();
if (@$doc->loadHTML($content)) {
$xpath = new DOMXPath($doc);
$entries = $xpath->query('/html/head/link[@rel="alternate" and '.
'(contains(@type,"rss") or contains(@type,"atom"))]|/html/head/link[@rel="feed"]');
$entries = $xpath->query('/html/*[self::head or self::body]/link[@rel="alternate" and '.
'(contains(@type,"rss") or contains(@type,"atom"))]|/html/*[self::head or self::body]/link[@rel="feed"]');
foreach ($entries as $entry) {
if ($entry->hasAttribute('href')) {