Introduction

Peekalink is an API that allows developers to preview almost every link in the web.

How does it work?

When you send us a link, we fetch it in our servers, analyse it and optimise it, we will then send you back a preview of what's behind the link.

Although this might sound quite simple, we actually do a lot of magic ๐Ÿช„ in order to deliver a fast, reliable and complete preview of the link.

Some of the things we do are:

  • Following redirections and the web's caching and invalidation mechanisms gracefuly
  • Upgrading requests to HTTPs if available
  • Using semantic text analysis to find missing titles and descriptions
  • Downloading, optimising and storing icons and thumbnails in a global CDN
  • Enriching platform links with platform specific details, such as Youtube links with view counts, channel, like ratios and more.
  • Analysing links connection requests to provide information on trackers and ad networks in the website
  • Monitoring links for changes in order to deliver up-to-date previews

Doing all of these and more result in the fastest and most advanced link preview service on the web ๐Ÿš€.

Why is it useful?

Link previews is an incredibly common feature to have in social networks and messaging apps.

They add valuable context to what otherwise would just be a string of undecipherable characters like https://youtu.be/dQw4w9WgXcQ, in other words, it turns sharing links into sharing content.

This encoruages people to share more, be it Youtube videos, Soundcloud songs, Spotify playlists or just another article over how trickle-down-economics are a lie to enrich the rich and impoverish the poor.

This in turn sparks users conversations and discussion, increasing your user engagement, usability and satisfaction.

Quick example

Let's say you send the following request to us.

import requests

response = requests.post(
    "https://api.peekalink.io/",
    headers={"X-API-Key": "YourSecretKey"},
    data={"link": "https://bit.ly/3frD2OP"},
)

In this POST request, you added your API key on the header X-API-Key and in the request body you added the link https://bit.ly/3frD2OP which you want us to preview.

If you now print the result of the request print(response.json()) , you will see the following.

{
  "url": "https://bit.ly/3frD2OP",
  "domain": "bit.ly",
  "lastUpdated": "2020-11-23T16:55:51.648662Z",
  "nextUpdate": "2020-11-24T16:55:51.615769Z",
  "contentType": "html",
  "mimeType": "text/html",
  "redirected": true,
  "redirectionUrl": "https://www.youtube.com/watch?feature=youtu.be&v=dQw4w9WgXcQ",
  "redirectionCount": 2,
  "redirectionTrail": [
    "https://youtu.be/dQw4w9WgXcQ",
    "https://www.youtube.com/watch?feature=youtu.be&v=dQw4w9WgXcQ"
  ],
  "title": "Rick Astley - Never Gonna Give You Up (Video)",
  "description": "Rick Astley's official music video for โ€œNever Gonna Give You Upโ€ \nListen to Rick Astley: https://RickAstley.lnk.to/_listenYD\n\nSubscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/subscribeYD\n\nFollow Rick Astley:\nFacebook: ht..",
  "name": "RickAstleyVEVO in YouTube",
  "trackersDetected": true,
  "icon": {
    "url": "https://cdn.peekalink.io/public/images/e54bc7cf-047a-413a-b707-14626e9094e0/19f0e08e-d03b-4edf-9bf1-9c2ea72b7536.jpg",
    "width": 144,
    "height": 144
  },
  "image": {
    "url": "https://cdn.peekalink.io/public/images/7b4c43dd-05ee-47b7-937f-a4b65c9bf7ea/44a88bb2-8990-4530-836a-4c746f00e4e9.jpe",
    "width": 640,
    "height": 480
  },
  "details": {
    "type": "youtube",
    "videoId": "dQw4w9WgXcQ",
    "duration": "213.0",
    "viewCount": 787905032,
    "likeCount": 7200677,
    "dislikeCount": 228169,
    "commentCount": 1162359,
    "publishedAt": "2009-10-25T06:57:33Z"
  }
}

Congrats! ๐ŸŽ‰ You have now previewed your first link.

The cherry on the top

After finding no other link previews solution up to our standards, we built Peekalink for our privacy-friendly and open-source social network Okuna.

While we were building the service, we realised most of the other social networks and messaging apps posed risks and costs unbeknown to their users.

How they usually preview links is by downloading and processing the links in your device, this means that your IP and potentially your identity is leaked, sometimes also running Javascript code of the previewed website in your device and without your consent, posing a potential security risk and draining your battery.

To make things worse, the images on the link previews are loaded directly from the website, resulting in a huge bandwidth drain from the application which if on a mobile phone plan, can be costly for users.

If you are using Peekalink, you are already 97% done in mitigating these issues for your users.

  • We employ sandboxed machines to generate the link previews, meaning there is no extra bandwith costs nor security risks.
  • We optimise all media, resulting in significantly lower bandwith.
  • Because we generate the preview in our servers, we do not reveal your users IP address nor any other identifiable information to the websites, mitigating the privacy risk.

We are also happy to see that in the time since then, researchers and media have catched up on this.

What about the remaining 3%?

Privacy-enthusiast can rightfully argue that by loading the link preview images from our CDN (https://cdn.peekalink.io) you are still leaking their IP to us.

While we ensure you that we do not collect any kind of information from your users as stated in our privacy policy, if you want to be extra paranoid, you can set up a reverse proxy to load the media images through it.

At the end, this would see your users loading images from

https://yourproxy.com/?imgSrc=https://cdn.peekalink.io/image.jpg

instead of

https://cdn.peekalink.io/image.jpg

Get started

In order to get started, head to setup

ย  Setup