diff --git a/file_placer.py b/file_placer.py index f7f32fe..3896dc7 100644 --- a/file_placer.py +++ b/file_placer.py @@ -24,6 +24,15 @@ newFolder = input("Please Enter the name of the new Folder: ").title() + try: + os.mkdir(newFolder) + print(f"{newFolder} created successful") + + except FileExistsError: + print(f"{newFolder} already exists") + + else: + if os.path.exists(chgeDirectory): lstDir = os.listdir(os.getcwd()) @@ -39,12 +48,12 @@ else: fileSide.append(check) - if newFolder not in folderSide: - os.mkdir(newFolder) - - print(f"{newFolder} folder created successful") - else: - print(f"{newFolder} folder already exits") + # if newFolder not in folderSide: + # os.mkdir(newFolder) + # + # print(f"{newFolder} folder created successful") + # else: + # print(f"{newFolder} folder already exits") # Differentiate the file from the extension @@ -78,7 +87,7 @@ print(f"{uniqFile} already exists ") for vryFile in lstDir: - #print(vryFile) + # print(vryFile) if os.path.isfile(vryFile): fullPath = os.path.join(chgeDirectory, vryFile) @@ -87,10 +96,8 @@ elif vryFile in fullPath and vryFile in getExistingDir: print(f"{vryFile}, I exits on both path ") - - for chkFolder in folderSide: - # print(chkFolder) + # print(chkFolder) getExistingDir = os.path.join(chgeDirectory, chkFolder) try: @@ -108,14 +115,10 @@ except shutil.Error: print("file already exits") - else: - print("No folder created") + # print("No folder created") # urlLink = "https://www.youtube.com/watch?v=n3IYVthup9I" # # urlLink2 = "https://www.youtube.com/watch?v=PAMpNhx4maM" urlLink3 = "https://www.youtube.com/watch?v=isRtFdu8sRs" - - - diff --git a/pytube_YoutubeDownload.py b/pytube_YoutubeDownload.py index e69de29..7b52ee2 100644 --- a/pytube_YoutubeDownload.py +++ b/pytube_YoutubeDownload.py @@ -0,0 +1,23 @@ +import os +from pytube import YouTube + +dirct = input("Please put the directory here: ") + +if os.getcwd() != dirct: + + os.chdir(dirct) + print(os.getcwd()) + +urlLink = input("Please paste your URL link here: ") + +y = YouTube(urlLink) + +adapt = y.streams.filter(adaptive=True) +print(adapt) + +dwn = y.streams.get_highest_resolution() + + +dwn.download() + +print(f"{dwn.title} download successfully and completed")