reddit not pulling scraping image on link post

788 Views Asked by At

On link posts, the reddit scraper is not scraping an image from my site for a thumbnail and I cannot see why. I have followed any small snippet I could find about it which basically said.

  1. Use a squareish image, less than 1.5:1 ration on the sides.
  2. make the size as small as possible.
  3. link it with the open graph protocol http://ogp.me/

I have done all of these and added this in the html with no luck, and nowhere else to turn to.

<meta property="og:image:secure_url" content="static/screenshot.png" />
1

There are 1 best solutions below

3
On

If the scraping code finds an og:image, it will return the url unmodified. This url is then passed directly to _fetch_url(), which calls _initialize_request(), which ignores non-absolute urls. So, try specifying an absolute url for your image and it should work.

From a brief look at the Open Graph spec, I don't see anything about requiring absolute urls, so this might be considered a bug in reddit. It would be fairly easy to solve, since the relevant code already has access to the requested page for the purposes of setting the referrer, so you may wish to post about it on r/bugs.