Created
June 7, 2019 14:14
-
-
Save wangonya/94e3b87a1a13a8fbb71b42fb26c70855 to your computer and use it in GitHub Desktop.
A python script to generate a timestamp link for google drive videos
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
# How it works: | |
# - Download and run it (python3 gdrive-vid-timestamper.py) | |
# - Enter the google drive link for your video. Make sure the link ends at the `view` part e.g `https://drive.google.com/file/d/sdf/view` | |
# - Enter the time you want e.g `8:36` | |
# - A link with the timestamp embedded in seconds will be returned | |
# - The app continues running, waiting for the next time to be input. `ctrl-c` to terminate it. | |
def converter(link): | |
_time = input("Enter time in 'm:s' format: ") # e.g 2:01 | |
to_convert = _time.split(":") | |
time_in_seconds = (int(to_convert[0])*60) + int(to_convert[1]) | |
print("{}?t={}s/preview?autoplay=1".format(link, time_in_seconds)) | |
converter(link) | |
if __name__ == "__main__": | |
link = input("Enter gdrive video link: ") | |
converter(link) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment