Skip to content

Commit

Permalink
Modify the if-else statements to switch statements in accordance with…
Browse files Browse the repository at this point in the history
… the linter
  • Loading branch information
Qeynos authored Sep 16, 2024
1 parent f366016 commit 50629f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/reader/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,13 @@ func fetchBilibiliWatchTime(websiteURL string) (int, error) {

bilibiliVideoId := bilibiliVideoIdRegex.FindStringSubmatch(websiteURL)
var bilibiliApiURL string
if bilibiliVideoId[1] != "" {
switch {
case bilibiliVideoId[1] != "":
bilibiliApiURL = "https://api.bilibili.com/x/web-interface/view?aid=" + bilibiliVideoId[1]
} else if bilibiliVideoId[2] != "" {
case bilibiliVideoId[2] != "":
bilibiliApiURL = "https://api.bilibili.com/x/web-interface/view?bvid=" + bilibiliVideoId[2]
} else {
return 0, errors.New("video id has not found")
default:
return 0, fmt.Errorf("video id has not found")
}

responseHandler := fetcher.NewResponseHandler(requestBuilder.ExecuteRequest(bilibiliApiURL))
Expand Down

0 comments on commit 50629f2

Please sign in to comment.