Youtube Download Python 3 On Mac 2019

Posted By admin On 01.12.20
  1. Python 3.8.0b2 - July 4, 2019. Download macOS 64-bit installer; Python 3.6.9rc1 - June 18, 2019. No files for this release. Python 3.7.4rc1 - June 18, 2019. Download macOS 64-bit/32-bit installer; Download macOS 64-bit installer; Python 3.8.0b1 - June 4, 2019. Download macOS 64-bit installer; Python 3.8.0a4 - May 6, 2019. Download macOS 64-bit.
  2. Note: Python 3.5.8 has been superseded by Python 3.5.10. Python 3.5.8 was released on October 29th, 2019. Python 3.5 has now entered 'security fixes only' mode, and as such the only changes since Python 3.5.4 are security fixes. Also, Python 3.5.8 has only been released in source code form; no more official binary installers will.
  3. Python 3.6.9 - July 2, 2019. Note that Python 3.6.9 cannot be used on Windows XP or earlier. No files for this release. Python 3.7.3 - March 25, 2019. Note that Python 3.7.3 cannot be used on Windows XP or earlier. Download Windows help file; Download Windows x86-64 embeddable zip file; Download Windows x86-64 executable installer.

Files for mac-youtube, version 2020.7.1; Filename, size File type Python version Upload date Hashes; Filename, size mac-youtube-2020.7.1.tar.gz (2.6 kB) File type Source Python version None Upload date Jul 1, 2020 Hashes View.

In this article I am going to present you with an easy (and advertisement/malware free) way to downloadvideos from youtube, converting them to mp3 if needed. Also, I will give some more useful hints, forexample how to download multiple mp3s using a script, how to break a long mp3 to same-length partsso you could quickly skip tracks when you play it in your stereo etc.

I am going to give specific instructions for Windows users - however everything I’ll propose should also be applicableto OSX or Linux users with minor modifications.

The tools we are going to use are:

  • youtube-dl which is a python library for downloading videos from youtube (and some other sites)
  • ffmpeg which is a passepartout video/audio editing library

Installation

To install youtube-dl I recommend installing it in your global python (2 or 3) package list using pip. Please read myprevious article

to see how you should install and use Python 2 or 3on Windows. Following the instructions from there, you can do the following to install youtube-dl in your globalPython 3 packages:

To run youtube-dl you’ll write something like py -3-m youtube_dl url_or_video_id (notice the underscore instead of dash sincedashes are not supported in module names in python). For example try something like this py -3-m youtube_dl YgtL4S7Hrwo and you’llbe rewarded with the 2016 Pycon talk from Guido van Rossum! If you find this a little too much too type don’t be afraid, I will givesome hints later about how to improve this.

To upgrade your youtube-dl installation you should do something like this:

Notice that you must frequently upgrade your youtube-dl installation because sometimes youtube changes the requirementsfor viewing / downloading videos and your old version will not work. So if for some reason something is not correct whenyou use youtube-dl always try updating first.

If you wanted you could also create a virtual environment (see instructions on previously mentioned article) and install youtube-dl locally there using pip install youtube-dlhowever I prefer to install it on the global packages to be really easy for me to call it from a command prompt I open. Noticethat if you install youtube-dl in a virtualenv, after you activate that virtualenv you’ll be able to run it just by typing youtube-dl.

Finally, If for some reason you don’t want want to mess with python and all this (or it just seems greek to you) then youmay go on and directly download a youtube-dl windows executable. Just put it in your path and you should be good to go.

To install ffmpeg, I recommend downloading the Windows build from here (select the correct Windows architecture of your system andalways static linking - the version doesn’t matter). This will get you a zip - we are mainly interested to the three files under thebin folder of that zip which should be copied to a directory under your path:

  • ffmpeg is the passepartout video converting toot that we are going to use
  • ffprobe will print some information about a file (about its container and video/audio streams)
  • ffplay will play the file — not really recommended there are better tools but it is invaluablefor testing; if it can be played be ffplay then ffmpeg will be able to properly read your file

Notice I recommend copying things to a directory in your path. This is recommended and will save you from repeatedly typing the same thingsover and over. Also, later I will propose a bunch of DOS batch (.bat) files that can also be copied to that directory and help you evenmore in you youtube video downloading. To add a directory to the PATH, just press Windows+Pause Break, Advanced System Settings, Advanced,Environment Variables, edit the “Path” User variable (for your user) and append the directory there.

Using youtube-dl

As I’ve already explained before, to run youtube-dl you’ll either write something like py -3-m youtube_dl (if you’ve installed itto your global python packages) or run youtube-dl if you’ve downloaded the pre-built exe or have installed it in a virtualenv. To saveyou from some keystrokes, you can create a batch file that will run and pass any more parameters to it, something like this:

