annie ってなに?

Environment
Photo by hyt.

annie ってなに?ってまず,答えから書きますが,

速くて軽くてシンプルでキレイなビデオのダウンローダーだそうです.Go 言語で作られてるらしい.

なお,コマンドラインから使うツールです.

導入方法

元サイトは以下の通り.

GitHub - iawia002/lux: 👾 Fast and simple video download library and CLI tool written in Go
👾 Fast and simple video download library and CLI tool written in Go - iawia002/lux

MacOS だと Homebrew で入るようですし,他にも幾つか標準的なパッケージになってるものもあるみたいですが,残念ながら Ubuntu 系は素直に Go から入れないとダメみたいです.

Ubuntu 18.04 (elementary OS) で実際に入れてみた様子は以下の通り.

まず,ffmpeg が入ってない場合は,

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo apt install ffmpeg
$ sudo apt install ffmpeg
$ sudo apt install ffmpeg

で入れておきます.また,もちろん Go も必要です.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo apt install golang
$ sudo apt install golang
$ sudo apt install golang

これらが入っていれば元サイトの指示通り,

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ go get github.com/iawia002/annie
$ go get github.com/iawia002/annie
$ go get github.com/iawia002/annie

なお,標準だと ~/go/bin/ 以下にインストールされるので,PATH を通すか,面倒なら /usr/local/bin 以下に移動します.標準的なライブラリ以外に依存関係は無いので,単に mv するだけでキチンと動きます.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo mv ~/go/bin/annie /usr/local/bin/.
$ annie
annie
Too few arguments
Usage: annie [args] URLs...
-C Download captions
-F string
URLs file path
-O string
Specify the output file name
-aria2
Use Aria2 RPC to download
-aria2addr string
Aria2 Address (default "localhost:6800")
-aria2method string
Aria2 Method (default "http")
-aria2token string
Aria2 RPC Token
-c string
Cookie
-ccode string
Youku ccode (default "0590")
-ckey string
Youku ckey (default "7B19C0AB12633B22E7FE81271162026020570708D6CC189E4924503C49D243A0DE6CD84A766832C2C99898FC5ED31F3709BB3CDD82C96492E721BDD381735026")
-cs int
HTTP chunk size for downloading (in MB)
-d Debug mode
-end int
Define the ending item of a playlist or a file input
-f string
Select specific stream to download
-i Information only
-items string
Define wanted items from a file or playlist. Separated by commas like: 1,5,6,8-10
-j Print extracted data
-n int
The number of download thread (only works for multiple-parts video) (default 10)
-o string
Specify the output path
-p Download playlist
-password string
Youku password
-r string
Use specified Referrer
-retry int
How many times to retry when the download failed (default 10)
-start int
Define the starting item of a playlist or a file input (default 1)
-v Show version
$ sudo mv ~/go/bin/annie /usr/local/bin/. $ annie annie Too few arguments Usage: annie [args] URLs... -C Download captions -F string URLs file path -O string Specify the output file name -aria2 Use Aria2 RPC to download -aria2addr string Aria2 Address (default "localhost:6800") -aria2method string Aria2 Method (default "http") -aria2token string Aria2 RPC Token -c string Cookie -ccode string Youku ccode (default "0590") -ckey string Youku ckey (default "7B19C0AB12633B22E7FE81271162026020570708D6CC189E4924503C49D243A0DE6CD84A766832C2C99898FC5ED31F3709BB3CDD82C96492E721BDD381735026") -cs int HTTP chunk size for downloading (in MB) -d Debug mode -end int Define the ending item of a playlist or a file input -f string Select specific stream to download -i Information only -items string Define wanted items from a file or playlist. Separated by commas like: 1,5,6,8-10 -j Print extracted data -n int The number of download thread (only works for multiple-parts video) (default 10) -o string Specify the output path -p Download playlist -password string Youku password -r string Use specified Referrer -retry int How many times to retry when the download failed (default 10) -start int Define the starting item of a playlist or a file input (default 1) -v Show version
$ sudo mv ~/go/bin/annie /usr/local/bin/.
$ annie
annie
Too few arguments
Usage: annie [args] URLs...
  -C	Download captions
  -F string
    	URLs file path
  -O string
    	Specify the output file name
  -aria2
    	Use Aria2 RPC to download
  -aria2addr string
    	Aria2 Address (default "localhost:6800")
  -aria2method string
    	Aria2 Method (default "http")
  -aria2token string
    	Aria2 RPC Token
  -c string
    	Cookie
  -ccode string
    	Youku ccode (default "0590")
  -ckey string
    	Youku ckey (default "7B19C0AB12633B22E7FE81271162026020570708D6CC189E4924503C49D243A0DE6CD84A766832C2C99898FC5ED31F3709BB3CDD82C96492E721BDD381735026")
  -cs int
    	HTTP chunk size for downloading (in MB)
  -d	Debug mode
  -end int
    	Define the ending item of a playlist or a file input
  -f string
    	Select specific stream to download
  -i	Information only
  -items string
    	Define wanted items from a file or playlist. Separated by commas like: 1,5,6,8-10
  -j	Print extracted data
  -n int
    	The number of download thread (only works for multiple-parts video) (default 10)
  -o string
    	Specify the output path
  -p	Download playlist
  -password string
    	Youku password
  -r string
    	Use specified Referrer
  -retry int
    	How many times to retry when the download failed (default 10)
  -start int
    	Define the starting item of a playlist or a file input (default 1)
  -v	Show version

使い方

全部元サイトに説明があるのですが,使い方は簡単で,Youtube だと,

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ annie 'https://www.youtube.com/watch?v=deIDDBmSfZQ'1
Site: YouTube youtube.com
Title: xxx – xxx.xxx.xxx.xxx [Official Video]
Type: video
Stream:
[137] -------------------
Quality: 1080p video/mp4; codecs="avc1.640028"
Size: 39.60 MiB (41526693 Bytes)
# download with: annie -f 137 ...
39.60 MiB / 39.60 MiB [=====================================================] 100.00% 377.75 KiB/s 1m47s
Merging video parts into xxx – xxx xxx xxx xxx [Official Video].mp4
$ annie 'https://www.youtube.com/watch?v=deIDDBmSfZQ' ✘ 1 Site: YouTube youtube.com Title: xxx – xxx.xxx.xxx.xxx [Official Video] Type: video Stream: [137] ------------------- Quality: 1080p video/mp4; codecs="avc1.640028" Size: 39.60 MiB (41526693 Bytes) # download with: annie -f 137 ... 39.60 MiB / 39.60 MiB [=====================================================] 100.00% 377.75 KiB/s 1m47s Merging video parts into xxx – xxx xxx xxx xxx [Official Video].mp4
$ annie 'https://www.youtube.com/watch?v=deIDDBmSfZQ'                                    ✘ 1 

 Site:      YouTube youtube.com
 Title:     xxx – xxx.xxx.xxx.xxx [Official Video]
 Type:      video
 Stream:   
     [137]  -------------------
     Quality:         1080p video/mp4; codecs="avc1.640028"
     Size:            39.60 MiB (41526693 Bytes)
     # download with: annie -f 137 ...

 39.60 MiB / 39.60 MiB [=====================================================] 100.00% 377.75 KiB/s 1m47s
Merging video parts into xxx – xxx xxx xxx xxx [Official Video].mp4

みたいな感じで使えます.CTRL + C で中断ですが,もう一度同じ URL でダウンロードを指示するとキチンと続きからダウンロードされます(レジュームが効く).

あと,-i オプションでダウンロードできる全ての quality のリストが出て来て,-f オプションでどれを実際にダウンロードできるのか指定できるそう.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ annie -i 'https://www.youtube.com/watch?v=dddS1BmSfZQ'
Site: YouTube youtube.com
Title: xxx – xxx xxx xxx xxx [Official Video]
Type: video
Streams: # All available quality
[137] -------------------
Quality: 1080p video/mp4; codecs="avc1.640028"
Size: 39.60 MiB (41526693 Bytes)
# download with: annie -f 137 ...
...
[397] -------------------
Quality: 480p video/mp4; codecs="av01.0.04M.08"
Size: 9.51 MiB (9968317 Bytes)
# download with: annie -f 397 ...
...
$ annie -f 397 'https://www.youtube.com/watch?v=dddS1BmSfZQ'
Site: YouTube youtube.com
Title: xxx – xxx xxx xxx xxx [Official Video]
Type: video
Stream:
[397] -------------------
Quality: 480p video/mp4; codecs="av01.0.04M.08"
Size: 9.51 MiB (9968317 Bytes)
# download with: annie -f 397 ...
9.51 MiB / 9.51 MiB [=========================================================] 100.00% 344.81 KiB/s 28s
Merging video parts into xxx – xxx xxx xxx [Official Video].mp4
$ annie -i 'https://www.youtube.com/watch?v=dddS1BmSfZQ' Site: YouTube youtube.com Title: xxx – xxx xxx xxx xxx [Official Video] Type: video Streams: # All available quality [137] ------------------- Quality: 1080p video/mp4; codecs="avc1.640028" Size: 39.60 MiB (41526693 Bytes) # download with: annie -f 137 ... ... [397] ------------------- Quality: 480p video/mp4; codecs="av01.0.04M.08" Size: 9.51 MiB (9968317 Bytes) # download with: annie -f 397 ... ... $ annie -f 397 'https://www.youtube.com/watch?v=dddS1BmSfZQ' Site: YouTube youtube.com Title: xxx – xxx xxx xxx xxx [Official Video] Type: video Stream: [397] ------------------- Quality: 480p video/mp4; codecs="av01.0.04M.08" Size: 9.51 MiB (9968317 Bytes) # download with: annie -f 397 ... 9.51 MiB / 9.51 MiB [=========================================================] 100.00% 344.81 KiB/s 28s Merging video parts into xxx – xxx xxx xxx [Official Video].mp4
$ annie -i 'https://www.youtube.com/watch?v=dddS1BmSfZQ'

 Site:      YouTube youtube.com
 Title:     xxx – xxx xxx xxx xxx [Official Video]
 Type:      video
 Streams:   # All available quality
     [137]  -------------------
     Quality:         1080p video/mp4; codecs="avc1.640028"
     Size:            39.60 MiB (41526693 Bytes)
     # download with: annie -f 137 ...
