From ee74b0402c7a91ad72c94e0ef5af4729292e8c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9B=9E=E9=A3=8E?= Date: Thu, 19 Mar 2020 17:56:42 +0800 Subject: [PATCH] Update README.md fix the example error occur at `vid.Download(vid.Formats[0], file)`: **vid.Download undefined, (type *ytdl.VideoInfo has no field or method Download)** --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 593eab7..c2ac8eb 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,22 @@ import ( "os" "github.com/rylio/ytdl" + "github.com/rs/zerolog/log" ) func main() { - vid, err := ytdl.GetVideoInfo("https://www.youtube.com/watch?v=WkVvG4QTO9M") + client := ytdl.Client{ + HTTPClient: http.DefaultClient, + Logger: log.Logger, + } + vid, err := client.GetVideoInfo("https://www.youtube.com/watch?v=WkVvG4QTO9M") if err != nil { fmt.Println("Failed to get video info") return } file, _ := os.Create(vid.Title + ".mp4") defer file.Close() - vid.Download(vid.Formats[0], file) + client.Download(vid, vid.Formats[0], file) } ```