DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk5 min

How to Capture Bulk Screenshots of URLs from a PostgreSQL Table

A practical workflow for selecting URL rows from PostgreSQL and saving reviewable screenshots with Playwright.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Query the URLs you want from PostgreSQL, then pass the rows to a browser automation script that visits each URL and saves an image. For a small, auditable batch, export the query as CSV; for an application workflow, read rows through the database driver already in use. This guide uses PostgreSQL 18’s documented COPY syntax and Playwright’s browser APIs; check your PostgreSQL version before relying on version-specific syntax.

Choose how to get URLs out of PostgreSQL

Keep database selection and screenshot capture as separate steps. Select only the rows you intend to capture, include a stable identifier for each row, and define a deterministic order. The table name, URL column, identifier, and filtering rule depend on your schema.

As an Amazon Associate I earn from qualifying purchases.

Export a query to CSV

PostgreSQL 18 supports exporting a query result with COPY. For example, in psql:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
copy (SELECT id, url FROM public.pages WHERE url IS NOT NULL ORDER BY id) TO 'urls.csv' WITH (FORMAT CSV, HEADER)

copy is a psql command that writes the file on the client machine. PostgreSQL’s SQL COPY can also write query output, but file access and location are handled by the database server. See the PostgreSQL 18 COPY documentation for syntax, CSV quoting, and escaping details.

#1 Best Overall
Sandisk 2TB Extreme Portable SSD, Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware, External Solid State Drive, SDSSDE61-2T00-G25
  • Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
  • Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
  • Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
  • Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
  • Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C

Do not parse CSV by splitting lines or commas: quoted fields can contain commas, quotation marks, and embedded line breaks. Use a CSV parser that follows the format.

Read rows through your application

If the script already connects to PostgreSQL, run a parameterized query with your database driver and iterate over its results instead of creating an intermediate file. Choose the driver and connection setup that match your application. This avoids CSV handoff but makes database access, credentials, and query behavior part of the capture script.

Rank #2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
  • Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
  • Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
  • Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
  • Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
  • From Sandisk, a brand professional photographers trust to take on assignments.

Capture each URL with Playwright

The following Python example reads the exported CSV using Python’s standard CSV parser, visits each valid HTTP or HTTPS URL with Playwright, and writes one PNG per row. Install Playwright and its Chromium browser before running it:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
python -m pip install playwright
python -m playwright install chromium

Save this as capture_urls.py beside urls.csv:

import csv
import re
from pathlib import Path
from urllib.parse import urlparse

from playwright.sync_api import sync_playwright

INPUT = Path("urls.csv")
OUTPUT_DIR = Path("screenshots")
OUTPUT_DIR.mkdir(exist_ok=True)


def safe_filename(value):
    value = re.sub(r"[^A-Za-z0-9._-]+", "_", value).strip("._-")
    return value[:100] or "row"


with INPUT.open(newline="", encoding="utf-8-sig") as csv_file:
    rows = list(csv.DictReader(csv_file))

with sync_playwright() as playwright:
    browser = playwright.chromium.launch()
    page = browser.new_page(viewport={"width": 1440, "height": 900})

    with (OUTPUT_DIR / "results.csv").open("w", newline="", encoding="utf-8") as results_file:
        writer = csv.DictWriter(results_file, fieldnames=["id", "url", "status", "file", "error"])
        writer.writeheader()

        for row in rows:
            row_id = row.get("id", "")
            url = (row.get("url") or "").strip()
            filename = safe_filename(row_id) + ".png"
            output_path = OUTPUT_DIR / filename

            parsed = urlparse(url)
            if parsed.scheme not in {"http", "https"} or not parsed.netloc:
                writer.writerow({"id": row_id, "url": url, "status": "invalid_url", "file": "", "error": "Expected an absolute HTTP or HTTPS URL"})
                continue

            try:
                response = page.goto(url, wait_until="load", timeout=30000)
                page.screenshot(path=str(output_path), full_page=True)
                writer.writerow({
                    "id": row_id,
                    "url": url,
                    "status": "ok" if response is None or response.ok else f"http_{response.status}",
                    "file": str(output_path),
                    "error": "",
                })
            except Exception as exc:
                writer.writerow({"id": row_id, "url": url, "status": "error", "file": "", "error": str(exc)})

    browser.close()

