Python / Regex coding advice required…

Mar 5, 2010 at 5:39pm

Python / Regex coding advice required…

I’m attempting to make a patch within Max that enables the user to type in a search argument, after which the patch then returns & displays an image from google images relating to the argument.

I believe the best way to do this is to use Python & the Py /Pyext objects, though I’ve never used python before. I’ve also been informed that regex would haveto be used within the code in order to extract the the required data from the google image results source.

I’d appreciate any help or advice from anyone out there with experience in Python &/or using regex operations.

Alternatively, if anyone could suggest another solution that doesn’t involve Python, please do.

Thanks,
Matt.

#48934
Mar 5, 2010 at 6:45pm

you could do this with python, or you could do it in javascript, or you could do it in java with MXJ, and yes, you can do it without any of them (in “pure max”) utilizing jit.uldl.

the javascript method is a little less obvious than the others since there’s no “download this” function. in a little while i’ll attach something to this thread that i wrote recently to do it with jit.uldl in the background.

#175791
Mar 5, 2010 at 7:32pm

check it out. code should be attached.

Attachments:
  1. jscurl.zip
#175792
Mar 5, 2010 at 7:33pm

let’s try that again.

Attachments:
  1. jscurl.zip
#175793
Mar 5, 2010 at 10:33pm

You could also use [jweb] where you can display the google homepage and just use that. I would probably still go for the [jit.uldl] option though. If you look in the [jit.str.regexp] help file there’s a good examples of downloading images from a website.

lh

#175794
Mar 6, 2010 at 2:46am

That’s excellent, thanks alot! Shall look into all of the above.

Cheers,
Matt.

#175795

You must be logged in to reply to this topic.