ytupload.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from simple_youtube_api.Channel import Channel
  2. from simple_youtube_api.LocalVideo import LocalVideo
  3. # loggin into the channel
  4. channel = Channel()
  5. #channel.login("c:\\keys\\client_secret_244642730545-m6s4um0g6p3289ig7k92oseusisibnfp.apps.googleusercontent.com.json","c:\\keys\\cre.storage")
  6. channel.login("c:\\keys\\client_secret_244642730545-m6s4um0g6p3289ig7k92oseusisibnfp.apps.googleusercontent.com.json",storage_path="c:\\tmp\\storage.json")
  7. #, "credentials.storage"
  8. # setting up the video that is going to be uploaded
  9. video = LocalVideo(file_path="C:\\data\\demo\\test.mp4")
  10. # setting snippet
  11. video.set_title("My Title")
  12. video.set_description("This is a description")
  13. video.set_tags(["this", "tag"])
  14. video.set_category("gaming")
  15. video.set_default_language("en-US")
  16. # setting status
  17. video.set_embeddable(True)
  18. video.set_license("creativeCommon")
  19. video.set_privacy_status("private")
  20. video.set_public_stats_viewable(True)
  21. # setting thumbnail
  22. #video.set_thumbnail_path('test_thumb.png')
  23. # uploading video and printing the results
  24. video = channel.upload_video(video)
  25. print(video.id)
  26. print(video)
  27. # liking video
  28. video.like()