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

Issue downloading #28

Closed JacquesvanWyk closed 6 years ago

JacquesvanWyk commented 7 years ago

Good Day

I have gotten this to work but now i get this error

`C:/stackskills-dl/lib/lecture.rb:49:in ``': No such file or directory - youtube-dl --restrict-filenames https://fast.wistia.net/embed/iframe/7is59k8vtk (Errno::ENOENT)
        from C:/stackskills-dl/lib/lecture.rb:49:in `download_video'
        from C:/stackskills-dl/lib/lecture.rb:33:in `block in download'
        from C:/stackskills-dl/lib/utilities.rb:11:in `block in mkchdir'
        from C:/stackskills-dl/lib/utilities.rb:10:in `chdir'
        from C:/stackskills-dl/lib/utilities.rb:10:in `mkchdir'
        from C:/stackskills-dl/lib/lecture.rb:32:in `download'
        from C:/stackskills-dl/lib/course.rb:18:in `block (2 levels) in download'
        from C:/stackskills-dl/lib/course.rb:17:in `each'
        from C:/stackskills-dl/lib/course.rb:17:in `block in download'
        from C:/stackskills-dl/lib/utilities.rb:11:in `block in mkchdir'
        from C:/stackskills-dl/lib/utilities.rb:10:in `chdir'
        from C:/stackskills-dl/lib/utilities.rb:10:in `mkchdir'
        from C:/stackskills-dl/lib/course.rb:16:in `download'
        from C:/stackskills-dl/lib/course_finder.rb:10:in `block in run'
        from C:/stackskills-dl/lib/course_finder.rb:37:in `block in execute'
        from C:/stackskills-dl/lib/course_finder.rb:32:in `each'
        from C:/stackskills-dl/lib/course_finder.rb:32:in `execute'
        from C:/stackskills-dl/lib/course_finder.rb:9:in `run'
        from stackskills_dl.rb:8:in `<main>'
`

What does this mean?I have youtube-dl also in main directory but am stuck now.It does actually create folders but then that error.

yoonwaiyan commented 7 years ago

What's the folder name being created?

Aikio commented 7 years ago

Hi, I have the same problem on Windows 7, have tried a few different "youtube-dl" gems but no success so far. Tested with ruby-youtube-dl, youtubeDL, youtube-dl.rb (0.3.1.2016.09.11.1) It creates folders for the course but then stops at this error.

folder names is for example: C:\Users\xxxx\Documents\stackskills-dl\downloads\JavaScript_Programming_Complete\00. Introduction and Syntax\01. Promo

ruby-youtube-dl seems to get the closest to actualy downloading, but it stops with this error:

 Downloading Internal_JavaScript
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ruby-youtube-dl-0.0.5/bin/ruby-youtube-dl
:3:in ``': Exec format error - C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ruby-youtu
be-dl-0.0.5/bin/youtube-dl.py --restrict-filenames https://fast.wistia.net/embed
/iframe/0unuxm3l5d (Errno::ENOEXEC)
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ruby-youtube-dl-0.0.5/bin/ru
by-youtube-dl:3:in `<top (required)>'
        from C:/Ruby24-x64/bin/ruby-youtube-dl:22:in `load'
        from C:/Ruby24-x64/bin/ruby-youtube-dl:22:in `<main>'
yoonwaiyan commented 7 years ago

@Aikio, for Windows, please install youtube-dl via the official website here instead of using wrapped gems. Please update me whether it works after installing from the official source.

Aikio commented 7 years ago

I tried this, but the exe file for windows does not seem to be compatible as such. It's not an installer.
Or I am not sure how to edit lecture.rb to use the youtube-dl.exe correctly.

When running the exe file directly this is the message you get.

Usage: youtube-dl.exe [OPTIONS] URL [URL...]
youtube-dl.exe: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.
yoonwaiyan commented 7 years ago

Hmm is it mandatory to execute youtube-dl without .exe ? I think we'll need some workaround to make youtube-dl work.

For your case, I think it'll be putting the youtube.exe in the same folder as stackskills_dl.rb. If .exe is mandatory to run youtube-dl in Windows, please change line 57 of lib/lecture.rb from youtube-dl to youtube-dl.exe and try running the script again.

Not sure whether this works, but I'll appreciate your few minutes of time to try it out and update me if this quick hack works. Thanks in advance.

yoonwaiyan commented 7 years ago

According to youtube-dl github page, you'll need to place it in your system folder:

Windows users can download an .exe file and place it in any location on their PATH except for %SYSTEMROOT%\System32 (e.g. do not put in C:\Windows\System32).

Aikio commented 7 years ago

After placing it in the System32 folder I get this message:

