Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何设置代理? #11

Closed
osmboy opened this issue Mar 15, 2024 · 2 comments
Closed

如何设置代理? #11

osmboy opened this issue Mar 15, 2024 · 2 comments

Comments

@osmboy
Copy link

osmboy commented Mar 15, 2024

下载视频老是出错,可以添加http代理吗?
image

@fenglui
Copy link

fenglui commented Mar 15, 2024

@osmboy 修改 material.py,比如下面

@harry0703 是否可以加个配置项到config

proxies={
    "http":"http://127.0.0.1:1082",
    "https":"http://127.0.0.1:1082",
}

def save_video(video_url: str, save_dir: str) -> str:
    video_id = f"vid-{str(int(time.time() * 1000))}"
    video_path = f"{save_dir}/{video_id}.mp4"
    with open(video_path, "wb") as f:
        f.write(requests.get(video_url, proxies=proxies).content)

    return video_path

@harry0703
Copy link
Owner

@fenglui 已增加配置项

[pexels]
    [pexels.proxies]
        ### Use a proxy to access the Pexels API
        ### Format: "http://<username>:<password>@<proxy>:<port>"
        ### Example: "http://user:pass@proxy:1234"
        ### Doc: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
        # http = "http://10.10.1.10:3128"
        # https = "http://10.10.1.10:1080"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants