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

Course with - prefix to course name not downloading! #841

Open
zenny opened this issue Dec 8, 2022 · 2 comments
Open

Course with - prefix to course name not downloading! #841

zenny opened this issue Dec 8, 2022 · 2 comments

Comments

@zenny
Copy link

zenny commented Dec 8, 2022

Hi,

Courses with a none alphanumeric prefix do not get downloaded. For instance:
https://www.coursera.org/learn/-dyslexia/

Gets aborted with a message:
coursera-dl: error: unrecognized arguments: -dyslexia

Also tried the course name inside single ('-dyslexia') and double ("-dyslexia") quotes, no go.

Using the whole url gives:

$ ./coursera-dl --resume --path=../Specialization/online-learning-design
-eduators https://www.coursera.org/learn/-dyslexia
coursera_dl version 0.11.5
Downloading class: https://www.coursera.org/learn/-dyslexia (1 / 1)
Error 400 Client Error: Bad Request for url: https://api.coursera.org/api/onDemandCourseMaterials.v2/?q=slug&slug=https://www.coursera.org/learn/-dyslexia&includes=modules%2
Clessons%2CpassableItemGroups%2CpassableItemGroupChoices%2CpassableLessonElements%2Citems%2Ctracks%2CgradePolicy&&fields=moduleIds%2ConDemandCourseMaterialModules.v1(name%2C
slug%2Cdescription%2CtimeCommitment%2ClessonIds%2Coptional%2ClearningObjectives)%2ConDemandCourseMaterialLessons.v1(name%2Cslug%2CtimeCommitment%2CelementIds%2Coptional%2Ctr
ackId)%2ConDemandCourseMaterialPassableItemGroups.v1(requiredPassedCount%2CpassableItemGroupChoiceIds%2CtrackId)%2ConDemandCourseMaterialPassableItemGroupChoices.v1(name%2Cd
escription%2CitemIds)%2ConDemandCourseMaterialPassableLessonElements.v1(gradingWeight%2CisRequiredForPassing)%2ConDemandCourseMaterialItems.v2(name%2Cslug%2CtimeCommitment%2
CcontentSummary%2CisLocked%2ClockableByItem%2CitemLockedReasonCode%2CtrackId%2ClockedStatus%2CitemLockSummary)%2ConDemandCourseMaterialTracks.v1(passablesCount)&showLockedIt
ems=true getting page https://api.coursera.org/api/onDemandCourseMaterials.v2/?q=slug&slug=https://www.coursera.org/learn/-dyslexia&includes=modules%2Clessons%2CpassableItem
Groups%2CpassableItemGroupChoices%2CpassableLessonElements%2Citems%2Ctracks%2CgradePolicy&&fields=moduleIds%2ConDemandCourseMaterialModules.v1(name%2Cslug%2Cdescription%2Cti
meCommitment%2ClessonIds%2Coptional%2ClearningObjectives)%2ConDemandCourseMaterialLessons.v1(name%2Cslug%2CtimeCommitment%2CelementIds%2Coptional%2CtrackId)%2ConDemandCourse
MaterialPassableItemGroups.v1(requiredPassedCount%2CpassableItemGroupChoiceIds%2CtrackId)%2ConDemandCourseMaterialPassableItemGroupChoices.v1(name%2Cdescription%2CitemIds)%2
ConDemandCourseMaterialPassableLessonElements.v1(gradingWeight%2CisRequiredForPassing)%2ConDemandCourseMaterialItems.v2(name%2Cslug%2CtimeCommitment%2CcontentSummary%2CisLoc
ked%2ClockableByItem%2CitemLockedReasonCode%2CtrackId%2ClockedStatus%2CitemLockSummary)%2ConDemandCourseMaterialTracks.v1(passablesCount)&showLockedItems=true
The server replied: {"msg":"Routing error: Improperly formatted value for parameter 'slug'"}
HTTPError 400 Client Error: Bad Request for url: https://api.coursera.org/api/onDemandCourseMaterials.v2/?q=slug&slug=https://www.coursera.org/learn/-dyslexia&includes=modul
es%2Clessons%2CpassableItemGroups%2CpassableItemGroupChoices%2CpassableLessonElements%2Citems%2Ctracks%2CgradePolicy&&fields=moduleIds%2ConDemandCourseMaterialModules.v1(nam
e%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%2CtimeCommitme
nt%2CcontentSummary%2CisLocked%2ClockableByItem%2CitemLockedReasonCode%2CtrackId%2ClockedStatus%2CitemLockSummary)%2ConDemandCourseMaterialTracks.v1(passablesCount)&showLock
edItems=true

