def search(self): # Returns the first 10 results results = YoutubeSearch(self.title + " by " + self.artist, max_results=10).to_dict() # Grabs the first result first_result = str(results.pop(0)) # Sets youtube_link to the full youtube link remove_title = first_result[first_result.find(',') + 11: len(first_result)] self.watch_link = remove_title[0:remove_title.find('\'')] self.youtube_link += self.watch_link