Skip to content

Commit a01eb1a

Browse files
Facebook_Request_Acceptor_Script added
1 parent 5240a0b commit a01eb1a

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
from selenium import webdriver
2+
from bs4 import BeautifulSoup
3+
from dotenv import load_dotenv
4+
from pathlib import Path
5+
import os
6+
import time
7+
from selenium.webdriver.chrome.options import Options
8+
9+
# Configure Chrome options
10+
chrome_options = Options()
11+
chrome_options.add_experimental_option("prefs", {"profile.default_content_setting_values.notifications": 2})
12+
13+
# Load environmental variables from .env file
14+
load_dotenv(dotenv_path=Path(".", ".env"))
15+
16+
# Read credentials from environmental variables
17+
def read_creds():
18+
return {"username": os.getenv("username"), "password": os.getenv("password")}
19+
20+
# Function for accepting requests
21+
def accept_requests(browser):
22+
browser.get("https://www.facebook.com/friends")
23+
element_id = browser.find_element_by_css_selector("input#email")
24+
element_id.send_keys(credentials["username"])
25+
element_id = browser.find_element_by_css_selector("input#pass")
26+
element_id.send_keys(credentials["password"])
27+
element_id.submit()
28+
29+
while True:
30+
confirm_btns = browser.find_elements_by_css_selector("div[aria-label='Confirm']")
31+
if not confirm_btns:
32+
break
33+
34+
for btn in confirm_btns:
35+
btn.click()
36+
time.sleep(2)
37+
38+
try:
39+
see_more_btn = browser.find_element_by_css_selector(
40+
"div.k4urcfbm.f10w8fjw.pybr56ya.taijpn5t.btwxx1t3.j83agx80.bp9cbjyn"
41+
)
42+
see_more_btn.click()
43+
time.sleep(12)
44+
except:
45+
pass
46+
47+
def main():
48+
# Initialize Chrome browser with options
49+
browser = webdriver.Chrome(options=chrome_options)
50+
browser.maximize_window()
51+
52+
# Read credentials and accept requests
53+
credentials = read_creds()
54+
accept_requests(browser)
55+
56+
print("All Request Accepted")
57+
browser.quit()
58+
59+
if _name_ == "_main_":
60+
main()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Facebook Request Accepter
2+
3+
The Script will accept all your Friend Requests on your Facebook Account.
4+
5+
6+
## Setup instructions
7+
8+
In order to run this script, you need to have Python and pip installed on your system. After you're done installing Python and pip, run the following command from your terminal to install the requirements from the same folder (directory) of the project.
9+
10+
```
11+
pip3 install -r requirements.txt
12+
```
13+
14+
After satisfying all the requirements for the project:-
15+
16+
- Create `.env` file , copy the content of `.sample.env` file and change the value username and password.
17+
- Run following command :-
18+
```
19+
python script.py
20+
```
21+
or
22+
```
23+
python3 script.py
24+
```
25+
Depending upon the python version. Make sure that you are running the command from the same virtual environment in which the required modules are installed.
26+
27+
# Sample Output
28+
29+
[![ezgif.com-gif-maker-590e09bbc0ad6ad7e.gif](https://s6.gifyu.com/images/ezgif.com-gif-maker-590e09bbc0ad6ad7e.gif)](https://gifyu.com/image/BgZZ)
30+
31+
32+

0 commit comments

Comments
 (0)