Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
Refactored code base.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyah Check committed Sep 7, 2017
1 parent c004172 commit 935877c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 103 deletions.
7 changes: 0 additions & 7 deletions api/apiconv.go

This file was deleted.

7 changes: 0 additions & 7 deletions api/apiconv_test.go

This file was deleted.

39 changes: 39 additions & 0 deletions api/apidata.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,42 @@ func APIDownloadVideo(videoStream map[string][]string) ([]byte, err) {

return nil
}


//Search youtube API for video data.
func SearchApi(service youtube.Service) {


// Group video, channel, and playlist results in separate lists.
videos := make(map[string]string)
channels := make(map[string]string)
playlists := make(map[string]string)

// Iterate through each item and add it to the correct list.
for _, item := range response.Items {
switch item.Id.Kind {
case "youtube#video":
videos[item.Id.VideoId] = item.Snippet.Title
case "youtube#channel":
channels[item.Id.ChannelId] = item.Snippet.Title
case "youtube#playlist":
playlists[item.Id.PlaylistId] = item.Snippet.Title
}
}

printIDs("Videos", videos)
printIDs("Channels", channels)
printIDs("Playlists", playlists)
}

// Print the ID and title of each result in a list as well as a name that
// identifies the list. For example, print the word section name "Videos"
// above a list of video search results, followed by the video ID and title
// of each matching video.
func APIPrintIDs(sectionName string, matches map[string]string) {
fmt.Printf("%v:\n", sectionName)
for id, title := range matches {
fmt.Printf("[%v] %v\n", id, title)
}
fmt.Printf("\n\n")
}
79 changes: 0 additions & 79 deletions api/apisearch.go

This file was deleted.

8 changes: 0 additions & 8 deletions api/apisearch_test.go

This file was deleted.

1 change: 1 addition & 0 deletions auth/auth_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package auth
2 changes: 0 additions & 2 deletions cmd/ytd/ytd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"net/http"
"net/url"
"os"
"os/user"
"os/strings"
"strconv"
"strings"
"syscall"
Expand Down

0 comments on commit 935877c

Please sign in to comment.