use local timezone for youtube-dl, even though its not certain

This commit is contained in:
Alex Grintsvayg 2020-07-27 20:59:47 -04:00
parent 70ad891dfa
commit a05864404d
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5

View file

@ -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) { 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 { if err != nil {
return nil, errors.Err(err) return nil, errors.Err(err)
} }