OpenWrt Forum Archive

Topic: How to upload Youtube videos from OpenWRT

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'll explain how to upload Youtube videos from your OpenWRT router. Thanks to people helped me some time ago here: https://forum.openwrt.org/viewtopic.php?id=47026

So, that's great to upload videos from your Router, at least for people like me, with poor upload speed (i upload at 70KBps, 10 hours to upload 2GB). With OpenWRT i can upload videos with less energy consumption.

So, first of all, we need to install "python" package. Just "python".
On second place, if you've a USB that will never be moved, and not a lot of space on the router flash, you can make a symbolic link from the Python folder where scrypts are installed. Just execute:

mvdir /usr/lib/python2.7 /media/usb/python2.7

to move the python scripts folder. Remember to rename the /media/usb for your usb mountpoint. And take care if you've got another Python version installed (change numbers).
When folder is moved, create symlink:

ln -s /media/usb/python2.7 /usr/lib/python2.7

Now, let's install GoogleCL. That's an app, Python-based, to interact with some Google services, like Youtube. Before it, let's install a dependence, download from here: https://code.google.com/p/gdata-python- … loads/list
We must download it and extract it, cd to the dir and install with:

python setup.py install

Finally, GoogleCL can be downloaded from here: https://code.google.com/p/googlecl/downloads/list
Do the same that we did with GDATA package (the dependence) to install it.

When it's all installed, we can try to upload a video. That's the recommended command (for me):

google youtube post --category Games --access=hidden --user=youruser video.mkv &

That's all it does:
*google: calls the "GoogleCL"
*youtube: indicates the script to use Youtube service
*post: indicates the script to upload a video
*--category Games: here you can choose a category for the video. Check all names from here: https://code.google.com/p/googlecl/wiki/Manual#YouTube
*--access=hidden: it uploads your video as Private. I like it because i always upload videos at night (because my upload speed is very low and, if i upload by day, i can't play online or just surf the internet).
*--user=youruser: put here your youtube username, matching with your channel url. If it is youtube.com/channel/blablabla, it should be --user=blablabla. If your youtube account is linked to a gmail account, you also can put here your gmail username. If your gmail address is ezioauditore@gmail.com, you can use --user=ezioauditore.
*video.mkv: the video you want to upload. I guess you can put the complete direction (/media/blablabla/video.mkv) but i always cd before uploading the video.
*&: that last symbol allows you to run the command on background. Without the &, closing the SSH terminal on wherever you're running it, will kill the process. But using this, you can turn off your computer, smartphone or where you're using SSH/Telnet and video will keep uploading.


So, i hope it's well-explained and be useful!!

Thanks for the tip. Even though I installed

# opkg install python-openssl python-expat

I couldn't authenticate to youtube. I tried elinks browser to logon to youtube from another ssh session using the url given by googleCL, and then hit enter on the originating session, no success.

Any clues?

isiku wrote:

Thanks for the tip. Even though I installed

# opkg install python-openssl python-expat

I couldn't authenticate to youtube. I tried elinks browser to logon to youtube from another ssh session using the url given by googleCL, and then hit enter on the originating session, no success.

Any clues?

But does the script gave you a URL? Have you opened it on a graphical web browser?

The discussion might have continued from here.