Open In App
Related Articles

Pafy – Getting Description of the Video

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
In this article we will see how we can get the description of the given youtube video in pafy. Pafy is a python library to download YouTube content and retrieve metadata. Pafy object is the object which contains all the information about the given video. A YouTube video description is the text below each of your videos. It helps viewers find the content and decide whether to watch it. We can get the pafy object with the help of new method, below is the command to get the pafy object for given video
video = pafy.new(url)
The video url should exist on youtube as it get the information of those videos which are present on the youtube. YouTube is an American online video-sharing platform. In order to do this we use description attribute with the pafy object of video
Syntax : video.description Argument : It takes no argument Return : It returns string
Below is the implementation
# importing pafy
import pafy 
    
# url of video 
url = "https://www.youtube.com / watch?v = vG2PNdI8axo"
    
# getting video
video = pafy.new(url) 
  
# getting description of the video
value = video.description
  
# printing the value
print(value)

                    
Output :
Still having doubts about this course? Well, don't worry, that's how we humans are coded. But clear all your doubts by heading to the course page of the DSA Self Paced Course: https://practice.geeksforgeeks.org/co...
The course is a bestseller and one of the most promising courses for Data Structures and Algorithms by GeeksforGeeks till date. Register Now: https://practice.geeksforgeeks.org/co...

Please Like, Comment and Share the Video among your friends.

Install our Android App:
https://play.google.com/store/apps/de...

If you wish, translate into the local language and help us reach millions of other geeks:
http://www.youtube.com/timedtext_cs_p...

Follow us on Facebook:
https://www.facebook.com/GfGVideos/

And Twitter:
ht=tps://twitter.com/gfgvideos

Also, Subscribe if you haven't already! :)
Another example
# importing pafy
import pafy 
    
# url of video 
url = "https://www.youtube.com / watch?v = 3QKiK4rJIB0"
    
# getting video
video = pafy.new(url) 
  
# getting description of the video
value = video.description
  
  
# printing the value
print("Video description : " + str(value))

                    
Output :
Video description : None


Last Updated : 20 Jul, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads