diff --git a/dr-feeder.go b/dr-feeder.go index f0a1c1a..cad2ade 100644 --- a/dr-feeder.go +++ b/dr-feeder.go @@ -13,7 +13,7 @@ import ( ) // Version is current `git describe --tags` infomation. -var Version string = "v2.1.0" +var Version string = "v2.1.1" func consume(ch chan common.NotifyPayload, notifiers []notifier.Notifier) { for { diff --git a/watcher/akanno.go b/watcher/akanno.go index 23727ab..c6b6dda 100644 --- a/watcher/akanno.go +++ b/watcher/akanno.go @@ -2,7 +2,9 @@ package watcher import ( "encoding/json" + "fmt" "log" + "math/rand" "strings" "github.com/gocolly/colly/v2" @@ -30,17 +32,21 @@ func NewAkAnnounceWatcher(debugURL string) (Watcher, error) { return watcher, err } +func (watcher akAnnounceWatcher) apiURL() string { + if watcher.debugURL != "" { + return watcher.debugURL + } + clientID := rand.Intn(114514191) + 11451419 + return fmt.Sprintf("%s?sign=%d", + "https://ak-fs.hypergryph.com/announce/IOS/announcement.meta.json", + clientID, + ) +} + func (watcher akAnnounceWatcher) fetchAPI() (announceMeta, error) { - var apiURL string var err error = nil var data announceMeta - if watcher.debugURL != "" { - apiURL = watcher.debugURL - } else { - apiURL = "https://ak-fs.hypergryph.com/announce/IOS/announcement.meta.json?sign=1145141919" - } - c := colly.NewCollector( colly.UserAgent(iOSClientUA), ) @@ -53,7 +59,7 @@ func (watcher akAnnounceWatcher) fetchAPI() (announceMeta, error) { err = json.Unmarshal(r.Body, &data) }) - c.Visit(apiURL) + c.Visit(watcher.apiURL()) c.Wait() return data, err