Skip to content

Commit

Permalink
chore(youtube): limit max number of suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaraa committed Apr 22, 2024
1 parent b654e65 commit 788c54b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion services/youtube/youtube.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ func SearchSuggestions(query string) (sugesstions []string, err error) {
panic(err)
}

for _, res := range results[1].([]any) {
for i, res := range results[1].([]any) {
if i >= 9 { // max displayed suggestions is 10
break
}
sugesstions = append(sugesstions, res.(string))
}

Expand Down

0 comments on commit 788c54b

Please sign in to comment.