mjbright / futurelearn-dl

A script to download materials from the FutureLearn website (for enrolled courses)
GNU General Public License v3.0
34 stars 20 forks source link

error and mp4 download issue #3

Open bzvew opened 8 years ago

bzvew commented 8 years ago

Hi Bright,

I think the previous error is caused by my local network restriction. But the error like below always appears whether I use VPN to bypass restriction or not:

ERROR: UnicodeEncodeError - 'ascii' codec can't encode character '\xa5' in position 21140: ordinal not in range(128)

When I use VPN, the ssl error like below doesn’t appear.

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 559, in urlopen body=body, headers=headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request self._validate_conn(conn) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 784, in _validate_conn conn.connect() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 252, in connect ssl_version=resolved_sslversion) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/util/ssl.py", line 305, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 376, in wrap_socket _context=self) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 747, in init self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 983, in do_handshake self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 628, in do_handshake self._sslobj.do_handshake() ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:646)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/adapters.py", line 376, in send timeout=timeout File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 588, in urlopen raise SSLError(e) requests.packages.urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:646)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "futurelearn-dl.py", line 536, in token, cookies = getToken(session, SIGNIN_URL) File "futurelearn-dl.py", line 144, in getToken response = session.get(url, headers=headers) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 480, in get return self.request('GET', url, _kwargs) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 468, in request resp = self.send(prep, _send_kwargs) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 576, in send r = adapter.send(request, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/adapters.py", line 447, in send raise SSLError(e, request=request) requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:646)

But when it downloads mp4, it takes so long and I’m not sure whether it’s working.

Downloading 6-week course 'inside-cancer' ERROR: UnicodeEncodeError - 'ascii' codec can't encode character '\xa5' in position 21140: ordinal not in range(128) Downloading urlhttps://ugc.futurelearn.com/uploads/files/23/bc/23bc970a-2eaa-457e-90b8-564dc5de5c24/IC6S1_Models_used_in_Cancer_Research_6_1.pdf ... type=pdf, content.len=191414 Downloading urlhttps://ugc.futurelearn.com/uploads/files/06/69/066931f3-d9cb-4008-85a4-34362eeb53c5/IC6_S1_Models_used_in_Cancer_Research.pdf ... type=pdf, content.len=1631448 Downloading urlhttps://view.vzaar.com/1435674/video ...

I wait 30 minutes and it’s still on that line. How can I see the progress and know whether it’s downloading the file? And can you give some option in your code and output a list of urls and the corresponding file names in a file? The code like coursera-dl and edx-dl have some option like that. Thank you.

Best regards.

Rui Guo