Groovy web console

subscribe to the feed Subscribe
to this
site

youtube-start-end

Published 2 months ago by yosef with tags youtube start and end
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def url =  "https://www.youtube.com/watch?v=_1nPS7qOLxQ"
def start= "1:30"
def end = "1:50"

def toTime(String time){
    def splitted = time.split(":")
    println(splitted[1])
    return (splitted[0] as Integer)*60+(splitted[1] as Integer)
}

url.replace("watch?v=", "embed/") + "?start=${toTime(start)}&end=${toTime(end)}&autoplay=true"