Constructor
class Playlist(link, cookies)
class Playlist(link, cookies)
- Represents a YouTube playlist and manages its videos using a Playlist Manager.
Parameters:
Properties
link
str
link
str
- The URL to the playlist.
playlistId
str
playlistId
str
- Returns the unique identifier of the playlist.
title
str
title
str
- Returns the playlist title.
description
str
description
str
- Returns the playlist description.
type
str
type
str
- Returns the availability type of the playlist. (
"private" or "public"
)
videos
MyTube.PlaylistManager
videos
MyTube.PlaylistManager
-
Returns the Playlist Manager for accessing the videos.
Does not containDeletedVideo objects.
raw_videos
list
raw_videos
list
-
Returns the raw list of Playlist Video objects.
May containDeletedVideo objects.
Example
Get playlist info
import MyTube
link = "https://www.youtube.com/playlist?list=PLBnetXbvs5BGzGIsoxe6MYhX1hB7iRoOD"
p = MyTube.Playlist(link)
print(p.type)
print(p.title)
print(p.description)
print(len(p.videos), "videos")
public
Youtube Rewind (2010-2020)
All the YouTube Rewinds so far.
11 videos
Cookies example
import json
import MyTube
with open("my_cookies.json", 'r') as f:
cookies = json.loads(f.read())
p = MyTube.Playlist(link, cookies=cookies)
print(p.type)
print(p.title)
Get video's basic info
This method does not make additional requests to YouTube.
import MyTube
link = "https://www.youtube.com/playlist?list=PLBnetXbvs5BGzGIsoxe6MYhX1hB7iRoOD"
p = MyTube.Playlist(link)
for video in p.raw_videos:
if video:
print(video.title)
print(video.link)
YouTube Rewind 2010: Year in Review
https://www.youtube.com/watch?v=UFnXm6cjGwU
YouTube Rewind 2011
https://www.youtube.com/watch?v=SmnkYyHQqNs
Rewind YouTube Style 2012
https://www.youtube.com/watch?v=iCkYw3cRwLo
YouTube Rewind: What Does 2013 Say?
https://www.youtube.com/watch?v=H7jtC8vjXw8
YouTube Rewind: Turn Down for 2014
https://www.youtube.com/watch?v=zKx2B8WCQuw
YouTube Rewind: Now Watch Me 2015 | #YouTubeRewind
https://www.youtube.com/watch?v=KK9bwTlAvgo
YouTube Rewind: The Ultimate 2016 Challenge | #YouTubeRewind
https://www.youtube.com/watch?v=_GuOjXYl5ew
YouTube Rewind: The Shape of 2017 | #YouTubeRewind
https://www.youtube.com/watch?v=FlsCjmMhFmw
YouTube Rewind 2018: Everyone Controls Rewind | #YouTubeRewind
https://www.youtube.com/watch?v=YbJOTdZBX1g
YouTube Rewind 2019: For the Record | #YouTubeRewind
https://www.youtube.com/watch?v=2lAe1cqCOXo
Youtube Rewind 2020, Thank God It's Over
https://www.youtube.com/watch?v=PKtnafFtfEo
To manually load lazy video, execute load().
raw_videos may also containDeletedVideo, so it is recommended to check for this to avoid an error.
Get playlist's videos streams
import MyTube
link = "https://www.youtube.com/playlist?list=PLBnetXbvs5BGzGIsoxe6MYhX1hB7iRoOD"
p = MyTube.Playlist(link)
for video in p.videos:
print(video.title)
print(video.streams)
YouTube Rewind 2010: Year in Review
StreamsManager(29 streams)
[pause]
YouTube Rewind 2011
StreamsManager(24 streams)
[pause]
Rewind YouTube Style 2012
StreamsManager(24 streams)
[pause]
YouTube Rewind: What Does 2013 Say?
StreamsManager(24 streams)
[pause]
YouTube Rewind: Turn Down for 2014
StreamsManager(24 streams)
[pause]
YouTube Rewind: Now Watch Me 2015 | #YouTubeRewind
StreamsManager(24 streams)
[pause]
YouTube Rewind: The Ultimate 2016 Challenge | #YouTubeRewind
StreamsManager(28 streams)
[pause]
YouTube Rewind: The Shape of 2017 | #YouTubeRewind
StreamsManager(35 streams)
[pause]
YouTube Rewind 2018: Everyone Controls Rewind | #YouTubeRewind
StreamsManager(35 streams)
[pause]
YouTube Rewind 2019: For the Record | #YouTubeRewind
StreamsManager(35 streams)
[pause]
Youtube Rewind 2020, Thank God It's Over
StreamsManager(93 streams)