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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user