码迷,mamicode.com
首页 > 其他好文 > 详细

You-Get , A Tiny Downloader,视频下载小工具

时间:2017-04-16 22:34:44      阅读:1068      评论:0      收藏:0      [点我收藏+]

标签:ini   sites   opus   bin   run   layer   版本   网站   out   

You-Get

技术分享 技术分享 技术分享

You-Get is a tiny command-line utility to download media contents (videos, audios, images) from the Web, in case there is no other handy way to do it.

Here‘s how you use you-get to download a video from this web page: 

1 you-get -o E:/Desktop http://v.youku.com/v_show/id_XMjAyOTgwMzIw.html

C:\Users\Melo>you-get -o E:/Desktop http://v.youku.com/v_show/id_XMjAyOTgwMzIw.html

 site: 优酷 (Youku)

title: 3D北京 虚拟旅游 高清
stream:
- format: mp4
container: mp4
video-profile: 高清
size: 10.0 MiB (10474135 bytes)
# download-with: you-get --format=mp4 [URL]

Downloading 3D北京 虚拟旅游 高清.mp4 ...
0.0% ( 0.0/ 10.0MB) ├────────────────────────────
2.5% ( 0.2/ 10.0MB) ├█───────────────────────────
5.0% ( 0.5/ 10.0MB) ├███─────────────────────────
7.5% ( 0.8/ 10.0MB) ├███─────────────────────────
10.0% ( 1.0/ 10.0MB) ├█████───────────────────────
12.5% ( 1.2/ 10.0MB) ├█████───────────────────────
15.0% ( 1.5/ 10.0MB) ├███████─────────────────────
17.5% ( 1.8/ 10.0MB) ├███████─────────────────────
20.0% ( 2.0/ 10.0MB) ├█████████───────────────────
22.5% ( 2.2/ 10.0MB) ├██████████──────────────────
25.0% ( 2.5/ 10.0MB) ├███████████─────────────────
27.5% ( 2.8/ 10.0MB) ├████████████────────────────
30.0% ( 3.0/ 10.0MB) ├█████████████───────────────
32.5% ( 3.2/ 10.0MB) ├██████████████──────────────
35.0% ( 3.5/ 10.0MB) ├███████████████─────────────
37.5% ( 3.8/ 10.0MB) ├████████████████────────────
40.0% ( 4.0/ 10.0MB) ├█████████████████───────────
42.5% ( 4.2/ 10.0MB) ├██████████████████──────────
45.0% ( 4.5/ 10.0MB) ├███████████████████─────────
47.6% ( 4.8/ 10.0MB) ├████████████████████────────
50.1% ( 5.0/ 10.0MB) ├█████████████████████───────
52.6% ( 5.2/ 10.0MB) ├██████████████████████──────
55.1% ( 5.5/ 10.0MB) ├███████████████████████─────
57.6% ( 5.8/ 10.0MB) ├████████████████████████────
60.1% ( 6.0/ 10.0MB) ├█████████████████████████───
62.6% ( 6.2/ 10.0MB) ├██████████████████████████──
65.1% ( 6.5/ 10.0MB) ├███████████████████████████─
67.6% ( 6.8/ 10.0MB) ├████████████████████████████
70.1% ( 7.0/ 10.0MB) ├████████████████████████████
72.6% ( 7.2/ 10.0MB) ├████████████████████████████
75.1% ( 7.5/ 10.0MB) ├████████████████████████████
77.6% ( 7.8/ 10.0MB) ├████████████████████████████
80.1% ( 8.0/ 10.0MB) ├████████████████████████████
82.6% ( 8.2/ 10.0MB) ├████████████████████████████
85.1% ( 8.5/ 10.0MB) ├████████████████████████████
87.6% ( 8.8/ 10.0MB) ├████████████████████████████
90.1% ( 9.0/ 10.0MB) ├████████████████████████████
92.6% ( 9.2/ 10.0MB) ├████████████████████████████
95.1% ( 9.5/ 10.0MB) ├████████████████████████████
97.6% ( 9.8/ 10.0MB) ├████████████████████████████
100% ( 10.0/ 10.0MB) ├████████████████████████████
█████████████┤[1/1] 2 MB/s

