Last.fm Group Chart with Similar Tracks

Trying to write the outline for a script to build playlists from Last.fm data. There may a line or so missing, because I am coding with no real background in it, using building blocks from about the site. Let me know if there are improvements needed and I will endeavour to touch it up. If it works, this could then be modified to create autoplaylists from various points of Last.fm data - such as their charts - as well as other places that create API-style playlists.
s/$this//