Forums > Jitter

Pulling an image from a website

June 7, 2010 | 12:47 pm

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



EMV
June 7, 2010 | 2:19 pm

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.


June 7, 2010 | 5:55 pm

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.


June 7, 2010 | 6:34 pm

Thanks guys… Will get started on this right away!


Viewing 4 posts - 1 through 4 (of 4 total)