diff --git a/api/apiconv.go b/api/apiconv.go index e69de29..2376028 100644 --- a/api/apiconv.go +++ b/api/apiconv.go @@ -0,0 +1,7 @@ +// Copyright 2017 YTD Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// apiconv: Converts downloaded flv file to mp3. + +package api diff --git a/api/apiconv_test.go b/api/apiconv_test.go index e69de29..5db1c3e 100644 --- a/api/apiconv_test.go +++ b/api/apiconv_test.go @@ -0,0 +1,7 @@ +// Copyright 2017 YTD Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// apiconv_test: Tests apiconv.go + +package api diff --git a/api/apidata.go b/api/apidata.go index 8ba93a8..32f429a 100644 --- a/api/apidata.go +++ b/api/apidata.go @@ -1,9 +1,10 @@ // Copyright 2017 YTD Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -// Download Youtube video data as mp3 -package ytdata +// apidata: Processes requests to Youtube API, downloads video streams + +package api import ( "flag" @@ -12,11 +13,11 @@ import ( "os" "strings" - "code.google.com/p/google-api-go-client/youtube/v3" + "google.golang.org/api/youtube/v3" ) //Youtube Downloader Data file. -type Ytdd struct { +type ApiData struct { FileName string Title string description string @@ -35,6 +36,20 @@ var ( privacy = flag.String("privacy", "unlisted", "Video privacy status") ) + +//Searches and returns channel lists by username. +func channelsListByUsername(service *youtube.Service, part string, forUsername string) { + call := service.Channels.List(part) + call = call.ForUsername(forUsername) + response, err := call.Do() + handleError(err, "") + fmt.Println(fmt.Sprintf("This channel's ID is %s. Its title is '%s', "+ + "and it has %d views.", + response.Items[0].Id, + response.Items[0].Snippet.Title, + response.Items[0].Statistics.ViewCount)) +} + func main() { flag.Parse() diff --git a/api/apidata_test.go b/api/apidata_test.go index e69de29..a9838f3 100644 --- a/api/apidata_test.go +++ b/api/apidata_test.go @@ -0,0 +1,7 @@ +// Copyright 2017 YTD Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// apidata_test: Tests apidata + +package api diff --git a/api/apisearch.go b/api/apisearch.go index e5d2b94..aee8074 100644 --- a/api/apisearch.go +++ b/api/apisearch.go @@ -1,9 +1,10 @@ // Copyright 2017 YTD Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -// Search Youtube API for Video Data -package ytdata +// apisearch: Performs search queries on Youtube and returns results. + +package api import ( "flag" diff --git a/api/apisearch_test.go b/api/apisearch_test.go index e69de29..0af420a 100644 --- a/api/apisearch_test.go +++ b/api/apisearch_test.go @@ -0,0 +1,8 @@ +// Copyright 2017 YTD Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// apisearch_test: Tests api_search + +package api +