package
module
Version:
v0.0.0-...-949c81c
Opens a new window with list of versions in this module.
Published: Nov 13, 2018
License: MIT
Opens a new window with license information.
Imports: 12
Opens a new window with list of imports.
Imported by: 2
Opens a new window with list of known importers.
README
¶
gotube
Library meant to improve working with youtube api in Go
Installation
go get -u github.com/Aracki/gotube/...
Authorization
Document which explains how does OAuth 2.0 works for Mobile & Desktop Apps to access Google APIs: https://developers.google.com/youtube/v3/guides/auth/installed-apps
Steps for enabling Youtube API service:
- You need a Google Account to access the Google Developers Console, request an API key, and register your application.
- Create new project on https://console.developers.google.com
- Go to Credentials -> Create credentials -> OAuth client ID
- Select Web Application
- Authorized redirect URIs: http://localhost. (it is the endpoint to which the OAuth 2.0 server can send responses)
- Download
secret.json
file and save it to /etc/youtube/client_secret.json
.
- Make sure YouTube Data API v3 is enabled.
- Start Go app.
- Stdout will print link. Open it up in your browser and select proper Youtube account
- It redirects you to the http://localhost/?state=state-token&code=[code]
- Paste the code from the URL to the shell.
- It will save credential file to:
~/.credentials/youtube-go-quickstart.json
.
- Gotube initialized!
Documentation
¶
type Youtube struct {
Service *youtube.Service
}
New will read from config file
than make youtube client and service according to that client
returns pointer to youtube.Service
The getChannelInfo uses forUsername
to get info (id, tittle, totalViews and description)
Gets all playlists of current user - maxResult is set to 50 (default is 5)
returns array of all playlists (id, name, count)
Gets all the videos of all playlists of mine
Different goroutines are appending the same vds slice;
WaitGroup waits for all goroutines to finish
WriteAllSongsToFile goes through all playlists and write all songs to file
it returns pointer to file
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.