Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coursera: deprecating API endpoint onDemandCourseMaterials.v1 #834

Open
blakekjohnson opened this issue Oct 21, 2022 · 50 comments
Open

coursera: deprecating API endpoint onDemandCourseMaterials.v1 #834

blakekjohnson opened this issue Oct 21, 2022 · 50 comments

Comments

@blakekjohnson
Copy link

Hello, at Coursera we are in the process of deprecating the onDemandCourseMaterials.v1 endpoint. When looking for usages of this API we found it used externally here and wanted to notify the project owners that this endpoint will soon have traffic shut off. The onDemandCourseMaterials.v2 endpoint can serve as an alternative to onDemandCourseMaterial.v1

@Ranielo
Copy link

Ranielo commented Oct 27, 2022

Hey. has this happened today? as I cannot use anymore coursera-dl.

Thanks for info

@zacsyuan
Copy link

zacsyuan commented Oct 30, 2022

I run into this issue as well...wondering is there a way we could tweak codes at api to proceed when await owner to update package?

image

@MadApe
Copy link

MadApe commented Oct 30, 2022

@blakekjohnson If it's not too much trouble, would you mind proving a link to the documentation for the new API? Thanks!

@zacsyuan
Copy link

@MadApe
@blakekjohnson

and much appreciated if you two could keep me posted

@sbwcwso
Copy link

sbwcwso commented Oct 31, 2022

@MadApe @blakekjohnson

and much appreciated if you two could keep me posted

I also had the same problem, if you have a solution now?

@blakekjohnson
Copy link
Author

onDemandCourseMaterials.v2 is functionally the same as v1, a simple update of the version number would resolve the issue. Adding _V2 to the end of the variable on this line will resolve the aforementioned issues.

@sbwcwso
Copy link

sbwcwso commented Oct 31, 2022

onDemandCourseMaterials.v2 is functionally the same as v1, a simple update of the version number would resolve the issue. Adding _V2 to the end of the variable on this line will resolve the aforementioned issues.

When I changed line , I have the error below, is this a problem of my python version, I am using Python 3.10.7 now.

