lkubuntu

A listing of random software, tips, tweaks, hacks, and tutorials I made for Ubuntu

Download videos online with Inject2Download

and I swear this blog hasn’t been hijacked . Apologies for the clickbait title, although, in all honesty, I’m not sure how else to word it … suggestions? :)

Most video download scripts I’ve seen generally tend to rely on some download server that does magic behind the scenes, which may or may not work, among other issues (ads, loading times, etc.). I also don’t like the fact that I can’t really know what’s going on behind the scenes (one of the reasons I use free software).

Thing is, for many websites that embed videos (that don’t host content with their own proprietary players, i.e. not youtube, vimeo, wistia, dailymotion, etc.), they have the direct video URL somewhere in the javascript (plainly readable or obfuscated).

Since most websites use the same player engines to play their videos (jwplayer, flowplayer, or video.js), all that is needed to do is to inject code into those engines when the page is loaded that will capture the video URL and somehow share the URL with the user.

I originally started writing this using Chrome, until I found out that Chrome actually doesn’t support injecting code directly after a library is loaded (which Firefox does), so I ended up making this only Firefox-compatible. I tried to sort of “race” the code so as to try to run the code as soon as possible after the libraries were loaded, but it only worked a fraction of the time, and plus it slowed down the webpage heavily.

Inject2Download is a user script, so you’ll need Greasemonkey to run it. If there’s enough interest, I’ll make it a proper extension later :)

Download and install it here: https://greasyfork.org/en/scripts/18671-inject2download

Github: https://github.com/AnonymousMeerkat/inject2download

What you’ll (hopefully) notice is that when you go to a website that hosts a video player, a little box will pop up at the top-left corner of the page (you might have to scroll up to see it), containing one or more URLs.

Some websites host ads on the player, and it’s sometimes (although rarely, thankfully) a bit difficult for the script to know which is an ad, and which is a legitimate video, so just use common sense and avoid URLs with “ads” or other suspicious text as part of them :)

If you have any issues with this, please feel free to let me know, either on here or via github, I’d be happy to help!

 

Advertisements

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: