Web Render TOP - integrate any public website to touchdesigner

Hi,

I‘d like to create a realtime database of face images of this homepage beeing saved automatically in a FOLDER DAT:

as this website has two buttons, one „refresh“ and one „download image“, I d like to automate refresh and download, to create a real time updating image folder for a presentation of these images on touchdesigner.

is it possible to do so via the WEB RENDER TOP or WEBSOCKETS?
if yes, how would a possible approach be?
How can I automate this process to get a infinite database automatically refreshing?

the folder could be limited to 20 Images and the would add always new ones and erase the oldest ones (stack principle).

thanks for any suggestion,
greetz,
Sirom

2 Likes

just found this:

but seems to be just half way through…

this is certainly possible. But this post of mine you linked to above is very old, these days there are better methods.

Anyway in your case it’s pretty easy. If you look in the sourcecode of the site, you’ll see clicking the reload button calls an reImage() function, which generates an url like this:

?new='+timeInMs+imageType
where timeInMs is the javascript Date.now(), meaning milliseconds since epoch, and imageType is “auto” for persons.
So to translate into Python use this to generate a valid url:

import time
millisec = int(time.time() * 1000)
url = f"https://this-person-does-not-exist.com?new={millisec}auto"

Loading that url gives you a page with some JSON containing the new image url.
Very rough example attached, click the button to load new image in the Movie File In TOP.
Using an Info CHOP you can read the fully_pre_read member of the Movie File In TOP so see when downloading is complete, and trigger a saving to disk action for instance…

load_new_image.tox (2.4 KB)

2 Likes

@nettoyeur Thank you so much! i ll try that asap.

greetz,
Sirom

what could a code look like to save images into a folder automatically (as you supoosed in exec2)?

how would I setup a storage folder, with around max. 30 pics? which would be overwritten with a new generated image, once outputted through a screen?

goal should be a continuous presentation of those images, and i decided to have a folder of 30 just to keep it more fluently (as a puffer).

@nettoyeur Hey, sorry to bother you again.
for some reason it doesnt work anymore. it says:
error: Failed to parse DAT as JSON in the “JSON DAT”.
it seems, that the homepage this-person-does-not-exist.com has made some changes as well. maybe thats why?

could you please have a look and help me?

maybe I need to move that idea to this url: AI Generated Faces

could you help me with that?

kind regards,
Sirom

hi, could anybody else help me with this please?

Hey @Sirom_VJ,

it might have changed a bit - but diving a bit deeper into the javascript function reveals that you can nicely control the parameters and retrieve a json that contains the url.
I packaged this all up into a component.

It looks like there is also a placeholder for this to work for cars, cats, horses and artwork - but I couldn’t get that to work, hence the parameter is disabled.

Cheers
Markus
thisDoesNotExist.tox (2.9 KB)

Hey Markus,
thank you so much.
that helps a lot!

by the way, I just realized, that you are Markus Heckmann :slight_smile:
still learning and growing daily about this world.

I really admire your work.
I especially like the audiovisual glsl works :slight_smile:
and try to go through your past tutorials.

all the best from Innsbruck,
and thanks again for your help.

Sirom

1 Like