How to download multiple files from a list of links using python requests?

Viewed 43

I'm trying to download multiple mp3 files using Python's requests module from a list of links that I created, but for some reason it keeps giving me bad requests for every single link (it doesn't do this when I insert the link manually).

import requests as rq
HOR=[] #The list of links,it's actually a list not an empty list but it's too large
HOR_Names=[]
for i in range(189):
    print(HOR[i])
    doc=rq.get(HOR[i])
    print(doc.text)
    open(HOR_Names[i], 'wb').write(doc.content)

it gives me this error:

<HTML>
<HEAD>
<TITLE>Bad Request</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Bad Request</H1>
<H2>Error 400</H2>
</BODY>
</HTML>
0 Answers
Related