An open API service indexing awesome lists of open source software.

https://github.com/ppalone/ytsearch

🔎 A simple Golang library to get video search results from YouTube
https://github.com/ppalone/ytsearch

Last synced: about 2 months ago
JSON representation

🔎 A simple Golang library to get video search results from YouTube

Awesome Lists containing this project

README

        

# YTSearch

🔎 A simple Golang libary for getting video search results from Youtube (without any kind of API key)

## Installation

```
go get -u github.com/ppalone/ytsearch
```

## Usage

```go
package main

import (
"fmt"

"github.com/ppalone/ytsearch"
)

func main() {
// client
c := ytsearch.Client{}

// search for "nocopyrightsounds"
res, err := c.Search("nocopyrightsounds")
if err != nil {
panic(err)
}

fmt.Println("Search Results:")

// res.Results contains an array of Search results
for _, res := range res.Results {
fmt.Println("Video Title:", res.Title, "Channel:", res.Channel)
}

fmt.Println("Next Search Results:")

// res.Continuation contains continuation token
// can be used to fetch next results
// since youtube limits the number of search results
res, err = c.Next(res.Continuation)
if err != nil {
panic(err)
}

for _, res := range res.Results {
fmt.Println("Video Title:", res.Title, "Channel:", res.Channel)
}
}
```

## Author

Pranjal

## LICENSE

MIT