Have you ever wanted to download youTube videos from within your OS/2 environment?
Under my Linux Debian environment there is a small shell oriented utility that is called youtube-dl that will download the youTube video that you provide as argument. For instance:
Shell
youtube-dl https://youtu.be/WYCFR-0N0b0 |
(Updated 08-21-2021 to get over issue introduced by Youtube CEO Polish CENSOR and ex-sister-in-law to Google's co-founder1!)
will download the Flash video file (extension may be flv). Subsequently, an user may play the Flash video file, for example with mPlayer under OS/2.
Well here are some instructions that will permit you to download youTube files from within your OS/2 (or its reincarnation, eCS ), thanks to GNU General Public License software like Python, ported to OS/2 by Andrew MacIntyre and to Ricardo Garcia Gonzalez's Python script that enpowers the user to fetch the videos.
And yes, I should not forget that what makes Python and the youTube-dl script to function under OS/2 is the (also) GNU GPL EMX enabler by Eberhard Mattes. Is not the collaboration enabled by GNU's GPL wonderful!?
We begin by downloading the emx runtime for OS/2 from the Hobbes archive site, needed as the enabler --without it none of what follows would be possibe: emxrt.zip.
And proceed to download the GNU Shell Utilities. We need specifically, the env.exe and gnushu.dll found compressed in the GNU Shell Utilities collection.
Further, the need for an shell is necessary. Minimally, you will need sh.exe, that you can extract from the Hobbes Public Domain of the Korn shell or from an older but excellent version of the above. I will be using the latter older version for this exercise. (UPDATE 12-21-2016; have not tried it but there is mksh recently available
Next, we download the Python interpreter binaries from Hobbes. According to Ricardo, his Python script requires the Python interpreter version "2.4 or later." We should be fine, since the Python binary version at Hobbes is 2.44.
Then we are ready to work. Open an OS/2 window command prompt; by default your location in the OS/2 file sytem will be at the root drive. I will assume for our purposes that your root drive is E: (where my virtual image of Warp 3 resides). Proceed to create a working directory, then:
MKDIR WorkSpace
We proceed to download the files that we referenced above into our E:\WokSpace directory. After we do so, we proceed to verify that we have all the files that we will need:
DIR WokSpace
Yo will notice an extra file, the PkWare free version of the OS/2 native utility pkzip.exe; of course, you may use any other extractor but make sure that you know how to extract directory paths also.
Thus, we begin our process. We change directory to WorkSpace and proceed to extract our pkzip.exe (that I have highlighted);
CD WorkSpace
pkos2250.exe
MOVE pkzip.exe \OS2\.
As illustrated, we move the pkzip.exe utility to the OS2 directory so that we can execute it from anywhere in our directory structure.
Next we go back to the root drive E: and proceed to extract the highlighted EMX runtime:
CD ..
pkzip /extr /dir WorkSpace\emxrt.zip
So we have created a directory called emx where we will install all our utilities to make our youtube-dl work.
Note that if you want an OS/2 command window larger than the default but not full screen, try:
MODE CO80,41
(Note, above, that the argument to MODE is C followed by the letter O, then 8 followed by the number zero).
Proceed to change your directory to emx by typing:
CD emx
pkzip /extr /dir \WorkSpace\sh-utils-2.0.zip
The specific files that we will need for the specific task are among those highlighted; notwithstanding, becoming familiar with those unix utilities, will allow you to naturally use the powerful and free Linux operating system --you will not have to enter "activation codes" to use it, you will have higher resilency to viruses, and your environment will be much more stable than proprietary offerings.
We continue and extract the next file:
pkzip /extr /dir \WorkSpace\ksh527rt.zip
Again, the specific files that we will need are highlighted and, before extracting the Python binaries, let us move the highlighted files to their proper directories on E:\emx\bin and E:\emx\dll,
MOVE pdksh\ksh.exe \bin\.
MOVE pdksh\sh.exe \bin\.
as illustrated in the above screenshot. Additionally, once we are at it, let us move the files from the prior extraction of the file gnusutil.zip:
MOVE exe\*dll dll\.
thus we move the two only dll files, gnuregex.dll and gnushu.dll, in the exe directory to the proper directory E:\emx\dll. We do the same with env.exe, moving it to E:\emx\bin directory:
MOVE exe\env.exe bin\.
Now we are ready to install the Python binaries by extracting the appropriate file:
pkzip /extr /dir \WorkSpace\python-2.4.4-emx-bin-070101.zip
And, as above, we proceed to move the files with an .exe and .dll extension to their proper emx directory structure:
MOVE python244\*exe bin\.
MOVE python244\*dll dll\.
That is it! We only have to copy and paste Ricardo Garcia Gonzalez's Python script into the OS/2 E.EXE or EPM.exe editor and save the file with a name like youtube-dl --because we like Unix short and cool names , do not we?! But before we save the youtube-dl file in the E:\emx\bin directory, we must add something to make it execute under OS/2 --remember this file comes from Unix/Linux conventions.
Opening the original Python script in an OS/2 editor, it can be seen that only the modification of the very first line that contains the "sh bang" needs to be modifified to suit the OS/2 environment.
In other words, we change the very first directive:
#!/usr/bin/env python
to
#!/emx/bin/env.exe python
remember above that we moved the env.exe and its supporting gnushu.dll into its respective directories under emx?
Ok, so after the modified file is saved in the directory E:\emx\bin, we are ready for the final phase of our exercise. Let's create an OS/2 commad file so that we do not have to alter our important OS/2 CONFIG.SYS file; let us call it myPython.cmd and save it under E:\OS2 directory like we did with the pkzip.exe file, remember?
As an aside, under my OS/2 2.11, I had to actually modify my CONFIG.SYS because the oldie operating system did not support dynamic LIBPATH environment variable statements that we enjoy in OS/2 Warp 3 and above.
So after I modified OS/2 2.11 CONFIG.SYS and rebooted, I typed:
myPython.cmd
and the appropriate variables were set. We need to verify if the Python interpreter is working since the youtube-dl script depends on it. Hence I proceed to do that very thing and enter:
python
and my oldie OS/2 2.11 can not cope with it.
Humm, I had just tested the shell and it worked...
Selecting the additional information radio button on the radio message, I can see that it is due to the DOSCALL1.DLL. Warp 3 and above have an improved, totally modern equivalent that I should try best.
So I fire up my OS/2 Warp 3 Connect and perform the same procedure on as on my 2.11 version of OS/2. I also add an extra line to my file myPython.cmd, and rename it to myPythonMod.cmd, so that the shell utility, sh.exe, needed by the youtube-dl will start on another OS/2 window shell with an nice title:
Now I open an OS/2 windowed command shell and enter:
myPythonMod
The environment variables being set are echoed to the screen and at the end of myPythonMod.cmd the directive to start a sh.exe utility with an title is honored --openning another window with the sh.exe prompt:
#
Finally, we are ready to download our youTube flash video. Yes, there is some work to set up but after it is done you can simply type as I will now do as an very simple example:
Well the sh.exe may be replaced with ksh.exe and you would have a more friendly environment, needless to say. Further, as can be deduced from the virtually infinite creativity of the open source communities --that can not be matched by proprietary vendors who spread fear uncertainty, and doubt (FUD)-- there are other ways to achieve the same goal.
Since I use as my default the EMX base for Unix/Linux like behaviour in my OS/2 environment, this is my approach only. I had pondered about the feasability of youtube-dl on OS/2 for some time now. I had to wait for a long job to finish on another machine and decided to use my time enabling OS/2 for one more modern use. Indeed, I have come to the conclussion --hope that you share it with me-- that OS/2 rocks!
1 "Her sister Anne is the founder of the genetic-testing company 23andMe and was married to Google co-founder Sergey Brin." via NeoMcCarthyism as a smoke screen to hide the crisis of neoliberalism
DISCLAIMER:
Please do not hold me, or Metztli Information Technology, responsible if the information provided does not work in your environment --I do not guarantee that the procedure will perform adequately and may even render your machine unusable.
I have provided the information in good faith hoping that other computer users (especially OS/2ers) will benefit from it --but if you try it you do so at your own risk.