惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
Recorded Future
Recorded Future
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google DeepMind News
Google DeepMind News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
N
News | PayPal Newsroom
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Help Net Security
Help Net Security
博客园 - Franky
SecWiki News
SecWiki News
Recent Announcements
Recent Announcements
T
Troy Hunt's Blog
The Register - Security
The Register - Security
The Last Watchdog
The Last Watchdog
Webroot Blog
Webroot Blog
S
Security Affairs
博客园 - 司徒正美
S
Schneier on Security
I
InfoQ
博客园_首页
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Threat Research - Cisco Blogs
Forbes - Security
Forbes - Security
腾讯CDC
N
Netflix TechBlog - Medium
N
News and Events Feed by Topic
Cloudbric
Cloudbric
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta
Recent Commits to openclaw:main
Recent Commits to openclaw:main
B
Blog
V
Vulnerabilities – Threatpost
C
Check Point Blog
Google DeepMind News
Google DeepMind News
Google Online Security Blog
Google Online Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Cisco Blogs
Schneier on Security
Schneier on Security
O
OpenAI News
K
Kaspersky official blog

夜行人

回家路上 第一期的直播演示项目 震动检测器 正能量 在线参观CodeLab Neverland 发布 CodeLab Adapter 3.3.1 DynamicTable 之 纸糊方向盘 CodeLab DynamicTable: 一个可实施的技术方案 CodeLab Insight 发布 Alpha 版 情人节 Home Assistant 周报 && IoT 周报 (02) Joplin: 关注隐私的 Evernote 开源替代软件 浏览器的未来与 Web 传感器 Home Assistant 周报 && IoT 周报 (01) 百宝箱(01) 论自由 介绍 WebThings Home Assistant 周报 && iot 周报 (00) 百宝箱(00) 毛姆读书心得 传世之作 周末徒步 CodeLab Adapter ❤️ Jupyter/Python 航班 躲雨 夏令营途中 [译]思想--作为一种技术 The future of coding 美国之行 三门问题的程序模拟 从Python转向Pharo https://blog.just4fun.site/post/iot/iot-open-source-projects/ Python异步编程笔记 https://blog.just4fun.site/post/iot/iot-open-source-hardware-community/ 万物积木化开发者社区 CodeLab ❤️ Blender Scratch3技术分析之云变量 API(第7篇) [译]对管道(Pipes)的偏爱 [译]提出正确的问题比得到正确答案更重要 蓝牙设备与Scratch3.0 创建你的第一个Scratch3.0 Extension Scratch3技术分析之项目内部数据(第6篇) Scratch3技术分析之社区 API(第5篇) Scratch3技术分析之User API(第4篇) Scratch3技术分析之项目主页API(第3篇) Scratch3技术分析之静态资源API(第2篇) Scratch3.0、micro:bit与Windows7 https://blog.just4fun.site/post/iot/zerynth-vs-micropython/ 核聚变、方所与半宅空间 可视化编程为何是个糟糕的主意 codelab.club周末聚会 关于codelab.club '下一件大事'是一个房间 Hungry Robot - Eat everything 编程作为一种思考方式 今日简史 史蒂夫·乔布斯传 罗素自选文集 https://blog.just4fun.site/post/edx/tianjin-scratch-ai/ https://blog.just4fun.site/post/edx/richie-cms-openedx/ 徒步武功山 WebUSB与micro:bit 积木化编程与3D场景 夜宿武功山顶 scratch3-adapter接入优必选Alpha系列机器人 https://blog.just4fun.site/post/edx/video-migration-note/ scratch3-adapter重构笔记 https://blog.just4fun.site/post/edx/edx-community-members/ 两种硬件编程风格的比较 使用micro:bit自制PPT翻页笔 柏拉图对话集 scratch3.0 + micro:bit 七月电影放映计划 非营利组织的管理 Screenly--用树莓派让任何屏幕变为可编程的数字标牌 以最佳实践开始你的Django项目 micro:bit与事件驱动 为Scratch3.0设计的插件系统(上篇) OCR应用一例 近两年读过的一些好书 blockly开发之使用python驱动浏览器中的turtle(2) 牛顿新传 文学理论入门 逻辑的引擎 人生的意义 blockly开发之生成并运行js代码(1) blockly开发之hello world(0) micro:bit使用笔记 神器之Termux https://blog.just4fun.site/post/iot/micropython-notes/ Cozmo what is this Scratch的前世今生 下段旅程 我行在远方 爆裂 途中杂记 https://blog.just4fun.site/post/edx/open-edx-startup/ cozmo系列之入门 - 有性格且可编程的机器人 PaperWeekly开发笔记 创业二三事
youtube-dl使用记录
2015-12-04 · via 夜行人

#缘起 最近在跟着一些资料学习数据分析,时常会连接到youtube,要看些演讲之类的,想下载下来看。有朋友也在学习这块知识,所以最理想是把视频放到国内云上,这样可以分享给小伙伴

#思路 恰好有服务器在国外,所以想做个自动化的工作,大体思路是

写个网页收集下载链接,然后后台触发celery去执行任务,任务里使用youtube-dl去下载视频,下载完后使用bypy同步到百度云盘,然后发一封邮件通知视频下载者。

关于同步到云盘和邮件通知这部分我之前在for_dinner里写过

所以这次任务不算太难,写个建议的表单页面,熟悉使用youtube-dl就行了。

###dirty and quick 我们也可以简化以上流程,一种建议的不那么自动化的方式是:

  • 小伙伴把想下载的视频微信告诉你
  • 你去国外vps上使用youtube-dl把视频下载下来
  • 之后使用FTP把视频拖回本地

#youtube-dl ##what youtube-dl是一个简单的命令行下载工具,支持全球上百个视频网站的下载,包括国内主流视频网站资源,无须注册,无须付费,无须登录,智能嗅探出真实下载地址。据官网介绍,youtube-dl甚至支持全球最大的成人视频网站免费下载。

具体列表可通过youtube-dl --extractor-descriptions查看

我使用wc统计了下(youtube-dl --extractor-descriptions|wc -l),一共可以下载国内外714个视频源的视频/音频。

此外前头说的官网介绍属实!

可供下载的国内一些著名音视频源包括:优酷/百度视频/音悦Tai/QQ音乐/网易云音乐/酷我音乐

##安装 sudo pip install youtube-dl

##使用 ###帮助 youtube-dl –help

###常用命令

  • youtube-dl –list-extractors #查看支持网站列表
  • youtube-dl -U #程序升级
  • youtube-dl –get-format URL #获取视频格式
  • youtube-dl -F URL #获取所有格式(目前仅支持YouTube)
  • youtube-dl -f format URL #下载指定格式的视频,这里以下载1080p原画质量的视频格式为例: youtube-dl -f 137 https://www.youtube.com/watch?v=Izj_F8r2yt0

###demo 我们以下载Role of Python in Data Science and Machine Learning(地址:https://www.youtube.com/watch?v=CoxjADZHUQA)为例

因为YouTube的video 和 audio 部分是分开的,所以这里要用到 ffmpeg 这个神器来合并视频和音频:sudo apt-get install ffmpeg

youtube-dl -F " youtube-dl -F ",输出:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
:::text
[youtube] CoxjADZHUQA: Downloading webpage
[youtube] CoxjADZHUQA: Downloading video info webpage
[youtube] CoxjADZHUQA: Extracting video information
[youtube] CoxjADZHUQA: Downloading DASH manifest
[youtube] CoxjADZHUQA: Downloading DASH manifest
[info] Available formats for CoxjADZHUQA:
format code  extension  resolution note
140          m4a        audio only DASH audio   99k , m4a_dash container, aac  @128k (44100Hz), 29.96MiB
141          m4a        audio only DASH audio  195k , m4a_dash container, aac  @256k (44100Hz), 59.79MiB
160          mp4        256x144    DASH video  119k , avc1.4d400c, 13fps, video only, 34.22MiB
133          mp4        426x240    DASH video  258k , avc1.4d4015, 25fps, video only, 76.12MiB
134          mp4        640x360    DASH video  605k , avc1.4d401e, 25fps, video only, 77.20MiB
135          mp4        854x480    DASH video 1104k , avc1.4d401e, 25fps, video only, 160.60MiB
136          mp4        1280x720   DASH video 2205k , avc1.4d401f, 25fps, video only, 322.11MiB
137          mp4        1920x1080  DASH video 4127k , avc1.640028, 25fps, video only, 632.46MiB
17           3gp        176x144    small ,  mp4a.40.2, mp4v.20.3
36           3gp        320x240    small ,  mp4a.40.2, mp4v.20.3
5            flv        400x240    small
43           webm       640x360    medium ,  vorbis, vp8.0
18           mp4        640x360    medium ,  mp4a.40.2, avc1.42001E
22           mp4        1280x720   hd720 ,  mp4a.40.2, avc1.64001F (best)

选定音视频质量后(比如我们选择160对应的视频,141对于的音频),开始下载: youtube-dl -f 160+141 "https://www.youtube.com/watch?v=CoxjADZHUQA"

输出为:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
:::text
youtube] CoxjADZHUQA: Downloading webpage
[youtube] CoxjADZHUQA: Downloading video info webpage
[youtube] CoxjADZHUQA: Extracting video information
[youtube] CoxjADZHUQA: Downloading DASH manifest
[youtube] CoxjADZHUQA: Downloading DASH manifest
[download] Destination: PyCon Ukraine 2014 - Jeremy Achin - Role of Python in Data Science and Machine Learning-CoxjADZHUQA.f160.mp4
[download] 100% of 34.22MiB in 00:09
[download] Destination: PyCon Ukraine 2014 - Jeremy Achin - Role of Python in Data Science and Machine Learning-CoxjADZHUQA.f141.m4a
[download] 100% of 59.79MiB in 00:12
[ffmpeg] Merging formats into "PyCon Ukraine 2014 - Jeremy Achin - Role of Python in Data Science and Machine Learning-CoxjADZHUQA.mp4"

下载完毕!

#参考

文章作者 种瓜

上次更新 2015-12-04