simple Python and Bash to download the .zip archives from Viapath video visits
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

89 lines
2.5 KiB

import customtkinter
import wget
import os
import urllib
import urllib.request
import requests
import fileinput
import zipfile
from pathlib import Path
import glob, os, shutil
p = Path('.')
target_folder = './Videos' + '//'
source_folder = (os.getcwd()) + '//'
def buttonclick():
# CREATE TXT FILE OF LIST
listofurls = urltextbox.get("0.0", "end")
file = open('urls.txt', 'w')
file.write(listofurls)
file.close()
# DOWNLOAD ALL ZIPS
for lines in fileinput.FileInput("urls.txt"):
print(lines)
openurl = wget.download(lines)
for f in p.glob('*.zip'):
with zipfile.ZipFile(f, 'r') as archive:
archive.extractall(path=f'./{f.stem}')
print(f'Done {f.stem}')
# DELETE ALL ZIP FILES
filelist = p.glob(os.path.join("*.zip"))
for f in filelist:
os.remove(f)
# MAKE VIDEOS DIRECTORY AND MOVE FILES
if not os.path.exists('./Videos'):
os.mkdir('./Videos')
for path, dir, files in os.walk(source_folder):
if files:
for file in files:
if not os.path.isfile(target_folder + file):
if file.endswith('.mp4'):
os.rename(path + '//' + file, target_folder + file)
# CLEAN UP EMPTY FOLDERS
base_path = ""
dir_list = glob.iglob(os.path.join(base_path, "channel_package*"))
for path in dir_list:
if os.path.isdir(path):
shutil.rmtree(path)
# SET PROGRESS BAR TO 100% TEMPORARY
progressBar.set(100)
print("Done!")
print("Check the Videos Directory.")
customtkinter.set_appearance_mode("dark")
customtkinter.set_default_color_theme("dark-blue")
root = customtkinter.CTk()
# root.iconbitmap('c:/file.ico')
root.geometry("540x450")
root.title('LCCC Viapath Downloader')
frame = customtkinter.CTkFrame(master=root)
frame.pack(pady=1, padx=1, fill="both", expand=True)
# URL BOX
urllabel = customtkinter.CTkLabel(master=frame, text="Paste URLs:")
urllabel.pack(pady=1, padx=1)
urltextbox = customtkinter.CTkTextbox(master=frame, wrap='word', height=150, width=400)
urltextbox.pack(pady=10, padx=10)
# BUTTON
wgetbutton = customtkinter.CTkButton(master=frame, width=40, height=40, text="Get Videos", command=buttonclick)
wgetbutton.pack()
# PROGRESS BAR
progressBar = customtkinter.CTkProgressBar(master=frame, mode='determinate')
progressBar.pack(padx=10, pady=10)
progressBar.set(0)
root.mainloop()