检查Instagram图片是否私密 [英] Checking if a instagram image is private
问题描述
说我有图像的URL, http://instagr.am/p/xxxxxxxx/,如何从网页上检查图像是否设置为私有?我可以使用一些API吗?
Say I have the URL to an image, http://instagr.am/p/xxxxxxxx/, how can I check if the image is set to private or not from a webpage? Is there some API that I can use?
我需要这个,因为我在页面上显示了一堆Instagram图片,但是如果它们变为私有,我想删除指向它们的链接.
I need this since I have a bunch of Instagram images that I show on my page, but I want to remove the link to them if they become private.
推荐答案
我没有找到查看特定图像是否私有的方法,所以我保存了图像的AuthorID.如果该作者有一个私人档案,则尝试获取用户信息时会遇到异常;如果我遇到异常,则我可以删除指向该图像的链接.
I did not find a way to see if a specific image was private or not, so instead i save the AuthorID of the image. If this author has a private profile i will get an exception when trying to get the user information, and if i get an exception, then i know i can remove the link to the image.
这是我使用的powershell代码:
This is my powershell-code i use:
try
{
Invoke-WebRequest "https://api.instagram.com/v1/users/<InsertAuthorID>/?client_id=xxxx";
}
catch [Exception]
{
# Remove Image
}
这篇关于检查Instagram图片是否私密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!