Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jpastorm/gotube
A youtube library for retrieving metadata, obtaining direct links to video-only/audio-only/mixed versions of videos and download videos.
https://github.com/jpastorm/gotube
download go golang library metadata-extraction url video youtube youtube-downloader
Last synced: 4 days ago
JSON representation
A youtube library for retrieving metadata, obtaining direct links to video-only/audio-only/mixed versions of videos and download videos.
- Host: GitHub
- URL: https://github.com/jpastorm/gotube
- Owner: jpastorm
- License: mit
- Created: 2021-10-17T08:19:27.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-17T03:19:47.000Z (about 2 years ago)
- Last Synced: 2024-06-20T05:28:14.892Z (7 months ago)
- Topics: download, go, golang, library, metadata-extraction, url, video, youtube, youtube-downloader
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gotube
[![Go report](https://goreportcard.com/badge/github.com/jpastorm/gotube)](https://goreportcard.com/report/github.com/jpastorm/gotube)
✨ A youtube library for retrieving metadata, obtaining direct links to video-only/audio-only/mixed versions of videos and download videos.## 🤠 Docs
GoDoc: [https://pkg.go.dev/github.com/jpastorm/gotube](https://godoc.org/github.com/jpastorm/gotube)
## Install
```
go get github.com/jpastorm/gotube
```
## ⚡️ Quickstart```go
package mainimport (
"fmt"
"github.com/jpastorm/gotube"
"log"
"sync"
"time"
)func main() {
var wg sync.WaitGroupwg.Add(3)
fmt.Println("Start Goroutines")go download("./video1", "https://www.youtube.com/watch?v=AvQLyCqOyFs", "video1", &wg)
go download("./video2", "https://www.youtube.com/watch?v=yOt1bL-s0n8", "video2", &wg)
go download("./video3", "https://www.youtube.com/watch?v=P5DeAD_uXE0", "video3", &wg)
go startTimer()
// Wait for the goroutines to finish.
wg.Wait()
fmt.Println("Terminating Program")
}func download(path, url, name string, group *sync.WaitGroup) {
defer group.Done()
yr, err := gotube.GetMetaData(url)
if err != nil {
fmt.Println(err)
}downloadPath, err := gotube.Download(path, yr.StreamingData.Formats[0].URL, name)
if err != nil {
log.Fatalln(err)
}fmt.Println(downloadPath)
}func startTimer() {
for {
time.Sleep(2 * time.Second)
fmt.Println(gotube.GetDownloadProgressList())
}
}
```