Home > Testing, Ubuntu, Video > You-Get – Video Download Script for YouTube, YouKu, DailyMotion, and More

You-Get – Video Download Script for YouTube, YouKu, DailyMotion, and More

youku_logoYouKu is the equivalent of YouTube in China, and earlier today I wanted to download a video from the service, so I’ve looked for an application or script that can do the job in Linux. I’ve finally come across you-get, a python 3 script that claims to be able to download videos from an impressive number of websites, namely:

YouTube
Vimeo
Coursera
Blip
Dailymotion
Facebook
Google+
Google Drive
Tumblr
Vine
SoundCloud
Mixcloud
Freesound
JPopsuki
VID48
Niconico (ニコニコ動画)
Youku (优酷)
Tudou (土豆)
YinYueTai (音悦台)
AcFun
bilibili
CNTV (中国网络电视台)
Douban (豆瓣)
ifeng (凤凰视频)
iQIYI (爱奇艺)
Joy.cn (激动网)
Ku6 (酷6网)
MioMio h
NetEase (网易视频) (v.163.com)
PPTV.com
QQ (腾讯视频) (v.qq.com)
Sina (新浪视频) (video.sina.com.cn)
Sohu (搜狐视频) (tv.sohu.com)
56 (56网)
Xiami (虾米)
Baidu (百度音乐) (music.baidu.com)
SongTaste

I won’t try all, but just test it with YouKu and YouTube. First things first, let’s install it:

git clone git://github.com/soimort/you-get.git
cd you-get
sudo apt-get install python3 python3-setuptools
./you-get -V
make install

Time to go to youku.com and download a video:

you-get http://v.youku.com/v_show/id_XNTQ1OTk3NTAw.html
Video Site: Youku.com
Title:      1 second boot QT app in linux-sunxi with  A10
Type:       Flash video (video/x-flv)
Size:       5.45 MB (5711001 Bytes)

Downloading 1 second boot QT app in linux-sunxi with  A10.flv ...
100.0% (  5.4/5.4  MB) [========================================] 1/1

Success! And now Youtube:

you-get https://www.youtube.com/watch?v=A-9NKWm748o
 Video Site: YouTube.com
 Title:      Sigma Designs Digital Signage Demo - Frame Layout
 Type:       Flash video (video/x-flv)
 Size:       1.14 MB (1196352 Bytes)
Downloading Sigma Designs Digital Signage Demo - Frame Layout.flv ...
 100.0% (  1.1/1.1  MB) [========================================] 1/1

All good, and that was easy. To download several videos, you can either write you own script, or add videos in you-get command line such as “you-get link2video1 link2video2 … link2videon“.

I remember somebody on G+ wanted to upload several videos to YouKu, so while I was on this subject, I decided to have a look at YouKu upload scripts as well.