Downloading Internal_JavaScript Fatal Python error: Py_Initialize: unable to load the file system codec ImportError: No module named 'encodings'

Current thread 0x00001b80 (most recent call first):

Downloading Access_HTML_with_Commenting_Functionality_in_JavaScript C:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:229:in mkdir': Invalid argument @ dir _s_mkdir - 01. Get Access on Web Content |Better understanding of JS (Errno::EIN VAL) from C:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:229:infu_mkdir' from C:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:207:in block (2 levels) in mkdir_p' from C:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:205:inreverse_each' from C:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:205:in `block in mkdir_p'

   from C:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:191:in `each'
   from C:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:191:in `mkdir_p'
   from C:/Users/xxxx/Documents/stackskills-dl/lib/utilities.rb:11:in `m

kchdir' from C:/Users/xxxx/Documents/stackskills-dl/lib/lecture.rb:36:in dow nload' from C:/Users/xxxx/Documents/stackskills-dl/lib/course.rb:24:inbloc k (2 levels) in download' from C:/Users/xxxx/Documents/stackskills-dl/lib/course.rb:23:in each ' from C:/Users/xxxx/Documents/stackskills-dl/lib/course.rb:23:inbloc k in download' from C:/Users/xxxx/Documents/stackskills-dl/lib/utilities.rb:13:in b lock in mkchdir' from C:/Users/xxxx/Documents/stackskills-dl/lib/utilities.rb:12:inc hdir' from C:/Users/xxxx/Documents/stackskills-dl/lib/utilities.rb:12:in m kchdir' from C:/Users/xxxx/Documents/stackskills-dl/lib/course.rb:22:indown load' from C:/Users/xxxx/Documents/stackskills-dl/lib/course_finder.rb:13:i n block (2 levels) in run' from C:/Users/xxxx/Documents/stackskills-dl/lib/course_finder.rb:41:i nblock in execute' from C:/Users/xxxx/Documents/stackskills-dl/lib/course_finder.rb:36:i n each' from C:/Users/xxxx/Documents/stackskills-dl/lib/course_finder.rb:36:i nexecute' from C:/Users/xxxx/Documents/stackskills-dl/lib/course_finder.rb:12:i n block in run' from C:/Users/xxxx/Documents/stackskills-dl/lib/utilities.rb:13:inb lock in mkchdir' from C:/Users/xxxx/Documents/stackskills-dl/lib/utilities.rb:12:in c hdir' from C:/Users/xxxx/Documents/stackskills-dl/lib/utilities.rb:12:inm kchdir' from C:/Users/xxxx/Documents/stackskills-dl/lib/course_finder.rb:11:i n run' from stackskills_dl.rb:11:in

'

yoonwaiyan commented 7 years ago

For the first issue, you can refer to this issue in youtube-dl: https://github.com/rg3/youtube-dl/issues/10372 or Google for the solution, it's related to Python instead of this repo.

For the second issue, please try change line 18 of lib/course_section.rb to @name = Utilities.escape_chars(@name.strip) and run again, suspecting the error comes from unicode issues in Windows.

JacquesvanWyk commented 7 years ago

stack1 stack2

It created the folders but wont go further.

yoonwaiyan commented 7 years ago

@JacquesvanWyk What's the output you get when you put puts self.name after line 49 in lib/lecture.rb?

Aikio commented 7 years ago

Hi again.

According to youtube-dl github page, you'll need to place it in your system folder:

Windows users can download an .exe file and place it in any location on their PATH except for >%SYSTEMROOT%\System32 (e.g. do not put in C:\Windows\System32).

You cannot place it in the System32 folder. What you have to do is place it in any other folder (I chose the Stackskills_dl folder) and then add the path to the youtube-dl.exe file in Environmental variables under PATH (I.e. C:\Users\xxxx\Documents\stackskills-dl)

My issue with Python was solved by uninstalling python from my laptop and restarting windows.

So to summarize; To get it to work on my Win7 Computer you have to download the youtube-dl.exe file and add the path to the program to environmental variables... (anywhere except System folder) Change line 57 in lecture.rb from

 puts `youtube-dl --restrict-filenames #{video_url}`

to puts youtube-dl.exe --restrict-filenames #{video_url}

Change line 18 in course_section.rb from

@name = @name.strip to @name = Utilities.escape_chars(@name.strip)

Thank you for the script and all the help :)

yoonwaiyan commented 6 years ago

@JacquesvanWyk Sorry it's been a while. I've pushed the fix as suggested to @Aikio, does this solves your issue?

yoonwaiyan commented 6 years ago

Closing this for now as there's no newer response. Please re-open the issue if the problem persists, thanks.