Esempio n. 1
0
 def get_song(self,item):
     #Checking Youtube Links
     youtube=Youtube()
     link = youtube.extract_youtube_link_from_text(item)
     if link:
         full_title = youtube.get_title_from_youtube_code(get_youtube_code_from_link(link))
         song = Song(full_title= full_title, video_link = link, )
     else:
         soundcloud = Soundcloud()
         link = soundcloud.extract_soundcloud_link_from_text(item)
         if link:
             song= Song(full_title=soundcloud.get_title_soundcloud(link), video_link = link)
         else:
             #Items without a link
             songs = youtube.youtube_search(item,1)
             if len(songs) >0 :
                 song = songs[0]
             else:
                 return None
     return song