Skip to content

Commit 5e4562e

Browse files
Fb post
1 parent 8355383 commit 5e4562e

File tree

3 files changed

+38
-28
lines changed

3 files changed

+38
-28
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
This will install all these packages
1212

13-
* `pip3 install bs4`
13+
* `pip install bs4`
1414

15-
* `pip3 install selenium`
15+
* `pip install selenium`
1616

1717
After the installation, open terminal at the root folder--
1818

@@ -36,4 +36,6 @@ After setting virtual environment install packages listed above and Enjoy.
3636

3737
#License
3838

39-
Copyright (c) 2016 Ankit Jain - Released under the Apache License
39+
Copyright (c) 2016 Ankit Jain - Released under the Apache License
40+
41+
P.S For more python scripts Go To -> [pythonResources](https://github.com/ankitjain28may/pythonResources)

fb.py

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,50 @@
44
from selenium import webdriver
55
from bs4 import BeautifulSoup
66
from selenium.webdriver.common.keys import Keys
7+
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
78

89

910
def get_title(driver):
1011
html_page = driver.page_source
1112
soup = BeautifulSoup(html_page,'html.parser')
1213
print(soup.title.string+"\n")
14+
return soup.title.string
1315

14-
16+
binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\Firefox.exe')
17+
driver = webdriver.Firefox(firefox_binary=binary)
1518
url = "https://facebook.com"
1619

17-
driver = webdriver.Firefox()
18-
driver.get(url)
19-
time.sleep(2)
20-
get_title(driver)
20+
while True:
21+
driver.get(url)
22+
time.sleep(2)
23+
get_title(driver)
24+
25+
eMail = input("Enter your Email Id or Mobile No. to Login\n")
26+
pAss = getpass.getpass("Enter your password\n")
2127

22-
eMail = input("Enter your Email Id or Mobile No. to Login\n")
23-
pAss = getpass.getpass("Enter your password\n")
28+
email = driver.find_element_by_name("email")
29+
email.send_keys(eMail)
30+
password = driver.find_element_by_name("pass")
31+
password.send_keys(pAss)
2432

25-
email = driver.find_element_by_name("email")
26-
email.send_keys(eMail)
27-
password = driver.find_element_by_name("pass")
28-
password.send_keys(pAss)
33+
login = driver.find_element_by_css_selector("#u_0_l")
34+
login.click()
35+
time.sleep(5)
2936

30-
login = driver.find_element_by_css_selector("#u_0_l")
31-
login.click()
37+
if get_title(driver) != "Log in to Facebook | Facebook":
38+
print("You are logged in now\n")
3239

33-
print("You are logged in now\n")
34-
time.sleep(5)
40+
pp = input("Enter your Status\n")
41+
# status = driver.find_element_by_xpath('//textarea[@class="uiTextareaAutogrow _3en1" or @class="uiTextareaAutogrow _3en1 _480e"]')
42+
status = driver.find_element_by_xpath('//textarea[contains(@class, "uiTextareaAutogrow")]')
3543

36-
get_title(driver)
37-
pp = input("Enter your Status\n")
38-
status = driver.find_element_by_xpath('//textarea[@class="uiTextareaAutogrow _3en1" or @class="uiTextareaAutogrow _3en1 _480e"]')
39-
status.send_keys(pp)
44+
status.send_keys(pp)
45+
button = driver.find_element_by_xpath('//div[@class="clearfix"]/div[contains(@class, "rfloat")]/div/button[@type="submit" and @value="1"]')
46+
button.click()
47+
time.sleep(5)
48+
print("Your Status : '"+pp+"' has been uploaded!\n")
49+
driver.quit()
50+
break
4051

41-
button = driver.find_element_by_xpath('//button[@type="submit" and @class="_42ft _4jy0 _ej1 _4jy3 _4jy1 selected _51sy" and @value="1"]')
42-
button.click()
43-
time.sleep(5)
44-
print("Your Status : '"+pp+"' has been uploaded!\n")
45-
driver.quit()
52+
else:
53+
print("Invalid Email Id or Password, Try Login Again\nCtrl+C to exit the script\n")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
print("Wait for the installations, Its in progress..!!!")
88
for install in installs:
99
query = install.split()
10-
proc = subprocess.Popen(query, stdout=subprocess.PIPE, shell=True)
10+
proc = subprocess.Popen(query, stdout=subprocess.PIPE)
1111
output, error = proc.communicate()
1212
if output!=None:
1313
print(output.decode('utf-8'))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy