How to save it all by write to byte block. Thank you
This will help. You are going to want to use a while loop to send a http request to each of those urls. You can then save the response as bytes using the write file block.
can you give me the code.
I just example with this site.
BLOCK:HttpRequest
url = “https://www.hdwallpapers.in/”
TYPE:STANDARD
$""
“application/x-www-form-urlencoded”
ENDBLOCK
BLOCK:Parse
input = @data.SOURCE
prefix = “https://www.hdwallpapers.in”
suffix = “jpg”
leftDelim = “<img src=”/thumbs/"
rightDelim = “jpg”"
RECURSIVE
MODE:LR
=> CAP @urls
ENDBLOCK
I won’t supply the whole thing and do it for you. I already gave you the answer. All you have to do is apply it
Sorry bro, I tried but I can’t do it. It so hard to me.
Alright here. I’m ONLY doing this in hopes that you will look at it and learn a bit more about how OpenBullet 2 works.
BLOCK:CreatePath
path = "Images"
ENDBLOCK
data.Logger.Enabled = false;
BLOCK:HttpRequest
url = "https://www.hdwallpapers.in/"
TYPE:STANDARD
$""
"application/x-www-form-urlencoded"
ENDBLOCK
BLOCK:Parse
input = @data.SOURCE
prefix = "https://www.hdwallpapers.in/thumbs/"
suffix = "jpg"
leftDelim = "<img src=\"/thumbs/"
rightDelim = "jpg"
caseSensitive = False
RECURSIVE
MODE:LR
=> VAR @parseOutput
ENDBLOCK
FOREACH url IN parseOutput
BLOCK:HttpRequest
url = @url
TYPE:STANDARD
$""
"application/x-www-form-urlencoded"
ENDBLOCK
if (data.RESPONSECODE != 404)
{
BLOCK:RandomString
input = "?d?d?d?d-?d?d?d?d-?d?d?d?d.jpg"
=> VAR @NAME
ENDBLOCK
BLOCK:FileWriteBytes
LABEL:Save Image
path = $"Images/<NAME>"
content = @data.RAWSOURCE
ENDBLOCK
}
END
data.STATUS = "SUCCESS";
return;
This will save images from each url parsed from the request and save it in a folder in your OB2 directory called “Images”
thank you my friends. I got it.