Jump to content
UBot Underground

Socket Save Image With Default Name


Recommended Posts

hi,

need to save a lot of images direct from url and save them with there defauld name

add list to list(%image url,$list from file("C:\\Users\\admin\\Desktop\\image url list.txt"),"Delete","Global")
loop($list total(%image url)) {
    set(#image name,$next list item(%image url),"Global")
    plugin command("SocketCommands.dll", "socket container") {
        plugin command("SocketCommands.dll", "socket download file", $next list item(%image url), "D:\\image\\1.jpg")
    }
}

but i want the image to be saved not with 1.jpg but with default name

for example:

http://www.abc.net.au/news/image/4243128-3x2-940x627.jpg

script download image from above link and save image with name "4243128-3x2-940x627.jpg"

 

its seem to me that this type of operation have to be done with regex

 

Link to post
Share on other sites

so your code,the image URLS are saved in the list from file on your desktop,and you want each of those list items,to be the name of each of the saved files,which is the value of  {#image name} ,if that assumption is correct then,ive also added a counter,I know you are new but try getting away from the next list item,their is a lot of uses for knowing where you are in your loop from a debugging perspective,but really their is a lot more to why you need to use them,I honestly can't remember how the next list item works,if the next list item increases after every loop or since you have two their so it goes up each time it is called,anyways,

add list to list(%image url,$list from file("C:\\Users\\admin\\Desktop\\image url list.txt"),"Delete","Global")
set(#list counter,0,"Global")
loop($list total(%image url)) {
    plugin command("SocketCommands.dll""socket container") {
        plugin command("SocketCommands.dll""socket download file"$list item(%image url,#list counter), "D:\\image\\{$replace regular expression($find regular expression($list item(%image url,#list counter),"image.+"),"image/","")}")
    }
    increment(#list counter)
}

 

My regex sucks bad,but it should work

Link to post
Share on other sites

you can do like this too

 

set(#DL URL"http://www.abc.net.au/news/image/4243128-3x2-940x627.jpg""Global")
set(#file name$replace regular expression(#DL URL".*/"$nothing), "Global")
alert(#file name)
download file(#DL URL"{$special folder("Desktop")}\\{#file name}")
stop script
comment("you can do like this too")
download file(#DL URL"{$special folder("Desktop")}\\{$replace regular expression(#DL URL".*/", $nothing)}")

 

if you use sockets you can not use proxies yet.

 

so may as well do like this

 

if you must it is same idea

 

CD

  • Like 1
Link to post
Share on other sites

so your code,the image URLS are saved in the list from file on your desktop,and you want each of those list items,to be the name of each of the saved files,which is the value of  {#image name} ,if that assumption is correct then,ive also added a counter,I know you are new but try getting away from the next list item,their is a lot of uses for knowing where you are in your loop from a debugging perspective,but really their is a lot more to why you need to use them,I honestly can't remember how the next list item works,if the next list item increases after every loop or since you have two their so it goes up each time it is called,anyways,

add list to list(%image url,$list from file("C:\\Users\\admin\\Desktop\\image url list.txt"),"Delete","Global")

set(#list counter,0,"Global")

loop($list total(%image url)) {

    plugin command("SocketCommands.dll""socket container") {

        plugin command("SocketCommands.dll""socket download file"$list item(%image url,#list counter), "D:\\image\\{$replace regular expression($find regular expression($list item(%image url,#list counter),"image.+"),"image/","")}")

    }

    increment(#list counter)

}

 

My regex sucks bad,but it should work

i understand your idea and thanks for helping

your code will work only if image are in "image" folder but not all images have before them "image/"

Link to post
Share on other sites

you can do like this too

 

set(#DL URL"http://www.abc.net.au/news/image/4243128-3x2-940x627.jpg""Global")

set(#file name$replace regular expression(#DL URL".*/"$nothing), "Global")

alert(#file name)

download file(#DL URL"{$special folder("Desktop")}\\{#file name}")

stop script

comment("you can do like this too")

download file(#DL URL"{$special folder("Desktop")}\\{$replace regular expression(#DL URL".*/", $nothing)}")

 

if you use sockets you can not use proxies yet.

 

so may as well do like this

 

if you must it is same idea

 

CD

Great,your code work excellent

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...