Consider the following URLs
http://m3u.com/tunein.m3u
http://asxsomeurl.com/listen.asx:8024
http://www.plssomeotherurl.com/station.pls?id=111
http://22.198.133.16:802
Use urlparse to parse the path out of the URL, then os.path.splitext to get the extension.
import urlparse, os
url = 'http://www.plssomeotherurl.com/station.pls?id=111'
path = urlparse.urlparse(url).path
ext = os.path.splitext(path)[1]
Note that the extension may not be a reliable indicator of the type of the file. The HTTP Content-Type header may be better.