Checking if a instagram image is private

后端 未结 2 931
被撕碎了的回忆
被撕碎了的回忆 2021-01-15 21:06

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?

<
2条回答
  •  天命终不由人
    2021-01-15 21:21

    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.

    This is my powershell-code i use:

    try
    {
        Invoke-WebRequest "https://api.instagram.com/v1/users//?client_id=xxxx";
    }
    catch [Exception]
    {
        # Remove Image
    }
    

提交回复
热议问题