...
     [397]  -------------------
     Quality:         480p video/mp4; codecs="av01.0.04M.08"
     Size:            9.51 MiB (9968317 Bytes)
     # download with: annie -f 397 ...

...

$ annie -f 397 'https://www.youtube.com/watch?v=dddS1BmSfZQ'
 Site:      YouTube youtube.com
 Title:     xxx – xxx xxx xxx xxx [Official Video]
 Type:      video
 Stream:   
     [397]  -------------------
     Quality:         480p video/mp4; codecs="av01.0.04M.08"
     Size:            9.51 MiB (9968317 Bytes)
     # download with: annie -f 397 ...

 9.51 MiB / 9.51 MiB [=========================================================] 100.00% 344.81 KiB/s 28s
Merging video parts into xxx – xxx xxx xxx [Official Video].mp4

あと, -F オプションで txt ファイルに記された URL からダウンロードするらしい.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ cat dl.txt
https://www.youtube.com/watch?v=AAAsODSNfhw
https://www.youtube.com/watch?v=AAAAADbAHkI
$ annie -F ./dl.txt
annie -F dl.txt
Site: YouTube youtube.com
Title: xxxx yyyy yyyy
Type: video
Stream:
[136] -------------------
Quality: 720p video/mp4; codecs="avc1.4d401f"
Size: 63.60 MiB (66694228 Bytes)
# download with: annie -f 136 ...
63.60 MiB / 63.60 MiB [=====================================================] 100.00% 449.05 KiB/s 2m25s
Merging video parts into xxxx yyyy yyyy.mp4
Site: YouTube youtube.com
Title: [Official Music Video] zzzzzzz
Type: video
Stream:
[137] -------------------
Quality: 1080p video/mp4; codecs="avc1.640028"
Size: 79.88 MiB (83755377 Bytes)
# download with: annie -f 137 ...
79.88 MiB / 79.88 MiB [=====================================================] 100.00% 625.69 KiB/s 2m10s
Merging video parts into [Official Music Video] zzzzz.mp4
$ cat dl.txt https://www.youtube.com/watch?v=AAAsODSNfhw https://www.youtube.com/watch?v=AAAAADbAHkI $ annie -F ./dl.txt annie -F dl.txt Site: YouTube youtube.com Title: xxxx yyyy yyyy Type: video Stream: [136] ------------------- Quality: 720p video/mp4; codecs="avc1.4d401f" Size: 63.60 MiB (66694228 Bytes) # download with: annie -f 136 ... 63.60 MiB / 63.60 MiB [=====================================================] 100.00% 449.05 KiB/s 2m25s Merging video parts into xxxx yyyy yyyy.mp4 Site: YouTube youtube.com Title: [Official Music Video] zzzzzzz Type: video Stream: [137] ------------------- Quality: 1080p video/mp4; codecs="avc1.640028" Size: 79.88 MiB (83755377 Bytes) # download with: annie -f 137 ... 79.88 MiB / 79.88 MiB [=====================================================] 100.00% 625.69 KiB/s 2m10s Merging video parts into [Official Music Video] zzzzz.mp4
$ cat dl.txt
https://www.youtube.com/watch?v=AAAsODSNfhw
https://www.youtube.com/watch?v=AAAAADbAHkI

$ annie -F ./dl.txt
annie -F dl.txt

 Site:      YouTube youtube.com
 Title:     xxxx yyyy yyyy
 Type:      video
 Stream:   
     [136]  -------------------
     Quality:         720p video/mp4; codecs="avc1.4d401f"
     Size:            63.60 MiB (66694228 Bytes)
     # download with: annie -f 136 ...

 63.60 MiB / 63.60 MiB [=====================================================] 100.00% 449.05 KiB/s 2m25s
Merging video parts into xxxx yyyy yyyy.mp4

 Site:      YouTube youtube.com
 Title:     [Official Music Video] zzzzzzz
 Type:      video
 Stream:   
     [137]  -------------------
     Quality:         1080p video/mp4; codecs="avc1.640028"
     Size:            79.88 MiB (83755377 Bytes)
     # download with: annie -f 137 ...

 79.88 MiB / 79.88 MiB [=====================================================] 100.00% 625.69 KiB/s 2m10s
Merging video parts into [Official Music Video] zzzzz.mp4

今まで youtube-dl を使ってたんですが,こっちのほうが使い方がシンプル,しかも対応サイトも比較的多いようなので乗り換えることにしました.

以上!

 

Environment
スポンサーリンク
Following hyt!
タイトルとURLをコピーしました