This commit is contained in:
Matthieu Grieger 2016-11-05 19:22:58 -07:00
parent 51db9c3061
commit e1e3a334cd

View file

@ -209,6 +209,9 @@ func (yt *YouTube) getTrack(id string, submitter *gumble.User) (bot.Track, error
return bot.Track{}, err return bot.Track{}, err
} }
items, _ := v.GetObjectArray("items") items, _ := v.GetObjectArray("items")
if len(items) == 0 {
return bot.Track{}, errors.New("This YouTube video is private")
}
item := items[0] item := items[0]
title, _ := item.GetString("snippet", "title") title, _ := item.GetString("snippet", "title")
thumbnail, _ := item.GetString("snippet", "thumbnails", "high", "url") thumbnail, _ := item.GetString("snippet", "thumbnails", "high", "url")