gpt4 book ai didi

python - 如何从源代码重建 python youtube-dl

转载 作者:太空宇宙 更新时间:2023-11-04 04:15:20 25 4
gpt4 key购买 nike

起初我想承认我是 python 编程的菜鸟。但不知何故,我还是设法弄清楚了如何修改一些 python 正则表达式,因为提取器可以为我获取一些额外的数据。不幸的是,我不知道如何从更改后的源代码构建可执行文件。因为我正在使用 PHP 包装器来使用 youtube-dl ubuntu 可执行文件来抓取一些数据。

我注意到有一个 6 年以上的帖子在

Python youtube-dl recompile

但不幸的是,解决方案没有提供重新编译或重建的方法。我什至还没有在开发人员的官方文档中找到如何重建

https://github.com/ytdl-org/youtube-dl#developer-instructions

Most users do not need to build youtube-dl and can download the buildsor get them from their distribution.

To run youtube-dl as a developer, you don't need to build anythingeither.

最后使用 git 进行开源贡献

  1. Finally, create a pull request. We'll then review and merge it.

但找不到任何可在本地构建以在本地使用的内容。

最佳答案

development instructions 中所述,您可以交互式地运行 youtube-dl

python -m youtube_dl

当 youtube-dl 存储库在您的 PYTHONPATH 中时,例如因为您的 cwd是 youtube-dl 存储库的根目录。

对于开发,运行测试通常更容易。同样,as documented , 任何这些工作:

python -m unittest discover
python test/test_download.py
nosetests

如果你正在开发一个提取器,你可以运行

python test/test_download.py TestDownload.test_YourExtractor

只是测试你的提取器。

如果您真的想要一个 youtube-dl 二进制文件,请输入

make

在 youtube-dl 存储库的根目录中。您将获得一个名为 youtube-dl 的二进制文件。

请注意 make任何维护良好的软件项目一起工作,尽管一些新千年的时髦语言更愿意重新发明他们自己的不兼容版本。

关于python - 如何从源代码重建 python youtube-dl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55561387/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com