From a05864404da99260d872f6bb314806aeddfd9eb8 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Mon, 27 Jul 2020 20:59:47 -0400 Subject: [PATCH] use local timezone for youtube-dl, even though its not certain --- sources/youtubeVideo.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index fd85bf1..b7cf793 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -90,7 +90,9 @@ var youtubeCategories = map[string]string{ } func NewYoutubeVideo(directory string, videoData *ytdl.YtdlVideo, playlistPosition int64, awsConfig aws.Config, stopGroup *stop.Group, pool *ip_manager.IPPool) (*YoutubeVideo, error) { - publishedAt, err := time.Parse("20060102", videoData.UploadDate) + // youtube-dl returns times in local timezone sometimes. this could break in the future + // maybe we can file a PR to choose the timezone we want from youtube-dl + publishedAt, err := time.ParseInLocation("20060102", videoData.UploadDate, time.Local) if err != nil { return nil, errors.Err(err) }