Earlier quoted context omitted.
It seems like it would be pretty hard to draft TOS that prohibit the user from running a program on their own machine that requests, processes, and outputs data on the user's behalf without banning more traditional user agents like web browsers and proxies.
Usually the trick is to add in something like "...at Facebook's discretion...".
It's impossible for something like Facebook to use a whitelist model for determining what you use to interact with their service, and they can't retroactively add things to their blacklist. They usually have to rely on generic rules about causing harm to the service, but then it's no longer a pure whim.