We are looking forward to announce that we have integrated the OpenGraphr platform with Prime Video. No need to stress about this anymore. We will handle the metadata extraction of your videos.
Extracting information from a Prime Video link
First of all, enter your profile and copy your token. You will need it for the following steps :-)
We will be making a GET request to the following API endpoint: https://api.opengraphr.com/v1/og
.
To make a request, you will need to include your api_token
and the requested url:
GET https://api.opengraphr.com/v1/og?api_token={YOUR_API_TOKEN}&url={YOUR_URL}
.
By default, our API will cache results for a month, but you can refresh the cache by sending the force=1
parameter:
GET https://api.opengraphr.com/v1/og?api_token={YOUR_API_TOKEN}&url={YOUR_URL}&force=1
.
Using our API to extract Prime Video metadata
Once the GET request is sent, you will get a response like this from our API. In this case, we are requesting the following URL: https://www.primevideo.com/detail/The-Boys/0LTURNRIIF1SFJUX32I7XALS8U
{
"title": "Prime Video: The Boys \u2013 Season 2",
"description": "All Episodes Available. In a more intense Season 2 of THE BOYS, Butcher, Hughie and the team reel from their losses in Season 1. On the run from the law, they struggle to fight back against the Superheroes. Meanwhile Vought, the hero management company, cashes in on the panic over Supervillains, and a new hero, Stormfront, shakes up the company and challenges an already unstable Homelander.",
"image": "https:\/\/images-eu.ssl-images-amazon.com\/images\/S\/pv-target-images\/473fd8bc878799c1a035cb13c688edd9eb6d240d426abf34e0bf3c1dde95724b._RI_V_TTW_.jpg",
"url": "https:\/\/www.primevideo.com\/detail\/The-Boys\/0LTURNRIIF1SFJUX32I7XALS8U",
"raw": {
"title": "Prime Video: The Boys \u2013 Season 2",
"metadescription": "All Episodes Available. In a more intense Season 2 of THE BOYS, Butcher, Hughie and the team reel from their losses in Season 1. On the run from the law, they struggle to fight back against the Superheroes. Meanwhile Vought, the hero management company, cashes in on the panic over Supervillains, and a new hero, Stormfront, shakes up the company and challenges an already unstable Homelander.",
"og_image": "https:\/\/images-eu.ssl-images-amazon.com\/images\/S\/pv-target-images\/473fd8bc878799c1a035cb13c688edd9eb6d240d426abf34e0bf3c1dde95724b._RI_V_TTW_.jpg"
}
}
And that's it! Easy, right? Now let's see some examples of how to implement this using actual code!
Extract Prime Video information using PHP
You can easily get the Open Graph information of a given Prime Video link by using the following script in PHP:
$token = 'YOUR_TOKEN';
$url = 'https://www.primevideo.com/detail/The-Boys/0LTURNRIIF1SFJUX32I7XALS8U';
$requestUrl = 'https://api.opengraphr.com/v1/og?api_token=' . $token . '&url=' . urlencode($url);
$response = json_decode(file_get_contents($requestUrl), true);
var_dump($response);
Extract Prime Video information using JavaScript
You can easily get the Open Graph information of a given Prime Video URL by using the following script in plain JS:
const token = 'YOUR_TOKEN'
const url = 'https://www.primevideo.com/detail/The-Boys/0LTURNRIIF1SFJUX32I7XALS8U'
const requestUrl = `https://api.opengraphr.com/v1/og?api_token=${token}&url=${encodeURIComponent(url)}`
fetch(requestUrl)
.then(response => response.json())
.then(og => {
console.table(og)
})
Extract Prime Video information using NodeJS
You can easily get the Open Graph information of a given Prime Video URL by using the following script in NodeJS:
const axios = require('axios')
const express = require('express')
const app = express()
const token = 'YOUR_TOKEN'
app.get('/site/info', async (req, res) => {
const { url } = req.query
const requestUrl = 'https://www.primevideo.com/detail/The-Boys/0LTURNRIIF1SFJUX32I7XALS8U'
const response = await axios.get(requestUrl, {
params: {
url,
api_token: token,
// force: 1,
},
})
const og = response.data
res.json(og)
})
app.listen(3000, function () {
console.log('Example app listening on port 3000!')
})
Extract Prime Video information using C-Sharp
You can easily get the Open Graph information of a given Prime Video URL by using the following script in C#:
using System;
using System.Net;
using System.IO;
using Newtonsoft.Json;
namespace CSharpDemo
{
class MainClass
{
public static void Main (string[] args)
{
var token = 'YOUR_TOKEN';
var url = 'https://www.primevideo.com/detail/The-Boys/0LTURNRIIF1SFJUX32I7XALS8U';
var urlEncoded = Uri.EscapeDataString(url);
var requestUrl = "https://api.opengraphr.com/api/og?api_token=" + token + "&url=" + urlEncoded;
var request = WebRequest.Create(requestUrl);
request.ContentType = "application/json;";
string text;
var response = (HttpWebResponse)request.GetResponse();
using (var sr = new StreamReader(response.GetResponseStream()))
{
text = sr.ReadToEnd();
dynamic og = JsonConvert.DeserializeObject(text);
Console.WriteLine("Title\t\t" + og.title);
Console.WriteLine("Description\t" + og.description);
Console.WriteLine("Image\t\t" + og.image);
}
}
}
}
Extract Prime Video information using Python
You can easily get the Open Graph information of a given Prime Video URL by using the following script in Python:
import requests
TOKEN = 'YOUR_TOKEN'
url = 'https://www.primevideo.com/detail/The-Boys/0LTURNRIIF1SFJUX32I7XALS8U'
endpoint = 'https://api.opengraphr.com/api/og'
response = requests.get(endpoint, params={ 'url': url, 'api_token': TOKEN }).json()
print(response)