viernes, 23 de noviembre de 2018

Pharo Script of the Day: Super easy meme generation

Couldn't resist sharing this one:

ZnClient new
 logToTranscript;
 url: 'https://api.imgflip.com/';
 addPath: 'caption_image';
 formAt: 'template_id' put: '95158268';
 formAt: 'username' put: '...'; 
 formAt: 'password' put: '...'; 
 formAt: 'text0' put: 'Just Zinc';
 formAt: 'text1' put: 'HTTP Components'; 
 accept: 'application/json';
 contentReader: [ : entity | 
   ZnEasy getJpeg: (((NeoJSONReader fromString: entity contents) at: #data) at: #url) display ]; 
 post.

To save you from generating a user in imgflip API, this is the resulting output:


0 comentarios:

Publicar un comentario