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
you can try the rfc6266 module like:
import requests import rfc6266 req = requests.head(downloadLink) headersContent = req.headers['Content-Disposition'] rfcFilename = rfc6266.parse_headers(headersContent, relaxed=True).filename_unsafe filename = requests.utils.unquote(rfcFilename)