Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,9 @@ For a complete example of a ComputerInterface implementation, you can refer to t
url={https://arxiv.org/abs/2502.12115},
}
```

## Utilities

We include the following utilities to facilitate future research:

- `download_videos.py` allows you to download the videos attached to an Expensify GitHub issue if your model supports video input
62 changes: 62 additions & 0 deletions utils/download_videos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import os
import re
import requests

def fetch_issue(issue_number):
url = f"https://api.github.com/repos/Expensify/App/issues/{issue_number}"
headers = {
"Accept": "application/vnd.github.v3+json",
"User-Agent": "ExpensifyVideoDownloader"
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except Exception as e:
print(f"Error fetching issue {issue_number}: {e}")
return None

def download_issue_videos(issue):
title = issue.get('title', '<No Title>')
body = issue.get('body', '')

print("Issue Title:", title)
print("Issue Body:", body)

video_urls = re.findall(r'(https?://[^\s]+?\.(?:mp4|mov))', body)
if not video_urls:
print("No .mp4 or .mov files found in the issue body.")
return

issue_id = str(issue.get('number') or issue.get('id', 'unknown'))
destination_dir = os.path.join("issue_videos", issue_id)
os.makedirs(destination_dir, exist_ok=True)

for url in video_urls:
video_name = os.path.basename(url.split('?')[0])
destination_path = os.path.join(destination_dir, video_name)
print(f"Downloading {url} to {destination_path} ...")

try:
video_response = requests.get(url, stream=True)
video_response.raise_for_status()
with open(destination_path, 'wb') as out_file:
for chunk in video_response.iter_content(chunk_size=8192):
if chunk:
out_file.write(chunk)
print(f"Downloaded {video_name} successfully.")
except Exception as e:
print(f"Error downloading {url}: {e}")

def fetch_and_download_issue_videos(issue_number):
issue = fetch_issue(issue_number)
if issue is not None:
download_issue_videos(issue)

if __name__ == '__main__':
import sys
if len(sys.argv) < 2:
print("Usage: python utils/download_videos.py <issue_number>")
else:
issue_number = sys.argv[1]
fetch_and_download_issue_videos(issue_number)