Add OpenClaw workspace configuration and tools
- Add agent configuration files (AGENTS.md, USER.md, IDENTITY.md, SOUL.md) - Add git configuration and skills management scripts - Add frontend/backend analysis tools and reports - Add DingTalk media sender utilities and documentation - Fix OpenClaw runtime environment (Node.js and Python) - Configure git remotes and push scripts
This commit is contained in:
57
download_sample_video.py
Normal file
57
download_sample_video.py
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""下载小于500k的示例视频"""
|
||||
|
||||
import requests
|
||||
import os
|
||||
|
||||
SAMPLE_VIDEOS = [
|
||||
"https://www.w3schools.com/html/mov_bbb.mp4", # 约200k
|
||||
"https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4", # 可能太大
|
||||
"https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_2mb.mp4", # 可能太大
|
||||
]
|
||||
|
||||
OUTPUT_DIR = r"C:\Users\ALC\.openclaw\media\videos"
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
|
||||
def download_small_video():
|
||||
for url in SAMPLE_VIDEOS:
|
||||
try:
|
||||
print(f"Trying: {url}")
|
||||
r = requests.get(url, stream=True, timeout=30)
|
||||
|
||||
# 检查大小
|
||||
size = int(r.headers.get('content-length', 0))
|
||||
size_kb = size / 1024
|
||||
|
||||
print(f"Size: {size_kb:.2f} KB")
|
||||
|
||||
if size > 500 * 1024:
|
||||
print("Too large (>500KB)\n")
|
||||
continue
|
||||
|
||||
filename = url.split('/')[-1]
|
||||
output_path = os.path.join(OUTPUT_DIR, filename)
|
||||
|
||||
# 下载文件
|
||||
with open(output_path, 'wb') as f:
|
||||
for chunk in r.iter_content(chunk_size=8192):
|
||||
f.write(chunk)
|
||||
|
||||
print(f"\nDownloaded: {output_path}")
|
||||
print(f"Size: {size_kb:.2f} KB")
|
||||
|
||||
return output_path
|
||||
|
||||
except Exception as e:
|
||||
print(f"Failed: {e}\n")
|
||||
continue
|
||||
|
||||
raise Exception("No suitable video found")
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
video_path = download_small_video()
|
||||
print(f"\n=== SUCCESS ===\n{video_path}")
|
||||
except Exception as e:
|
||||
print(f"\n=== ERROR ===\n{e}")
|
||||
Reference in New Issue
Block a user