search and enter the first youtube video using python -
hi using youtube api in python. , want user write in function @ automatically search wanted , first video. succeed search:
def start_song(self,song_name): words = song_name.split() url = "http://www.youtube.com/results?search_query=" word in words: url = url + word + "+" time.sleep(1) #sleeps sec webbrowser.open_new(url)
but entry have no thought how it.
considering "song_name" sentence want separate words space character, can seek :
def start_song(self,song_name): words = song_name.split() url = "http://www.youtube.com/results?search_query=" word in words: url += word + "+" time.sleep(1) #sleeps sec webbrowser.open_new(url[:-1]) # -1 because remove lastly "+" inserted
python youtube youtube-api
No comments:
Post a Comment