首页 > 其他分享 >tinypng.sh

tinypng.sh

时间:2023-01-25 01:23:30浏览次数:30  
标签:URL tinypng ne echo JSON sh FILE

#!/bin/bash
# 图片自动压缩
echo '= start ============================================'
find ./src/assets -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' |while read IN_FILE;do
  {
    UA='User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
    while
        set $(dd if=/dev/urandom bs=4 count=1 2>/dev/null | od -An -tu1)
        [ $1 -lt 224 ] &&
        [ $1 -ne 10 ] &&
        { [ $1 -ne 192 ] || [ $2 -ne 168 ]; } &&
        { [ $1 -ne 172 ] || [ $2 -lt 16 ] || [ $2 -gt 31 ]; }
      do :; done
    IP="X-Forwarded-For:$1.$2.$3.$4"
    echo "压缩: $IN_FILE"
    JSON=`curl -s --data-binary @$IN_FILE -H "$UA" -H "$IP" https://tinypng.com/web/shrink`
    URL=`echo $JSON|awk -F 'url":"' '{print $2}'|awk -F '"' '{print $1}'`

    if [ -n "$URL" ];then
      echo "JSON: $JSON"
      echo "保存: $URL->$IN_FILE"
      curl -s $URL --output $IN_FILE
    else
      echo "异常: $JSON"
    fi
  }&
done
wait
echo '= end ============================================'

 

标签:URL,tinypng,ne,echo,JSON,sh,FILE
From: https://www.cnblogs.com/zhenjianyu/p/17018467.html

相关文章

  • CSharp: emojione
     ///<summary>///mysql数据库用编码类型utf8mb4///向sqlserver数据库插入emoji表情包///插入emoji的数据时,值value需要......
  • CSharp: SOAP,WSDL
     引用服务有修改,点右键更新 Web.config<?xmlversion="1.0"encoding="utf-8"?><configuration><configSections><sectionname="microsoft.web.services3......
  • HashMap常用方法
    packagemap;importjava.util.Collection;importjava.util.HashMap;importjava.util.Set;publicclassHashMapDemo{publicstaticvoidmain(String[]args){......
  • CSharp: Lazy Load Pattern in donet core 6
     usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceGeovin.Du.DuLazyLoad.DuGhost......
  • SVG Animation & CSS stroke-dasharray & stroke-dashoffset All In One
    SVGAnimation&CSSstroke-dasharray&stroke-dashoffsetAllInOnehttps://maxwellito.github.io/vivus/https://github.com/maxwellito/vivus#vivusjshttps://de......
  • 2021 ACL Parameter-efficient Multi-task Fine-tuning for Transformers via Shared
    Parameter-efficientMulti-taskFine-tuningforTransformersviaSharedHypernetworks阅读这篇文章的目的是为了了解hypernet,相关代码https://github.com/rabeehk/hyp......
  • Shell编程
    Shell是一个命令行解释器,接受应用程序或者用户的命令,然后调用操作系统的内核.sh是Linux批处理脚本文件的后缀名,是一组命令sh是bash的一个软链接也就是一个快捷方式 运......
  • [English workout #3] 2 short MMA news and HLTV news about monesy (Part 1)
    Iputthelinksonthetopofthepost.https://www.mmafighting.com/2022/12/27/23523053/alexander-volkanovski-determined-to-prove-islam-makhachev-is-beatable-t......
  • SSH
    简介SSH是Telnet,FTP等网络访问的安全方式。SSH基本上就是Open-SSH了。 入门资料SSH菜鸟教程https://www.cainiaojc.com/ssh/ssh-index.html是小白学习SSH的个人认为......
  • SSH提示ssh: connect to host XXX.XXX.XXX.XXX port XXX: Operation timed out解决方
    服务器可能位于校园网或者公司网内部,而客户端没有连接校园网或者公司网,连接内网即可解决该问题。公网ip、端口号、主机名错误。以ubuntu系统的服务器为例,在终端中输入ip......