From 223613fa664ede3631e6a866745330b0e6e44c68 Mon Sep 17 00:00:00 2001 From: Edi Piqoni Date: Tue, 24 Sep 2024 20:24:41 +0200 Subject: [PATCH] add https scheme if missing --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 823d6ff..ab8a3e3 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "fmt" + "net/url" "os/exec" "runtime" "time" @@ -149,6 +150,11 @@ func fetchWebsite(url string, updateTextChan chan<- string) { } func fetchRSSArticles(feedURL string) (urls []string, titles []string) { + parsedUrl, err := url.Parse(feedURL) + if err != nil || parsedUrl.Scheme == "" { + feedURL = "https://" + feedURL + } + fp := gofeed.NewParser() feed, err := fp.ParseURL(feedURL) if err != nil {