Ver Fonte

fix: panic during YouTube channel feed discovery

Regression introduced in commit e54825b
Frédéric Guillot há 1 ano atrás
pai
commit
79ea9e28b5
1 ficheiros alterados com 3 adições e 2 exclusões
  1. 3 2
      internal/reader/subscription/finder.go

+ 3 - 2
internal/reader/subscription/finder.go

@@ -87,10 +87,11 @@ func (f *SubscriptionFinder) FindSubscriptions(websiteURL, rssBridgeURL string)
 		return Subscriptions{NewSubscription(responseHandler.EffectiveURL(), responseHandler.EffectiveURL(), feedFormat)}, nil
 	}
 
-	subscriptions := make(Subscriptions, 1)
+	var subscriptions Subscriptions
 
 	// Step 2) Parse URL to find feeds from YouTube.
 	kind, _, err := youtubeURLIDExtractor(websiteURL)
+	slog.Debug("YouTube URL ID extraction", slog.String("website_url", websiteURL), slog.Any("kind", kind), slog.Any("err", err))
 
 	// If YouTube url has been detected, return the YouTube feed
 	if err == nil || !errors.Is(err, errNotYoutubeUrl) {
@@ -393,6 +394,6 @@ func youtubeURLIDExtractor(websiteURL string) (idKind youtubeKind, id string, er
 		id = decodedUrl.Query().Get("list")
 		return
 	}
-	err = fmt.Errorf("unable to extract youtube id from URL: %s", websiteURL)
+	err = fmt.Errorf("finder: unable to extract youtube id from URL: %s", websiteURL)
 	return
 }