ajithkp560

Terminal Media Downloader(Adv.)

May 21st, 2012
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.09 KB | None | 0 0
  1. #If You Like This Share It Through Facebook and Twitter
  2.  
  3. #Examples
  4. #URL To Media:http://sport-wallpaper.com/wallpaper/elektric-hd-desktop-theme.jpg
  5. #Name:Wallpaper.jpg
  6.  
  7. #Alfa Version:YouTube Downloader
  8.  
  9.  
  10. #Ramesh Kavullapurayil
  11.  
  12. #Greets To All Indian Hackers
  13. #TeamOpenFire
  14. #Indian Snakes Hackers
  15. #Coded32
  16. #Pivot, Toofan, Angeera, GreenBoy, Codesmasher,$p1|{3 B07,Parinda, Prabhjot,
  17. #Outsider,Hangslasher, Unhapy Stifler.
  18.  
  19. #Connect Me FaceBook: www.facebook.com/ajithkp560
  20. #Twitter: www.twitter.com/ajithkp560
  21. #Advanced From Last Post
  22.  
  23.  
  24. import urllib
  25.  
  26.  
  27. print "MediaFile Saver"
  28.  
  29. print "\n\n\t|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
  30. print "\t|||||                                                       |||||"
  31. print "\t|||||                                                       |||||"
  32. print "\t|||||        Coded By Ajith KP:::Coded By Ajith KP          |||||"
  33. print "\t|||||                                                       |||||"
  34. print "\t||||| [email protected]         [email protected] |||||"
  35. print "\t|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
  36.  
  37.  
  38. try:
  39.     url = raw_input("URL To Media File:")
  40.     url = url.replace("http://","")
  41.     print "\nGive Name For Save. Eg. Music.mp3, Video.flv, etc."
  42.     filename = raw_input("Name:")
  43.     print ("\t\n\nSaving "+filename+".....")
  44.     cobra = urllib.urlopen('http://'+url)
  45.     files = open(filename, 'wb')
  46.     meta = cobra.info()
  47.     filesize = int (meta.getheaders ("Content-Length")[0])
  48.     print "\t\nDownloading: %s Bytes: %s" % (filename, filesize)
  49.     filesizedown = 0
  50.     blocksize = 10000
  51.  
  52.     while True:
  53.         buffer = cobra.read(blocksize)
  54.         if not buffer:
  55.             break
  56.  
  57.         filesizedown += len(buffer)
  58.         files.write(buffer)
  59.         percent = r"%10d  [%3.2f%%]" % (filesizedown, filesizedown * 100. / filesize)
  60.         percent = percent + chr (8)*(len(percent)+1)
  61.         print percent,
  62.        
  63.     files.close()
  64.     raw_input("\t\n\nDownload Complete...")
  65. except (KeyboardInterrupt, SystemExit):
  66.     print "\t[x] Session cancelled"
Add Comment
Please, Sign In to add comment