0
votes

I'm trying to download YouTube videos from a simple self written python script using a "youtube-dl.exe" which I've downloaded. On running the command from cmd ie "c:\youtube-dl.exe https://www.youtube.com/watch?v=Gkk3Kloz-_Y", I'm able to get the video extracted under C:\Users\John but when trying the below python module, I'm unable to detect the video location. -----------------Youtube Downloader Python module------------------------

#!/usr/bin/python -tt
import os
import sys
def main():
   link = raw_input("Please enter the youtube link that you wish to download\n")
   link = "https://" + link
   result = os.system("C:\youtube-dl.exe %s"%(link))
   if result == 0:
        print "The Youtube Video got downloaded and is stored under C:\Users\John folder"
   else:
        print "Sorry! The video couldn't get downloaded"
if __name__ == '__main__':
    main()

Can I somehow know where are the videos getting downloaded. Are they somewhere under C:\Python27\ .... ??

1

1 Answers

1
votes

You could try print(os.path.getcwd()) just before you run the os.system command. That will print Python's working directory, which will hopefully be inherited by the executable and be the place where the file is put (if it isn't, you might need to look at the documentation for the executable).