Advertisement
Guest User

Untitled

a guest
Sep 9th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. Invalid request URI while adding a video to playlist via youtube api
  2. import getpass
  3. import gdata.youtube
  4. import gdata.youtube.service
  5.  
  6. yt_service = gdata.youtube.service.YouTubeService()
  7.  
  8. # The YouTube API does not currently support HTTPS/SSL access.
  9. yt_service.ssl = False
  10. yt_service = gdata.youtube.service.YouTubeService()
  11. yt_service.email = #myemail
  12. yt_service.password = getpass.getpass()
  13. yt_service.developer_key = #mykey
  14. yt_service.source = #text
  15. yt_service.client_id= #text
  16. yt_service.ProgrammaticLogin()
  17.  
  18. feed = yt_service.GetYouTubePlaylistFeed(username='default')
  19. # iterate through the feed as you would with any other
  20. for entry in feed.entry:
  21. if (entry.title.text == "test"):
  22. lst = entry;
  23. print entry.title.text, entry.id.text
  24.  
  25. custom_video_title = 'my test video on my test playlist'
  26. custom_video_description = 'this is a test video on my test playlist'
  27. video_id = 'Ncakifd_16k'
  28. playlist_uri = lst.id.text
  29.  
  30. playlist_video_entry = yt_service.AddPlaylistVideoEntryToPlaylist(playlist_uri, video_id, custom_video_title, custom_video_description)
  31.  
  32. if isinstance(playlist_video_entry, gdata.youtube.YouTubePlaylistVideoEntry):
  33. print 'Video added'
  34.  
  35. playlist_entry_id = lst.id.text.split('/')[-1]
  36. original_playlist_description = lst.description.text
  37. updated_playlist = yt_service.UpdatePlaylist(playlist_entry_id,'test',original_playlist_description,playlist_private=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement