Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/batteredbunny/youtube_scraper
Youtube metadata scraping library for golang
https://github.com/batteredbunny/youtube_scraper
Last synced: 21 days ago
JSON representation
Youtube metadata scraping library for golang
- Host: GitHub
- URL: https://github.com/batteredbunny/youtube_scraper
- Owner: BatteredBunny
- License: gpl-3.0
- Created: 2023-10-23T16:26:07.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-07T11:09:43.000Z (6 months ago)
- Last Synced: 2024-06-21T15:26:53.443Z (5 months ago)
- Language: Go
- Size: 136 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# youtube_scraper
Youtube metadata scraping library for golang
## Features
- Search videos
- View playlist videos
- Fetch basic info about channel and videos from videos and livestreams tabs
- Fetch videos from homepage
- Fetch video metadata
- Fetch video sidebar recommendations (video, playlist, radio)
- Fetch comments and its reply threads
- Fetch non DRM video media URLs
- Export pagination and scraper state to continue later## Example
For more examples please look into the "examples" folder```go
package mainimport (
"encoding/json"
"github.com/BatteredBunny/youtube_scraper"
"log"
)func main() {
c := scraper.NewChannelScraper("@TomScottGo")var printedChannel bool
for {
videos, err := c.NextVideosPage()
if err != nil {
log.Fatal(err)
} else if len(videos) == 0 {
break
}if !printedChannel {
if available, channel := c.GetChannelInfo(); available {
bs, err := json.MarshalIndent(channel, "", " ")
if err != nil {
log.Fatal(err)
}
log.Println(string(bs))
}printedChannel = true
}for _, video := range videos {
log.Println(video.VideoID, video.Title, video.Views)
}
}
}
```