Instagram API - 使用视频简码获取无效的媒体 ID
Instagram API - Getting invalid media id with video shortcode
我正在使用 instagram 的 /media/shortcode/shortcode
端点通过短代码获取有关特定媒体的信息。
https://www.instagram.com/developer/endpoints/media/#get_media_by_shortcode
问题是,当我将照片的简码传递到端点时,一切正常,我从 Instagram 得到了我期望的结果,但是,当我将视频的简码传递到该端点时,api returns 以下:
{
"meta": {
"code": 400,
"error_type": "APINotFoundError",
"error_message": "invalid media id"
}
}
这对我来说意义不大,因为给定的端点应该可以很好地处理视频。
我也运行陷入这个问题---Instagram文档不是很清楚,但这是因为沙盒模式的限制。
To help you develop and test your app, the users and media available in Sandbox mode are real Instagram data (i.e. what is normally visible in the Instagram app), but with the following conditions:
- Apps in sandbox are restricted to 10 users
- Data is restricted to the 10 users and the 20 most recent media from each of those users
- Reduced API rate limits
来自 https://www.instagram.com/developer/sandbox/.
TLDR 您需要让您的应用获得批准才能让您的其他 API 调用正常工作。
获取媒体信息(照片或视频)的最佳和最简单方法是调用此 url(GET 方法)Insta Fetch Media URL
示例代码写在Python.
import requests, json
def get_media_id(image_url):
url = "https://api.instagram.com/oembed/"
querystring = {"callback": "", "url": image_url}
headers = {
'cache-control': "no-cache"
}
response = requests.request("GET", url, headers=headers, params=querystring)
return json.loads(response.text)
我正在使用 instagram 的 /media/shortcode/shortcode
端点通过短代码获取有关特定媒体的信息。
https://www.instagram.com/developer/endpoints/media/#get_media_by_shortcode
问题是,当我将照片的简码传递到端点时,一切正常,我从 Instagram 得到了我期望的结果,但是,当我将视频的简码传递到该端点时,api returns 以下:
{
"meta": {
"code": 400,
"error_type": "APINotFoundError",
"error_message": "invalid media id"
}
}
这对我来说意义不大,因为给定的端点应该可以很好地处理视频。
我也运行陷入这个问题---Instagram文档不是很清楚,但这是因为沙盒模式的限制。
To help you develop and test your app, the users and media available in Sandbox mode are real Instagram data (i.e. what is normally visible in the Instagram app), but with the following conditions:
- Apps in sandbox are restricted to 10 users
- Data is restricted to the 10 users and the 20 most recent media from each of those users
- Reduced API rate limits
来自 https://www.instagram.com/developer/sandbox/.
TLDR 您需要让您的应用获得批准才能让您的其他 API 调用正常工作。
获取媒体信息(照片或视频)的最佳和最简单方法是调用此 url(GET 方法)Insta Fetch Media URL
示例代码写在Python.
import requests, json
def get_media_id(image_url):
url = "https://api.instagram.com/oembed/"
querystring = {"callback": "", "url": image_url}
headers = {
'cache-control': "no-cache"
}
response = requests.request("GET", url, headers=headers, params=querystring)
return json.loads(response.text)