WebService::Browshot
====================

Perl extension for Browshot http://www.browshot.com/, a web service to create website screenshots in real-time.

INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

API v1 AND v2

The client selects the API version for each request. It uses v1 for legacy
options such as instance_id, instances, screen, details, hooks, and hosting,
and for instance lookup and screenshot_host. Shared calls prefer v2. If the
server reports that the v2 route is unavailable, shared requests can use v1.

   $browshot->screenshot_create(url => 'https://example.org/', instance_id => 373);
   $browshot->screenshot_create(url => 'https://example.org/', country => 'fr', device => 'iphone_15_pro');
   $browshot->screenshot_thumbnail(id => $id, width => 640);

screenshot_info uses v2 by default for IDs from either version. Use
details => 0–3 or api_version => 1 to read the v1 response, including
instance_id. A client created with an explicit base URL keeps that URL.

Use device_list for device names. The app_list, app_info, app_create,
app_update, app_delete, app_test, and app_run methods manage v2 S3 and
webhook apps. See the module documentation for examples.

PDF AND VIDEO

New capture options are passed as named arguments to the existing screenshot,
multiple, batch, and crawl methods. No request format change is needed.

Download PDF and video output with:

   $browshot->screenshot_pdf(id => $id);
   $browshot->screenshot_pdf_file(id => $id, file => 'capture.pdf');
   $browshot->screenshot_video(id => $id);
   $browshot->screenshot_video_file(id => $id, file => 'capture.webm');

Video supports WebM (default), MP4, and animated GIF. Wait for status=finished
before downloading. See the module documentation for options and credit costs.

TESTS

Run the offline unit tests without an API key:

   prove -l t

Run the read-only API 1.32 tests against your account:

   BROWSHOT_REMOTE_TESTS=1 BROWSHOT_KEY=your_api_key prove -lv t/API-1.32-remote.t

To test successful downloads, also set BROWSHOT_PDF_ID, BROWSHOT_WEBM_ID,
BROWSHOT_MP4_ID, and/or BROWSHOT_GIF_ID to finished test captures belonging to
your account. BROWSHOT_SCREENSHOT_ID enables checks of an existing screenshot
and thumbnail. BROWSHOT_BASE can override the API base for a private test server.
The test creates no captures, shares, hosting jobs, batches, or crawls.

The original remote tests in t/WebService-Browshot.t assume the historical
zero-balance test account. Run the API 1.32 remote test separately for a regular
customer account.

DEPENDENCIES

This module requires these other modules and libraries:

  URI
  URI::Encode
  JSON
  LWP::UserAgent

SOURCE

The source code is available on github at https://github.com/juliensobrier/browshot-perl

CPAN

The library is available on CPAN at https://metacpan.org/pod/WebService::Browshot

COPYRIGHT AND LICENCE

Copyright (C) 2012-2013 by Julien Sobrier

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.


