Skip to content

Instantly share code, notes, and snippets.

@wangonya
Created June 7, 2019 14:14
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 wangonya/94e3b87a1a13a8fbb71b42fb26c70855 to your computer and use it in GitHub Desktop.
Save wangonya/94e3b87a1a13a8fbb71b42fb26c70855 to your computer and use it in GitHub Desktop.
A python script to generate a timestamp link for google drive videos
# 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