Reputation: 13
I'm trying to implement Story Mention rendering according to IG messenger graph API.
IG webhooks sends the payload URL of the media as CDN URLs that are extensionless, which means I can't detect the file type(could be any kind of image or a video file). The purpose is to render the URL to an HTML element and to prevent saving some file extensions.
Did anybody find out how to get this information?
Upvotes: 0
Views: 1338
Reputation: 11
I was able to retrieve the content type by making a request with node-fetch.
const fetch = require('node-fetch');
const response = await fetch(mediaUrl, { method: 'HEAD' });
const contentType = response.headers.get('Content-Type');
Upvotes: 1
Reputation: 122
Python:
import requests
res = requests.head(url)
print res.headers
Upvotes: 0