I'm working on a small python script to automate a daily post to a page my wife manages. It downloads a pic, merges with a header, and posts to the page with a URL and some text. My idea is ultimately to drop this on a Linux box I have and schedule it to fire once a day. If I do go to automate it, I'm wondering if there's a way to check and make sure the post hasn't already been done. The text is consistent (and unique as it has the date in it). Is there a way to have the script search the page for the text before posting? Searches so far haven't yielded much.

Tag:python, facebook-graph-api

Only one comment.

  1. wongacj

    Based on the approach you are asking for, it doesn't appear to be possible to run a query of a user's posts and specific search text without being a Facebook Partner according to the discussion on this other post.

    Suggestion:

    If your automated script is a single instance and the only one making the posts, would a simple history that is updated and managed locally to your script suffice?

    #Pseudo code # Obviously, it would make sense to make this history data structure # persistent across runs of your script published_posts = set() def publish_post(text: str): if text in published_posts: console.log("Post already previously published!") return resp = api.post(text) if resp.status != 200: console.log("Post unsuccessful!") raise Exception(resp.status) published_posts.add(text)

Add a new comment.