youtube-dl, or living without flash

For the past year, I've been living without Adobe Flash Player, meaning I could not watch videos/play music on most sites or use some web applications, that still use it. This was due to several reasons:

And what can I say, I don't miss it, thanks to youtube-dl (I find the project name a bit misleading (although Youtube has the most support) and a new user might simply overlook all the power he/she is given.), a small commandline application that is capable of downloading videos from Youtube and more than 300 other sites (the list is constantly growing). youtube-dl provides the URL of the video/stream, so you can play the video without downloading to (if your player supports it).

Being a CLI application, youtube-dl allows you to intergrate it into scripts, bash aliases and with other applications. For example, I wrote this little script to play the video in the current website (if there is a video, and the URL/website is supported by youtube-dl) by simply typing mpv in dwb (mpv is also the player I use, check it out):

// play YouTube and other videos with mpv.

function playInMpv() {
    system.spawn("sh -c 'youtube-dl -g \"" + tabs.current.uri + "\" | mpv -playlist -' &"); 

bind("mpv", playInMpv, "play_in_mpv");

If your favorite website is not supported, you can file an issue for it to be added, or, if you know some Python, try to implement it yourself. The hardest parts of doing that are reverse engineering the method the website in question uses to hide (if it does so) the video URL from the user and writing reliable regular expressions, which are used to extract information from the website (if you, like me, are not a Regex guru). There are full developer instructions on youtube-dl's GitHub page. I also recommend reading this tutorial by Filippo Valsorda, which also shows how to reverse engineer a video website.

So, if you have an urge to say goodbye to the Adobe Flash Player, go on and do so, abandon the sinking ship and join the Fight!.

Note: If you do try youtube-dl, be sure to compare your CPU usage when streaming the same video in your media player and using flash!

PyCon US 2014

Here are some interesting talks from PyCon US 2014, that are worth to watch.

All Your Ducks In A Row: Data Structures in the Standard Library and Beyond

by Brandon Rhodes

Why are Python programmers crazy about lists and dictionaries, when other languages tout bitmaps, linked lists, and B+ trees? Are we missing out? Come learn how data structures are implemented on bare metal, how to select the right data structure, how the list and dictionary cover a wide swath of use cases, and when to dip into the Standard Library or a third-party package for an alternative.

Refresh your knowledge about Python's data structures, and when to (not) use which.

Watch on Youtube

Building and breaking a Python sandbox

by Jessica McKellar

What does it take to make a Python sandbox that can run untrusted code? Learn some surprising language features and experience security challenges first-hand as we work through building a Python sandbox from scratch. You'll leave this talk with renewed appreciation for the dynamic nature of Python, some sneaky language tricks, and a solid background in classes of sandboxing security issues.

Hacking Python itself through introspection.

Watch on Youtube

Generators: The Final Frontier

by David Beazley

Python generators have long been useful for solving all sorts of problems involving iteration and data flow. However, one of their more powerful uses is in customizing various aspects of program control flow. In this tutorial, we'll look at some more exotic uses of generators such as writing context managers, inlining callback functions, eliminating recursion, implementing actors, and more.

All I knew about generators was ~5% of what there is to know.

Watch on Youtube

More to come (maybe). Full list of PyCon US 2014 available here.

Heartbleed Lithuania

Let's scrape the Internet and check some 5887 Lithuanian websites for the Heartbleed bug. The vulnerable:

Is your site vulnerable? You can check here.

Update (2014-04-15):

Since posting, these sites have fixed the Heartbleed bug.