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.
# inside quickstart script
session = FacebookPy(username="abc",
password="123")
- FacebookPy Available Features
- Following β
- Following by a list β
- Follow someone else's followers β
- Follow the likers of posts of users β
- Friending β
- Friending by a list β
- Restricting Likes β
- Ignoring Users β
- Excluding friends β
- Quota Supervisor β
# 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)
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 ofset_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)
# 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.
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)
session.friend('user1', daysold=365, max_pic = 100, sleep_delay=600, interact=False)
friend_by_list(friendlist=['samantha3', 'larry_ok'], times=1, sleep_delay=600, interact=False)
session.set_dont_like(['#exactmatch', '[startswith', ']endswith', 'broadmatch'])
# completely ignore liking images from certain users
session.set_ignore_users(['random_user', 'another_username'])
# will prevent commenting on and unfollowing your good friends (the images will
# still be liked)
session.set_dont_include(['friend1', 'friend2', 'friend3'])
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)
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)
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))
- modify
quickstart.py
according to your requirements python quickstart.py -u <myusername> -p <mypssword> -ui <my_userid>
*/10 * * * * bash /path/to/FacebookPy/run_facebookpy_only_once_for_mac.sh /path/to/FacebookPy/quickstart.py $USERNAME $PASSWORD $USERID
Check out this short guide on how to start contributing!.