I'm trying to fetch a file from a website which is a .edf file. When I click on it, it opens the corresponding text view in the browser. But if I save the content as to a directory everything works fine.
And the question is since I have a lot of file like this I wanted to use python to fetch all of them automatically and save in a directory. So, how can I use beautifulsoup or selenium or any library to get this file in a directory just like using "saving as" option?
note: Reading the file with using soup.read() and trying to write on a .edf file is not working.
import urllib2
from bs4 import BeautifulSoup
res=urllib2.urlopen('https://www.physionet.org/pn4/eegmmidb/S001/S001R03.edf')
html = response.read()
soup = BeautifulSoup(html,'html.parser')
testfile = open('tfile.edf','w')
testfile.write(soup.encode('utf-8'))
testfile.close()
It's working but the data is not contains in .edf file as reading the html content.
There is a image file in below which may explain my purpose.
Basically and shortly what I'm trying to do is saving the file content in a specific directory with using python.