Created
August 2, 2015 14:48
-
-
Save ulikoehler/c9321eea7a7501502483 to your computer and use it in GitHub Desktop.
Does a video have subtitles on YT?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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