Skip to content

Instantly share code, notes, and snippets.

@iqiancheng
Created January 29, 2024 08:54
Show Gist options
  • Save iqiancheng/b573110daabe56adb266ca3341a5efe4 to your computer and use it in GitHub Desktop.
Save iqiancheng/b573110daabe56adb266ca3341a5efe4 to your computer and use it in GitHub Desktop.
Mac下Python启动Downie下载视频

由于最近有一些下载视频的需求,用过youtube-dlyou-get硕鼠,但是都不是很满意,比如说腾讯视频:
youtube-dl:不支持

ERROR: Unsupported URL: https://v.qq.com/x/page/l0550bf7eei.html

you-get:莫名的报错,官方更新速度又慢,似乎得用you-get的fork版本Lulu

you-get: [error] oops, something went wrong.
you-get: don't panic, c'est la vie. please try the following steps:
you-get:   (1) Rule out any network problem.
you-get:   (2) Make sure you-get is up-to-date.
you-get:   (3) Check if the issue is already known, on
you-get:         https://github.com/soimort/you-get/wiki/Known-Bugs
you-get:         https://github.com/soimort/you-get/issues
you-get:   (4) Run the command with '--debug' option,
you-get:       and report this issue with the full output.

硕鼠:国内主流网站又对其打压,更是无力回天

提示:因接到腾讯公司要求,目前已停止了对腾讯视频的解析支持,请理解,您可以优先从其他视频网站找资源下载。

Downie

Downie

最终找到了Downie,完美解析腾讯视频,优酷,爱奇艺,并且支持超过900多个网站,算上18+类型的网站则多达1000多个

Downie支持的网站

如果你需要用Python驱动Downie来下载这些网站的视频,需要知道Downie的scheme,通过查询资料查找到了 浏览器打开Downie并下载视频 的URL:

downie://XUOpenLink?url=https://v.qq.com/x/page/l0550bf7eei.html

那么scheme就是 downie://XUOpenLink?url= ,就可以应用在shell和python上了,代码如下:shell脚本

open "downie://XUOpenLink?url=https://v.qq.com/x/page/l0550bf7eei.html"

python

import os  
os.system("open 'downie://XUOpenLink?url=https://v.qq.com/x/page/l0550bf7eei.html'")

参考:
1、you-get、youtube-dl 最近 B 站部分视频下载不了,很困惑
2、Downie的Chrome和Safari扩展的源代码
3、Open document with default application in Python

来源: https://www.jianshu.com/p/53da33de96b8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment