Skip to content

Instantly share code, notes, and snippets.

@darkaico
Created January 19, 2023 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkaico/b06f1ea5e9012d961af0d08f87c4500d to your computer and use it in GitHub Desktop.
Save darkaico/b06f1ea5e9012d961af0d08f87c4500d to your computer and use it in GitHub Desktop.
import requests
from urllib.request import urlretrieve
from datetime import datetime
TOKEN = "<api_token_here"
FORM_URLS = "https://api.videoask.com/forms"
headers = {"Authorization": f"Bearer {TOKEN}"}
# I knew that my total videoasks were 84 so I'm going from 20 to 20
offset = 64
while offset > 0:
params = {"order_by": "-updated_at", "limit": "0", "offset": offset}
response = requests.get(FORM_URLS, headers=headers, params=params)
forms = response.json().get("results")
for form in forms:
created = datetime.strptime(form["created_at"], "%Y-%m-%dT%H:%M:%S.%fZ")
file_name = created.strftime("%Y_%m_%d_%H_%M")
print(file_name)
thumbnail_url = form.get("first_question", {}).get("thumbnail")
# Only save those that were thumbanils from videos
if thumbnail_url and thumbnail_url.startswith("https://media.videoask.com"):
urlretrieve(thumbnail_url, f"{file_name}.jpg")
offset -= 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment