TRoboto / datacamp-downloader

Download your completed courses on Datacamp easily!
MIT License
178 stars 52 forks source link

List of courses not available - "profile is private" #46

Closed jorritvm closed 2 years ago

jorritvm commented 2 years ago

I think the guys at datacamp must have updated their website, as I am now getting an error while listing courses:

First I set up my token, which works fine. Output is:

INFO: Hi, Jorrit
INFO: Active subscription found

However, then when attempting to read courses the selenium window shows a "profile is private" before closing and Python crashes (stack below).

D:\dev\python\datacamp_downloader_31\.venv\Scripts>datacamp courses
+--------+------------------------------------------+------------+------------+------------+
| ID     | Title                                    | Datasets   | Exercises  | Videos     |
+--------+------------------------------------------+------------+------------+------------+
Please wait |Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main
Please wait /    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\dev\python\datacamp_downloader_31\.venv\Scripts\datacamp.exe\__main__.py", line 7, in <module>
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\typer\main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\typer\main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\datacamp_downloader\downloader.py", line 67, in courses
    datacamp.list_completed_courses(refresh)
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\datacamp_downloader\datacamp_utils.py", line 44, in wrapper
    return f(*args, **kwargs)
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\datacamp_downloader\helper.py", line 72, in wrapper
    output = f(*args)
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\datacamp_downloader\datacamp_utils.py", line 181, in list_completed_courses
    for i, course in enumerate(self.get_completed_courses(refresh), 1):
  File "d:\dev\python\datacamp_downloader_31\.venv\lib\site-packages\datacamp_downloader\datacamp_utils.py", line 410, in get_completed_courses
    completed_courses = data["props"]["pageProps"]["completed_courses"]
KeyError: 'completed_courses'
TRoboto commented 2 years ago

Thank you for reporting this. I've just created PR #47 to fix the issue. Would you mind checking if the PR really fixes the problem reported?

jorritvm commented 2 years ago

Hey, sorry for the delay, I see you have already merged the fix. Just wanted to add that I tested it and it works without any bugs now.