ScreenshotNeo

BlogHow-to

How to Create Social Preview Images from Indian News URLs with Abstract Screenshot API

Capture Indian news pages or turn article details into branded social cards with Abstract Screenshot API, with code, workflow, and troubleshooting.

By the ScreenshotNeo team4 October 20269 min read

Abstract Screenshot API can render a news URL or supplied HTML into an image. But decide first what you mean by “social preview image”: a screenshot captures the article page as it renders, while a branded social card is a designed image built from article details such as title, description, and publisher name. For consistent branding and readable text, compose a controlled HTML card and capture that; a screenshot of the article itself may include navigation, ads, consent notices, or other page content.

Abstract documents a REST endpoint at https://screenshot.abstractapi.com/v1/ that accepts a URL or raw HTML and returns an image. Its product page describes support for HTML, CSS, SVG, web fonts, graphs, images, viewport and device dimensions, custom CSS, capture delay, and image formats. Check the current Abstract documentation for exact parameter names, authentication, request encoding, and response behavior before deploying: those details can change.

1. Choose the image you actually need

Goal Input Result and tradeoff
Show what the article page looks like The article URL A rendered page image. Layout and visible clutter depend on the publisher page and capture settings.
Make a branded share card Article title, publisher, optional summary, date, and image A designed composition with control over typography and branding. Requires a template and a reliable way to obtain the fields.
Show the article’s existing social image Article URL and its metadata Extract the page’s Open Graph or Twitter card image URL, then validate that image. This is metadata extraction, not a screenshot.

Metadata and screenshots are separate outputs in URL preview workflows; OpenGraph.io describes both in its overview. A screenshot service is not, by itself, a metadata parser or a ready-made branded card generator.

2. Capture an article page with Abstract

Keep the API key on a server. Do not put it in browser JavaScript or a public page. The following request shape is illustrative of the endpoint and fields shown on Abstract’s product page; verify the live API documentation for the exact authentication and parameters before using it as production code. The dossier does not establish exact current parameter names or response format, so do not assume this sample is runnable unchanged.

curl -X POST 'https://screenshot.abstractapi.com/v1/' \
  -H 'Content-Type: application/json' \
  -d '{
    "api_key": "YOUR_ABSTRACT_API_KEY",
    "url": "https://example.com/news/article"
  }' \
  --output article.png

Use a real article URL in place of the example. Confirm whether the current endpoint expects GET or POST, the key’s parameter or header name, and whether the response is image bytes or a JSON response containing an image reference. Handle the documented response accordingly rather than assuming --output always produces an image.

Python request pattern

After confirming the current request fields and response type, adapt this server-side pattern. This example assumes an image-byte response and uses placeholders for the request schema, because the exact schema must be checked in Abstract’s live documentation.

import os
import requests

endpoint = "https://screenshot.abstractapi.com/v1/"
payload = {
    "api_key": os.environ["ABSTRACT_API_KEY"],
    "url": "https://example.com/news/article",
}
response = requests.post(endpoint, json=payload, timeout=90)
response.raise_for_status()
content_type = response.headers.get("content-type", "")
if not content_type.startswith("image/"):
    raise RuntimeError(f"Expected image bytes, got {content_type}: {response.text[:500]}")
with open("article.png", "wb") as image_file:
    image_file.write(response.content)

Node.js request pattern

This likewise assumes JSON POST and direct image bytes. Match the request and response handling to Abstract’s current documentation before deployment.

const endpoint = 'https://screenshot.abstractapi.com/v1/';
const payload = {
  api_key: process.env.ABSTRACT_API_KEY,
  url: 'https://example.com/news/article'
};

const response = await fetch(endpoint, {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify(payload),
  signal: AbortSignal.timeout(90_000)
});
if (!response.ok) {
  throw new Error(`Screenshot request failed: ${response.status} ${await response.text()}`);
}
const contentType = response.headers.get('content-type') || '';
if (!contentType.startsWith('image/')) {
  throw new Error(`Expected image bytes, got ${contentType}`);
}
const image = Buffer.from(await response.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('article.png', image));

Set dimensions and wait deliberately

For a page capture, select a viewport matching the intended composition and use the API’s documented delay or other readiness control when the page needs time to render. Abstract lists viewport or device dimensions and capture delay as controls. Exact option names and limits need confirmation in the current docs. A larger viewport may include more page content but can make text less legible when displayed as a small preview. Check the actual output dimensions and readability at the size where it will appear.

3. Build a branded card from article fields

For a predictable card, collect fields you are entitled to use and render your own template. Do not depend on arbitrary publisher markup being uniform. A minimal HTML template can be rendered as a screenshot input if Abstract’s current API supports the documented raw-HTML mode; verify how it accepts HTML and associated CSS/assets.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <style>
    * { box-sizing: border-box; }
    body { margin: 0; font: 600 42px/1.18 system-ui, sans-serif; }
    .card {
      width: 1200px; height: 630px; padding: 64px;
      display: flex; flex-direction: column; justify-content: space-between;
      color: #fff; background: #172033;
    }
    .publisher { color: #a9c8ff; font-size: 24px; }
    h1 { margin: 30px 0; max-width: 1000px; }
    .summary { font-size: 25px; line-height: 1.35; color: #d8deeb; }
  </style>
</head>
<body>
  <article class="card">
    <div class="publisher">Publisher name</div>
    <h1>Article headline goes here</h1>
    <div class="summary">Optional short summary</div>
  </article>
</body>
</html>

Escape or safely encode untrusted titles and summaries before inserting them into HTML. Avoid inserting scraped text as markup. If the API accepts raw HTML as described by Abstract, check its documented encoding and how external fonts, images, and stylesheets are loaded. If you use a custom font, verify it has glyph coverage for the scripts present in your source text. Keep the design legible at the final display size and set explicit dimensions to avoid accidental layout changes.

4. Use a stable public image URL

Social crawlers generally need to fetch the image from a URL available to them. Store the generated file in storage you control and serve it from a stable, publicly fetchable URL if the downstream preview requires one. Do not assume an API response, temporary vendor URL, private object, or authenticated link will remain available or be accessible to crawlers. Check the target platform’s current image requirements and test the resulting unfurl.

5. Test representative Indian news URLs

Publisher compatibility is not established by the available product information. Test URLs that represent the publishers, languages, and page states you actually need. Include cases with consent prompts, redirects, paywalls, slow assets, and different page layouts where relevant. This is a test plan, not a claim that any particular publisher has been verified.

  1. Capture the URL and inspect the image for the expected headline, language, and visible content.
  2. Check whether a consent screen, paywall, challenge page, or redirect changed what rendered.
  3. For branded cards, compare the rendered output with the source fields and inspect font glyphs, wrapping, clipping, and image loading.
  4. Publish the image at its final stable URL and test the actual platform preview.
  5. Record failures by publisher and page condition; do not generalize from one successful URL.

Abstract’s FAQ says location-specific capture is not supported. A page can vary by visitor IP geolocation, so do not assume the capture represents what a reader in India sees. See the Abstract product page for its current statement.

6. Options, reliability, and operating cost

Relevant controls

  • URL or raw HTML: use a URL for a direct page capture; use supplied HTML for a controlled composition if the current endpoint supports it.
  • Viewport or device dimensions: choose dimensions for the desired crop and display size.
  • Capture delay: allow content to render when needed, while avoiding unnecessary waiting.
  • Image format: Abstract lists formats including JPEG, PNG, and GIF; confirm the exact supported output choices and response behavior in current docs.
  • Custom CSS: useful for page adjustments where supported; for a fully branded card, a controlled template gives more predictable styling.

Reliability and throughput

Expect publisher pages to differ in rendering, redirects, consent behavior, access restrictions, and load time. Add timeouts, inspect HTTP failures and content type, and retain enough diagnostics to identify whether a failure came from the API request or the target page. Retry transient failures with a limit and backoff; repeated immediate retries can waste quota and may not change a publisher-side block. Cache results by a normalized URL plus the capture settings when the underlying content does not need to be refreshed on every request.

Abstract’s product page displayed a free allowance of 100 requests and a rate of 1 request per second, and a Standard allowance of 60,000 requests per month and 3 requests per second in the dossier’s 2026 review. Plan figures and pricing can change; reconfirm current limits and billing terms on the live page before budgeting. The dossier notes differing monthly and annual billing displays for Standard and does not establish a universally applicable price.

7. Troubleshooting

Symptom Likely cause What to do
Authentication or request rejected Wrong key location, HTTP method, content type, or parameter schema Compare the request with Abstract’s current docs; keep the key server-side and check the account’s access.
Saved file is not an image The endpoint returned JSON or an error body Check status and content type before writing bytes; parse the documented response format.
Blank or incomplete capture Page load delay, script failure, redirect, or publisher restriction Inspect the returned image, adjust documented readiness settings, and test the URL independently. Do not assume more delay resolves access restrictions.
Consent or challenge screen appears The publisher rendered that state to the capture request Treat the output as a page-state result; test other representative pages and use only workflows permitted by the publisher.
Card text clips or wraps unexpectedly Long headline, missing font glyphs, or dimensions differ from the template Set fixed dimensions, add text-length handling, verify font coverage, and inspect output at final display size.
Image works locally but not in a social preview Image URL is private, temporary, blocked, or inaccessible to crawlers Serve it at a stable public URL and test the platform’s current crawler and image requirements.
Results differ from an India-based browser Location-dependent page content; Abstract says location-specific capture is unsupported Do not treat the API result as an India-local rendering. Validate the intended audience’s needs separately.
Rate limit or quota reached Requests exceed the plan’s current limits Throttle requests, cache repeat captures, and check the live account limits before retrying.

8. Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. For article page captures, its clean-shot flow accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status.

Use ScreenshotNeo’s API documentation for the available options and request details. Example request for a page screenshot:

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

It also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. For a branded card, create your own HTML design and use the documented HTML/CSS capture options; a page screenshot alone is not a custom social-card generator.

Sign up free for 1,000 screenshots a month with no card.

FAQ

Does a screenshot automatically create Open Graph metadata?

No. The image is an output asset. Your page or sharing system still needs its own metadata and a publicly fetchable image URL where required.

Can Abstract guarantee that an Indian news page will render?

No publisher-specific compatibility is established here. Test the URLs and page states that matter to your workflow.

Can I use this to reproduce exactly what readers in India see?

Do not assume so. Abstract says location-specific capture is unsupported, and pages may vary by visitor location.

Should I capture the article or create a card?

Capture the article when a page image is the desired artifact. Build a controlled template when brand, headline readability, and consistent dimensions matter most.