Merge branch 'youtube-lib-fix'
This commit is contained in:
commit
4fda52d531
3 changed files with 33 additions and 14 deletions
30
Gopkg.lock
generated
30
Gopkg.lock
generated
|
@ -1,6 +1,18 @@
|
|||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/PuerkitoBio/goquery"
|
||||
packages = ["."]
|
||||
revision = "09540e565986583836b5fc792fe951ec5fd201dd"
|
||||
version = "v1.3.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/andybalholm/cascadia"
|
||||
packages = ["."]
|
||||
revision = "901648c87902174f774fac311d7f176f8647bdaa"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/aws/aws-sdk-go"
|
||||
packages = [
|
||||
|
@ -121,12 +133,6 @@
|
|||
revision = "3433f3ea46d9f8019119e7dd41274e112a2359a9"
|
||||
version = "0.2.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/kkdai/youtube"
|
||||
packages = ["."]
|
||||
revision = "ac4c6cefe62a7eb2e894cb37014ee63eb7c12b8e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/lbryio/lbryschema.go"
|
||||
|
@ -139,6 +145,12 @@
|
|||
packages = ["."]
|
||||
revision = "00c29f56e2386353d58c599509e8dc3801b0d716"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/nikooo777/ytdl"
|
||||
packages = ["."]
|
||||
revision = "64fe19bb69f66746824eb7812caf9f382c0e0bd8"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/shopspring/decimal"
|
||||
packages = ["."]
|
||||
|
@ -195,7 +207,9 @@
|
|||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
"context/ctxhttp"
|
||||
"context/ctxhttp",
|
||||
"html",
|
||||
"html/atom"
|
||||
]
|
||||
revision = "803fdb99c0f72e493c28ef2099d250a9c989d8ff"
|
||||
|
||||
|
@ -229,6 +243,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "f682d1d74ea3bad9f49de558985c802ba82f08d8aa6b6593891226d8441e5824"
|
||||
inputs-digest = "d09cbc6007ff3e80d5f89504e55bc464289f7dfca50d90b708ee23fcb4577e37"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/kkdai/youtube"
|
||||
name = "github.com/nikooo777/ytdl"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/lbryio/lbry.go/errors"
|
||||
"github.com/lbryio/lbry.go/jsonrpc"
|
||||
|
||||
ytdl "github.com/kkdai/youtube"
|
||||
"github.com/nikooo777/ytdl"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"google.golang.org/api/youtube/v3"
|
||||
)
|
||||
|
@ -103,16 +103,21 @@ func (v YoutubeVideo) download() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
downloader := ytdl.NewYoutube(false)
|
||||
err = downloader.DecodeURL("https://www.youtube.com/watch?v=" + v.id)
|
||||
videoUrl := "https://www.youtube.com/watch?v=" + v.id
|
||||
videoInfo, err := ytdl.GetVideoInfo(videoUrl)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = downloader.StartDownload(videoPath)
|
||||
|
||||
var downloadedFile *os.File
|
||||
downloadedFile, err = os.Create(v.getFilename())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
defer downloadedFile.Close()
|
||||
|
||||
return videoInfo.Download(videoInfo.Formats.Best(ytdl.FormatAudioEncodingKey)[0], downloadedFile)
|
||||
}
|
||||
|
||||
func (v YoutubeVideo) triggerThumbnailSave() error {
|
||||
|
|
Loading…
Reference in a new issue