Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →If a link preview is blank because the page lacks an og:image tag, the lasting fix is to add that metadata to the page’s generated HTML. A small Python script using only the standard library can check the HTML returned by a URL and flag a missing or empty image value. It diagnoses the page markup; it does not change the site or refresh a platform’s cache.
What an og:image tag does
Open Graph defines four required properties for a page: og:title, og:type, og:image, and og:url. The og:image value is the URL of the image representing the page’s object. Add it as a meta element in the document’s <head>, using an image URL the intended preview consumer can retrieve. See the Open Graph protocol.
As an Amazon Associate I earn from qualifying purchases.
<head>
<meta property="og:title" content="A useful page title">
<meta property="og:type" content="website">
<meta property="og:url" content="https://example.com/article">
<meta property="og:image" content="https://example.com/images/article-preview.jpg">
<meta property="og:image:alt" content="A description of the preview image">
</head>
The example image address is illustrative; replace it with a real image URL for your page. Open Graph recommends og:image:alt when an image is specified. Use a useful description of what the image depicts, not merely a caption.
Check the returned HTML with Python
This diagnostic fetches a page, checks that the response is successful and HTML, decodes the response using its declared charset when available, and scans <meta> start tags for property="og:image". It reports an absent or empty value. It uses Python’s built-in urllib.request and html.parser, so it needs no third-party packages.
#1 Best Overall
from html.parser import HTMLParser
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
class OpenGraphImageFinder(HTMLParser):
def __init__(self):
super().__init__()
self.images = []
def handle_starttag(self, tag, attrs):
if tag.lower() != "meta":
return
values = {key.lower(): value for key, value in attrs if key}
if values.get("property", "").lower() == "og:image":
self.images.append(values.get("content") or "")
def check_og_image(url):
request = Request(url, headers={"User-Agent": "og-image-check/1.0"})
try:
with urlopen(request, timeout=15) as response:
status = response.status
content_type = response.headers.get_content_type()
charset = response.headers.get_content_charset()
html_bytes = response.read()
except (HTTPError, URLError, TimeoutError) as error:
print(f"Could not fetch page: {error}")
return
if not 200 <= status < 300:
print(f"Unexpected HTTP status: {status}")
return
if content_type != "text/html":
print(f"Expected HTML, got {content_type}")
return
# Use the response's declared charset, falling back to UTF-8.
html = html_bytes.decode(charset or "utf-8", errors="replace")
parser = OpenGraphImageFinder()
parser.feed(html)
usable_images = [image.strip() for image in parser.images if image.strip()]
if usable_images:
print("Found og:image:", usable_images[0])
elif parser.images:
print("og:image exists, but its content is empty.")
else:
print("No og:image meta tag found in the returned HTML.")
check_og_image("https://example.com/article")
Replace the final URL with the page you want to inspect. Python’s urllib.request documentation describes fetching URLs and reading response data as bytes. Its html.parser documentation explains how parser callbacks expose start-tag attributes; the parser can handle invalid HTML, but it is not a browser and does not promise browser-style recovery in every case.
Read the result correctly
- “No og:image meta tag found” means no matching property appeared in the HTML fetched by this script. Add the metadata to the template or server-side output that generates the page.
- “content is empty” means the tag exists but its content is blank or whitespace. Set its content to a usable image URL.
- “Found og:image” means the script found a non-empty value in the returned markup. It does not establish that a social platform can retrieve, accept, or display that image.
- Fetch or content-type errors mean the script did not inspect the intended HTML page. Check the URL, response, and server behavior before interpreting the metadata result.
Fix the page, not just the diagnostic
The script only reads the response. Once you find the source template, add or correct the og:image element in the page’s generated <head>, then fetch the page again and check the returned HTML. If the site renders its metadata through JavaScript after the initial response, this script may not see it; the diagnostic checks the HTML returned by the server, not a browser-rendered page.
Rank #2
Keep image alternatives and metadata in order
Open Graph permits multiple og:image properties. When values conflict, the first image tag in document order receives preference. Keep intentional alternatives rather than collapsing them blindly. Structured image properties—such as dimensions and alt text—belong after the corresponding og:image root and before the next image root begins. The protocol describes these rules at ogp.me.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
After correcting the HTML, a previously shared URL may still show an old preview: adding a tag does not guarantee an immediate cache update. Cache refresh behavior and platform-specific image requirements vary and are not determined by this Python check.
Quick Recap
Best Value
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.




