clash 打开 Allow Lan\Tun Mode\System Proxy
在 vscode 设置中设置http:Proxy:http://127.0.0.1:7890
# !/usr/bin/python3 # encoding=utf-8 from pytube import YouTube from pytube.exceptions import VideoUnavailable video = YouTube("https://www.youtube.com/watch?v=tO_L8bik10k") print("Video_title = " + video.title) try: print(video.streams) print(video.title) except VideoUnavailable: print("视频不可用") except Exception as e: print(f"发生错误: {e}")
为什么 title 可以打印出来,但是 streams 无法打印,并且返回发生错误: HTTP Error 400: Bad Request
试了一下在 vscode 终端 ping youtube.com
连接超时
![]() | 1 xinhaih 2024-07-22 15:47:49 +08:00 能返回 title 和 http error 就说明已经走代理了,streams 无法打印应该有其他的问题。另外 ping 使用 icmp 协议不走 http 代理。 |
2 ZekeRuan 2024-07-22 16:49:23 +08:00 我觉得是没有走代理,clash 无法代理系统层面,用软路由应该可以解决,而且谷歌系网站都不接受 icmp |
3 fgt1t5y 2024-07-22 16:53:59 +08:00 用 clash 的 tun 模式试试 |
![]() | 4 Vegetable 2024-07-22 16:55:00 +08:00 哥们儿们写代码甚至不愿意看一眼文档吗 |
![]() | 5 Vegetable 2024-07-22 16:55:06 +08:00 |
![]() | 6 Kakarrot OP |