Using the WordPress mShots Screenshot API


A few years ago, I wrote about Google's secret screenshot API - a slightly cumbersome way to take website screenshots for free.

There's another service which you may find simpler to use - mShots from WordPress.

Here's how it works:

  1. Take any website link:
    • https://twitter.com/JennyVass/status/1067855777040338944
  2. URL Encode it:
    • https%3A%2F%2Ftwitter.com%2FJennyVass%2Fstatus%2F1067855777040338944
  3. Add it to the end of this URL: https://s0.wordpress.com/mshots/v1/
  4. Add ?w=800 to the end:
    • https://s0.wordpress.com/mshots/v1/https%3A%2F%2Ftwitter.com%2FJennyVass%2Fstatus%2F1067855777040338944?w=800

Screenshot of a Tweet. Jenny Vass is saying how much she likes the stickers I sent her.

There are a few things to note. The first time you send a URL to the service it will reply with HTTP 307 (temporary redirect) and you'll get this image:
Generating Preview.

Wait a few seconds and request the URL again, you should now have the image.

You can change the height of the image with h=500. For example: https://s0.wordpress.com/mshots/v1/https%3A%2F%2Fwww.whatsmyua.info?w=800&h=500

The user-agent can't be changed from Headless Chrome.
The user agent of the screenshot tool.

You can request different widths by changing the ?w=800 to something else. The maximum image size is 1280x960. Changing the width doesn't affect the viewport, just the size of the returned image. Although, at some widths, you'll get a centre crop.

A cropped image.

There are no other options. You can't change the image quality, image format, the IP address, geolocation, or anything else. Images will be cached for an unspecified period, so you'll need to mangle the link if you want to regenerate it.

mShots looks like it is abandonware - no new updates to it in the last 2 years. That's a shame, but you get what you pay for.


Share this post on…

7 thoughts on “Using the WordPress mShots Screenshot API”

      1. says:

        Is that a "it's the same thing?" comment?

        The mshot tool is under the Automattic organisation and the URLs you've tested this with are WordPress.com - it's using Automattic services to generate the screenshot. Calling it a WordPress tool doesn't help the confusion people have.

        Reply
        1. Mike says:

          Having a W for WordPress logo as a placeholder hardly helps clarity that it's Automattic...

          Reply
    1. Shafi says:

      Hello Matt, I'm using it on Personal Website - and I'm getting generate preview if it's first time, if i refresh second or third time, it shows perfectly fine. Is there a way to fix this ? the visitors doesn't refresh the website two or three times certainly.

      Reply
  1. Khayri says:

    Bummer. mShots does not seem to update screenshots regardless if the page changed content.

    Reply

What links here from around this blog?

What are your reckons?