hackoo

Download_Images_CURL.bat

Jul 2nd, 2022 (edited)
895
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. Title Get Status Codes from URL using the commandline CURL and Download images files
  3.  
  4. Set "ONLINE=%~dp0ONLINE.txt"
  5. If Exist "%ONLINE%" Del "%ONLINE%"
  6. Set "OFFLINE=%~dp0OFFLINE.txt"
  7. If Exist "%OFFLINE%" Del "%OFFLINE%"
  8. set /a c=0
  9.  
  10. Set URLS="https://www.google.com/images/branding/googlelogo/1x/googlelogo_light_color_272x92dp.png" ^
  11. ^ "https://i.gifer.com/embedded/download/7IsD.gif" ^
  12. ^ "https://i.gifer.com/embedded/download/Ao.gif" ^
  13. ^ "https://i.gifer.com/embedded/download/1Nz.gif" ^
  14. ^ "https://i.gifer.com/embedded/download/LuvJ.gif" ^
  15. ^ "https://i.gifer.com/embedded/download/6os.gif" ^
  16. ^ "https://i.gifer.com/embedded/download/7VE.gif" ^
  17. ^ "https://i.gifer.com/embedded/download/AmO.gif" ^
  18. ^ "https://i.gifer.com/embedded/download/3Hw.gif" ^
  19. ^ "https://i.gifer.com/embedded/download/Z35M.gif" ^
  20. ^ "https://i.gifer.com/embedded/download/Lvy.gif" ^
  21. ^ "https://i.gifer.com/embedded/download/lp2.gif" ^
  22. ^ "https://cdn2.unrealengine.com/Fortnite%2FBoogieDown_GIF-1f2be97208316867da7d3cf5217c2486da3c2fe6.gif"
  23.  
  24. echo/
  25. SetLocal EnableDelayedExpansion
  26. @for %%a in (%URLS%) do (
  27.     set /a c+=1
  28.     Call :Get_Status "%%~a"
  29.     If [!httpCode!] EQU [200] (
  30.         Call :PSColor " !c!-[!Time!] [!httpcode!] [!Description!] [%%~a]" DarkGreen \n
  31.         Curl -# -O "%%~a"
  32.         echo [!Time!] [!httpcode!] [!Description!] [%%~a]>>"%ONLINE%"
  33.     ) Else (
  34.         Call :PSColor " !c!-[!Time!] [!httpcode!] [!Description!] [%%~a]" DarkRed \n
  35.         echo [!Time!] [!httpcode!] [!Description!] [%%~a]>>"%OFFLINE%"
  36.     )
  37. )
  38.  
  39. Call :MoveFiles
  40. EndLocal & Pause & EXIT /B
  41. REM -----------------------------------------------------------------------------------
  42. :Get_Status <url> <httpCode>
  43. @for /f "tokens=*" %%a in (
  44.     'curl -sI -o nul -w "%%{http_code}" "%~1"'
  45. ) do (
  46.     Set "httpCode=%%a"
  47.     If [!httpcode!] EQU [503] (set "Description=Service Unavailable")
  48.     If [!httpcode!] EQU [500] (set "Description=Internal Server Error")
  49.     If [!httpcode!] EQU [404] (set "Description=Not Found OFFLINE")
  50.     If [!httpcode!] EQU [403] (set "Description=Forbidden Access Denied")
  51.     If [!httpcode!] EQU [302] (set "Description=Temporary Redirect")
  52.     If [!httpcode!] EQU [301] (set "Description=Redirect and Moved Permanently")
  53.     If [!httpcode!] EQU [200] (set "Description=OK ONLINE")
  54.     If [!httpcode!] EQU [000] (set "Description=TIMEOUT Server Rejected the Request")
  55. )
  56. Exit /B
  57. REM ----------------------------------------------------------------------------------
  58. :PSColor <String> <Color> <NewLine>
  59. If /I [%3] EQU [\n] (
  60.     Powershell Write-Host "`0%~1" -ForegroundColor %2
  61. ) Else (
  62.     Powershell Write-Host "`0%~1" -ForegroundColor %2 -NoNewLine
  63. )
  64. Exit /B
  65. REM -----------------------------------------------------------------------------------
  66. :MoveFiles
  67. @for %%a in (gif png jpg jpeg) do (
  68.     If not exist %%a\ MkDir %%a\
  69.     @for /f "delims=" %%i in ('dir /s /b *.%%a 2^>nul') do (
  70.         If /I  ["%%~xi"] EQU [".%%a"] Move /Y "%%~i" %%a>nul 2>&1
  71.     )
  72. )
  73. Exit /B
  74. REM -----------------------------------------------------------------------------------
  75. REM https://anonfiles.com/3bY5y8v1y3
  76. REM -----------------------------------------------------------------------------------
RAW Paste Data Copied