find pictures from internetsides

Feb 17, 2009 at 2:50pm

find pictures from internetsides

Hello,

Im havin a problem with my code. I want to build a programm that finds all the pictures on an internetside i choose and downloads them. The first problem is to find
the pictures. Thats what im trying to do here:

//picfind.js
//
//finds pictures in source code

inlets =1;
outlets=1;

var httppos;

var jpgpos;

var z;
//this is the var for the string im putting in

function god(z) {
//I give it the name god

for (var ti = 0; ti < = z.length; ti++){

if (z.substring(ti,ti+7)==”http://&#8221;) {

httppos=ti;

}

if (z.substring(ti,ti+4)==”.jpg”) {

jpgpos=ti+4;

outlet(0,z.substring(httppos,jpgpos));

}

}

}

this works really good for things like that:

wnuciwefncw…(()))888eiunwediuntrastrashtrashdasdadhttp://lol.jpgtrashtrashtrashdasdasd

the output ist http://lol.jpg

but when I put in some sourcecode from a homepage I get this:

width:1px: no such object
height:1px: no such object
top:-1000em: no such object
overflow:hidden}.f{color:#666}.flc: no such object
a.fl{color:#77c}a: no such object
.w: no such object
.q:visited: no such object
.q:active: no such object
.q: no such object
.b: no such object
.b: no such object
color:#000: no such object
padding:5px: no such object
.n: no such object
.b: no such object
cursor:hand}.ta{padding:3px: no such object
#tpa3{padding-top:9px}#gbar{height:22px: no such object
padding-left:2px}.gbh: no such object
.gbd{border-top:1px: no such object
font-size:1px}.gbh{height:0: no such object
position:absolute: no such object
top:24px: no such object
width:100}#gbi: no such object
#gbs{background:#fff: no such object
left:0: no such object
position:absolute: no such object
top:24px: no such object
visibility:hidden: no such object
z-index:1000}#gbi{border:1px: no such object
border-color:#c9d7f1: no such object
z-index:1001}#guser{padding-bottom:7px: no such object
#guser{font-size:13px: no such object
padding-top:1px: no such object
.gb3{height:22px: no such object
margin-right:.73em: no such object
vertical-align:top}#gbar{float:left}}.gb2{display:block: no such object
padding:.2em: no such object
a.gb2: no such object
a.gb3{color:#00c: no such object
.gb3{text-decoration:none}a.gb2:hover{background:#36c: no such object
color:#fff: no such object
font-style:normal}body: no such object
td: no such object
div: no such object
.p: no such object
a{font-family:arial: no such object
sans-serif}#sd{font-size:84o such object

(plenty lines of nothing)

2009: not a symbol

————–
for some reason it tries to understand the string, I think.
Does anybody knows what im doing wrong here ?

greetz

#42355
Feb 17, 2009 at 6:23pm

Would it be possible that you would have some semi colon, and that you display that in a message box that you trigger? That’s only a speculation though.

#151571
Feb 17, 2009 at 11:10pm

yeah…you are right

it doesnt like semi colons
i found out that it also doesnt like whitespaces

thanks alot ;)

hmmmm…think think
but what can i do to avoid that ?

#151572
Feb 17, 2009 at 11:20pm

#151573
Feb 18, 2009 at 11:50am

why not use regular expressions (ie the RegExp object) instead of having to roll your own text scanner?

http://www.javascriptkit.com/jsref/regexp.shtml

#151574
Feb 19, 2009 at 4:38pm

You might find your life will be a lot easier if you use the shell and use wget, which has lots of convenient settings to filter filetypes. that’s what I did for a similar project a few years ago.

M

#151575
Feb 22, 2009 at 11:15pm

hmm, i tried something with regexp.
but theres always the semi colon problem

– Pasted Max Patch, click to expand. –
#151576
Feb 23, 2009 at 12:22am

Dieter_Laser wrote on Mon, 23 February 2009 00:15hmm, i tried something with regexp.
but theres always the semi colon problem

The message box with the semi colon needs to be quoted or have the semi-colon escaped, which is hopefully what you’ll get in the normal life using jit.uldl and jit.text.

– Pasted Max Patch, click to expand. –

ej

#151577
Mar 10, 2009 at 2:22pm

Hi, its me again

hmm, when i press bang my max always crashes.
its working for decimal and hex for me. but not with ascii.

the thing is, that i want to make this with max.
so what do you suggest is the best way ?

– Pasted Max Patch, click to expand. –

thanks

#151578
Mar 11, 2009 at 9:48am

EEEEHHHHHHHHHH

nice

– Pasted Max Patch, click to expand. –

Man, max is soo big !

#151579
Apr 27, 2009 at 7:10pm

Hi.
I have this error :
jit.str.regexp: PCRE error -10

Some knows about it ?

10.5, macbook pro

Ad

#151580
Apr 27, 2009 at 7:59pm

Yeh I’ve come across that error before but the cause appears to be a mystery. One way of solving it that has worked for me is to open the [jit.textfile] after you have downloaded from [jit.uldl] and before you send it a bang. Using something like [t b wclose open] with all the outlets connected to the [jit.textfile] should do it. No idea why this seems to work though.

lh

#151581
Apr 27, 2009 at 8:26pm

Works fine, thanks !
Ad

#151582
Apr 29, 2009 at 6:29pm

Here’s my version of this fix with included dropfile for specifying where to save images.

Enjoy and thanks so much for the fix in the first place!

– Pasted Max Patch, click to expand. –
#151583

You must be logged in to reply to this topic.