爬虫工具yt-dlp

yt-dlp是youtube-dlp的一个fork,youtube-dlp曾经也较为活跃,但后来被众多网站屏蔽,于是大家转而在其基础上开发yt-dlp。yt-dlp的github项目地址为:GitHub - yt-dlp/yt-dlp: A feature-rich command-line audio/video downloaderA feature-rich command-line audio/video downloader - yt-dlp/yt-dlphttps://github.com/yt-dlp/yt-dlp

一、安装

以下为相关依赖,需要分别安装:

  • Python 3 (必须)
  • FFmpeg(非必须,但是强烈推荐)
  • FFprobe(非必须,但是强烈推荐)

推荐使用PyPI镜像中的pip包管理器安装:

复制代码
pip3 install yt-dlp

二、升级

如果需要升级,可使用以下命令:

复制代码
# 可使用如下命令升级
yt-dlp --update

# 或者简单的大写字母U
yt-dlp -U

上述是默认升级stable(稳定版),官方额外提供了两种可升级版本nightly(夜间版)和master(主版本)。

复制代码
# 稳定版,该版本为默认版本,其中的功能成熟完善,完全经过测试
# (如果不是极客编程大佬,推荐普通用户使用该版本)
yt-dlp --update-to stable

# 夜间版,在世界协调时间(UTC)午夜0点左右进行更新,该版本主要是对当前的稳定版打最新补丁
yt-dlp --update-to nightly

# 主版本,正在开发中的下一代稳定版,主版本包含一些创新功能,但也可能出现未经测试的bug
yt-dlp --update-to master

三、使用

直接输入you-get+空格+"网址"即可。

复制代码
C:\Users\hp>yt-dlp https://www.bilibili.com/video/BV1jy4y1c7ia/

[BiliBili] Extracting URL: https://www.bilibili.com/video/BV1jy4y1c7ia/
[BiliBili] 1jy4y1c7ia: Downloading webpage
[BiliBili] BV1jy4y1c7ia: Extracting videos in anthology
[BiliBili] 790398302: Extracting chapters
[BiliBili] Format(s) 1080P 高码率, 1080P 高清, 720P 高清 are missing; you have to login or become premium member to download them. Use --cookies-from-browser or --cookies for the authentication. See  https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp  for how to manually pass cookies
[info] BV1jy4y1c7ia: Downloading 1 format(s): 30033+30280
[download] Destination: 国外街头整蛊路人,他发的传单你敢不接吗 [BV1jy4y1c7ia].f30033.mp4
[download] 100% of    5.41MiB in 00:00:00 at 10.69MiB/s
[download] Destination: 国外街头整蛊路人,他发的传单你敢不接吗 [BV1jy4y1c7ia].f30280.m4a
[download] 100% of  891.47KiB in 00:00:00 at 12.13MiB/s
[Merger] Merging formats into "国外街头整蛊路人,他发的传单你敢不接吗 [BV1jy4y1c7ia].mp4"
Deleting original file 国外街头整蛊路人,他发的传单你敢不接吗 [BV1jy4y1c7ia].f30280.m4a (pass -k to keep)
Deleting original file 国外街头整蛊路人,他发的传单你敢不接吗 [BV1jy4y1c7ia].f30033.mp4 (pass -k to keep)
相关推荐
Amazon数据采集2 小时前
🚀 Pangolin Scrape API实战指南:从0到1构建高性能亚马逊数据采集系统
爬虫·自动化运维
DataLaboratory11 小时前
Python爬取百度地图-前端直接获取
爬虫·python·百度地图
APIshop20 小时前
代码实例:Python 爬虫抓取与解析 JSON 数据
爬虫·python·json
一晌小贪欢1 天前
Python爬虫第4课:XPath与lxml高级解析技术
开发语言·爬虫·python·网络爬虫·python爬虫·python3·python办公
一晌小贪欢1 天前
Python爬虫第3课:BeautifulSoup解析HTML与数据提取
爬虫·python·网络爬虫·beautifulsoup·python爬虫·python3·requests
小白学大数据2 天前
Python爬虫常见陷阱:Ajax动态生成内容的URL去重与数据拼接
爬虫·python·ajax
Jonathan Star2 天前
跨域处理的核心是解决浏览器的“同源策略”限制,主流方案
javascript·chrome·爬虫
Amazon数据采集2 天前
深度解析:如何构建企业级电商数据采集架构?Pangolin API实战指南
爬虫·api
亿牛云爬虫专家3 天前
优化分布式采集的数据同步:一致性、去重与冲突解决的那些坑与招
分布式·爬虫·数据采集·爬虫代理·代理ip·数据同步·房地产
深蓝电商API3 天前
静态网页 vs 动态网页:爬虫该如何选择抓取策略?
爬虫