you-get super powerful video download tool (supports multiple platforms such as station B)

  1. Open Anaconda Prompt
  2. Create a new environment and activate
    conda create -n videoDown python=3.7
    conda activate videoDown
  3. Install FFmpeg
    conda install FFmpeg
  4. 安装you-get
    pip3 install you-get
  5. Find the link of the video you want to download, eg https://www.example.com/example
    you-get https://www.example.com/example
    add the output path
    you-get -o output_dir https://www.example .com/example
    If there are multiple videos of the same level in this path, you can use the --playlist parameter to download all the videos (when you do not use this parameter, but there are multiple videos of the same level under the link to be downloaded, you- get will prompt you to use the --playlist parameter)
    you-get -o output_dir https://www.example.com/example --playlist
  6. Attachment: Use the python program to keep files in a certain format in the folder, and remove part of the file name prefix
import os

# 文件夹路径,例如 r'C:\example'
forder_dir = r'C:\example'
# 要保留的文件类型,例如['mp4', 'txt']
retain_type = ['mp4']
# 要删除的文件名前缀,例如 r'111',文件 1112365.mp3将输出为2365.mp3
deletePre = r'111'

# ---------------------以下代码无需关注和修改----------------------
files = os.listdir(forder_dir)
for file in files:
    type = file.split(".")
    type = type[type.__len__() - 1]
    if type not in retain_type:
        os.remove(forder_dir + '\\' + file)
        print('[删除]' + file)
    else:
        os.rename(forder_dir + '\\' + file, forder_dir + '\\' + file.replace(deletePre, ""))
        print('[改名]' + file.replace(deletePre, ""))

print('执行结束')

Guess you like

Origin blog.csdn.net/qq_42283621/article/details/123633909