1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-09-01 20:23:39 +02:00

[GolemBridge] Fix relative links

By always changing them to absolute ones.
This commit is contained in:
Mynacol
2025-08-28 22:07:00 +00:00
parent 1f5f7bc4ca
commit ff84c3ab90

View File

@@ -72,16 +72,18 @@ class GolemBridge extends FeedExpander
while ($uri) { while ($uri) {
if (isset($urls[$uri])) { if (isset($urls[$uri])) {
// Prevent forever a loop // Prevent loop in navigation links
break; break;
} }
$urls[$uri] = true; $urls[$uri] = true;
$articlePage = getSimpleHTMLDOMCached($uri, static::CACHE_TIMEOUT, static::HEADERS); $articlePage = getSimpleHTMLDOMCached($uri, static::CACHE_TIMEOUT, static::HEADERS);
$articlePage = defaultLinkTo($articlePage, $uri);
// URI without RSS feed reference // URI without RSS feed reference
$item['uri'] = $articlePage->find('head meta[name="twitter:url"]', 0)->content; $item['uri'] = $articlePage->find('head meta[name="twitter:url"]', 0)->content;
// extract categories
if (!array_key_exists('categories', $item)) { if (!array_key_exists('categories', $item)) {
$categories = $articlePage->find('div.go-tag-list__tags a.go-tag'); $categories = $articlePage->find('div.go-tag-list__tags a.go-tag');
foreach ($categories as $category) { foreach ($categories as $category) {
@@ -97,11 +99,7 @@ class GolemBridge extends FeedExpander
// next page // next page
$nextUri = $articlePage->find('li.go-pagination__item--next>a', 0); $nextUri = $articlePage->find('li.go-pagination__item--next>a', 0);
if ($nextUri) { if ($nextUri) {
$nextUri = $nextUri->href; $uri = $nextUri->href;
if (str_starts_with($nextUri, '/')) {
$nextUri = substr($nextUri, 1);
}
$uri = static::URI . $nextUri;
} else { } else {
$uri = null; $uri = null;
} }