前段时间,我们写了一篇关于 传输.sh 它允许您从命令行通过 Internet 共享文件。 今天,我们将看到另一个名为 任意粘贴. 这是一个简单的脚本,可以根据文件的类型自动共享和上传文件到兼容的托管站点。 您无需手动登录托管站点并上传或共享您的文件。 任何粘贴都会 选择正确的托管站点取决于文件的类型 你要上传。 简而言之,照片将上传到图片托管网站,视频上传到视频网站,代码上传到 pastebin。 酷,是吗? 您无需依赖任何繁重、消耗内存的 GUI 应用程序即可在线上传和共享文件。 Anypaste 是完全免费的开源轻量级脚本,适用于任何类 Unix 操作系统。
内容
安装任何粘贴
就像我已经说过的,它只是一个 shell 脚本。 因此,不会有任何复杂的安装步骤。 只需将其下载到可以运行它的地方,例如 /usr/bin/,使其成为可执行文件并立即开始使用它。 或者,您可以运行以下两个命令来快速安装 Anypaste。
$ sudo curl -o /usr/bin/anypaste https://anypaste.xyz/sh
$ sudo chmod +x /usr/bin/anypaste
而已。 要更新旧的 Anypaste 版本,只需用新的可执行文件覆盖旧的可执行文件。
现在,让我们看一些实际的例子。
配置
Anypaste 开箱即用。 无需特殊配置! 默认配置文件是 ~/.config/anypaste.conf 当您第一次运行 Anypaste 时,它将自动创建。
唯一需要的配置选项是 ap_plugins. Anypaste 使用插件系统上传文件。 每个托管(上传)站点都由一个特定的插件表示。 您可以在下面查看启用的插件列表 应用插件指令 在 anypaste.conf 文件中。
# List of plugins # If there are multiple compatible plugins, precedence is determined # by which one is listed first in this array ap_plugins=( # Videos/Gifs 'sendvid' 'streamable' 'gfycat' # Images 'tinyimg' 'vgyme' # Audio 'instaudio' # Text 'hastebin' 'ixio' 'sprunge' # Documents 'docdroid' # Any file 'jirafeau' 'fileio' ) [...]
如果您安装了新插件,请将其添加到此列表中。 如果您想禁用默认插件,只需将其删除! 如果多个插件兼容,则选择数组中的第一个,所以 订单很重要.
使用 Anypaste 自动共享和上传文件到兼容的托管站点
要上传单个文件,例如 test.png,请运行:
$ anypaste test.png
示例输出为:
Current file: test.png Attempting to upload with plugin 'tinyimg' ######################################################################## 100.0% Direct Link: https://tinyimg.io/i/Sa1zsjj.png Upload complete. All files processed. Have a nice day!
正如您在上面的输出中看到的,Anypaste 已经自动找到了兼容的托管站点(https://tinyimg.io 在这种情况下)到给定的图像文件 测试.png 并上传到其中。 此外,它为我们提供了查看/下载上传文件的直接链接。
不仅仅是 .png 文件,您还可以上传任何其他图像文件类型。 例如,以下命令将上传 file.gif:
$ anypaste file.gif Current file: file.gif Plugin 'streamable' is compatible, but missing config parameters: 'streamable_email' 'streamable_password' You can set them in /home/sk/.config/anypaste.conf Attempting to upload with plugin 'gfycat' ######################################################################## 100.0% Reminder: Gfycat needs time to encode. Your video will not appear right away. Link: https://gfycat.com/MisguidedQuaintBergerpicard Direct(ish) Link: https://thumbs.gfycat.com/MisguidedQuaintBergerpicard-size_restricted.gif Upload complete. All files processed. Have a nice day!
您可以将链接分享给您的家人、朋友和同事。 这是我刚刚上传到的图像的屏幕截图 gfycat 网站。
也可以一次上传多个文件(相同的文件类型或不同的文件)。
看看下面的例子。 在这个例子中,我上传了两个不同的文件,一个图像和一个视频文件:
$ anypaste image.png video.mp4
样本输出:
Current file: image.png Attempting to upload with plugin 'tinyimg' ######################################################################## 100.0% Direct Link: https://tinyimg.io/i/au1PHpg.png Upload complete. Current file: video.mp4 Plugin 'streamable' is compatible, but missing config parameters: 'streamable_email' 'streamable_password' You can set them in /home/sk/.config/anypaste.conf Attempting to upload with plugin 'sendvid' ######################################################################## 100.0% Link: https://sendvid.com/wwy7w96h Delete/Edit: https://sendvid.com/wwy7w96h?secret=39c0af2d-d8bf-4d3d-bad3-ad37432a40a5 Upload complete. All files processed. Have a nice day!
Anypaste 已自动为这两种类型的文件找到兼容的托管站点,并将它们成功上传到各自的站点。
正如您在使用部分的上述示例中可能注意到的那样,Anypaste 自动选择了“最佳”插件。 此外,您可以使用特定插件上传文件。 例如,将文件上传到 gfycat 网站,运行:
$ anypaste -p gfycat file.gif
样本输出:
Current file: file.gif Plugin 'streamable' is compatible, but missing config parameters: 'streamable_email' 'streamable_password' You can set them in /home/sk/.config/anypaste.conf Attempting to upload with plugin 'gfycat' ######################################################################## 100.0% Reminder: Gfycat needs time to encode. Your video will not appear right away. Link: https://gfycat.com/GrayDifferentCollie Direct(ish) Link: https://thumbs.gfycat.com/GrayDifferentCollie-size_restricted.gif Upload complete. All files processed. Have a nice day!
要使用特定插件上传,绕过兼容性检查,请运行:
$ anypaste -fp gfycat file.gif
如果您发现配置文件中缺少特定插件,您仍然可以强制 Anypaste 使用带有“-xp”参数的特定插件。
$ anypaste -xp gfycat file.gif
要以交互模式上传文件,请使用“-i”标志运行它:
$ anypaste -i file.gif Current file: file.gif Determine compatible plugins automatically? [Y/n] n The following plugins were found: 'sendvid' 'streamable' 'gfycat' 'tinyimg' 'vgyme' 'instaudio' 'hastebin' 'ixio' 'sprunge' 'docdroid' 'jirafeau' 'fileio' Enter the (partial) name of a plugin, or nothing for automatic selection gfycat Attempt to upload with plugin 'gfycat'? [Y/n] y Attempting to upload with plugin 'gfycat' ######################################################################## 100.0% Reminder: Gfycat needs time to encode. Your video will not appear right away. Link: https://gfycat.com/WaryAshamedBlackbear Direct(ish) Link: https://thumbs.gfycat.com/WaryAshamedBlackbear-size_restricted.gif Upload complete. All files processed. Have a nice day!
如您所见,Anypaste 首先要求我自动确定插件。 我不希望它自动查找插件,所以我简单地回答“否”。 然后,它列出了可用的插件并让我从列表中选择一个。 同样,您可以上传和共享不同类型的文件。 给定的文件将上传到兼容的站点。
每当您尝试上传视频文件时,它都会上传到以下任一站点:
- 发送视频
- 可流式传输
- gfycat
这里注意顺序。 Anypaste 将首先尝试将文件上传到 sendvid 站点。 如果 sendvid 没有插件,它将按给定顺序尝试其他两个站点。 当然,您可以在配置文件中更改它。
图片将上传至:
- tinyimg.io
- vgy.me
音频文件将上传到:
- 安装
文本文件将上传到:
- 哈斯特宾
- ix.io
- sprunge.us
文件将上传至:
- 类机器人
任何其他文件将上传到:
- 吉拉费
- 文件.io
上面列出的一些网站会在特定时间后删除内容。 因此,在上传和共享内容之前,请检查这些网站的条款和条件。
- PSiTransfer – 一个简单的开源自托管文件共享解决方案
- iWant – 去中心化的点对点文件共享命令行应用程序
结论
在我看来,文件识别来确定文件上传位置的想法真的很棒,开发人员在这个工具中完美地实现了它。 Anypaste 肯定会对经常通过 Internet 共享文件的每个人有用。 我希望你也会发现它很有用。
资源:
- 任意粘贴网站
- Anypaste GitHub页面
感谢您的光临!
帮助我们帮助您:
- 订阅我们的电子邮件通讯: 立即注册
- 支持 OSTechNix: 通过贝宝捐款
- 下载免费的电子书和视频: TradePub 上的 OSTechNix
- 联系我们: 红迪网 | Facebook | 推特 | 领英 | RSS订阅
祝你有美好的一天!!
AnypasteCLI文件共享和上传Linux开源