Skip to content

Facebook Bot - Tool for automated Facebook interactions

License

Notifications You must be signed in to change notification settings

johndpope/FacebookPy

Repository files navigation

FacebookPy

MIT license built with Selenium built with Python3 Travis

Installation

It is recomended to use via pyenv We will be supporting python 3.6.0 and above going forward

curl https://pyenv.run | bash
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
pyenv install 3.6.0
pyenv local 3.6.0
pip install --upgrade git+https://github.com/socialbotspy/SocialCommons.git
pip install -r requirements.txt

Now all you need is a quickstart script into your computer, go ahead and run it in the command prompt as:

python quickstart.py --username [email protected] --userid abc.pqr --password 123

PRO: Read about difference between username and userid for facebook: https://www.facebook.com/help/211813265517027?helpref=faq_content

PRO: Read more about passing arguments from the command line interface in the section - Pass arguments by CLI.


🚁 You can provide username & password inside the quickstart script, too!
# inside quickstart script

session = FacebookPy(username="abc",
                  password="123")

Documentation

Table of Contents


FacebookPy Available Features

Following

# default enabled=False, follows ~ 10% of the users from the images, times=1
# (only follows a user once (if unfollowed again))

session.set_do_follow(enabled=True, percentage=10, times=2)

Following by a list

This will follow each account from a list of facebook nicknames
follow_by_list(followlist=['samantha3', 'larry_ok'], times=1, sleep_delay=600, interact=False)

only follows a user once (if unfollowed again) would be useful for the precise targeting
sleep_delay is used to define break time after some good following (averagely ~10 follows)
For example, if one needs to get followbacks from followers of a chosen account/group of accounts.

accs = ['therock','natgeo']
session.follow_by_list(accs, times=1, sleep_delay=600, interact=False)
  • You can also interact with the followed users by enabling interact=True which will use the configuration of set_user_interact setting:
session.set_user_interact(amount=4,
                 percentage=50,
                  randomize=True,
                   media='Photo')
session.follow_by_list(followlist=['samantha3', 'larry_ok'], times=2, sleep_delay=600, interact=True)

Follow someone else's followers

# Follows the followers of each given user
# The usernames can be either a list or a string
# The amount is for each account, in this case 30 users will be followed
# If randomize is false it will pick in a top-down fashion

session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False)

# default sleep_delay=600 (10min) for every 10 user following, in this case
# sleep for 60 seconds

session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False, sleep_delay=60)

Note: simulation takes place while running this feature.

Follow the likers of posts(only non video/non-photo) of users

This will follow the people those liked photos of given list of users
session.follow_likers(['user1' , 'user2'], photos_grab_amount = 2, follow_likers_per_photo = 3, randomize=True, sleep_delay=600, interact=False)
session.set_user_interact(amount=2,
                    percentage=70,
                    randomize=True,
                    media='Photo')
session.follow_likers(['user1' , 'user2'], photos_grab_amount = 2, follow_likers_per_photo = 3, randomize=True, sleep_delay=600, interact=True)

Friending

session.friend('user1', daysold=365, max_pic = 100, sleep_delay=600, interact=False)

Friending by a list

This will add as friend each account from a list of facebook userids
friend_by_list(friendlist=['samantha3', 'larry_ok'], times=1, sleep_delay=600, interact=False)

Restricting Likes

session.set_dont_like(['#exactmatch', '[startswith', ']endswith', 'broadmatch'])

Ignoring Users

# completely ignore liking images from certain users

session.set_ignore_users(['random_user', 'another_username'])

Excluding friends

# will prevent commenting on and unfollowing your good friends (the images will
# still be liked)

session.set_dont_include(['friend1', 'friend2', 'friend3'])

Follow/Unfollow/exclude not working?

If you notice that one or more of the above functionalities are not working as expected - e.g. you have specified:

session.set_do_follow(enabled=True, percentage=10, times=2)

Bypass Suspicious Login Attempt

If you're having issues with the "we detected an unusual login attempt" message, you can bypass it setting FacebookPy in this way:

session = FacebookPy(username=facebook_username, password=facebook_password, bypass_suspicious_attempt=True)

Quota Supervisor

  session.set_quota_supervisor(
                      Settings, enabled=True,
                      sleep_after=["likes", "comments_d", "follows", "unfollows", "server_calls_h"],
                      sleepyhead=True,
                      stochastic_flow=True,
                      notify_me=True,
                      peak_likes=(57, 585),
                      peak_comments=(21, 182),
                      peak_follows=(48, None),
                      peak_unfollows=(35, 402),
                      peak_server_calls=(None, 4700))

How to run:

  • modify quickstart.py according to your requirements
  • python quickstart.py -u <myusername> -p <mypssword> -ui <my_userid>

How to schedule as a job:

*/10 * * * * bash /path/to/FacebookPy/run_facebookpy_only_once_for_mac.sh /path/to/FacebookPy/quickstart.py $USERNAME $PASSWORD $USERID

Help build socialbotspy

Check out this short guide on how to start contributing!.

About

Facebook Bot - Tool for automated Facebook interactions

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published