add fallback for socialblade API failures

This commit is contained in:
Niko Storni 2020-08-08 02:31:26 +02:00
parent 7c02c5b92d
commit 7e83b17b69

View file

@ -75,7 +75,8 @@ func (s *Sync) walletSetup() error {
videosOnYoutube, err := ytapi.CountVideosInChannel(s.DbChannelData.ChannelId)
if err != nil {
return err
logUtils.SendErrorToSlack(errors.FullTrace(errors.Prefix("failed to get video count through socialblade. Falling back to API count", err)))
videosOnYoutube = int(s.DbChannelData.TotalVideos)
}
log.Debugf("Source channel has %d videos", videosOnYoutube)
@ -416,7 +417,7 @@ func (s *Sync) ensureChannelOwnership() error {
//}
var locations []jsonrpc.Location = nil
if channelInfo.Topbar.DesktopTopbarRenderer.CountryCode != "" {
locations = []jsonrpc.Location{{Country: util.PtrToString(channelInfo.Topbar.DesktopTopbarRenderer.CountryCode)}}
locations = []jsonrpc.Location{{Country: &channelInfo.Topbar.DesktopTopbarRenderer.CountryCode}}
}
var c *jsonrpc.TransactionSummary
claimCreateOptions := jsonrpc.ClaimCreateOptions{