界面还是很好看的

你可能会用上You-Get:

  • 你在互联网上看见某个喜欢的东西,出于乐趣,你就是想把载下来,强迫症o_O。
  • 通过电脑,在线观看你喜欢的视频,但是不被允许保存。你觉得你不能控制(掌控)你的电脑,我的地盘应该是我做主的啊
  • You want to get rid of any closed-source technology or proprietary JavaScript code, and disallow things like Flash running on your computer.
  • You are an adherent of hacker culture and free software.

You-Get能够为你做些什么呢?

  • 下载视频/音频(来源于YouTube、Youku、Niconico ,以及其它一些网站,支持下载的网站清单
  • Stream an online video in your media player. No web browser, no more ads.
  • Download images (of interest) by scraping a web page.
  • Download arbitrary non-HTML contents, i.e., binary files.

=========================靓丽的分割线==================================================

安装所需环境:

安装Python

最好选择最新版本,路径不限,记得  

Add Python 3.×× to PATH   前面打"√"         ‘不勾选,我们得自己设置环境变量,具体方法:我的计算机→右键,属性→高级系统设置,高级标签下的环境变量
                          用户变量(或者系统变量),新建path变量,变量值输入Python安装路径。

勾选后,我们直接 Win+R  ,输入 CMD  ,确定  ,并输入 Python ,得到下图所示,则说明Python 安装成功

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Melo>python
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>                                                                        ‘安装Ctrl+Z可以得到^z,然后Enter键可以退出python,或者直接×掉。

有了Python环境以后,我们就要下载You-Get啦,我们通过命令可以轻松愉快的得到,输入以下命令

pip3 install you-get

成功以后,接下来就是FFmpeg 的安装

 

FFmpeg 的安装

 

把下载好的FFmpeg压缩包,解压,然后把解压后的文件放在熟悉的位置(最好放在python所在的同级目录),然后添加环境变量,通过CMD安装FFmpeg

本人放在C盘 

 

1 C:\Python36        这是Python安装路径
2 C:\ffmpeg\bin      这是ffmpeg文件夹位置

 为ffmpeg添加环境变量

具体方法:

我的计算机→右键,属性→高级系统设置,高级标签下的环境变量→

用户变量(或者系统变量),新建Path变量,变量值输入 C:\ffmpeg\bin   


如果已经有了Path变量,则选中Path变量,点编辑,在变量值后 输入

;C:\ffmpeg\bin    分号,是用来把变量隔开的

然后输入以下命令

 1 C:\Users\Melo>cd C:\ffmpeg\bin              ‘进入ffmpeg下的bin文件夹
 2 
 3 C:\ffmpeg\bin>ffmpeg -version     ‘查看ffmpeg版本 4 ffmpeg version N-85469-gf1d80bc Copyright (c) 2000-2017 the FFmpeg developers
 5   built with gcc 6.3.0 (GCC)
 6   configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --ena
 7 visynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-
 8 -libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug
 9 able-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp
10 ex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libv
11 libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enab
12   libavutil      55. 61.100 / 55. 61.100
13   libavcodec     57. 92.100 / 57. 92.100
14   libavformat    57. 72.100 / 57. 72.100
15   libavdevice    57.  7.100 / 57.  7.100
16   libavfilter     6. 84.101 /  6. 84.101
17   libswscale      4.  7.100 /  4.  7.100
18   libswresample   2.  8.100 /  2.  8.100
19   libpostproc    54.  6.100 / 54.  6.100

 试验下:

 1 Microsoft Windows [版本 6.1.7601]
 2 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
 3 
 4 C:\Users\Melo>you-get -o E:/Desktop https://www.youtube.com/watch?v=vnkhgZPLys4
 5 site:                YouTube
 6 title:               3 Secrets To MAKE Shots IN GAMES!  3 Challenges! Basketball Shooting Drills
 7 stream:
 8     - itag:          22
 9       container:     mp4
10       quality:       hd720
11       size:          52.8 MiB (55338294 bytes)
12     # download-with: you-get --itag=22 [URL]
13 
14 Downloading 3 Secrets To MAKE Shots IN GAMES!  3 Challenges! Basketball Shooting Drills.mp4 ...
15  0.0% (  0.0/ 52.8MB) ├─────────────────────────────────────────┤[1/1]
Downloading 3 Secrets To MAKE Shots IN GAMES!  3 Challenges! Basketball Shooting Drills.mp4 ...
 9.0% (  4.8/ 52.8MB) ├████─────────────────────────────────────┤[1/1]   37 kB/s
Downloading 3 Secrets To MAKE Shots IN GAMES!  3 Challenges! Basketball Shooting Drills.mp4 ...
16.1% (  8.5/ 52.8MB) ├███████──────────────────────────────────┤[1/1]  368 kB/s

下载完成

Downloading 3 Secrets To MAKE Shots IN GAMES!  3 Challenges! Basketball Shooting Drills.mp4 ...
 100% ( 52.8/ 52.8MB) ├█████████████████████████████████████████┤[1/1]    4 MB/s

Saving 3 Secrets To MAKE Shots IN GAMES!  3 Challenges! Basketball Shooting Drills.a.en.srt ... Done.

 

you-get -o E:/Desktop https://www.youtube.com/watch?v=vnkhgZPLys4  you-get 启动 you-get , -o 表示输出位置,E:/Desktop 表示输出到E盘桌面文件夹,后面的为视频网址

更多使用,可以使用you-get -h   ,即help帮助文件

C:\Users\Melo>you-get -h
you-get: version 0.4.652, a tiny downloader that scrapes the web.
Usage: you-get [OPTION]... [URL]...

Startup options:
    -V | --version                      Print version and exit.
    -h | --help                         Print help and exit.

Dry-run options: (no actual downloading)
    -i | --info                         Print extracted information.
    -u | --url                          Print extracted information with URLs.
         --json                         Print extracted URLs in JSON format.

Download options:
    -n | --no-merge                     Do not merge video parts.
         --no-caption                   Do not download captions.
                                        (subtitles, lyrics, danmaku, ...)
    -f | --force                        Force overwriting existed files.
    -F | --format <STREAM_ID>           Set video format to STREAM_ID.
    -O | --output-filename <FILE>       Set output filename.
    -o | --output-dir <PATH>            Set output directory.
    -p | --player <PLAYER [OPTIONS]>    Stream extracted URL to a PLAYER.
    -c | --cookies <COOKIES_FILE>       Load cookies.txt or cookies.sqlite.
    -x | --http-proxy <HOST:PORT>       Use an HTTP proxy for downloading.
    -y | --extractor-proxy <HOST:PORT>  Use an HTTP proxy for extracting only.
         --no-proxy                     Never use a proxy.
    -s | --socks-proxy <HOST:PORT>      Use an SOCKS5 proxy for downloading.
    -t | --timeout <SECONDS>            Set socket timeout.
    -d | --debug                        Show traceback and other debug info.

更多内容,关注https://github.com/soimort/you-get#you-get  欢迎留言,一起探讨。

参考资料:

https://github.com/soimort/you-get#you-get  

http://zh.wikihow.com/%E5%9C%A8Windows%E4%B8%8A%E5%AE%89%E8%A3%85FFmpeg%E7%A8%8B%E5%BA%8F


Finished at 2017-04-16 21:40:32

原文地址:http://www.cnblogs.com/Melo520/p/6720177.html

You-Get , A Tiny Downloader,视频下载小工具

标签:ini   sites   opus   bin   run   layer   版本   网站   out   

原文地址:http://www.cnblogs.com/Melo520/p/6720177.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!