Поскольку каждое видео является объектом YouTube, и в документации говорится, что вы можете сделать что-то вроде yt_video.title, я думал, что смогу это сделать:
Код: Выделить всё
from pytube import Playlist
playlist = Playlist('https://www.youtube.com/playlist?list=PLS1QulWo1RIaJECMeUT4LFwJ-ghgoSH6n')
for video in playlist.videos:
print(video.title)
Код: Выделить всё
Traceback (most recent call last):
File "C:\Users\****\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 341, in title
self._title = self.vid_info['videoDetails']['title']
KeyError: 'videoDetails'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\****\Desktop\dev\api\yt.py", line 15, in
print(video.title)
File "C:\Users\****\AppData\Local\Programs\Python\Python39\lib\site-packages\pytube\__main__.py", line 346, in title
raise exceptions.PytubeError(
pytube.exceptions.PytubeError: Exception while accessing title of [youtube]41qgdwd3zAg[/youtube]. Please file a bug report at https://github.com/pytube/pytube
Подробнее здесь: https://stackoverflow.com/questions/792 ... ing-pytube