1.python 下载地址

下载 : https://www.python.org/downloads/

2. 配置环境变量

配置 python_home 地址

Python基于you-get下载网页上的视频_音视频


配置 python_scripts 地址

Python基于you-get下载网页上的视频_开发语言_02


在path 中加入对应配置

Python基于you-get下载网页上的视频_开发语言_03

3. 验证


C:\Users>python --version
Python 3.12.4
C:\Users>wheel version
wheel 0.43.0

4. 下载 curl

curl官网

下载地址

5. 解压并配置环境变量

Python基于you-get下载网页上的视频_音视频_04


同样加入系统 path 中

Python基于you-get下载网页上的视频_python_05

6. 验证是否成功

C:\Users>curl --version
curl 8.0.1 (Windows) libcurl/8.0.1 Schannel WinIDN
Release-Date: 2023-03-20
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI threadsafe Unicode UnixSockets

7.下载并 安装 get-pip.py

7.1 下载

C:\Users>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2224k  100 2224k    0     0   605k      0  0:00:03  0:00:03 --:--:--  605k

7.2 安装

get-pip.py

C:\Users>python get-pip.py
Collecting pip
  Using cached pip-24.1.1-py3-none-any.whl.metadata (3.6 kB)
Using cached pip-24.1.1-py3-none-any.whl (1.8 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 24.1.1
    Uninstalling pip-24.1.1:
      Successfully uninstalled pip-24.1.1
Successfully installed pip-24.1.1

8. 验证

C:\Users>pip -V
pip 24.1.1 from D:\devtool\Python\Python312\Lib\site-packages\pip (python 3.12)

9. 安装 you-get

C:\Users>pip install you-get
Collecting you-get
  Downloading you_get-0.4.1710-py3-none-any.whl.metadata (3.9 kB)
Collecting dukpy (from you-get)
  Downloading dukpy-0.4.0-cp312-cp312-win_amd64.whl.metadata (12 kB)
Collecting mutf8 (from dukpy->you-get)
  Downloading mutf8-1.0.6.tar.gz (6.4 kB)
  Preparing metadata (setup.py) ... done
Downloading you_get-0.4.1710-py3-none-any.whl (188 kB)
   ---------------------------------------- 189.0/189.0 kB 2.3 MB/s eta 0:00:00
Downloading dukpy-0.4.0-cp312-cp312-win_amd64.whl (1.3 MB)
   ---------------------------------------- 1.3/1.3 MB 816.0 kB/s eta 0:00:00
Building wheels for collected packages: mutf8
  Building wheel for mutf8 (setup.py) ... done
  Created wheel for mutf8: filename=mutf8-1.0.6-cp312-cp312-win_amd64.whl size=4908 sha256=f12783eecb8d726cde15a42b3f578d2706eb7da088e8a8e3c4af92509172d2ec
  Stored in directory: c:\users\appdata\local\pip\cache\wheels\c2\2a\80\4c1ef20c67de151e7de0f1d4168f9a7e26c75d54403c6114a8
Successfully built mutf8
Installing collected packages: mutf8, dukpy, you-get
Successfully installed dukpy-0.4.0 mutf8-1.0.6 you-get-0.4.1710

10.下载视频

C:\Users\Desktop>you-get https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.mp4
Site:       kwimgs.com
Title:      1
Type:       MPEG-4 video (video/mp4)
Size:       4.06 MiB (4254325 Bytes)

Downloading 1.mp4 ...
 100% (  4.1/  4.1MB) ├████████████████████████████████████████┤[1/1]   13 MB/s

11. 编写批量bat 脚本

@echo off
setlocal enabledelayedexpansion

set "url=https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/"
set /a "count=0"

:loop
if !count! lss 12 (
    set /a "count+=1"
    echo Downloading !count! / 12 ...
    set "fullURL=!url!!count!.mp4"
    echo !fullURL!

    REM 注意:确保你的 PATH 环境变量中包含了 you-get,或者提供完整的 you-get 路径
    you-get "!fullURL!"
    if !errorlevel! neq 0 (
        echo Download failed! Exiting loop.
        exit /b !errorlevel!
    )
    goto :loop
)

echo All downloads completed.
endlocal