HuntAPI

Submit a batch of jobs with a webhook URL

Submit several jobs that report to your webhook URL.

Pass your publicly accessible endpoint as webhook_url. Each job is independent; HuntAPI will call the webhook when it finishes.

import os
import requests

API_KEY = os.environ["HUNTAPI_API_KEY"]


def get(path, params):
    response = requests.get(f"https://api.huntapi.com{path}", headers={"x-api-key": API_KEY}, params=params)
    if not response.ok:
        raise SystemExit(f"Error {response.status_code}: {response.text}")
    return response.json()


WEBHOOK_URL = "https://yourserver.example.com/webhooks/huntapi"

URLS = [
    "https://www.youtube.com/watch?v=VIDEO_ID_1",
    "https://www.youtube.com/watch?v=VIDEO_ID_2",
    "https://www.youtube.com/watch?v=VIDEO_ID_3",
]

job_ids = []
for video_url in URLS:
    params = {"query": video_url, "video_quality": "best", "webhook_url": WEBHOOK_URL}
    job_id = get("/v1/video/download", params)["job_id"]
    job_ids.append(job_id)
    print(f"Submitted: {job_id}")

print(f"{len(job_ids)} jobs submitted. Waiting for webhooks...")