Delete playlist items
Closed this issue · 3 comments
On the main documentation page https://pypi.org/project/pytuber/ the software lists the following:
Update youtube playlist items (add/remove)
However, I don't see an example of removing an item from a playlist. What I am looking for is a way to delete all playlist items from a playlist. Does pytuber have that function? If not, I request that it be added.
Thanks
Peter
Hi @peliopoulos
The push command actually performs a sync between your local and youtube playlsits, there is no need to add/remove things manually.
If you have removed some items from a local playlist use the push command, preferably with the --tracks
and the service will compute the difference between local and youtube and make all the necessary changes.
let me know if you need further help,
Thanks @tefra, I'm not looking for it for my own videos from a local playlist, I want to do the following steps in order:
- I have YT playlists that I save videos to that I want to watch later
- detect when videos are added to the playlist (Zapier with webhook)
- detect the webhook to download the playlists full of videos to my computer in separate folders (youtube-dl)
- upload them to a cloud drive (using rclone)
- delete the videos from the playlists (manually right now, but hopefully automatically)
- sync the cloud drive to my phone
I have the other steps figured out, just the step deleting the playlists is slowing me down. There is an api function available for it, so I just need to figure out some way to actually write a python script to do it. If I can pull it off, it will be a really fun Rube Goldberg process - I haven't even listed the Wake On Lan steps running on the Raspberry Pi!
I am not saying it's not possible but I believe you should use the google api directly. pytuber is a cli tool to sync local playlists imported from last.fm or from a .m3u, .jspf, .xspf file to youtube.
But if you insist and you want to use my internal api wrapper and you know the playlist item id already then something like that should work.
from pytuber.core.models import PlaylistItem
from pytuber.core.services import YouService
item = PlaylistItem(id="xxx", name="", artist="", video_id="") # only the id is necessary for the remove api call
YouService.remove_playlist_item(item)
But again just dig into that method and copy/keep what you need and don't use the whole pytuber library for something that you can rewrite in a couple of minutes.