Year of Python (YOP) – Week Thirty

27Jul15

Hello Reader!

Wow, it’s hard to believe I’ve made it to thirty weeks with this project.  Also a bit shocking that the year is getting closer to the end than to the beginning.

Unfortunately real life got in the way of things this week, so I have to reach back to a script I wrote a while ago.  However it’s a script I use on a regular basis.

Typically there are YouTube videos from conferences, etc that I like to watch on my tablet on trips, the train ride into work, etc.  I wanted to find a way to download the files off of YouTube and then just move them over to my device.  After a bit of Googling I found the pytube project on GitHub.  At the time I looked at this script, I didn’t have a lot of experience with Python, so I started with the author’s sample script.  Once I was able to get that working, I wanted to tweak it for something I could use whenever I wanted to.  Most of the sample script has everything hard coded, so you need to edit the script when the YouTube video changes.

I decided to have it prompt me for all the choices I wanted, and that way I would never need to edit the script.  With all that said the caveat with this weeks script is I’m using the pytube author’s license, versus what I normally use.

The script is pretty straightforward, when you run it, the first thing it does is ask you for the URL of the YouTube video you want to download.  This is what you get from the address bar or the share link.  Next, the script goes out and queries the URL, and pulls the name of the video.  I’m using this just to confirm that the video I want is correct.  Next, it queries the video and determines the possible video formats that you can save (codec and quality).  Finally it downloads the file.

Until next week!

https://github.com/CdtDelta/YOP

Advertisements


No Responses Yet to “Year of Python (YOP) – Week Thirty”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: