WebDL on standard macOS 10.13.x

Posted: Sunday, May 27, 2018 by Tyler Durden in Labels:

These instructions show you how to install WebDL on standard macOS 10.13.x
delx - this is your site - if you want delete this comment or move it to somewhere more relevant on bitbucket... not sure about the etiquette of these things.
Disclaimer
This explanation comes with no warranty or support. This has been tested on a clean 'out of the box' Mac, but you may well have installed other items on your Mac that render these instructions invalid that I won't know about. I don't visit this forum often (in fact, I had to re-register since it has changed!) so I can't reliably respond to queries - but I've commented everything below that hopefully should give you some clues if you run into difficulty. Lastly, I'm a bash guy really, not fully versant with Python, so there are likely others here who understand much more than me. These instructions expect you are logged in with default user privileges (as the first user of any macOS box is). This installation - and the use of WebDL - involves use of the Terminal. If you aren't familiar with using the command line then you may want to get help from someone who is. You need an internet connection for any of this to work.
(1) Install XCode from the Mac AppStore. It is free, but you do need an AppleID to download it. It is a big download, so will take a while.
(2) Next you must launch XCode once - to agree to its licence and let it install various components. It will ask for your password to do this. It will eventually display the splash screen to start an XCode project - but you aren't going to do that. So just choose Quit from the menu.
(3) Next we need to install the XCode command line tools. I'm not sure if the AppStore install does this for you now or not, but better safe than sorry - it will only take a few minutes. Do the following:
Launch Terminal from /Applications/Utilities From now on everything is typed in Terminal. If you aren't comfortable about this think twice before using WebDL.
In the Terminal window type:
xcode-select --install
A GUI dialog box will pop up and so choose Install, and Agree to the licence After a few minutes of running the Install CommandLine DeveloperTools will display 'The software was installed' Click Done
Comment: At this point we haven't done anything about WebDL - we've just been getting the Mac ready to run some software WebDL uses. WebDL is written in Python and macOS has Python - but it's an older version (2.7) and so we can't just install WebDL and get going. We are going to use HomeBrew - 'Brew is an excellent way of installing command line programs that don't come with macOS by default. Purists may say that you should compile them yourself, but this is much easier, believe me. You can find out more about HomeBrew here:https://brew.sh/
(4) For now, we are going to install HomeBrew to use it to get a few extra bits WebDL needs. In Terminal copy/paste the following install command which is also available on the website I listed above:
It tells you what it is about to do and offers you to bail out if you want Press Return to continue It will ask for your password. Enter it and press Return
The install finishes with a Next Steps information about using 'Brew more, but you don't need to do that now, but feel free to learn about it later.
Comment: If anything goes wrong at this point, then I can't help you. This is what normally happens on a stock standard 10.13 Mac - if the HomeBrew installation fails then there is some other stuff on your Mac likely interfering with it. Best to ask around in the HomeBrew forums for help.
(5) We now type (or better, copy/paste) the following one-liner
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
This will let the Terminal know where to find the 'brew stuff we've installed
(6) We can now use HomeBrew to install the extras that WebDL needs
brew install python
will install that latest (v3.6 or later) version of Python that WebDL needs
brew install ffmpeg
will install the ffmpeg video libraries that are needed to turn downloads to MP4s If 'brew is functioning right, all this should work fine
Comment: It is important to realise that we now have TWO versions of Python on our Mac - When installing two versions of any program, the older version can't usually open stuff made by the newer version. So from now on we have to indicate which version we need to use. (Yes, there are ways of making Python3 the default, but if you know that, then you are not likely to be reading this guide and know more about it than me.)
(7) Lastly for Python, we need to install virtual environments. This is a feature of Python 3 that I'm not really familiar with, but is needed for WebDL. Virtual Environments are a bit like macOS app packages - they put all the necessary parts for a program to work into one directory for you. pip is a program that comes with Python and we want to use the v3 of it:
pip3 install virtualenv
Now we are at last ready to work with WebDL
Comment: I put all my TV stuff in a directory in my home folder called TV You don't have to, but you MUST know where you've put webdl because we are about to download it.
(8) The following commands make a TV directory in my Home folder and change our working directory to it:
mkdir ~/TV
cd ~/TV
This means I'm now working in the TV folder in my home folder
(9) It is into this folder we are going to 'clone' the WebDL repository This makes it easy to keep it up to date too
It is a small program and quickly downloads
(10) I mentioned Virtual Environments - we need to make one for WebDL to run in so I'm going to put it in the webdl directory. We change into that directory:
cd webdl
(11) We're now in the webdl directory that has been cloned from the web repository and we create the virtual environment using python3
virtualenv --python python3 WebDLEnvironment
This has put the environment into the webdl folder in the TV folder I've called it WebDLEnvironment to be clear, but you can call it what you want
(12) The VirtualEnv can store everything we need but it needs to be 'activated'
. WebDLEnvironment/bin/activate
Note that <dot> and <space> at the beginning
You will see that the command line prompt changes to let you know we are using an activated virtual environment.
(13) We next install the WebDL requirements into this environment:
pip3 install -r requirements.txt
(14) And that's the install done. To be polite we deactivate the environment:
deactivate
Now we can quit Terminal
Comment: From now on, anytime we want to use WebDL, we launch terminal and activate the virtual environment:
. /Users/<username>/TV/webdl/WebDLEnvironment/bin/activate
Again, remember the dot-space... and run the program
/Users/<username>/TV/webdl/grabber.py
(Strictly you could use: python3 /Users/<username>/TV/webdl/grabber.py but the virtualenv is python3 now)
Comment: A good idea is to change to the directory you want to store our downloads in before you actually run the program, eg:
cd /Users/<username>/Desktop
When running the program, follow delx's interactive guide. It is all pretty straightforward. Hope this helps.

1 comments :

  1. My first time I visit here. I found so many entertaining stuff on your blog, especially its discussion. thanks for sharing such a wonderful post. You can also read:-health benefits of cumin