Saturday, September 8, 2018

Installing mps-youtube on Windows 10 : A step by step guide.



  • mps-youtube is a command line based youtube player. It's a pretty neat app and works really well. Installing it in Linux is pretty straight forward but in windows, you might run into some problems doing the same. So, in this tutorial I've mentioned step by step everything you need to do to run it fine. Do, check it out. I've also attached screenshots as I take you through these steps.




Step 1:  PYTHON

Install python on your PC. Mps-yt is written in python, so you must have python installed to run it. Now, i'm assuming you don't have it already installed, in case you have it installed, then skip to step 2.


Now,  I have a 64 bit system so, i have installed the 64 bit version,  if you are using a 32 bit system, install x86 version.

Click here  for 64 bit version download (Python V 3.7)

Click here  for 32 bit version download (Python V 3.7)

If you want to download the latest version go to : https://www.python.org/downloads/windows/ 
and download executable install.


Now that you have downloaded python, open the downloaded file, an installer prompt will pop up.
Go ahead with the installation process, regular stuff.

Important :  When installer reaches the stage shown below, check the "Add to system path" box. If you leave this unchecked you might have to manually add it to system path.






Now, after installing, open a command prompt window and type "python".

It should show something like this :




Now, you have successfully installed Python. Proceed to step 2.



Step 2:  Install mps-youtube

Now, in the command prompt window, type the following command:

   pip3 install mps-youtube           


Now, this will download and install the mps youtube on your system.

After the process completes, type "mpsyt" in the command window to check if you have successfully installed the application.

As you press enter, you should see something like this :




Notice, that the colours are not visible in mps-youtube.

Also, if you go ahead and search for something in mps-yt and try to play it you will notice that it shows a long series of errors. Like:
ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 995, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 910, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 973, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/jsinterp.py", line 241, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'xm'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 673, in extract_info
ie_result = ie.extract(url)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/common.py", line 341, in extract
return self._real_extract(url)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 1568, in _real_extract
encrypted_sig, video_id, player_url, age_gate)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 1005, in _decrypt_signature
'Signature extraction failed: ' + tb, cause=e)
youtube_dl.utils.ExtractorError: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 995, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 910, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 973, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/jsinterp.py", line 241, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'xm'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
(caused by ExtractorError("Could not find JS function 'xm'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pafy/backend_youtube_dl.py", line 38, in _fetch_basic
self._ydl_info = ydl.extract_info(self.videoid, download=False)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 688, in extract_info
self.report_error(compat_str(e), e.format_traceback())
File "/usr/local/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 547, in report_error
self.trouble(error_message, tb)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 517, in trouble
raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 995, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 910, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 973, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/jsinterp.py", line 241, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'xm'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
(caused by ExtractorError("Could not find JS function 'xm'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/mps_youtube/player.py", line 148, in _playsong
streams.get(song, force=failcount, callback=screen.writestatus)
File "/usr/local/lib/python3.5/site-packages/mps_youtube/streams.py", line 51, in get
p = util.get_pafy(vid, force=force, callback=callback)
File "/usr/local/lib/python3.5/site-packages/mps_youtube/util.py", line 201, in get_pafy
p = pafy.new(ytid, callback=callback_fn)
File "/usr/local/lib/python3.5/site-packages/pafy/pafy.py", line 122, in new
return Pafy(url, basic, gdata, size, callback, ydl_opts)
File "/usr/local/lib/python3.5/site-packages/pafy/backend_youtube_dl.py", line 29, in init
super(YtdlPafy, self).init(*args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/pafy/backend_shared.py", line 95, in init
self._fetch_basic()
File "/usr/local/lib/python3.5/site-packages/pafy/backend_youtube_dl.py", line 41, in _fetch_basic
raise IOError(str(e).replace('Youtube says', 'Youtube says'))
OSError: ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 995, in _decrypt_signature
video_id, player_url, s
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 910, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/extractor/youtube.py", line 973, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/local/lib/python3.5/site-packages/youtube_dl/jsinterp.py", line 241, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'xm'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
(caused by ExtractorError("Could not find JS function 'xm'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Now, don't panic, just press ctrl+c and exit the mps-youtube.

It means, you don't have youtube-dl and mpv player installed. Proceed to strep 3.


  Step 3:  Install youtube-dl, colorama and mpv player.


Now, to download youtube-dl which is basically a youtube downloader, type  in the following command:

     pip install --upgrade youtube_dl


You can also go to their website and download the same here.



Now, after the process completes, open mps-youtube again (by typing 'mpsyt' obvio.) and search for any video
by typing  '/<search-string>' in mpsyt.

now you can see that there are no errors this time. But, the text and numbers  is still a bit  clumpy and unprocessed. 
Like this:





now quit the mps-youtube ( by entering command 'q' without quotes and pressing enter) and run the following command :

   pip3 install colorama


now open mpsyt again. Now the colours shouyld be visible and the text should be nicely rendered. It should be something like this :












Now, if you play the video using video number, you will get an error message saying "Player not configured! Enter set player <player_app>  to set a player"

Now, to rectify this error, find where your system has python installed. It will be a folder named "Python" usually. Now, navigate to a folder named "Scripts" in that. 
In this folder you will see things like pip, mps-yt and youtube-dl. You need to copy a couple of files into this folder.

The files are, mpv.exe which is mpv player and mpv.com which is a MS Dos app. Just go to the link here (select the appropriate version 64/32 bit according to your system) and download the zip file. Extract them and copy them in this folder.

After you copy them :






Note: The path is visible in the picture if you can't find these files. Also, click on "view" menu and check "show hidden files" if the folder "Appdata" is not visible.



Now, you're almost finished. Couple of commands in mps-yt and you're finished.





Step 4: Configure mps-yt and start playing videos.


Now, for the final step. We have to configure couple of things. 

We need to add mpv player as the default player and we have to set the mpsyt to show video when played. 

To do so, first run this command inside mpsyt:

     set player mpv


or    set player mpv.exe


This will, as it reads, sets mpv player as the default player. 

Now, to set it to show video, run this command inside mpsyt:


   set show_video true



That's it, you're all set. search for any video and enter the number of the video to play it.






Now, I hope that tutorial was helpful and informative. If you were able to successfully run mps-youtube following these steps, drop a comment or an email. I'd really appreciate that.

Also, if you're stuck at any point, ask in comments or again, drop an email. I would try to help you out.


Also, visit mps-yt github page :  https://github.com/mps-youtube/mps-youtube

To further know how to use mpsyt, open mpsyt and type "help". The application has a pretty neat documentation. Also, you can google how to use some features.




   Ciao !



1 comment:

  1. You certainly learn how to bring a concern to light and produce windows 10 activator critical.

    ReplyDelete