Advertisement
captaindavepdx

Untitled

Aug 18th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. <!--
  2.  
  3. ######################################################################
  4. WARNING!
  5. IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
  6. ######################################################################
  7.  
  8. -->
  9.  
  10.  
  11. ## Checklist
  12.  
  13. <!--
  14. Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
  15. - Look through the README (http://yt-dl.org/readme) and FAQ (http://yt-dl.org/faq) for similar questions
  16. - Search the bugtracker for similar questions: http://yt-dl.org/search-issues
  17. - Finally, put x into all relevant boxes (like this [x])
  18. -->
  19.  
  20. - [x] I'm asking a question
  21. - [x] I've looked through the README and FAQ for similar questions
  22. - [x] I've searched the bugtracker for similar questions including closed ones
  23.  
  24.  
  25. ## Question
  26.  
  27. <!--
  28. Ask your question in an arbitrary form. Please make sure it's worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient.
  29. -->
  30.  
  31. WRITE QUESTION HERE
  32.  
  33. OpenLoad: How do you setup $PATH to resolve the following error?
  34.  
  35. `ERROR: PhantomJS executable not found in PATH, download it from http://phantomjs.org`
  36.  
  37. ## Context:
  38. 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. =]
  39.  
  40. ## Solution:
  41. `youtube-dl` looks for the `phantomjs` file in the location stored in the`$PATH` value. The `$PATH` value tells the command line interface where to find executable files. You need to manually set this value to the location of your `phantomjs` executable file.
  42.  
  43. For my Swift application, I downloaded and stored the [youtube-dl](https://github.com/ytdl-org/youtube-dl#what-is-this-binary-file-where-has-the-code-gone), [ffmpeg](https://github.com/kribblo/node-ffmpeg-installer#readme), and [phantomjs](http://phantomjs.org) executable files in my application's directory. To set the `$PATH` value to that directory, I needed to use the **environment dictionary** of the`Process` class. The **environment dictionary** uses **variable names** as `keys`, and **variable values** as `values`. In Swift, it looks like this:
  44. ```
  45. let environmentDictionary = ["$PATH": "/Users/davidlittlefield/path/to/phantomjs/executable/directory/"]
  46. ```
  47. Then, I set the **environment dictionary** to the `environment` property of the `Process` class. I also had to set the `currentDirectoryPath` property of the `Process` class 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:
  48.  
  49. ![youtube-dl](https://user-images.githubusercontent.com/30560737/63229941-ff21e500-c1ba-11e9-814a-577a2268e82e.png)
  50.  
  51. ## Note:
  52. 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.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement