Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Checklist
Question
WRITE QUESTION HERE
OpenLoad: How do you setup $PATH to resolve the following error?
ERROR: PhantomJS executable not found in PATH, download it from http://phantomjs.orgContext:
I read through all the posts about the error:
ERROR: PhantomJS executable not found in PATH, download it from http://phantomjs.org. The solution given was to setup$PATH,but I didn't know how or where to do that. I looked up a variety of keywords on Google, but the results weren't very helpful, so I wanted to pass along the implementation that worked for me. =]Solution:
youtube-dllooks for thephantomjsfile in the location stored in the$PATHvalue. The$PATHvalue tells the command line interface where to find executable files. You need to manually set this value to the location of yourphantomjsexecutable file.For my Swift application, I downloaded and stored the youtube-dl, ffmpeg, and phantomjs executable files in my application's directory. To set the
$PATHvalue to that directory, I needed to use the environment dictionary of theProcessclass. The environment dictionary uses variable names askeys, and variable values asvalues. In Swift, it looks like this:Then, I set the environment dictionary to the
environmentproperty of theProcessclass. I also had to set thecurrentDirectoryPathproperty of theProcessclass to the same path value that I used for$PATH. Then, I was able to successfully download titles and videos from OpenLoad! In Swift, it looks like this:Note:
Also, this code demonstrates how to run an executable file with arguments from within Swift, which was another challenge that didn't seem to have much documentation available online.