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

​ 1.python 下载地址

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

2. 配置环境变量

配置 python_home 地址
在这里插入图片描述
配置 python_scripts 地址
在这里插入图片描述
在path 中加入对应配置
在这里插入图片描述

3. 验证

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

4. 下载 curl

curl官网

下载地址

5. 解压并配置环境变量

在这里插入图片描述
同样加入系统 path 中
在这里插入图片描述

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

相关推荐

  1. Python如何下载视频

    2024-07-10 02:58:04       33 阅读
  2. 爬虫工具you-get

    2024-07-10 02:58:04       29 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-10 02:58:04       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-10 02:58:04       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-10 02:58:04       57 阅读
  4. Python语言-面向对象

    2024-07-10 02:58:04       68 阅读

热门阅读

  1. LeetCode 算法:课程表 c++

    2024-07-10 02:58:04       22 阅读
  2. UniVue@v1.2.0版本发布

    2024-07-10 02:58:04       25 阅读
  3. 【Lua】元表使用示例

    2024-07-10 02:58:04       26 阅读
  4. 使用 apktool 解包 apk 并重新打包签名

    2024-07-10 02:58:04       21 阅读
  5. Mobile ALOHA前传之VINN, Diffusion Policy和ACT对比

    2024-07-10 02:58:04       24 阅读
  6. React面试题之setState的执行机制

    2024-07-10 02:58:04       23 阅读
  7. 如何控制代码质量

    2024-07-10 02:58:04       22 阅读
  8. C++常用类

    2024-07-10 02:58:04       26 阅读