❯ ./coursera-dl build-a-computer
/home/lijunjie/Downloads/coursera-dl/coursera/api.py:948: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if extension is '':
/home/lijunjie/Downloads/coursera-dl/coursera/api.py:1593: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if extension is '':
coursera_dl version 0.11.5
Downloading class: build-a-computer (1 / 1)
Parsing syllabus of on-demand course (id=ct7G8DVLEeWfzhKP8GtZlQ). This may take some time, please be patient ...
Processing module  introduction
Processing section     introduction
Processing lecture         module-0-introduction-roadmap (supplement)
Traceback (most recent call last):
  File "/home/lijunjie/Downloads/coursera-dl/./coursera-dl", line 6, in <module>
    coursera_dl.main()
  File "/home/lijunjie/Downloads/coursera-dl/coursera/coursera_dl.py", line 247, in main
    error_occurred, completed = download_class(
  File "/home/lijunjie/Downloads/coursera-dl/coursera/coursera_dl.py", line 214, in download_class
    return download_on_demand_class(session, args, class_name)
  File "/home/lijunjie/Downloads/coursera-dl/coursera/coursera_dl.py", line 134, in download_on_demand_class
    error_occurred, modules = extractor.get_modules(
  File "/home/lijunjie/Downloads/coursera-dl/coursera/extractors.py", line 53, in get_modules
    error_occurred, modules = self._parse_on_demand_syllabus(
  File "/home/lijunjie/Downloads/coursera-dl/coursera/extractors.py", line 161, in _parse_on_demand_syllabus
    links = course.extract_links_from_supplement(
  File "/home/lijunjie/Downloads/coursera-dl/coursera/api.py", line 1268, in extract_links_from_supplement
    supplement_content, self._extract_links_from_text(value))
  File "/home/lijunjie/Downloads/coursera-dl/coursera/api.py", line 1518, in _extract_links_from_text
    supplement_links = self._extract_links_from_a_tags_in_text(text)
  File "/home/lijunjie/Downloads/coursera-dl/coursera/api.py", line 1597, in _extract_links_from_a_tags_in_text
    extension = clean_filename(
  File "/home/lijunjie/Downloads/coursera-dl/coursera/utils.py", line 118, in clean_filename
    s = h.unescape(s)
AttributeError: 'HTMLParser' object has no attribute 'unescape'

@zacsyuan
Copy link

zacsyuan commented Nov 1, 2022

@sbwcwso I dont have your issue

but other than adding _V2 as @blakekjohnson points out, I also edited the name down below to align the version name.

works for me now... again @blakekjohnson much appreciated....I dont think we would ever figure out without your note

image

@olawalejuwonm
Copy link

@sbwcwso I dont have your issue

but other than adding _V2 as @blakekjohnson points out, I also edited the name down below to align the version name.

works for me now... again @blakekjohnson much appreciated....I dont think we would ever figure out without your note

image

Thank you so much, this worked

@kmp8072
Copy link

kmp8072 commented Nov 3, 2022

Hello, at Coursera we are in the process of deprecating the onDemandCourseMaterials.v1 endpoint. When looking for usages of this API we found it used externally here and wanted to notify the project owners that this endpoint will soon have traffic shut off. The onDemandCourseMaterials.v2 endpoint can serve as an alternative to onDemandCourseMaterial.v1

Thanks for this solution. Life saver.

@raffaem
Copy link

raffaem commented Nov 6, 2022

I pushed these changes in my fork

@SyedUmairHassanKazmi
Copy link

how do i install this forked library using pip?

@raffaem
Copy link

raffaem commented Nov 14, 2022

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

@SadaFalah
Copy link

Worked like magic thank you so much

@loky777
Copy link

loky777 commented Nov 18, 2022

@raffaem been waiting for this for past 2 weeks, thanks a lot :)

@huggiebao2
Copy link

It perfectly worked! :0
Thx very much! life safer!!

@benvxavier
Copy link

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

Thanks! work for me.

@ahmmishkat
Copy link

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

Thanks a lot.

@rallantan
Copy link

Hello,

How do i install this forked library using pip?

I uninstall using this command prompt pip3 uninstall coursera-dl

The coursera got uninstalled but after that when I typed git clone https://github.com/raffaem/coursera-dl

It says 'git' is not recognized as an internal or external command,
operable program or batch file.

Can someone help me how to follow the below command step by step pls

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

Request you pls help me

@raffaem
Copy link

raffaem commented Dec 12, 2022

@rallantan you need to install git from here

@raffaem
Copy link

raffaem commented Dec 12, 2022

@rallantan you can also go to the repo and click on Code->Download ZIP

@rallantan
Copy link

Dear Rraffaem,

Thanks for your response,let me tell you I am not a tech savy person,I still learning.

I have installed git from https://git-scm.com/

I have downloaded the Code->Download ZIP, I have downloaded the file.

I dont know what to do next can you help me.I need coursera courses for my professional life.Pls help me

@raffaem
Copy link

raffaem commented Dec 13, 2022

Dear Rraffaem,

Thanks for your response,let me tell you I am not a tech savy person,I still learning.

I have installed git from https://git-scm.com/

I have downloaded the Code->Download ZIP, I have downloaded the file.

I dont know what to do next can you help me.I need coursera courses for my professional life.Pls help me

If you now have git, you can follow these instructions

@rallantan
Copy link

Pls help me

I have installed git from https://git-scm.com/

I finished this step ----------- git clone https://github.com/raffaem/coursera-dl

I went to the cd coursera-dl

When I enter pip3 install it gives me a error message -----ERROR: You must give at least one requirement to install (see "pip help install")

I upgraded the pip with this command pip install --upgrade pip

It says ----- Requirement already satisfied: pip in c:\users\rajal\appdata\local\programs\python\python311\lib\site-packages (22.3.1)

I am stuck now pls help me

@raffaem
Copy link

raffaem commented Dec 18, 2022

Pls help me

I have installed git from https://git-scm.com/

I finished this step ----------- git clone https://github.com/raffaem/coursera-dl

I went to the cd coursera-dl

When I enter pip3 install it gives me a error message -----ERROR: You must give at least one requirement to install (see "pip help install")

I upgraded the pip with this command pip install --upgrade pip

It says ----- Requirement already satisfied: pip in c:\users\rajal\appdata\local\programs\python\python311\lib\site-packages (22.3.1)

I am stuck now pls help me

The command is

pip3 install .

not

pip3 install

The dot is important.

Don't neglect the dot.

Welcome the dot in your life, and good things will happen.

@anny-soft
Copy link

Hello,
I'm working on Ubuntu 20.04
Python 3.8.10
I type :~/my-coursera$ coursera-dl initiation-programmation-cpp
And i have that:
coursera_dl version 0.11.5
Downloading class: initiation-programmation-cpp (1 / 1)
Parsing syllabus of on-demand course (id=zRR1L_KfEeWUoA51NO3YLQ). This may take some time, please be patient ...
Error 404 Client Error: Not Found for url: https://api.coursera.org/api/onDemandCourseMaterials.v1/?q=slug&slug=initiation-programmation-cpp&includes=moduleIds%2ClessonIds%2CpassableItemGroups%2CpassableItemGroupChoices%2CpassableLessonElements%2CitemIds%2Ctracks&fields=moduleIds%2ConDemandCourseMaterialModules.v1(name%2Cslug%2Cdescription%2CtimeCommitment%2ClessonIds%2Coptional)%2ConDemandCourseMaterialLessons.v1(name%2Cslug%2CtimeCommitment%2CelementIds%2Coptional%2CtrackId)%2ConDemandCourseMaterialPassableItemGroups.v1(requiredPassedCount%2CpassableItemGroupChoiceIds%2CtrackId)%2ConDemandCourseMaterialPassableItemGroupChoices.v1(name%2Cdescription%2CitemIds)%2ConDemandCourseMaterialPassableLessonElements.v1(gradingWeight)%2ConDemandCourseMaterialItems.v1(name%2Cslug%2CtimeCommitment%2Ccontent%2CisLocked%2ClockableByItem%2CitemLockedReasonCode%2CtrackId)%2ConDemandCourseMaterialTracks.v1(passablesCount)&showLockedItems=true getting page https://api.coursera.org/api/onDemandCourseMaterials.v1/?q=slug&slug=initiation-programmation-cpp&includes=moduleIds%2ClessonIds%2CpassableItemGroups%2CpassableItemGroupChoices%2CpassableLessonElements%2CitemIds%2Ctracks&fields=moduleIds%2ConDemandCourseMaterialModules.v1(name%2Cslug%2Cdescription%2CtimeCommitment%2ClessonIds%2Coptional)%2ConDemandCourseMaterialLessons.v1(name%2Cslug%2CtimeCommitment%2CelementIds%2Coptional%2CtrackId)%2ConDemandCourseMaterialPassableItemGroups.v1(requiredPassedCount%2CpassableItemGroupChoiceIds%2CtrackId)%2ConDemandCourseMaterialPassableItemGroupChoices.v1(name%2Cdescription%2CitemIds)%2ConDemandCourseMaterialPassableLessonElements.v1(gradingWeight)%2ConDemandCourseMaterialItems.v1(name%2Cslug%2CtimeCommitment%2Ccontent%2CisLocked%2ClockableByItem%2CitemLockedReasonCode%2CtrackId)%2ConDemandCourseMaterialTracks.v1(passablesCount)&showLockedItems=true
The server replied:

<title>Coursera - API Route Does Not Exist</title>







API Route Does Not Exist



Edge does not know about this API route.

Check whether this route is exposed in the routing table.


HTTPError 404 Client Error: Not Found for url: https://api.coursera.org/api/onDemandCourseMaterials.v1/?q=slug&slug=initiation-programmation-cpp&includes=moduleIds%2ClessonIds%2CpassableItemGroups%2CpassableItemGroupChoices%2CpassableLessonElements%2CitemIds%2Ctracks&fields=moduleIds%2ConDemandCourseMaterialModules.v1(name%2Cslug%2Cdescription%2CtimeCommitment%2ClessonIds%2Coptional)%2ConDemandCourseMaterialLessons.v1(name%2Cslug%2CtimeCommitment%2CelementIds%2Coptional%2CtrackId)%2ConDemandCourseMaterialPassableItemGroups.v1(requiredPassedCount%2CpassableItemGroupChoiceIds%2CtrackId)%2ConDemandCourseMaterialPassableItemGroupChoices.v1(name%2Cdescription%2CitemIds)%2ConDemandCourseMaterialPassableLessonElements.v1(gradingWeight)%2ConDemandCourseMaterialItems.v1(name%2Cslug%2CtimeCommitment%2Ccontent%2CisLocked%2ClockableByItem%2CitemLockedReasonCode%2CtrackId)%2ConDemandCourseMaterialTracks.v1(passablesCount)&showLockedItems=true PLEASE i need help to fix that error

@koluantic
Copy link

@blakekjohnson and @raffaem thank you so much...cheers!!!

@anny-soft
Copy link

It's ok with python 3.9 :)
Thank you all

@DevMachTech
Copy link

Please, have you been able to solve this

@IMJoeyZhu
Copy link

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

Thanks a lot! This works for me!

binarin added a commit to binarin/nixpkgs that referenced this issue Feb 2, 2023
The api was changed in November 2022, so the program no longer works -
coursera-dl/coursera-dl#834

Doesn't look like it's maintained either, but at least there is a
patch that restores the functionality.
github-actions bot pushed a commit to NixOS/nixpkgs that referenced this issue Feb 2, 2023
The api was changed in November 2022, so the program no longer works -
coursera-dl/coursera-dl#834

Doesn't look like it's maintained either, but at least there is a
patch that restores the functionality.

(cherry picked from commit fd3d2c3)
dpausp pushed a commit to flyingcircusio/nixpkgs that referenced this issue Feb 7, 2023
The api was changed in November 2022, so the program no longer works -
coursera-dl/coursera-dl#834

Doesn't look like it's maintained either, but at least there is a
patch that restores the functionality.

(cherry picked from commit fd3d2c3)
@lsimone
Copy link

lsimone commented Feb 12, 2023

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

thanks! <3
Worked for mee too!

miker2049 pushed a commit to miker2049/nixpkgs that referenced this issue Feb 17, 2023
The api was changed in November 2022, so the program no longer works -
coursera-dl/coursera-dl#834

Doesn't look like it's maintained either, but at least there is a
patch that restores the functionality.

(cherry picked from commit fd3d2c3)
@olawalejuwonm
Copy link

I pushed these changes in my fork

How do i use your fork?

@raffaem
Copy link

raffaem commented Feb 26, 2023

I pushed these changes in my fork

How do i use your fork?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

The dot in the last command is important.

@khrnchn
Copy link

khrnchn commented Feb 28, 2023

I pushed these changes in my fork

How do i use your fork?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

The dot in the last command is important.

hi, same error still occurs after i did the commands you gave :c

@sebastianelsner
Copy link

The repo mentioned above worked for me: https://github.com/raffaem/coursera-dl

pip uninstall coursera-dl
pip install git+https://github.com/raffaem/coursera-dl.git
coursera-dl -u YOURUSER -p YOURPASSWORD -ca YOURCA YOURSPECIALIZATION

@Justin-326
Copy link

I have done the following
pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

But how do I run the commands now? When I enter something like "coursera-dl -h" it says no command found. In the original version when I did that, it would display the help

@thetenthousandthings
Copy link

Works great! You rock! Thank you so much for this.

@raffaem
Copy link

raffaem commented Jul 15, 2023

I have done the following pip3 uninstall coursera-dl git clone https://github.com/raffaem/coursera-dl cd coursera-dl pip3 install .

But how do I run the commands now? When I enter something like "coursera-dl -h" it says no command found. In the original version when I did that, it would display the help

I renamed my fork. Check the README for the correct command to run.

Please post questions about my fork on my fork. This is the original fork.

@gothamnight
Copy link

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

i followed your instructions but now it's tell me :
command not found: coursera-dl

@gothamnight
Copy link

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

i followed your instructions but now it's tell me : command not found: coursera-dl

don't worry I've found my way around the problem and it worked.
what I did was substitute the command "coursera-dl" with "cs-dlp" and it worked just fine. THANKS!

@UpalkKazi
Copy link

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

i followed your instructions but now it's tell me : command not found: coursera-dl

don't worry I've found my way around the problem and it worked. what I did was substitute the command "coursera-dl" with "cs-dlp" and it worked just fine. THANKS!

This is the best suggestion

@AndreyBaum
Copy link

AndreyBaum commented Aug 29, 2023

'cs-dlp' is not recognized as an internal or external command, operable program or batch file.
I am writing a command in the folder where I created the coursera-dl folder, but this error comes out

UPD: It doesn't matter anymore. I just wrote all the commands through PowerShell, not through cmd, and everything worked

@gabi271
Copy link

gabi271 commented Sep 22, 2023

After completing the 4 steps, I get the message "coursera-dl is not recognized as a command", the four steps were completed without problems

@stevienovak
Copy link

stevienovak commented Sep 24, 2023

Hello Rraffaem,

Thanks for the above code! I have been using it for two months and it works like a gem but I am receiving a 403 error now.

The server replied: {"errorCode":"Not Authorized","message":null,"details":null}
HTTPError 403 Client Error: Forbidden for url: https://api.coursera.org/api/onDemandCourseMaterials.v2/?q=slug&slug=siads532&includes=modules%2Clessons%2CpassableItemGroups%2CpassableItemGroupChoices%2CpassableLessonElements%2Citems%2Ctracks%2CgradePolicy&&fields=moduleIds%2ConDemandCourseMaterialModules.v1(name%2Cslug%2Cdescription%2CtimeCommitment%2ClessonIds%2Coptional%2ClearningObjectives)%2ConDemandCourseMaterialLessons.v1(name%2Cslug%2CtimeCommitment%2CelementIds%2Coptional%2CtrackId)%2ConDemandCourseMaterialPassableItemGroups.v1(requiredPassedCount%2CpassableItemGroupChoiceIds%2CtrackId)%2ConDemandCourseMaterialPassableItemGroupChoices.v1(name%2Cdescription%2CitemIds)%2ConDemandCourseMaterialPassableLessonElements.v1(gradingWeight%2CisRequiredForPassing)%2ConDemandCourseMaterialItems.v2(name%2Cslug%2CtimeCommitment%2CcontentSummary%2CisLocked%2ClockableByItem%2CitemLockedReasonCode%2CtrackId%2ClockedStatus%2CitemLockSummary)%2ConDemandCourseMaterialTracks.v1(passablesCount)&showLockedItems=true

The last I used cs-dlp was on 15 Sep! Possible to advise what I should do to solve the above issue? thx!

Update on 26 Sep
I solved the problem! There was an update to my CAUTH. I changed it and the script works like a gem. thanks for the script! its a Life Saver

@inayatiphone619
Copy link

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

i followed your instructions but now it's tell me : command not found: coursera-dl

don't worry I've found my way around the problem and it worked. what I did was substitute the command "coursera-dl" with "cs-dlp" and it worked just fine. THANKS!

This is the best suggestion

Thank you so much,
I have cloned but getting following warning WARNING: The script cs-dlp.exe is installed in 'C:\Users\Commissioner\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed cs-dlp-0.12.0b0

and when i run coursera-dl it is also not reconginized can anyone help me please

@a1timothy
Copy link

Fault on install:
_building 'lz4.version' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Installing C++ as advised does not help. Any ideas for a cure?

@ellyturla
Copy link

how do i install this forked library using pip?

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

its work. thanks

@Ananyaa32
Copy link

Ananyaa32 commented May 12, 2024

Hello All,

I am not a technical person pls help me.

I have installed git from https://git-scm.com/

I have done all the below steps :-

pip3 uninstall coursera-dl
git clone https://github.com/raffaem/coursera-dl
cd coursera-dl
pip3 install .

Now in the CMD prompt what should type to download the Coursera course pls help me

Pls share the command which I need to follow. Pls help me

I dont know how to download the Coursera course pls help me

@Ananyaa32
Copy link

Hello raffaem

Can you pls help me pls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests