Artist new release search program

This is the first program I've written that has actually served a real purpose to me, that I use frequently. Feel free to criticize and make any suggestions or corrections, because the code is probably pretty ugly. I hope it's readable. The program searches for the newest release of whatever electronic music artist you specify from Keep in mind please, that I'm a total python noob.





from urllib import urlopen

from subprocess import call


print "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++"

print "Artist new release search v1.0"

print "This program utilizes for results"

print "+++++++++++++++++++++++++++++++++++++++++++++++++++++\n"



  def artist_search():



        artist = raw_input('\nEnter artist name: ')

        print "\nSearching..."


        website = urlopen('' + artist)

        text =


        import re


        artist ='Artist: <a href="/artist/([^"]+)" title="([^"]+)">([^"]+)</a>', text, re.IGNORECASE)

        track ='<a href="/genre/([^"]+)/track/([^"]+).html"><strong>([^"]+)</strong>', text, re.IGNORECASE)

        date ='release date: ([^"]+)<br />', text, re.IGNORECASE)

        urlpreview ='<a href="([^"]+).mp3"', text, re.IGNORECASE)

        url =

      except AttributeError: print '\nNo artist found! Exiting...', quit()


      print "\nFound result!"

      print "\n======================================"

      print "Artist: " +

      print "Track name: " +

      print "Release date: " +

      print "======================================\n"



        print "\nPreview at: " + + ".mp3"

        preview = raw_input('Play preview? y/n: ')

        if preview == 'y' : call(['mpg123', url + ".mp3"])

        if preview == 'n' : print "Exiting...", quit()

      except OSError: print "Looks like you don't have mpg123 installed! Exiting...", quit()

    except KeyboardInterrupt: search_again = raw_input("\nWould you like to perform another search? y/n: ")

    if search_again == "n" : print 'Exiting...', quit()

    if search_again == "y" : artist_search()



except UnboundLocalError: print "\n", artist_search() 

Leave comments


Copyright(c) 2017 -
By using this website, you signify your acceptance of Terms and Conditions and Privacy Policy
All rights reserved