Run it with python capture_urls.py. The script creates a screenshots directory, names images from the stable database identifier, and records an outcome for every row in screenshots/results.csv. It uses full-page PNG screenshots and a 30-second navigation timeout; adjust those choices for the pages and review workflow you have.

Rank #3
SSK Portable SSD 500GB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity

Set capture scope and output deliberately

Viewport or full page

A viewport screenshot records the currently visible frame. A full-page screenshot attempts to include the scrollable document. Use full_page=False for a viewport capture, or full_page=True when the entire page is needed. Very long or continuously scrolling pages may need a different capture strategy.

Path, format, and scale

Playwright’s screenshot API accepts an output path and options including full-page capture, image format, and scale. The example writes PNG files at CSS-pixel scale. Choose the format for the downstream use: PNG is lossless, while JPEG and WebP can reduce file size depending on content and quality settings. Device-pixel scale produces denser images and larger files. Consult the Playwright screenshots guide and the language-specific Page API for available options.

Rank #4
Sale
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
  • NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
  • IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
  • POCKET-SIZED – fits easily in pockets and small bags.
  • SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
  • 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.

Make a batch reliable and reviewable

  • Use stable filenames. A database ID avoids collisions between URLs with similar hosts or paths. Sanitize identifiers before using them as filenames.
  • Keep a per-row result. Record invalid URLs, navigation errors, HTTP status, and output path so a partial run is visible and can be resumed deliberately.
  • Bound the batch. Start with a limited query or a small sample. Choose concurrency, timeout, retries, and resource limits based on the target sites and deployment; there is no universally correct setting.
  • Protect access. Treat the CSV and screenshots as potentially sensitive data. Avoid logging credentials embedded in URLs, and secure the database credentials and output directory.
  • Expect rendering differences. Playwright notes that output can vary with host OS, browser version, settings, hardware, power source, and headless mode. Keep the runtime environment consistent when comparing captures. See its visual comparisons guidance.

Troubleshoot common batch failures

  • CSV rows have shifted or URLs are truncated: use a real CSV parser such as csv.DictReader; do not split on commas or newline characters.
  • Navigation times out: the site may be slow, unreachable, or waiting on ongoing requests. Check the URL independently, choose a timeout suitable for the target, and log the failed row rather than dropping it.
  • The image is blank or incomplete: verify the page actually loaded and select a readiness condition appropriate to its behavior. The example waits for the page load event; pages that render content later may require an explicit wait for a selector or another application-specific condition.
  • Images differ between runs: keep the OS, browser version, viewport, and headless configuration consistent; dynamic page content can also change independently of the script.
  • A filename is missing or overwritten: ensure each row has a unique stable ID and sanitize it before creating a path. Do not use raw, untrusted URL text as a filesystem path.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo can capture a URL with one GET request and also offers bulk capture for up to 100 URLs per call. The API removes cookie/consent banners, newsletter popups, and chat widgets before capture; those cleanup steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a single image, this cURL example saves a WebP screenshot of Stripe:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Replace the URL with the one you want to capture and provide your API key. The ScreenshotNeo documentation describes API options. It also has an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents and other MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots. Sign up for free and try 1,000 screenshots a month with no card.

Quick Recap

Bestseller No. 2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
From Sandisk, a brand professional photographers trust to take on assignments.
$188.90
SaleBestseller No. 4
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.; POCKET-SIZED – fits easily in pockets and small bags.
$249.17
SaleBestseller No. 5
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
Best Value
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Sources

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.