利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
add pexels.proxies
harry753ec011d868
diff --git a/app/config/config.py b/app/config/config.pyindex ab4aa6ed..d05eb178 100644--- a/app/config/config.py+++ b/app/config/config.py@@ -12,6 +12,8 @@ with open(config_file, mode="rb") as fp:app = _cfg.get("app", {})whisper = _cfg.get("whisper", {})+pexels = _cfg.get("pexels", {})+hostname = socket.gethostname()log_level = _cfg.get("log_level", "DEBUG")diff --git a/app/services/material.py b/app/services/material.pyindex 8aa59004..2c0bbf76 100644--- a/app/services/material.py+++ b/app/services/material.py@@ -33,12 +33,12 @@ def search_videos(search_term: str,headers = {"Authorization": round_robin_api_key()}-+ proxies = config.pexels.get("proxies", None)# Build URLquery_url = f"https://api.pexels.com/videos/search?query={search_term}&per_page=15&orientation={video_orientation}&locale={locale}"- logger.info(f"searching videos: {query_url}")+ logger.info(f"searching videos: {query_url}, with proxies: {proxies}")# Send the request- r = requests.get(query_url, headers=headers)+ r = requests.get(query_url, headers=headers, proxies=proxies, verify=False)# Parse the responseresponse = r.json()@@ -71,8 +71,9 @@ def search_videos(search_term: str,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"+ proxies = config.pexels.get("proxies", None)with open(video_path, "wb") as f:- f.write(requests.get(video_url).content)+ f.write(requests.get(video_url, proxies=proxies, verify=False).content)return video_pathdiff --git a/config.example.toml b/config.example.tomlindex 7fc8ae5a..7a669ec7 100644--- a/config.example.toml+++ b/config.example.toml@@ -50,4 +50,13 @@model_size="large-v3"# if you want to use GPU, set device="cuda"device="CPU"- compute_type="int8"\ No newline at end of file+ compute_type="int8"++[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"\ No newline at end of file