Scrapingdog
HomePricingSupportLogin
  • Documentation
  • Web Scraping API
    • Request Customization
      • Javascript Rendering
        • Wait when rendering Javascript
      • Custom Headers
      • Premium Residential Proxies
      • Geotargeting
      • Sessions
  • POST Request
  • Google Search Scraper API
    • Google Country Parameter: Supported Google Countries
    • Supported Google Countries via cr parameter
    • Google Domains Page
    • Google Language Page
    • Google LR Language Page
  • Google AI Overview API
  • Google Maps API
    • Google Maps Posts API
    • Google Maps Photos API
    • Google Maps Reviews API
    • Google Maps Places API
  • Google Trends API
    • Google Trends Autocomplete API
    • Google Trends Trending Now API
  • Google Images API
  • Google News API
    • Google News API 2.0
  • Google Shopping API
  • Google Product API
  • Google Videos API
  • Google Shorts API
  • Google Autocomplete API
  • Google Scholar API
    • Google Scholar Profiles API
    • Google Scholar Author API
      • Google Scholar Author Citation API
    • Google Scholar Cite API
  • Google Finance API
  • Google Lens API
  • Google Jobs API
  • Google Local API
  • Google Patents API
    • Google Patent Details API
  • Bing Search Scraper API
  • Amazon Scraper API
    • Amazon Product Scraper
    • Amazon Search Scraper
    • Amazon Reviews API
    • Amazon Autocomplete Scraper
  • Instagram Scraper API
  • Linkedin Scraper API
    • Person Profile Scraper
    • Company Profile Scraper
  • Linkedin Jobs Scraper
    • Scrape Linkedin Jobs
    • Scrape LinkedIn Job Overview
  • Yelp Scraper API
  • Twitter Scraping API
    • X Scraping API 2.0
  • Indeed Scraper API
  • Zillow Scraper API
  • Youtube Scraper API
    • Youtube Search API
    • YouTube Transcripts API
    • YouTube Channel API
  • Walmart Scraper API
    • Walmart Product Scraper
    • Walmart Search Scraper
    • Walmart Reviews Scraper
  • Screenshot API
  • Webhook Integration
  • Datacenter Proxies
  • Account API
Powered by GitBook
On this page
  • Parameters
  • API Example
  • Response

Screenshot API

PreviousWalmart Reviews ScraperNextWebhook Integration

Last updated 26 days ago

With this API you can take screenshots of any page. You just have to send a GET request to https://api.scrapingdog.com/screenshot with the below-given parameters.

Each successful request to this API will cost 5 credits.

Parameters

Parameter
Description

api_key required

Your personal API key. Available on your dashboard. Type: String

url required

This is the URL of the page for which you want to take a screenshot. Type: String

fullPage

This is a boolean that tells our server to take a full-page screenshot or just the part that is visible without scrolling. Type: Boolean

API Example

curl "https://api.scrapingdog.com/screenshot?api_key=6103077e467766765f5803ed2df7bc8&url=https://www.scrapingdog.com"
import requests

api_key = "6103077e467766765f5803ed2df7bc8"
url = "https://api.scrapingdog.com/screenshot"

params = {
    "api_key": api_key,
    "url": "https://www.scrapingdog.com"
}

response = requests.get(url, params=params)

if response.status_code == 200:
    with open("screenshot.png", "wb") as f:
        f.write(response.content)
else:
    print("Failed to capture a screenshot.")
const axios = require('axios');
const fs = require('fs');

const apiKey = '6103077e467766765f5803ed2df7bc8';
const url = 'https://api.scrapingdog.com/screenshot';

const params = {
  api_key: apiKey,
  url: 'https://www.scrapingdog.com',
};

axios
  .get(url, { params, responseType: 'stream' })
  .then((response) => {
    if (response.status === 200) {
      response.data.pipe(fs.createWriteStream('screenshot.png'));
    } else {
      console.error('Failed to capture a screenshot.');
    }
  })
  .catch((error) => {
    console.error('Error:', error.message);
  });
<?php
$apiKey = '6103077e467766765f5803ed2df7bc8';
$url = 'https://api.scrapingdog.com/screenshot';
$targetUrl = 'https://www.scrapingdog.com';

$data = [
    'api_key' => $apiKey,
    'url' => $targetUrl,
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);

if ($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    file_put_contents('screenshot.png', $response);
    echo 'Screenshot saved as screenshot.png';
}

curl_close($ch);
?>
require 'net/http'

api_key = '6103077e467766765f5803ed2df7bc8'
target_url = 'https://www.scrapingdog.com'

uri = URI('https://api.scrapingdog.com/screenshot')
uri.query = URI.encode_www_form(api_key: api_key, url: target_url)

response = Net::HTTP.get_response(uri)

if response.code.to_i == 200
  # Save the screenshot as screenshot.png
  File.open('screenshot.png', 'wb') do |file|
    file.write(response.body)
  end
  puts "Screenshot saved as screenshot.png"
else
  puts "Error: #{response.code} - #{response.message}"
end
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class ScreenshotAPI {
    public static void main(String[] args) {
        String apiKey = "6103077e467766765f5803ed2df7bc8";
        String apiUrl = "https://api.scrapingdog.com/screenshot";
        String targetUrl = "https://www.scrapingdog.com";

        try {
            HttpClient httpclient = HttpClients.createDefault();
            HttpGet httpGet = new HttpGet(apiUrl + "?api_key=" + apiKey + "&url=" + targetUrl);
            HttpResponse response = httpclient.execute(httpGet);

            if (response.getStatusLine().getStatusCode() == 200) {
                // Get the response stream
                InputStream is = response.getEntity().getContent();

                // Save the screenshot to a file
                FileOutputStream fos = new FileOutputStream("screenshot.png");
                int inByte;
                while ((inByte = is.read()) != -1) {
                    fos.write(inByte);
                }
                is.close();
                fos.close();

                System.out.println("Screenshot saved as screenshot.png");
            } else {
                System.out.println("Error: " + response.getStatusLine().getStatusCode() + " - " + response.getStatusLine().getReasonPhrase());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Response