简体   繁体   中英

How to detect if Facebook page is unpublished using Linux script

I've created many business/company pages in Facebook. But regularly Facebook unpublishes them.

I'd like to check whether a page is unpublished using some script on Linux which can notify me.

How can I do it?

There is related thread: Facebook API: Determine if Facebook Page is published / unpublished and curl command mentioned does not seem to be working correctly when I tried on my Linux command prompt.

First of all, you'll need a User Access Token with manage_pages permission. Then, you should be able to do the following:

 curl -4 "https://graph.facebook.com/fql?q=SELECT%20page_id%2C%20name%2C%20username%2C%20is_published%20FROM%20page%20WHERE%20page_id%20IN%20(SELECT%20page_id%20FROM%20page_admin%20WHERE%20uid%20%3D%20me())%20AND%20is_published%3D0%20ORDER%20BY%20fan_count%20DESC&access_token={user_access_token}"

and replace {user_access_token} with your actual User Access Token.

Call https://graph.facebook.com/PAGE_ID and check, if a "Unsupported get request" is returned. If yes, then it can be, that the page is unpublished.

This attempt is not going to work for age-restricted pages! They always return "Unsupported get request" when calling the Graph API endpoint with no access token.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM