Goal: I have a list of links that link to a mp3 file which I would like to save to a directory.
Example: This is an example of a link that I stored in a list of python http://www.youtubeinmp3.com/download/get/?i=ydcYNJkoDxZhuV7x4neb4zcTaVJmCX9q&e=54
I tried using the requests module like so, however, this has not worked to save a file.
with open('static/'+url[url.rfind('/')+1:],'wb') as saved_file:
response = requests.get(mp3_url, stream=True)
if not response.ok:
print("[-] Response did not return OK.")
for block in response.iter_content(1024):
if not block:
break
saved_file.write(block)