Python实现视频\音乐\图片下载自由


又到了每日分享Python小技巧的时候了,今天给大家分享如何实现视频、音乐、图片下载自由的教程吧,我自己觉得灰常好用,所以把它分享给大家,因为好东西需要大家一起学。

在这里插入图片描述

1、实战效果

在这里插入图片描述

在这里插入图片描述

?接下来下冰冰图片

you-get https://inews.gtimg.com/newsapp_bt/0/13122504219/1000

在这里插入图片描述

在这里插入图片描述

?下霉霉短视频

you-get https://www.bilibili.com/video/BV1Et411D7LU\?from=search\&seid=14842777690307993679\&spm_id_from=333.337.0.0

在这里插入图片描述

在这里插入图片描述

下载视频

you-get https://v.qq.com/x/cover/mzc0020020cyvqh.html

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

?下音乐

 

在这里插入图片描述

you-get https://music.163.com/#/song\?id=1909932703

在这里插入图片描述

2、安装

pip3 install you-get 

在这里插入图片描述

3、常用参数

我感觉,下面添加中文注释的参数即可,

####Python学习交流Q群:906715085


(base) 14:39:50 >you-get usage: you-get [OPTION]... URL... A tiny downloader that scrapes the web optional arguments: -V, --version Print version and exit -h, --help Print this help message 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 #输出下载文件信息为json格式 Download options: -n, --no-merge Do not merge video parts --no-caption Do not download captions (subtitles, lyrics, danmaku, ...) #不下载视频弹幕、音乐歌词等 -f, --force Force overwriting existing files --skip-existing-file-size-check Skip existing file without checking file size -F STREAM_ID, --format STREAM_ID Set video format to STREAM_ID #指定视频下载格式、清晰度等 -O FILE, --output-filename FILE Set output filename #指定下载文件名称,默认原网站文件名称 -o DIR, --output-dir DIR Set output directory #指定下载文件路径,默人you-get执行目录 -p PLAYER, --player PLAYER Stream extracted URL to a PLAYER -c COOKIES_FILE, --cookies COOKIES_FILE Load cookies.txt or cookies.sqlite -t SECONDS, --timeout SECONDS Set socket timeout -d, --debug Show traceback and other debug info -I FILE, --input-file FILE Read non-playlist URLs from FILE -P PASSWORD, --password PASSWORD Set video visit password to PASSWORD -l, --playlist Prefer to download a playlist -a, --auto-rename Auto rename same name different files -k, --insecure ignore ssl errors Playlist optional options: --first FIRST the first number --last LAST the last number --size PAGE_SIZE, --page-size PAGE_SIZE the page size number Proxy options: -x HOST:PORT, --http-proxy HOST:PORT Use an HTTP proxy for downloading -y HOST:PORT, --extractor-proxy HOST:PORT Use an HTTP proxy for extracting only --no-proxy Never use a proxy -s HOST:PORT or USERNAME:PASSWORD@HOST:PORT, --socks-proxy HOST:PORT or USERNAME:PASSWORD@HOST:PORT Use an SOCKS5 proxy for downloading

在这里插入图片描述

以下载一个沙雕视频为例,
you-get --output-filename=沙雕 --output-dir=/Users/xx/Desktop --format=dash-flv720 --no-caption https://www.bilibili.com/video/BV1qL4y1B7ff/

#--output-filename=沙雕 ,将下载后的视频前缀重命名为沙雕
#--output-dir=/Users/xx/Desktop,将视频存储在/Users/xx/Desktop下
#--format=dash-flv720,下载清晰度为720的视频
#-no-caption,不下载弹幕

在这里插入图片描述

在这里插入图片描述

4、支持平台

在这里插入图片描述

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

到这里就没有了,今天分享的东西很多,不过白嫖还是很香的,你可以不给我点赞,但是必须给密密麻麻的代码点赞,不然都对不起这些代码。这一篇的内容就那么多,喜欢的拿走,下一章见。

在这里插入图片描述