Pulling an image from a website

Jun 7, 2010 at 12:47pm

Pulling an image from a website

Hi all,

I’d like to create a patch that gets the picture of the day from Wikipedia: http://en.wikipedia.org/wiki/Pic_of_the_day. I know that the general format of the url is http://en.wikipedia.org/wiki/Template:POTD/yyyy-mm-dd

I’m not familiar with the scripting necessary to fill in the rest of the details. First, I’d like Max to get ‘today’s date,’ which I’m not sure how to do. Then I would stick the date in yyyy-mm-dd format on the end of the url message, which is not difficult. However, this leads to the page itself, and not the specific image. Is there a way to direct Max to the .jpg featured on the page without knowing its exact url location?

Any suggestions are appreciated.
Jay

#50768
Jun 7, 2010 at 2:19pm

How much have you tried yourself?

For the current date, there is the [date] object (as searching in the Max help told me in 2 minutes).

For crawling websites, there is jit.uldl (as searching on this forum told me in 4 minutes: http://cycling74.com/forums/topic.php?id=18533)

But you will need a bit of intelligent parsing of the page contents to find out what the picture is called.

#182199
Jun 7, 2010 at 5:55pm

jit.uldl helpfile, in the subpatch. But you could probably do it with [regexp]. Here’s today’s file (and is a cool pic too)

http://en.wikipedia.org/wiki/File:Elephas_Maximus_Eye_Closeup_cropped.jpg

so… use [regexp] to find
http://en.wikipedia.org/wiki/File:
then take the whole URL and load that page, or use jit.uldl to grab the .jpg.

#182201
Jun 7, 2010 at 6:34pm

Thanks guys… Will get started on this right away!

#182202

You must be logged in to reply to this topic.