You get video music download in python

Keywords: Python IDE

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()

Supported websites

websiteURLVideo?Image?Audio?
YouTubehttps://www.youtube.com/
Twitterhttps://twitter.com/
VKWelcome to VK | VK
Vinehttps://vine.co/
Vimeohttps://vimeo.com/
Vidtovidto.me
Veohhttp://www.veoh.com/
Tumblrhttps://www.tumblr.com/
TEDTED: Ideas Worth Spreading
SoundCloudhttps://soundcloud.com/
Pinteresthttps://www.pinterest.com/
MusicPlayOnhttp://en.musicplayon.com/
MTV81MTV Japan
Mixcloudhttps://www.mixcloud.com/
MetacafeVideosHub | Popular Internet Videos
MagistoOnline Video Editor | Smart Video Maker by Magisto
Khan AcademyKhan Academy | Free Online Courses, Lessons & Practice
JPopsuki TVhttp://www.jpopsuki.tv/
Internet Archivehttps://archive.org/
Instagramhttps://instagram.com/
Heavy Music Archiveιlιlι Heavy Music Archive
Google+https://plus.google.com/
Freesoundhttp://www.freesound.org/
Flickrhttps://www.flickr.com/
Facebookhttps://www.facebook.com/
eHowhttp://www.ehow.com/
Dailymotionhttp://www.dailymotion.com/
CBSCBS TV Network Primetime, Daytime, Late Night and Classic Television Shows
Bandcamphttp://bandcamp.com/
AliveThaihttp://alive.in.th/
interest.meNO.1 K콘텐츠 채널, 즐거움엔 tvN
755
ナナゴーゴー
New sense SNS | 755
niconico
Animation
http://www.nicovideo.jp/
163
Netease video
NetEase cloud music
Netease live
NetEase cloud music
56 Network56 video home page
AcFunhttp://www.acfun.tv/
Baidu
Baidu Post Bar
Baidu Post Bar -- the world's leading Chinese community
Popcorn netPopcorn net -- a wonderful vision
bilibili
Bilibili
Beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping beeping
Dilidilihttp://www.dilidili.com/
WatercressWatercress
BettaBetta - everyone's live platform
Phoenix videoPhoenix video home page - the most media valuable video portal - phoenix.com
Popular networkPopular - new generation platform
iQIYI
Iqiyi
Iqiyi - online video website - massive genuine HD video online viewing
Excited netExcited net
Cool 6 networkCool 6 network
Cool dog musicCool dog music - just more songs! There are also many novel crosstalk!
KuWo musicKuWo Music - Lossless sound quality genuine online audition website
letv http://www.letv.com/
Litchi FMAudio novel crosstalk storytelling talk show radio drama listening live FM litchi
Second beathttp://www.miaopai.com/
MioMio barrage nethttp://www.miomio.tv/
Ruffian Kebanghttps://www.pixnet.net/
PPTV cohesionhome page
Qilu networkShandong network station_ Qilu network_ Sponsored by Shandong Radio and television station
QQ
Tencent video
Tencent Video - China's leading online video media platform, massive HD video online viewing
Paddock videohttp://qianmo.com/
Sina
Sina video
Microblogging second video
Sina video_ HD video online viewing_ Sina.com
http://video.weibo.com/
Sohu
Sohu Video
Sohu Video - China's leading comprehensive video website, genuine HD video online viewing, original video uploading and whole network video search
Beautiful every dayhttp://www.dongting.com/
Tudou
potato
http://www.tudou.com/
small shrimpYinluo · new scene of digital music
Sunshine satellite TVhttp://www.isuntv.com/
YinYue Tai Yinyue Tai - watch music
Youku
Youku
http://www.youku.com/
Battle Flag TVLive broadcast online_ Live broadcast of all games_ Online game live broadcast - Battle Flag live broadcast
CNTVChina Central Television

Posted by deltawing on Thu, 11 Nov 2021 09:38:52 -0800