This python script is based on the Youtube data api. This script in particular returns you with the duration of a playlist. For accessing the duration of the playlist you require two things.
- Your own personal api key
- The playlist id which will be available in the url.
You can use the script as follows:
- First install the package using:
pip install -i https://test.pypi.org/simple/ playlistwrapper==0.0.4
- Now, you have to import the package in your code:
from playlistwrapper.playlist import youtube
- Create an object instance for it and pass in the key and the playlist id in double quote as such:
first = youtube("your-key", "playlist id")
- Call the method totalduration as such:
duration = first.totalduration()
- You can also get the video ids of all the videos by calling the method getVideos:
videos = first.getVideos()
Note
This is just a passion project. Google already has a very well coded and documented python client for all of its services google api client