You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

get.go 784B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package apiclassic
  2. import (
  3. "github.com/terorie/yt-mango/data"
  4. "errors"
  5. )
  6. func GetVideo(v *data.Video) error {
  7. if len(v.ID) == 0 { return errors.New("no video ID") }
  8. // Download the doc tree
  9. doc, err := GrabVideo(v.ID)
  10. if err != nil { return err }
  11. // Parse it
  12. p := parseInfo{v, doc}
  13. err = p.parse()
  14. if err != nil { return err }
  15. return nil
  16. }
  17. func GetVideoSubtitleList(v *data.Video) (err error) {
  18. tracks, err := GrabSubtitleList(v.ID)
  19. if err != nil { return }
  20. for _, track := range tracks.Tracks {
  21. v.Subtitles = append(v.Subtitles, track.LangCode)
  22. }
  23. return
  24. }
  25. func GetChannel(c *data.Channel) error {
  26. return errors.New("not implemented")
  27. }
  28. func GetChannelVideoURLs(channelID string, page uint) ([]string, error) {
  29. return nil, errors.New("not implemented")
  30. }