偶然在CSDN上发现有人使用一个叫做you-get的python第三方库,按他的说法基本上可以满足对于主流网站上的视频的批量下载以及单独下载,包括但不限于YouTube,Twitter,bilibili,爱奇艺,腾讯视频等等平台。
@[toc]
github中文说明
具体实践
- 命令行安装you-get
pip install you-get
我已经安装成功。
- 爬取某一个B站视频,默认爬取的都是最高画质
C:\Users\lenovo>you-get https://www.bilibili.com/video/BV1pV411y7E8
site: Bilibili
title: 【官方双语】汉明码part2,优雅的全貌
stream:
- format: dash-flv
container: mp4
quality: 高清 1080P
size: 43.6 MiB (45766253 bytes)
# download-with: you-get --format=dash-flv [URL]
Downloading 【官方双语】汉明码part2,优雅的全貌.mp4 ...
100% ( 43.6/ 43.6MB) ├████████████████████████████████████████┤[2/2] 7 MB/s
Merging video parts... Merged into 【官方双语】汉明码part2,优雅的全貌.mp4
Downloading 【官方双语】汉明码part2,优雅的全貌.cmt.xml ...
- 批量爬取B站视频
E:\>you-get --playlist -o E:\bilibili https://www.bilibili.com/video/BV1pV411y7E8
site: Bilibili
title: 【官方双语】汉明码part2,优雅的全貌 (P1. 汉明码part2,优雅的全貌)
stream:
- format: dash-flv
container: mp4
quality: 高清 1080P
size: 43.6 MiB (45766253 bytes)
# download-with: you-get --format=dash-flv [URL]
Downloading 【官方双语】汉明码part2,优雅的全貌 (P1. 汉明码part2,优雅的全貌).mp4 ...
98.6% ( 43.0/ 43.6MB) ├████████████████████████████████████████┤[2/2] 581 kB/s
- 表示
-playlist 批量下载
-o E:bilibili 指定下载位置
-i 获取视频或图片信息(-info)
--player/-p 将视频喂进播放器在线观看
optional arguments:
-V, --version Print version and exit
-h, --help Print this help message and exit
Dry-run options:
(no actual downloading)
-i, --info Print extracted information
-u, --url Print extracted information with URLs
--json Print extracted URLs in JSON format
Download options:
-n, --no-merge Do not merge video parts
--no-caption Do not download captions (subtitles, lyrics, danmaku, ...)
-f, --force Force overwriting existing files
--skip-existing-file-size-check
Skip existing file without checking file size
-F STREAM_ID, --format STREAM_ID
Set video format to STREAM_ID
-O FILE, --output-filename FILE
Set output filename
-o DIR, --output-dir DIR
Set output directory
-p PLAYER, --player PLAYER
Stream extracted URL to a PLAYER
-c COOKIES_FILE, --cookies COOKIES_FILE
Load cookies.txt or cookies.sqlite
-t SECONDS, --timeout SECONDS
Set socket timeout
-d, --debug Show traceback and other debug info
-I FILE, --input-file FILE
Read non-playlist URLs from FILE
-P PASSWORD, --password PASSWORD
Set video visit password to PASSWORD
-l, --playlist Prefer to download a playlist
-a, --auto-rename Auto rename same name different files
-k, --insecure ignore ssl errors
Proxy options:
-x HOST:PORT, --http-proxy HOST:PORT
Use an HTTP proxy for downloading
-y HOST:PORT, --extractor-proxy HOST:PORT
Use an HTTP proxy for extracting only
--no-proxy Never use a proxy
-s HOST:PORT or USERNAME:PASSWORD@HOST:PORT, --socks-proxy HOST:PORT or USERNAME:PASSWORD@HOST:PORT
Use an SOCKS5 proxy for downloading
网友评论