Skip to content

Instantly share code, notes, and snippets.

@BastinRobin
Created January 11, 2015 14:46
Show Gist options
  • Save BastinRobin/8cc7d25f6691de107326 to your computer and use it in GitHub Desktop.
Save BastinRobin/8cc7d25f6691de107326 to your computer and use it in GitHub Desktop.
Youtube Scrapper
import pafy
url = raw_input ("Enter your URL : ")
# Instantiation
video = pafy.new (url)
#Users Choice
print "1 => Download || 2 => Extract"
choice = raw_input ( "Input d To Download or ei To Extract Information : ")
#Actions on Choices
if choice == '1' :
#Get the best video url
best = video.getbest ()
#Print relevant information, when downloading the file
best.download (quiet=False)
elif choice == '2' :
print "Title : " + video.title
print "Rating : " + str (video.rating)
print "View Count : " + str (video.viewcount) + "Author : " + video.author + "Length : " + str (video.length)
print "Duration : " + str (video.duration) + "Likes : " + str (video.likes) + "Dislikes : " + str (video.dislikes)
print "Description : " + video.description
print "Published on Date : " + str (video.published)
else :
print "OOps Wrong Choice!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment