Skip to content

Instantly share code, notes, and snippets.

@ulikoehler
Created August 2, 2015 14:48
Show Gist options
  • Save ulikoehler/c9321eea7a7501502483 to your computer and use it in GitHub Desktop.
Save ulikoehler/c9321eea7a7501502483 to your computer and use it in GitHub Desktop.
Does a video have subtitles on YT?
#!/usr/bin/env python3
import requests
def hasTimedText(v, lang="de"):
url = "https://www.youtube.com/api/timedtext?caps=asr&key=yttt1&v=%s&lang=%s&fmt=srv2" % (v, lang)
response = requests.get(url)
return bool(response.text) # Empty if not available
if __name__ == "__main__":
print(hasTimedText("Y6JsEja15Vk"))
print(hasTimedText("oajrmwCALmc"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment