检查 Instagram 图像是否私密 [英] Checking if a instagram image is private
问题描述
假设我有图片的 URL,http://instar.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屋!