coursera-dl / edx-dl

A simple tool to download video lectures from edx.org (and other openedx sites)
GNU Lesser General Public License v3.0
1.93k stars 640 forks source link

Error 403: Forbidden #633

Closed Fyleth-7 closed 4 years ago

Fyleth-7 commented 4 years ago

Subject of the issue

This happens every time I try to download, I also changed the header to Mozilla 5.0 in the edx_dl as one of you suggested, but it doesn't work.

Edit: I also fixed the File "c:\users\fatim\anaconda3\lib\site-packages\edx_dl\edx_dl.py", line 1021, in get_available_sections(selected_course.url.replace('info', 'course'),

to (selected_course.url.replace('/info/', '/course/'), line because it changed the name of the course

Your environment

Building initial headers for future requests. Getting initial CSRF token. Found CSRF token. Logging into Open edX site: https://courses.edx.org/login_ajax Extracting course information from dashboard. Traceback (most recent call last): File "c:\users\fatim\anaconda3\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\fatim\anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\fatim\anaconda3\Scripts\edx-dl.exe__main__.py", line 7, in File "c:\users\fatim\anaconda3\lib\site-packages\edx_dl\edx_dl.py", line 1020, in main all_selections = {selected_course: File "c:\users\fatim\anaconda3\lib\site-packages\edx_dl\edx_dl.py", line 1021, in get_available_sections(selected_course.url.replace('info', 'course'), File "c:\users\fatim\anaconda3\lib\site-packages\edx_dl\edx_dl.py", line 184, in get_available_sections page = get_page_contents(url, headers) File "c:\users\fatim\anaconda3\lib\site-packages\edx_dl\utils.py", line 58, in get_page_contents result = urlopen(Request(url, None, headers)) File "c:\users\fatim\anaconda3\lib\urllib\request.py", line 222, in urlopen return opener.open(url, data, timeout) File "c:\users\fatim\anaconda3\lib\urllib\request.py", line 531, in open response = meth(req, response) File "c:\users\fatim\anaconda3\lib\urllib\request.py", line 640, in http_response response = self.parent.error( File "c:\users\fatim\anaconda3\lib\urllib\request.py", line 569, in error return self._call_chain(args) File "c:\users\fatim\anaconda3\lib\urllib\request.py", line 502, in _call_chain result = func(args) File "c:\users\fatim\anaconda3\lib\urllib\request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden.

bsnyder9 commented 4 years ago

Already resolved in another issue thread:

https://github.com/coursera-dl/edx-dl/issues/631#issuecomment-667852988

Fyleth-7 commented 4 years ago

Already resolved in another issue thread:

#631 (comment)

I have already done that, doesn't work. As I mentioned here.

bsnyder9 commented 4 years ago

Ahhh sorry, I missed that part. Do you mind sharing which course you're trying to access? That fix worked for me on two unrelated courses earlier today.

Fyleth-7 commented 4 years ago

Ahhh sorry, I missed that part. Do you mind sharing which course you're trying to access? That fix worked for me on two unrelated courses earlier today.

This one, https://courses.edx.org/courses/course-v1:IsraelX+infosec101+3T2019a/course/

I changed (selected_course.url.replace('info', 'course'), to (selected_course.url.replace('/info/', '/course/'),

because it has 'info' in the name, but it doesn't work either :/

floviolleau commented 4 years ago

Fix in #631 worked for me as well