From 7e83b17b69f991b37faeabcfb7c138ab26b2c435 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Sat, 8 Aug 2020 02:31:26 +0200 Subject: [PATCH] add fallback for socialblade API failures --- manager/setup.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manager/setup.go b/manager/setup.go index ec1e771..17de7fe 100644 --- a/manager/setup.go +++ b/manager/setup.go @@ -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{