getVideo/utils.py


Home Back

import sys,requests,os

def getConfigDirPath():
    from os.path import expanduser
    home = expanduser("~")
    if sys.platform == 'win32': 
        configDir=home+"\\AppData\\Local\\getvideo\\"
    elif  sys.platform == 'linux':
        configDir=home+"/.config/getvideo/"
    elif sys.platform== "darwin":
        configDir=home+"/.config/getvideo/"    
    else:
        configDir=home+"/.config/getvideo/"
    
    return configDir 


# https://yt-dl.org/downloads/latest/youtube-dl.exe

def downloadFile(url, dest):
    myfile = requests.get(url)
    open(dest, 'wb').write(myfile.content)

def getDownloadPath():
    from os.path import expanduser
    home = expanduser("~")
    download=os.path.join(home,"GetVideo")
    return download

Powered by Code, a simple repository browser by Fabio Di Matteo