Any idea? Thanks

@agsax2020
Copy link

It might be the same issue I encountered today. I fixed it by installing a forked version of coursera-dl (see #834 (comment)) that addresses a recent change in the Coursera API endpoints. Seems that Coursera recently deprecated their v1 endpoints that this tool uses.

@zenny
Copy link
Author

zenny commented Dec 13, 2022

It might be the same issue I encountered today. I fixed it by installing a forked version of coursera-dl (see #834 (comment)) that addresses a recent change in the Coursera API endpoints. Seems that Coursera recently deprecated their v1 endpoints that this tool uses.

Thanks. But that did not solved the issue.

Now I get:

$ ./coursera-dl --resume --path=../Specialization/online-learning-design-eduators '-dyslexia'
/home/zenny/Downloads/Education/coursera/my-coursera/coursera-dl-v2/coursera/api.py:947: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if extension is '':
/home/zenny/Downloads/Education/coursera/my-coursera/coursera-dl-v2/coursera/api.py:1592: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if extension is '':
usage: coursera-dl [-h] [-u USERNAME] [-p PASSWORD] [--jobs JOBS]
                   [--download-delay DOWNLOAD_DELAY] [-b] [--path PATH]
                   [-sl SUBTITLE_LANGUAGE] [--specialization] [--only-syllabus]
                   [--download-quizzes] [--download-notebooks] [--about]
                   [-f FILE_FORMATS] [--ignore-formats IGNORE_FORMATS]
                   [-sf SECTION_FILTER] [-lf LECTURE_FILTER] [-rf RESOURCE_FILTER]
                   [--video-resolution VIDEO_RESOLUTION] [--disable-url-skipping]
                   [--wget [WGET]] [--curl [CURL]] [--aria2 [ARIA2]] [--axel [AXEL]]
                   [--downloader-arguments DOWNLOADER_ARGUMENTS] [--list-courses]
                   [--resume] [-o] [--verbose-dirs] [--quiet] [-r]
                   [--combined-section-lectures-nums] [--unrestricted-filenames]
                   [-ca COOKIES_CAUTH] [-c COOKIES_FILE] [-n [NETRC]] [-k]
                   [--clear-cache] [--hook HOOKS] [-pl]
                   [--mathjax-cdn MATHJAX_CDN_URL] [--skip-download] [--debug]
                   [--cache-syllabus] [--version] [-l LOCAL_PAGE]
                   [class_names ...]

Without the full url of the course

$ ./coursera-dl --resume --path=../Specialization/online-learning-design-eduators "https://www.coursera.org/learn/-dyslexia"
coursera_dl version 0.11.5
Downloading class: https://www.coursera.org/learn/-dyslexia (1 / 1)
Error 400 Client Error: Bad Request for url: https://api.coursera.org/api/onDemandCourseMaterials.v2/?q=slug&slug=https://www.coursera.org/learn/-dyslexia&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 getting page https://api.coursera.org/api/onDemandCourseMaterials.v2/?q=slug&slug=https://www.coursera.org/learn/-dyslexia&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 server replied: {"msg":"Routing error: Improperly formatted value for parameter 'slug'"}
HTTPError 400 Client Error: Bad Request for url: https://api.coursera.org/api/onDemandCourseMaterials.v2/?q=slug&slug=https://www.coursera.org/learn/-dyslexia&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

So the API version is no issue, but the leading '-' is!

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

2 participants