Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Fr0sT-Brutal
Created November 13, 2016 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fr0sT-Brutal/60824f99a5069e91c23a40fa37877596 to your computer and use it in GitHub Desktop.
Save Fr0sT-Brutal/60824f99a5069e91c23a40fa37877596 to your computer and use it in GitHub Desktop.
Grab images from a-comics.ru
@echo off
SET Dir=shakes-and-fidget
SET EndNum=148
mkdir tmp
:: get pages
for /l %%f in (1,1,%EndNum%) do wget -nv -P tmp http://a-comics.ru/comics/%Dir%/%%f
:: extract lines with links to images (ipic.ru)
find "ipic" tmp\* > list || goto :Err
:: extract URL-number pairs
cscript //Nologo process.js > filtered || goto :Err
:: get images
mkdir out
for /f "tokens=1,2" %%s in (filtered) do wget -nv -O out\%%t.jpg %%s
:: cleanup
del list
del filtered
rd /s/q tmp
goto :EOF
:Err
pause
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var file = FSO.GetFile("list");
var stm = file.OpenAsTextStream(1);
var re = new RegExp("\"(http://ipic.+?)\".+?выпуск (\\d+)");
function padLeft(nr, n, str)
{
return Array(n-String(nr).length+1).join(str||'0')+nr;
}
while (!stm.AtEndOfStream)
{
var s = stm.ReadLine();
var res = s.match(re);
if (!res) continue;
var url = res[1];
var num = padLeft(res[2], 3);
WScript.Echo(url, num);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment