更新时间:2021.1.12
Bulksplash
一个下载Unsplash图片的命令行工具.
项目地址:https://github.com/MehediH/Bulksplash
使用Bulksplash需要安装Node.js ,我们先安装Nodejs,并且配置国内源
安装Nodejs
下载 https://nodejs.org/dist/v14.15.0/node-v14.15.0.pkg 并进行安装
安装成功后,运行以下命令配置国内源
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
安装
运行以下命令安装:
$ npm install bulksplash --g
安装时出现以下错误,因为权限问题,
$ checkPermissions Missing write access to /usr/local/lib/node_modules
按以下方法解决
sudo chown -R $USER /usr/local/lib/node_modules
使用
然后重新运行安装命令,安装成功后运行bulksplash
即可使用
Which directory do you want to save to?
- 你希望将图片下载到哪个文件夹,默认是当前文件夹内。Which images do you want to download?
- 你希望随机下载图片还是下载合辑,默认随机下载。What search term?
- 输入一个关键词进行搜索,默认空白。Enter the URL of the Unsplash collection you want to download from
- 输入你要下载到合集链接How many images (up to 50)?
- 你想下载多少张图片,默认20张。Only featured images?
- 只下载精选图片?默认是。What orientation?
- 你想下载什么方向到图片。Width?
- 设置要下载的图片宽度,默认原宽。Height?
- 设置要下载的图片高度。Export the credits for the photos to a .json file?
-将下载的图片信息保存到一个json文件夹内,默认保存。
spotdl
spotdl是一个通过命令行下载Spotify音乐的工具。
项目地址:https://github.com/spotDL/spotify-downloader
安装
$ pip install spotdl
使用
下载单曲,
# spotdl $trackUrl
$ spotdl https://open.spotify.com/track/08mG3Y1vljYA6bvDt4Wqkj?si=SxezdxmlTx-CaVoucHmrUA
下载专辑,
# spotdl $albumUrl
$ spotdl https://open.spotify.com/album/2YMWspDGtbDgYULXvVQFM6?si=gF5dOQm8QUSo-NdZVsFjAQ
下载列表,
# spotdl $playlistUrl
$ spotdl https://open.spotify.com/playlist/37i9dQZF1DWXhcuQw7KIeM?si=xubKHEBESM27RqGkqoXzgQ
通过搜索下载音乐(不是很精准),
# spotdl $songQuery
$ spotdl 'The HU - Sugaan Essenna'
恢复失败/未完成的下载,
# spotdl $pathToTrackingFile
$ spotdl 'Sugaan Essenna.spotdlTrackingFile'
注意:.spotdlTrackingFile文件下载时自动创建,下载完成后自动删除。
需要你能够正常访问YouTube Music, spotdl通过YouTube Music来过滤结果
Instaloader
instaloader是一个下载Ins图片的命令行工具
项目地址: https://github.com/instaloader/instaloader
Docs: https://instaloader.github.io/
安装
$ pip3 install instaloader
使用
下载某人所有图片和视频
# instaloader --login=your_username profile
$ instaloader --login=zhangleileix dlwlrma
未登录下载图片最大尺寸1080,登录下载可以下载更大尺寸
下载某个帖子
$ instaloader --login=zhangleileix -- -B_K4CykAOtf
不下载视频
$ instaloader --login=zhangleileix --post-filter="not is_video" dlwlrma
筛选下载
可以通过 --post-filter 来筛选要下载的帖子
- not is_video # 不下载视频
--post-filter="not is_video"
- date_utc # 按时间下载
--post-filter="date_utc <= datetime(2018, 5, 31)"
- likes # 按喜欢数量下载
--post-filter="likes>1000000"
此处仅记录目前我用到的,其他更多选项请至官方文档页面查看
weiboPicDownloader
weiboPicDownloader是一个免登录下载微博图片的工具。
项目地址:https://github.com/nondanee/weiboPicDownloader.git
安装依赖
$ pip3 install requests
$ pip install colorama # 仅 Windows 10.0.14393 以下需要
$ pip install futures # 仅 Python2 需要
安装
直接克隆项目到本地即可
$ git clone https://github.com/nondanee/weiboPicDownloader.git
使用
$ cd weiboPicDownloader/
$ python3 weiboPicDownloader.py -u 张子枫
必需参数(任选一)
- -u user 用户(昵称或 id)
- -f file 用户列表文件(昵称或 id,一个用户占一行)
可选参数
- -d directory 图片保存路径(默认值:./weiboPic)
- -s size 线程池大小(默认值:20)
- -r retry 最大重试次数(默认值:2)
- -i interval 请求间隔(默认值:1,单位:秒)
- -c cookie 登录凭据 (需要 cookie 中的 SUB 值)
- -b boundary 微博 mid/bid 或日期范围(格式:id:id 两者之间,:id 之前,id: 之后,id 指定,: 全部)
- -n name 命名模板 (标识符: url、index、type、mid、bid、date、text、name,类似 "f-Strings" 语法)
- -v 同时下载秒拍视频
- -o 重新下载已保存的文件(默认跳过)
如何从浏览器中取得 SUB 的值(以 Chrome 举例)
- 转到 https://m.weibo.cn 并登录
- 右键检查 > Application > Cookies > https://m.weibo.cn
- 双击 SUB 所在行并右键拷贝它的值
- 将 SUB 的值粘贴到命令行窗口,以 -c
的方式运行程序
Chrome 自带截屏
在页面审查元素,然后按shift + command + p , 然后输入screen
解锁网易云音乐灰色歌曲
安装Nodejs
# Debian/Ubuntu系统
cd ~
curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
apt update -y
apt install nodejs
# Centos系统
curl -sL https://rpm.nodesource.com/setup_14.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
yum update -y
yum install nodejs
下载并运行UnblockNeteaseMusic
cd /home/wwwroot/
git clone https://github.com/nondanee/UnblockNeteaseMusic.git
cd UnblockNeteaseMusic
设置进程保护
这里使用systemd 进程守护,只适用于Centos 7,Debian 8+,Ubuntu 16+等。
#修改一下ExecStart源码路径就可以了,然后一起复制到源码ssh运行
cat > /etc/systemd/system/UnblockNeteaseMusic.service <<EOF
[Unit]
Description=UnblockNeteaseMusic
After=network.target
Wants=network.target
[Service]
Type=simple
PIDFile=/var/run/UnblockNeteaseMusic.pid
WorkingDirectory=/home/wwwroot/UnblockNeteaseMusic
ExecStart=/usr/bin/node app.js
RestartPreventExitStatus=23
Restart=always
[Install]
WantedBy=multi-user.target
EOF
启动并设置开机自启
systemctl start UnblockNeteaseMusic
systemctl enable UnblockNeteaseMusic
安装证书和设置代理
-
安装证书
将UnblockNeteaseMusic里的ca.crt 安装到手机 -
ios系统:
手机设置 > Wi-Fi > 进入所连接Wi-Fi设置 > 配置代理 > 启用手动 > 填入服务器IP和上面的端口8080。就行了 -
安卓系统:
手机设置 > WLAN > 网络设置 > 代理
一般安卓手机设置代理类型的时候分为两种,手动代理和自动代理,有手动代理的,只需填上你打服务器IP和端口就行了 -
Windows系统:
网易云客户端 > 工具 > 自定义代理 > HTTP 代理
然后填上你的服务器IP和端口就行了。
或者在代理设置的地方填写自动代理
地址填写http://IP:端口/proxy.pac