#!/usr/bin/env python3

import sys
import urllib.parse
import shlex

for song in sys.stdin:
    song = song.strip()

    # Generate a Google search URL for the song
    query = urllib.parse.quote_plus(f"{song} youtube")
    url = f"https://www.google.com/search?q={query}&btnI=I\'m+Feeling+Lucky"

    # Print the shell command to open the URL in Chrome
    print(shlex.join(["google-chrome", url]), "& sleep 1")
