Linux 服务器上的 Pytube 返回链接不起作用。奇怪的问题

Pytube on Linux server returns links not working. Strange problem

提问人:Othman Alkhatib 提问时间:10/24/2023 更新时间:10/24/2023 访问量:22

问:

为了弄清楚问题,我将给出以下代码示例:

from pytube import YouTube

video = YouTube("https://www.youtube.com/watch?v=sMvk9kE94uE")
streams = video.streams.filter(progressive=True)
# let's say the video with 720p quality is the third one in the list
print(streams[2].url)

当我在 Windows 10 计算机上运行它时,它会返回可以下载的正确 URL,当我在 ubuntu Linux 服务器上运行它时,它会返回一个不起作用的 URL,只是继续加载。

这是一张照片:enter image description here

有时,也只是有时,左边的代码会返回正确的 URL。

我不明白这是为什么。唯一的区别是操作系统。

请尝试向我提供解决此问题的任何建议。如果需要更多细节,我会直接添加。

python linux youtube-api pytube

评论


答: 暂无答案