There is indeed a script called “pyYouku“, which is also written in Python, that allows you to upload videos to YouKu. Once you download the software, you just need to update config.py with your username, password, and partner ID (API key). The latter is quite problematic, as you have to apply to become a developer (easy), and then request an API key by sending YouKu an email with your business name & address, business phone and business license (hard). And this is where I gave up…

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

  1. onebir
    April 22nd, 2013 at 21:55 | #1

    Great :) Had this problem & hate the windoze-only youku app. And get_flash_videos (in Debian repos, doesn’t seem to work with youku).

  2. rm
    April 23rd, 2013 at 11:19 | #2

    I wonder if there’s a script which could download entire shows, playlists or channels of videos from YouTube. Anyone knows something like that?

    For downloading single videos from YouTube, I currently use youtube-dl. There’s also ‘cclive’, which I once used to get a video from DailyMotion. There’s quite a lot of these downloader scripts, most of them support more than one service. But You-Get seems to be very useful, since I don’t think any other script supports so many Chinese services.

  3. April 23rd, 2013 at 16:18 | #3

    @rm
    you-get supports playlist, but apparently not with YouTube.

  4. April 23rd, 2013 at 16:46 | #4
  5. April 23rd, 2013 at 17:11 | #5

    For some reasons, it did not work directly for me, so I modified it, in a quick and dirty way, to make it work with you-get – http://www.cnx-software.com/code/ytplaylistfetcher

    You’ll need to install lynx, and clive (Not used, but I haven’t removed the check):
    sudo apt-get install lynx clive

    Tested it with:
    ./ytplaylistfetcher http://www.youtube.com/watch?list=PL6B821BBBD4F8CAE1

    and it works for now.

  6. Dileep kunjaai
    May 27th, 2013 at 03:58 | #6

    Thanks a lot…

  7. Bin Laden
    May 28th, 2013 at 03:16 | #7

    If you add “http://www.xvideos.com” also in your list, it will be more useful ..:))

  8. Dileep kunjaai
    May 28th, 2013 at 23:34 | #8

    I installed you-get and used for 2 days… but now it showing error like

    dileep@dileep:~$ you-get -o /home/dileep/Downloads/you_get http://www.youtube.com/watch?v=gtVQITmYlXY
    Traceback (most recent call last):
    File “/usr/lib/python3.2/urllib/request.py”, line 1140, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
    File “/usr/lib/python3.2/http/client.py”, line 970, in request
    self._send_request(method, url, body, headers)
    File “/usr/lib/python3.2/http/client.py”, line 1008, in _send_request
    self.endheaders(body)
    File “/usr/lib/python3.2/http/client.py”, line 966, in endheaders
    self._send_output(message_body)
    File “/usr/lib/python3.2/http/client.py”, line 811, in _send_output
    self.send(msg)
    File “/usr/lib/python3.2/http/client.py”, line 749, in send
    self.connect()
    File “/usr/lib/python3.2/http/client.py”, line 727, in connect
    self.timeout, self.source_address)
    File “/usr/lib/python3.2/socket.py”, line 426, in create_connection
    raise err
    File “/usr/lib/python3.2/socket.py”, line 417, in create_connection
    sock.connect(sa)
    socket.error: [Errno 111] Connection refused

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File “/usr/local/bin/you-get”, line 9, in
    load_entry_point(‘you-get==0.3.12′, ‘console_scripts’, ‘you-get’)()
    File “/usr/local/lib/python3.2/dist-packages/you_get-0.3.12-py3.2.egg/you_get/__main__.py”, line 77, in main
    script_main(‘you-get’, any_download, any_download_playlist)
    File “/usr/local/lib/python3.2/dist-packages/you_get-0.3.12-py3.2.egg/you_get/common.py”, line 696, in script_main
    download_main(download, download_playlist, args, playlist, output_dir, merge, info_only)
    File “/usr/local/lib/python3.2/dist-packages/you_get-0.3.12-py3.2.egg/you_get/common.py”, line 616, in download_main
    download(url, output_dir = output_dir, merge = merge, info_only = info_only)
    File “/usr/local/lib/python3.2/dist-packages/you_get-0.3.12-py3.2.egg/you_get/__main__.py”, line 70, in any_download
    m.download(url, output_dir = output_dir, merge = merge, info_only = info_only)
    File “/usr/local/lib/python3.2/dist-packages/you_get-0.3.12-py3.2.egg/you_get/downloader/youtube.py”, line 144, in youtube_download
    youtube_download_by_id(id, None, output_dir, merge = merge, info_only = info_only)
    File “/usr/local/lib/python3.2/dist-packages/you_get-0.3.12-py3.2.egg/you_get/downloader/youtube.py”, line 132, in youtube_download_by_id
    type, ext, size = url_info(url)
    File “/usr/local/lib/python3.2/dist-packages/you_get-0.3.12-py3.2.egg/you_get/common.py”, line 117, in url_info
    response = request.urlopen(request.Request(url))
    File “/usr/lib/python3.2/urllib/request.py”, line 139, in urlopen
    return opener.open(url, data, timeout)
    File “/usr/lib/python3.2/urllib/request.py”, line 370, in open
    response = self._open(req, data)
    File “/usr/lib/python3.2/urllib/request.py”, line 388, in _open
    ‘_open’, req)
    File “/usr/lib/python3.2/urllib/request.py”, line 348, in _call_chain
    result = func(*args)
    File “/usr/lib/python3.2/urllib/request.py”, line 1160, in http_open
    return self.do_open(http.client.HTTPConnection, req)
    File “/usr/lib/python3.2/urllib/request.py”, line 1143, in do_open
    raise URLError(err)
    urllib.error.URLError:

  9. onebir
    November 10th, 2013 at 03:32 | #9

    I just wanted to grab some youtube videos listed in a text file with youtube-dl:

    bir@N2C:~/faders$ youtube-dl -t < faders.txt
    Usage: youtube-dl [options] url [url...]

    youtube-dl: error: you must provide at least one URL

    Is there a way to get youtube-dl to use URLs from a text file? :s

    (The URLs are in the file, which '<' is supposed to direct to standard input… (Right?) Funnily enough cat < faders.txt works just like cat without '<' . But echo < faders.txt gives an empty line; it must be recognising '<' as a special character, or it would print it out again. I thought I kind of understood redirection, but now I'm not so sure!)

  10. November 10th, 2013 at 09:52 | #10

    Try youtube-dl -t -a faders.txt

  11. onebir
    November 10th, 2013 at 14:36 | #11

    @cnxsoft
    Thanks!

  12. November 29th, 2013 at 21:01 | #12

    Just seen it’s possible to get audio from a YouTube video (e.g. music videos) directly using “youtube-dl -x url”.

  13. onebir
    November 30th, 2013 at 03:42 | #13

    @cnxsoft
    That’ll save some typing; for some reason help only mentions “–extract-audio” ;)

  14. onebir
    November 30th, 2013 at 17:39 | #14

    -x didn’t work for me:
    ~$ youtube-dl -x http://www.youtube.com/watch?feature=player_embedded&v=JSxLkc-WWuw
    [1] 1441
    ~$ Usage: youtube-dl [options] url [url...]

    youtube-dl: error: no such option: -x
    $ youtube-dl –version
    2012.09.27

    Newer version?

  15. November 30th, 2013 at 17:42 | #15

    @onebir
    Yes, I’ve just updated to Ubuntu 13.10 because Ubuntu 12.04 would always crash with YouTube videos. My old “youtube2mp3″ script failed, and I found out it was much easier to use that option, but it could be only available in newer versions.

    My version:
    youtube-dl –version
    2013.08.29

  16. onebir
    November 30th, 2013 at 21:26 | #16

    Think I’ll have to cook up an alias or 3:)

  17. onebir
    February 10th, 2014 at 04:12 | #17

    I could get youtube-dl to extract to aac files, but couldn’t get it to convert to mp3, even though libmp3lame was installed. Installing avconv (a fork of ffmpeg that youtube-dl seems to prefer) and ubuntu-restricted-extras has done the trick :)

  18. onebir
    October 19th, 2014 at 23:25 | #18

    Just grabbed something from youku with You-Get 0.3.30 – works well, including automatically stitching the flv files together, but either youku is unreliable, or it locked me out after a couple of d/ls…

    (Added ‘3’ at the end of #! #!/usr/bin/env python3 for simplicity of invocation, since my system defaults to 2.7.x )

  1. August 14th, 2013 at 23:51 | #1