feat:add RSSHub RSSHubAccessKey

This commit is contained in:
Twelveeee
2025-11-06 11:06:26 +08:00
parent bc54cc852e
commit f67db8ea86
2 changed files with 1 additions and 2 deletions

View File

@@ -134,7 +134,6 @@ type ScrapeSource struct {
type ScrapeSourceRSS struct {
URL string `yaml:"url,omitempty" json:"url,omitempty" desc:"The URL of the RSS feed. e.g. http://localhost:1200/github/trending/daily/any. You can not set it when rsshub_route_path is set."`
RSSHubRoutePath string `yaml:"rsshub_route_path,omitempty" json:"rsshub_route_path,omitempty" desc:"The RSSHub route path of the RSS feed. e.g. github/trending/daily/any. It will be joined with the rsshub_endpoint as the final URL."`
// RSSHubAccessKey string `yaml:"rsshub_access_key,omitempty" json:"rsshub_access_key,omitempty" desc:"The access key for accessing RSSHub routes. If set, it will be appended as a query parameter to the URL."`
}
type RewriteRule struct {

View File

@@ -48,7 +48,7 @@ func (c *ScrapeSourceRSS) Validate() error {
}
// Append access key as query parameter if provided
if c.RSSHubAccessKey != "" && !strings.Contains(c.URL, "key=") {
if c.RSSHubEndpoint != "" && c.RSSHubAccessKey != "" && !strings.Contains(c.URL, "key=") {
if strings.Contains(c.URL, "?") {
c.URL += "&key=" + c.RSSHubAccessKey
} else {