From 89fe1e99d666bcb04fd3d1b538f5ba683902de45 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Fri, 12 Jul 2019 01:28:00 +0200 Subject: [PATCH] improve ipv6 validation fix audio merge issue --- go.mod | 1 + go.sum | 1 + sources/youtubeVideo.go | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 572f31f..8bf2a90 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ require ( github.com/ChannelMeter/iso8601duration v0.0.0-20150204201828-8da3af7a2a61 github.com/PuerkitoBio/goquery v1.5.0 // indirect github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 // indirect + github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf github.com/aws/aws-sdk-go v1.17.3 github.com/channelmeter/iso8601duration v0.0.0-20150204201828-8da3af7a2a61 // indirect github.com/go-ini/ini v1.42.0 // indirect diff --git a/go.sum b/go.sum index b8d8247..ecce78c 100644 --- a/go.sum +++ b/go.sum @@ -25,6 +25,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 h1:EFSB7Zo9Eg91v7MJPVsifUysc/wPdN+NOnVe6bWbdBM= github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.16.11/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.17.3 h1:KBXxg7Jh0TxE5zmpNB2DwKmJeDUqh0O6jhy25TuYOmc= diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index 24f66e0..bf880bb 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -24,6 +24,7 @@ import ( "github.com/lbryio/ytsync/thumbs" "github.com/ChannelMeter/iso8601duration" + "github.com/asaskevich/govalidator" "github.com/aws/aws-sdk-go/aws" "github.com/shopspring/decimal" log "github.com/sirupsen/logrus" @@ -189,7 +190,7 @@ func getNextIP() (string, error) { for _, address := range addrs { if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() { - if ipnet.IP.To16() != nil && len(ipnet.IP) == net.IPv6len { + if ipnet.IP.To16() != nil && govalidator.IsIPv6(ipnet.IP.String()) { ipPool = append(ipPool, ipnet.IP.String()) } } @@ -225,7 +226,7 @@ func (v *YoutubeVideo) download(youtubeAntiThrottle bool) error { "--no-progress", "--max-filesize", fmt.Sprintf("%dM", v.maxVideoSize), - "-fbestvideo[ext=mp4][height<=1080]+bestaudio", + "-fbestvideo[ext=mp4][height<=1080]+bestaudio[ext!=webm]", "-o" + strings.TrimRight(v.getFullPath(), ".mp4"), "--merge-output-format", "mp4",