问题
I am trying to build an app to download YouTube videos in python using pytube3.
But I am unable to retrieve the title of the video.
Here goes my code:
from pytube import YouTube
yt = YouTube(link)
print(yt.title)
No matter whatever is the link I always get the title returned as YouTube
instead of title of the video.
Is there anyway to fix it?
回答1:
try this instead
yt.streams[0].title
or
yt.streams[0].default_filename
来源:https://stackoverflow.com/questions/62652157/getting-the-title-of-youtube-video-in-pytube3