yoonwaiyan / stackskills-dl

Simple Ruby script to download all StackSkills tutorials.
https://yoonwaiyan.github.io/stackskills-dl/
MIT License
59 stars 19 forks source link

courses failing to be downloaded as it cannot identify them #12

Closed zero-executioner closed 7 years ago

zero-executioner commented 7 years ago

Apologies for the generic subject When I run this command under linux: ruby stackskills_dl.rb
it requests the login and password, and says that login was successful, but then just terminates. I assumed this meant it wanted the course to be downloaded. I then ran this: ruby stackskills_dl.rb -c https://stackskills.com/courses/certified-information-systems-security-professional-cissp/ similar to your example in the readme.md file.

It throws this error: Login Successfully. Finding https://stackskills.com/courses/certified-information-systems-security-professional-cissp/ from your list of courses /opt/15_green/stackskills-dl-master/lib/course_finder.rb:33:in block in execute': undefined methodtext' for nil:NilClass (NoMethodError) from /opt/15_green/stackskills-dl-master/lib/course_finder.rb:32:in each' from /opt/15_green/stackskills-dl-master/lib/course_finder.rb:32:inexecute' from /opt/15_green/stackskills-dl-master/lib/course_finder.rb:9:in run' from stackskills_dl.rb:8:in

'

I've never made any ruby code, but I've done a bunch of perl code, especially with the WWW:mechanize module so my assumption was that they're at least related. I added a require for 'pp' in the main script (stackskills_dl.rb) and then on line 32 of lib_course_finder.rb, I added pp current_page to do some debugging.

The resulting output showed that it saw my courses(including the one entitled above) and gave URL's. However the URL's were not the named ones: "/courses/enrolled/83416"

On a hunch, I guessed to just try using the number to download the course videos and it worked fine: ruby stackskills_dl.rb -c 83416

So this may be an opportunity for the documentation, or may require a bit of a modification to the code to resolve to search for the title and not the URL, or to try loading the URL if specified, because that URL did open the course for me.

yoonwaiyan commented 7 years ago

Hi there, apparently this is a bug of the script as the link isn't recognized in the courses page. The course link as displayed in Courses page is using course id while the example stated was prettified slugs of the course name.

Please try using the link as stated in Courses page e.g. https://stackskills.com/courses/enrolled/68582 while waiting for the fix (sorry it'll take some time).

PoiSonS commented 7 years ago

Hello Dear @yoonwaiyan ,

I faced the same issue mentioned above, as well try to follow the workaround your mentioned but unfortunately still the same;

Login Successfully. Finding https://stackskills.com/courses/enrolled/53726 from your list of courses /home/trng/Downloads/stackskills-dl-master/lib/course_finder.rb:33:inblock in execute': undefined method text' for nil:NilClass (NoMethodError) from /home/trng/Downloads/stackskills-dl-master/lib/course_finder.rb:32:ineach' from /home/trng/Downloads/stackskills-dl-master/lib/course_finder.rb:32:in execute' from /home/trng/Downloads/stackskills-dl-master/lib/course_finder.rb:9:inrun'`

and want to say that I really appreciate your efforts in write and maintain this script.

regards,

yoonwaiyan commented 7 years ago

@PoiSonS Is this course being listed in your "My Courses" page? If yes, do My Courses page have any pagination(courses are divided into pages)?

By the way, I've improved the code to display proper message when a course is not found in the list.

yoonwaiyan commented 7 years ago

Fixed the issue by adding another option called -cs so that you can find the course by course slugs. For @PoiSonS 's case, please file another issue if there's any further discussion as it's not related to this issue anymore.

PoiSonS commented 7 years ago

appreciate your efforts and support, thanks.

I will try the updated source code.