per-fide / FacebookPy

Facebook Bot - Tool for automated Facebook interactions. Star this repo if you enjoy it! Let the script running and do your thing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
pyenv install 3.6.0
pyenv local 3.6.0
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 abc@gmail.com --userid abc.pqr --password 123

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


You can provide username & password inside the quickstart script, too!
session = FacebookPy(username="abc", password="123")

Documentation

Table of Contents




Following

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

Restricting Likes

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

Ignoring Users

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

Excluding friends

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

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))

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

    session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False)
    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)

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)

UnFriending by a list

This will unfriend each account from a list of facebook userids
    unfriend_by_list(friendlist=['samantha3', 'larry_ok'], sleep_delay=6)

UnFriending by url list

This will unfriend each account from a list of facebook profile full urls
    unfriend_by_urllist(urllist=["facebook.com/profile.php?id=100023983575804&fref=pb&hc_location=friends_tab", "https://www.facebook.com/profile.php?id=100021936281017&fref=pb&hc_location=friends_tab"])

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)

Confirm friends received?

Confirm all the friends requests recieved.

    session.confirm_friends()

Add members of group

    session.add_members_of_group(group_id="941808466025179")

Add suggested friends?

From friends suggested by facebook add top few

    session.add_suggested_friends()

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)

Invite friends to page

  session.invite_friends_to_page(friendslist=['samantha3', 'larry_ok'])

Add likers from term

It searches for pages with a term , then visits each of those pages and adds the likers of those pages

     session.add_likers_from_term(search_term = "fantasy")

Withdraw outgoing friends requests

    session.withdraw_outgoing_friends_requests()

Get recent friends

  session.get_recent_friends()

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. Star this repo if you enjoy it! Let the script running and do your thing.

License:GNU General Public License v3.0


Languages

Language:Python 98.7%Language:Shell 1.3%