Created
January 11, 2015 14:46
-
-
Save BastinRobin/8cc7d25f6691de107326 to your computer and use it in GitHub Desktop.
Youtube Scrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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