Recently, I want to download video and music resources, but I can't download them, which annoys me.
So I found a way to download video and music. Now follow me!
The protagonist is you get, which is implemented through python script and presented through GUI, which is convenient for people who can't program.
You get is an open-source third-party library that supports the download of videos, music and pictures, and covers mainstream websites, such as Tencent video, BiliBili, YouTube, kugou, Netease cloud and other 86 + websites.
Install python
Download python installation package https://www.python.org/ftp/python/3.9.6/python-3.9.6-amd64.exe
After downloading, double-click to open the python installation package, check the add environment variable "Add python 3.9 to PATH", and then click to select the installation location "Customize installation"
Continue to click next
Select the installation location (or default), click "Install" to install, and then wait for the installation to complete.
Verify whether the installation is ok!
Press win+r to open the cmd window and enter "python"
If you have Python related information, the python installation is complete.
You get use
Enter the following command in the cmd window to install you get
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple you-get
View video quality and format: - i
you-get -i https://v.qq.com/x/cover/mzc00200p29gosv/x0036gyn378.html
Video default options Download
you-get https://v.qq.com/x/cover/mzc00200p29gosv/x0036gyn378.html
Set output path and rename file: - O is set output path, - O is rename downloaded video
you-get -o E:\ -O Break https://v.qq.com/x/cover/mzc00200p29gosv/x0036gyn378.html
Watch videos online: if you don't want to watch advertisements, you can use the player to play them online
you-get -p chromium https://v.qq.com/x/cover/mzc00200p29gosv/x0036gyn378.html
The above is the download method in the cmd window. The python code that can be downloaded directly in the interface is attached below. You can use it as a reference
from tkinter import * from tkinter import filedialog from tkinter.scrolledtext import ScrolledText from threading import Thread from re import match import tkinter.messagebox as msgbox import sys from you_get import common as you_get top = Tk() top.title("Video Downloader--Author: stupid bear") # Obtain the screen size to calculate the layout parameters so that the window occupies the center of the screen, where width and height are the width and height of the interface width = 700 height = 350 screenwidth = top.winfo_screenwidth() screenheight = top.winfo_screenheight() alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2) top.geometry(alignstr) # Prevent window resizing top.resizable(0, 0) # Settings window icon top.iconbitmap(r"E:\pythonProject\az0bv-zfqt1-001.ico") # Frame layout frame_root = Frame(top) frame_left = Frame(frame_root) frame_right = Frame(frame_root) frame_left.pack(side=LEFT) frame_right.pack(side=LEFT, anchor=N) frame_root.pack() #Enter video link tip1= Label(frame_left, text='Please enter a video link',font = ('Regular script',18)) tip1.pack(padx=10,anchor=W) #Video link input box input_url= Entry(frame_left,bg='#F7F3EC') input_url.pack(ipadx=159,ipady=8,padx=20,anchor=W) input_url_clear = Button(frame_left, text='empty', font=('Regular script', 18), activebackground='gray', bd=5, bg='#da765b',command=_clear).pack(ipadx=80, padx=140, pady=38, anchor=W) #Please select a save location tip2=Label(frame_left, text='\n Please select a save location',font = ('Regular script',18)) tip2.pack(padx=10,anchor=W) #Save address input box input_save_address= Entry(frame_left,bg='#F7F3EC') input_save_address.pack(ipadx=159,ipady=8,padx=20,anchor=W) # Browse the local folder and select the save location def browse_folder(): # Browse to select a local folder save_address = filedialog.askdirectory() # Insert the obtained path into the input_save_address input box input_save_address.insert(0, save_address) # Download function def download(): # Get video link from input box url = input_url.get() # Get the save address from the input box save_address = input_save_address.get() cmd = f'you-get.exe -o {save_address} {url}' if match(r'^https?:/{2}\w.+$', url): if save_address != '': try: # stext.insert(END, '\n\n video downloading... \ n\n') sys.argv = ['you-get', '-o', save_address, url, ] you_get.main() # p = sub.Popen(cmd, stdout=sub.PIPE, stderr=sub.PIPE) # output,errors = p.communicate() # output = output.decode('UTF-8').strip().split() # for line in [f 'video: {output[14]}\n',f 'file size: {". join(output[9:11])}\n\n']: # stext.insert(END, line) # stext.insert(END, 'video download completed! \ n\n') # stext.insert(END, '='*60,'\n\n') msgbox.showinfo(title='Info', message='Video download complete!') # Keep the scroll bar of the scroll text box at the bottom # stext.yview_moveto(1) except: # Stext. Insert (end, '\ n \ nthe video does not support downloading! \ n\n') # stext.insert(END, '=' * 60, '\n\n') msgbox.showerror(title='Error', message='This video does not support downloading!') else: # stext.insert(END, '\n\n video save address error! \ n\n') # stext.insert(END, '=' * 60, '\n\n') msgbox.showerror(title='Error', message='Video saving address error!') else: # stext.insert(END, '\n\n video link error! \ n\n') # stext.insert(END, '=' * 60, '\n\n') msgbox.showerror(title='Error', message='Video link error!') # To prevent the tkinter interface from getting stuck during downloading, a thread function is created def thread_it(func, *args): # establish t = Thread(target=func, args=args) # guard!!! t.setDaemon(True) # start-up t.start() # Browse for folder button browse_folder_button = Button(frame_right, text='browse', font=('Regular script', 15), activebackground='gray', bd=5, bg='#da765b', command=lambda: thread_it(browse_folder)).pack(ipadx=30, pady=140, side=LEFT, anchor=SE) # A new blank label has no practical effect and the content is empty. In order to make the interface symmetrical and more beautiful, it can be understood as a "placeholder" # Label(frame_right, text=' ').pack(pady=223, padx=13,side=LEFT, anchor=W) # Download button download_button = Button(frame_left, text='download', font=('Regular script', 18), activebackground='gray', bd=5, bg='#da765b', command=lambda: thread_it(download)).pack(ipadx=80, padx=140, pady=38, anchor=W) # ScrolledText component (scroll text box) # stext = ScrolledText(frame_left, width=60, height=23, background='#F7F3EC') # stext.pack(padx=20, anchor=W) top.mainloop()