(the %* will capture the remaining command line) so to get the previous video just run getvideo YgtL4S7Hrwo(or getvideo https://www.youtube.com/watch?v=YgtL4S7Hrwo - works the same with the video id or the complete url).

One thing I’d like to mention here is that youtube-dl works fine with playlists and even channels. For example,to download all videos from PyCon 2017 just do this:

getvideo https://www.youtube.com/channel/UCrJhliKNQ8g0qoE_zvL8eVg/feed and you should see something like:

This is gonna take some time …

Now, youtube-dl has many options and can be configured with default values depending on yourrequirements. I won’t go into detail about these except on some things I usually use, if youneed some help feel free to ask me.

When you download a video, youtube-dl will try to download the best quality possible for that video,however a video may have various different formats that can be queries by passing the option --list-formatsto ffmpeg, for example here’s the output from the previously mentioned video:

As you can see, each has an id and defines an extension (container) and info about its video and audio stream.You can download a specific format by using the -f command line otpion. For example , to download the audio-onlyformat with the worst audio quality use C:Usersserafeim>getvideo YgtL4S7Hrwo -f 249. Notice that there areformats with audio ony and other formats with vide only. To download the worst format possible (resulting in thesmallest file size of course ) you can pass the -f worst command line (there’s also a -f best command linewhich is used by default).

Another thing I’d like to point out here is that you can define an output template using the -o option thatwill format the name of the output file of your video using the provided options. There are many examples in the docsso I won’t go into any more details here.

Another cool option is the -a that will help you download all videos from a file. For example, if you have a filenamed videos.txt with the following contsnts:

running getvideo -a videos.txt -f worst

will get you all three videos in their worst quality. If you don’t want to create files then you can use somethinglike this:

and it will run getvideo for all three files.

Some more options I’d like to recommend using are:

  • --restrict-filenames to avoid strange filenames
  • --ignore-errors to ignore errors when download multiple files (from a playlist or a channel) - this is reallyuseful because if you have a play with missing items youtube-dl will stop downloading the remaining files when itencounters the missing one

If you want to always use these options you may add them to your configuration file (C:Users<username>youtube-dl.conf)or to the getvideo.bat defined above i.e getvideo.bat will be:

Extracting mp3s

Python 3.8 mac

The next step in this trip is to understand how to extract mp3s from videos that are downloaded from youtube. If you’vepayed attention you’d know that by now you can download audio-only formats from youtube - however they are in a formatcalled DASH which most probably is not playable by your car stereo (DASH is specialized for streaming audio through HTTP).

Thus, the proper way to get mp3s is to post-processthe downloaded file using ffmpeg to convert it to mp3. This could be done manually (by doing somethingffmpeg -i input out.mp3 — ffmpeg is smart enough to know how to convert per extension)but thankfully youtube-dl offers the -x (and friend) parameters to make this automatic. Using -x tellsyoutube-dl to extract the audio from the video (notice that youtube-dl is smart enough to download one of the audio-onlyformats so you don’t have ). Using -x alone may result in a different audio format (for example .ogg) so to force conversion to mp3you should also add the --audio-format mp3 parameter. Thus, to download an mp3 you can use the following commandline (continuing from the previous examples):

or even better, create a getmp3.bat batch file that will be used to retrieve an mp3:

Please notice that also in this case youtube-dl is smart enough to download an audio-only format thusyou won’t need to select it by hand using -f to save bandwith.

Splitting the mp3 file to parts

Some people would like to split their large mp3 files to same-length segments. Of course it would be betterfor the file to be split by silence to individual songs (if the file contains songs) but these methods usuallydon’t work that good so I prefer the same length segments. To do that using ffmpeg you just need to add thefollowing parameters:

The segment time is in seconds (so each segment will be 3 minutes) while the output files will have a name likeout.001.mp3, out.002.mp3 etc.

Let s ride friends forever free download - WeRide; Motorcycle, routes and friends, LetsMeetApp - nearby friends notification, Wave Let's Meet App - Find Your Friends, and many more programs. Lets Ride Friends Forever was added to DownloadKeeper this week and last updated on 31-Jul-2020.New downloads are added to the member section daily and we now have 388,834 downloads for our members, including: TV, Movies, Software, Games, Music and More. It's best if you avoid using common keywords when searching for Lets Ride Friends Forever. /lets-ride-friends-forever-mac-download.html. In Let's Ride Friends Forever you need to groom, train and care for your horse and practice hard to perfect your riding and jumping skills as you prepare for the all-important regional jumping competitions. Select from 15 favorite horse breeds and hundreds of combinations of. Friends Forever might have a considerable amount of features to offer but gameplay is a bit left-handed. Controls are almost counter intuitive although after a while you get used to them and things get better. In the graphics department, things are rather bad. Trusted Windows (PC) download Let's Ride Friends Forever 1.0. Virus-free and 100% clean download. Get Let's Ride Friends Forever alternative downloads.

What if you’d like to make the segmentation automatic? For this, I recommend writing a batch file with twocommands - one to download the mp3 and a second one to call ffmpeg to segment the file. Notice that youcould use the --postprocessor-argsARGS command line parameter to pass the required arguments to youtube-dlso it will be done in one command however I’d like to have a little more control thus I prefer two commands (ifyou decide to use --postprocessor-argsARGS keep in mind that args must be inside double quotes “”).

Since we are going to use two commands, we need to feed the output file of youtube-dl to ffmpeg and specify aname for the ffmpeg output file-segments. The easiest way to do that is to just pass two parameters to the batchfile - one for the video to download and one for its name. Copy the following to a file named getmp3seg.bat:

You can then call it like this: getmp3seg AjFfsOA7AQI test. The first line will download and covertthe video to mp3 and put it in a file named test.mp3 (the %2 is the test, the %% is used toescape the % and the %(ext)s is the extensions - this is needed if you use something like -o %2.mp3youtube-dl will be confused when trying to convert the file to mp3 and will not work). The 2nd linewill segment the file to 180 second seconds (notice that here also we need to escape %) and the thirdline will delete the original mp3. This leaves us with the following 4 files (the video was around 10 minutes): test.000.mp3,test.001.mp3, test.002.mp3, test.003.mp3.

One final thing I’d like to present here is a (more complex) script that you can use to download a videoand segmentize it only if it is more than 360 seconds. For this, we will also use the mp3info util which canbe downloaded directly from the homepage and copied to the path. So copy the following to a script named getmp3seg2.bat:

This is a little more complex - I’ll explain it quickly: @echo off is used to suppress non needed output.The IF following makes sure that you have two parameters. The next line downloads the file and converts it to mp3. The FORloop is a little strange but it’s result will be to retrieve the output of mp3info -o '%S' title.mp3 (which is theduration in seconds of that mp3) and assign it to the koko variable. The next IF checks if koko is greater than (GTR)360 seconds and if yes will run the conversion code we discussed before - else it will just output that it is less than 360 seconds.

Finally, there’s a GOTO: eof line to skip printing the error message when the batch is called with less than two parameters.

Using youtube-dl from python

Integrating with youtube-dl from python is easy. Of course, you could just go on and directly call the command linehowever you can have more control. The most important class is youtube_dl.YoutubeDL.YoutubeDL. You instantiatean object of this class class passing the parameters you’d like and call its download() instance method passinga list of urls. Here’s a small script that downloads the input video ids:

Save it in a file named getvideo.py and run it like py -3 getvideo.py AjFfsOA7AQI 3dDtACSYVx0 G17E4Muylis to download all three videos!

Fixing your unicode names

The last thing I’d like to talk about concerns people that want to download videos with Unicode characters in their titles (for example Greek).

Let’s suppose that you want to download the file vFVNOaUPRow which is piano music from a well-know greek composer. If you get it without parameters(for example py -3-m youtube_dl -x--audio-format mp3 vFVNOaUPRow)you’ll get the following output file: Ο Μάνος Χατζιδάκις. παίζει 11 κομμάτια στο πιάνο-vFVNOaUPRow.f247.mp3 (notice the greek characters) while, ifyou add the --restrict-filenames I mentioned before you’ll get _11-vFVNOaUPRow.f247.mp3 (notice that the greek characters have been removedsince they are not safe).

So if you use the --restrict-filenames parameter you’ll get an output that contains only the video id (and any safe characters it may find) whileif you don’t use it you’ll get the normal title of the video. However, most stereos do not display unicode characters properly so if I get thisfile to my car I’ll see garbage and I won’t be able to identify it — I will be able to listen it but not see its name!

To fix that, I propose transliterating the unicode characters using the unidecode library. Just install it using pip. Then you can the followingscript to rename all mp3 files in a directory to using english characters only:

Copy this to a file named transliterate.py and run it in a directory containing mp3 files (py -3 transliterate.py) to rename them to non-unicode characters.

Author

Bob Savage <bobsavage@mac.com>

Python

Python on a Macintosh running Mac OS X is in principle very similar to Python onany other Unix platform, but there are a number of additional features such asthe IDE and the Package Manager that are worth pointing out.

4.1. Getting and Installing MacPython¶

Mac OS X 10.8 comes with Python 2.7 pre-installed by Apple. If you wish, youare invited to install the most recent version of Python 3 from the Pythonwebsite (https://www.python.org). A current “universal binary” build of Python,which runs natively on the Mac’s new Intel and legacy PPC CPU’s, is availablethere.

What you get after installing is a number of things:

  • A Python3.9 folder in your Applications folder. In hereyou find IDLE, the development environment that is a standard part of officialPython distributions; and PythonLauncher, which handles double-clicking Pythonscripts from the Finder.

  • A framework /Library/Frameworks/Python.framework, which includes thePython executable and libraries. The installer adds this location to your shellpath. To uninstall MacPython, you can simply remove these three things. Asymlink to the Python executable is placed in /usr/local/bin/.

The Apple-provided build of Python is installed in/System/Library/Frameworks/Python.framework and /usr/bin/python,respectively. You should never modify or delete these, as they areApple-controlled and are used by Apple- or third-party software. Remember thatif you choose to install a newer Python version from python.org, you will havetwo different but functional Python installations on your computer, so it willbe important that your paths and usages are consistent with what you want to do.

IDLE includes a help menu that allows you to access Python documentation. If youare completely new to Python you should start reading the tutorial introductionin that document.

If you are familiar with Python on other Unix platforms you should read thesection on running Python scripts from the Unix shell.

4.1.1. How to run a Python script¶

Python 3.8 Mac

Your best way to get started with Python on Mac OS X is through the IDLEintegrated development environment, see section The IDE and use the Help menuwhen the IDE is running.

If you want to run Python scripts from the Terminal window command line or fromthe Finder you first need an editor to create your script. Mac OS X comes with anumber of standard Unix command line editors, vim andemacs among them. If you want a more Mac-like editor,BBEdit or TextWrangler from Bare Bones Software (seehttp://www.barebones.com/products/bbedit/index.html) are good choices, as isTextMate (see https://macromates.com/). Other editors includeGvim (http://macvim-dev.github.io/macvim/) and Aquamacs(http://aquamacs.org/).

Python 3.6 Mac

To run your script from the Terminal window you must make sure that/usr/local/bin is in your shell search path.

To run your script from the Finder you have two options:

  • Drag it to PythonLauncher

  • Select PythonLauncher as the default application to open yourscript (or any .py script) through the finder Info window and double-click it.PythonLauncher has various preferences to control how your script islaunched. Option-dragging allows you to change these for one invocation, or useits Preferences menu to change things globally.

4.1.2. Running scripts with a GUI¶

With older versions of Python, there is one Mac OS X quirk that you need to beaware of: programs that talk to the Aqua window manager (in other words,anything that has a GUI) need to be run in a special way. Use pythonwinstead of python to start such scripts.

With Python 3.9, you can use either python or pythonw.

4.1.3. Configuration¶

Python on OS X honors all standard Unix environment variables such asPYTHONPATH, but setting these variables for programs started from theFinder is non-standard as the Finder does not read your .profile or.cshrc at startup. You need to create a file~/.MacOSX/environment.plist. See Apple’s Technical Document QA1067 fordetails.

For more information on installation Python packages in MacPython, see sectionInstalling Additional Python Packages.

4.2. The IDE¶

MacPython ships with the standard IDLE development environment. A goodintroduction to using IDLE can be found athttp://www.hashcollision.org/hkn/python/idle_intro/index.html.

4.3. Installing Additional Python Packages¶

There are several methods to install additional Python packages:

  • Packages can be installed via the standard Python distutils mode (pythonsetup.pyinstall).

  • Many packages can also be installed via the setuptools extensionor pip wrapper, see https://pip.pypa.io/.

4.4. GUI Programming on the Mac¶

There are several options for building GUI applications on the Mac with Python.

PyObjC is a Python binding to Apple’s Objective-C/Cocoa framework, which isthe foundation of most modern Mac development. Information on PyObjC isavailable from https://pypi.org/project/pyobjc/.

The standard Python GUI toolkit is tkinter, based on the cross-platformTk toolkit (https://www.tcl.tk). An Aqua-native version of Tk is bundled with OSX by Apple, and the latest version can be downloaded and installed fromhttps://www.activestate.com; it can also be built from source.

wxPython is another popular cross-platform GUI toolkit that runs natively onMac OS X. Packages and documentation are available from https://www.wxpython.org.

PyQt is another popular cross-platform GUI toolkit that runs natively on MacOS X. More information can be found athttps://riverbankcomputing.com/software/pyqt/intro.

4.5. Distributing Python Applications on the Mac¶

The standard tool for deploying standalone Python applications on the Mac ispy2app. More information on installing and using py2app can be foundat http://undefined.org/python/#py2app.

4.6. Other Resources¶

The MacPython mailing list is an excellent support resource for Python users anddevelopers on the Mac:

Another useful resource is the MacPython wiki: