3

I am trying to capture some websites containing Adobe Flash elements with cutycapt with no luck.

My PHP script:

$url=escapeshellarg($url);
$filename=escapeshellarg($filenamebase);
$format=escapeshellarg($format);
$useragent=escapeshellarg($useragent);

$cmd = "xvfb-run --server-args=\"-screen 0, ".$width."x".$height."x24\" CutyCapt --url=$url --out=$filename --out-format=$format --user-agent=$useragent --plugins=\"on\" --delay=5000 --javascript=$js";

exec($cmd);

For exampe, if i want capture http://flashhry.cz/h/kingdom-rush my script is running this cmd in shell:

xvfb-run --server-args="-screen 0, 1024x5000x24" CutyCapt --url='http://sk.search.etargetnet.com/cookie.php?eURL=http%3A%2F%2Fflashhry.cz%2Fh%2Fkingdom-rush' --out='./screens/http_flashhry.cz_h_kingdom-rush.png' --out-format='png' --user-agent='Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0' --plugins="on" --delay=5000 --javascript=on

output (http://prntscr.com/5pxc7e) is without flash

commands stdout was:

Xlib:  extension "RANDR" missing on display ":99".

no error output.

I need it work on CentOS 6 server, but my Ubuntu desktop have similar results.

Ján Stibila
  • 619
  • 3
  • 12
  • I asked the author of CutyCapt about capturing Flash content and he confirmed that current version, at least, does not support that. – akmozo Jan 18 '15 at 00:35
  • Any alternatives? Except webkit2png - I couldn't get it work. – Ján Stibila Jan 19 '15 at 14:08
  • For some alternatives, take a look [here](http://www.binarytides.com/take-webpage-screenshot-from-command-line-in-ubuntu-linux/), I didn't test it. – akmozo Jan 20 '15 at 19:37

1 Answers1

-1

Try this for a reference implementation:

https://github.com/jaequery/php-site-screenshot

Note the install script as well for Ubuntu. It might give you an idea of the dependencies for CentOS as well.

https://github.com/jaequery/cutycapt-installer-script-on-ubuntu/blob/master/install

If it still fails, I would imagine that CentOS 6 might be too old to meet the requirements.

roktechie
  • 1,345
  • 1
  • 10
  • 15
  • This needs cutycapt which can't do flash. It's just a simple php script doing exactly the same as my own php script (although my is more complex) – Ján Stibila Jan 21 '15 at 08:22
  • Cutycapt, at least at one point, worked fine with Flash. If the author confirmed it I'm not in a position to argue, but it did work previously. – roktechie Jan 21 '15 at 14:50
  • According to this: http://stackoverflow.com/questions/10990535/debugging-cutycapt-flash I think it can somehow work with flash. I am just most unfortunate, that I can't make it work. – Ján Stibila Jan 21 '15 at 15:45
  • Worked fine for me (that was my question you linked). Make sure it's a desktop distro and actually has Flash installed. Beyond that, check your delay parameter and set it to milliseconds (not seconds). You must leave enough time for your Flash to execute and load before capturing. – roktechie Jan 21 '15 at 20:20
  • as i said, i have own php (which do the same, but have more options) to do that and tried on CentOS server and Ubuntu desktop, both with flash installed and working. I tried delay up to 10 second (enough time for flash to load). Problem is not with php, nor the delay (you can see what exactly my php is executing in my question). Problem is that CutyCapt just can't see (and output) flash elements. – Ján Stibila Jan 22 '15 at 09:46