zoukankan      html  css  js  c++  java
  • 批量下载头像

    ------------恢复内容开始------------

    今有需求更新一批账号的用户头像

    于是找了批真实用户的头像来替换

    就是下面的这个

    批量下载指定数量的 " Down_HeadImg -total 5000"

    function Down_HeadImg($total=10)
    {
       $count=0
       10000..70000|%{
            $body=@{
                userid=$_
            }
            $url='https://api.xxx.com/coxxx/xxxler.ashx?action=getuserinfo'
            $res=Invoke-RestMethod -Uri $url -Method Post -Body $body
            if($res.data.user_model.head_url.length -gt 89){
                Invoke-RestMethod ($res.data.user_model.head_url) -OutFile "$count.png"
                if((Get-FileHash "$count.png" -Algorithm MD5).hash -ne 'FEE9458C29CDCCF10AF7EC01155DC7F0'){
                    $count++
                }else{Remove-Item "$count.png" -Force;$count --}
            }
            $w=$count.tostring() + '/' + $total.tostring()
            Write-Progress -Activity "Download Progress:" -status "Current Download ... $count,Please await,$w" -percentcomplete ($count/($total)*100)
            if($count -eq $total){break}
        } 
    }
  • 相关阅读:
    NOI Online 2020 提高组游记
    【HDU5840】This world need more Zhu
    CSP-S 2019 AFO记
    防错笔记
    关于Blog
    题解 【UER #6】逃跑
    动态规划杂题选记
    有趣计数题选做
    题解 [POI2012] Leveling Ground
    xioa han 带画家!
  • 原文地址:https://www.cnblogs.com/feiyucha/p/12272575.html
Copyright © 2011-2022 走看看