From f6dc952551caf0d7e83deec472c714849e851ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Thu, 25 Jul 2024 20:31:30 -0700 Subject: [PATCH] feat: add support for base element when discovering feeds --- internal/reader/subscription/finder.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/reader/subscription/finder.go b/internal/reader/subscription/finder.go index ee5ff24c..945fd1c6 100644 --- a/internal/reader/subscription/finder.go +++ b/internal/reader/subscription/finder.go @@ -147,6 +147,13 @@ func (f *SubscriptionFinder) FindSubscriptionsFromWebPage(websiteURL, contentTyp return nil, locale.NewLocalizedErrorWrapper(err, "error.unable_to_parse_html_document", err) } + if hrefValue, exists := doc.Find("head base").First().Attr("href"); exists { + hrefValue = strings.TrimSpace(hrefValue) + if urllib.IsAbsoluteURL(hrefValue) { + websiteURL = hrefValue + } + } + var subscriptions Subscriptions subscriptionURLs := make(map[string]bool) for query, kind := range queries {